Skip to content

Commit

Permalink
CHexDlgDataInterp has exempted from MFC, except for the MfcPropertyGr…
Browse files Browse the repository at this point in the history
…id, which will be dealt with later.
  • Loading branch information
jovibor committed Dec 28, 2024
1 parent 5b2bb6c commit 0ef96b7
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 99 deletions.
44 changes: 43 additions & 1 deletion HexCtrl/dep/ListEx/ListEx.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,10 @@ namespace HEXCTRL::LISTEX {
int InsertColumn(int iCol, const LVCOLUMNW* pColumn, int iDataAlign, bool fEditable = false);
int InsertColumn(int iCol, LPCWSTR pwszName, int iFormat = LVCFMT_LEFT, int iWidth = -1,
int iSubItem = -1, int iDataAlign = LVCFMT_LEFT, bool fEditable = false);
int InsertItem(const LVITEMW* pItem)const;
int InsertItem(int iItem, LPCWSTR pwszName)const;
int InsertItem(int iItem, LPCWSTR pwszName, int iImage)const;
int InsertItem(UINT uMask, int iItem, LPCWSTR pwszName, UINT uState, UINT uStateMask, int iImage, LPARAM lParam)const;
[[nodiscard]] bool IsCreated()const;
[[nodiscard]] bool IsColumnSortable(int iColumn);
[[nodiscard]] auto MapIndexToID(UINT uIndex)const->UINT;
Expand All @@ -1110,6 +1114,7 @@ namespace HEXCTRL::LISTEX {
void SetHdrHeight(DWORD dwHeight);
void SetHdrImageList(HIMAGELIST pList);
auto SetImageList(HIMAGELIST hList, int iListType) -> HIMAGELIST;
bool SetItem(const LVITEMW* pItem)const;
void SetItemCountEx(int iCount, DWORD dwFlags = LVSICF_NOINVALIDATEALL)const;
bool SetItemState(int iItem, LVITEMW* pItem)const;
bool SetItemState(int iItem, UINT uState, UINT uStateMask)const;
Expand Down Expand Up @@ -1622,7 +1627,7 @@ bool CListEx::HitTest(LVHITTESTINFO* pHTI)const

int CListEx::InsertColumn(int iCol, const LVCOLUMNW* pColumn)const
{
return static_cast<int>(::SendMessageW(m_hWnd, LVM_INSERTCOLUMN, iCol, reinterpret_cast<LPARAM>(pColumn)));
return static_cast<int>(::SendMessageW(m_hWnd, LVM_INSERTCOLUMNW, iCol, reinterpret_cast<LPARAM>(pColumn)));
}

int CListEx::InsertColumn(int iCol, const LVCOLUMNW* pColumn, int iDataAlign, bool fEditable)
Expand Down Expand Up @@ -1676,6 +1681,33 @@ int CListEx::InsertColumn(int iCol, LPCWSTR pwszName, int iFormat, int iWidth, i
return InsertColumn(iCol, &lvcol, iDataAlign, fEditable);
}

int CListEx::InsertItem(const LVITEMW* pItem)const
{
assert(IsCreated());
if (!IsCreated()) {
return -1;
}

return static_cast<int>(::SendMessageW(m_hWnd, LVM_INSERTITEMW, 0, reinterpret_cast<LPARAM>(pItem)));
}

int CListEx::InsertItem(int iItem, LPCWSTR pwszName)const
{
return InsertItem(LVIF_TEXT, iItem, pwszName, 0, 0, 0, 0);
}

int CListEx::InsertItem(int iItem, LPCWSTR pwszName, int iImage)const
{
return InsertItem(LVIF_TEXT | LVIF_IMAGE, iItem, pwszName, 0, 0, iImage, 0);
}

int CListEx::InsertItem(UINT uMask, int iItem, LPCWSTR pwszName, UINT uState, UINT uStateMask, int iImage, LPARAM lParam)const
{
const LVITEMW item { .mask { uMask }, .iItem { iItem }, .state { uState }, .stateMask { uStateMask },
.pszText { const_cast<LPWSTR>(pwszName) }, .iImage { iImage }, .lParam { lParam } };
return InsertItem(&item);
}

bool CListEx::IsCreated()const
{
return m_fCreated;
Expand Down Expand Up @@ -1842,6 +1874,16 @@ auto CListEx::SetImageList(HIMAGELIST hList, int iListType)->HIMAGELIST
return reinterpret_cast<HIMAGELIST>(::SendMessageW(m_hWnd, LVM_SETIMAGELIST, iListType, reinterpret_cast<LPARAM>(hList)));
}

bool CListEx::SetItem(const LVITEMW* pItem)const
{
assert(IsCreated());
if (!IsCreated()) {
return { };
}

return ::SendMessageW(m_hWnd, LVM_SETITEMW, 0, reinterpret_cast<LPARAM>(pItem)) != 0;
}

void CListEx::SetItemCountEx(int iCount, DWORD dwFlags)const
{
assert(IsCreated());
Expand Down
5 changes: 1 addition & 4 deletions HexCtrl/res/HexCtrl.rc
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,7 @@ END

IDD_HEXCTRL_DATAINTERP AFX_DIALOG_LAYOUT
BEGIN
0,
0, 0, 100, 100,
0, 100, 0, 0,
0, 100, 0, 0
0
END

IDD_HEXCTRL_ABOUT AFX_DIALOG_LAYOUT
Expand Down
6 changes: 3 additions & 3 deletions HexCtrl/src/CHexCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,10 @@ auto CHexCtrl::GetWndHandle(EHexWnd eWnd, bool fCreate)const->HWND
}
return m_pDlgBkmMgr->GetHWND();
case EHexWnd::DLG_DATAINTERP:
if (!IsWindow(m_pDlgDataInterp->m_hWnd) && fCreate) {
m_pDlgDataInterp->Create(IDD_HEXCTRL_DATAINTERP, CWnd::FromHandle(m_hWnd));
if (!IsWindow(m_pDlgDataInterp->GetHWND()) && fCreate) {
m_pDlgDataInterp->CreateDlg();
}
return m_pDlgDataInterp->m_hWnd;
return m_pDlgDataInterp->GetHWND();
case EHexWnd::DLG_MODIFY:
if (!IsWindow(m_pDlgModify->GetHWND()) && fCreate) {
m_pDlgModify->CreateDlg();
Expand Down
Loading

0 comments on commit 0ef96b7

Please sign in to comment.