Skip to content

Commit

Permalink
SplitterEx improvements. Latest IListEx. Menu handling from IListEx t…
Browse files Browse the repository at this point in the history
…o OnCommand.

Dynamic tooltips for SectionsHeaders virtual list.
Minor fix for incorrect sub-item data in CViewRightTL::CreateListExport.
  • Loading branch information
jovibor committed Jan 24, 2021
1 parent 9536706 commit 3069914
Show file tree
Hide file tree
Showing 13 changed files with 1,104 additions and 621 deletions.
2 changes: 1 addition & 1 deletion Pepper/ChildFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pConte
m_stSplitterMain.CreateStatic(this, 1, 2);
m_stSplitterMain.CreateView(0, 0, RUNTIME_CLASS(CViewLeft), CSize(rc.Width() / 5, rc.Height()), pContext);
m_stSplitterRight.CreateStatic(&m_stSplitterMain, 2, 1, WS_CHILD | WS_VISIBLE, m_stSplitterMain.IdFromRowCol(0, 1));

m_stSplitterMain.AddNested(0, 1, &m_stSplitterRight);
m_stSplitterRightTop.CreateStatic(&m_stSplitterRight, 1, 2, WS_CHILD | WS_VISIBLE, m_stSplitterRight.IdFromRowCol(0, 0));
m_stSplitterRightTop.CreateView(0, 0, RUNTIME_CLASS(CViewRightTL), CSize((rc.Width() - rc.Width() / 5) / 2, rc.Height()), pContext);
m_stSplitterRightTop.CreateView(0, 1, RUNTIME_CLASS(CViewRightTR), CSize((rc.Width() - rc.Width() / 5) / 2, rc.Height()), pContext);
Expand Down
8 changes: 5 additions & 3 deletions Pepper/FileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ HRESULT CFileLoader::ShowOffset(ULONGLONG ullOffset, ULONGLONG ullSelSize, IHexC

EHexDataMode enMode;
std::byte* pData;
if (m_fMapViewOfFileWhole) {
if (m_fMapViewOfFileWhole)
{
enMode = EHexDataMode::DATA_MEMORY;
pData = static_cast<std::byte*>(m_lpBase);
}
else {
else
{
enMode = EHexDataMode::DATA_MSG;
pData = nullptr;
}
Expand All @@ -95,7 +97,7 @@ HRESULT CFileLoader::ShowOffset(ULONGLONG ullOffset, ULONGLONG ullSelSize, IHexC
m_hds.pData = pData;
m_hds.ullDataSize = static_cast<ULONGLONG>(m_stFileSize.QuadPart);
m_hds.enDataMode = enMode;

auto const& iter = std::find_if(m_vecQuery.begin(), m_vecQuery.end(),
[pHexCtrl](const QUERYDATA & r) {return r.hWnd == pHexCtrl->GetWindowHandle(EHexWnd::WND_MAIN); });

Expand Down
57 changes: 44 additions & 13 deletions Pepper/ListEx/ListEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace LISTEX
};

/********************************************
* LISTEXCELLCOLOR - colors for the cell. *
* LISTEXCOLOR - colors for the cell. *
********************************************/
struct LISTEXCELLCOLOR
struct LISTEXCOLOR
{
COLORREF clrBk { };
COLORREF clrText { };
};
using PLISTEXCELLCOLOR = LISTEXCELLCOLOR*;
using PLISTEXCOLOR = LISTEXCOLOR*;

/********************************************************************************************
* LISTEXCOLORS - All ListEx colors. *
Expand Down Expand Up @@ -71,10 +71,31 @@ namespace LISTEX
bool fSortable { false }; //Is list sortable, by clicking on the header column?
bool fLinkUnderline { true }; //Links are displayed underlined or not.
bool fLinkTooltip { true }; //Show links' toolips.
bool fHighLatency { false }; //Do not redraw window until scrolling completes.
};

/********************************************
* CListEx class definition. *
* LISTEXTOOLTIP - tool-tips for the cell. *
********************************************/
struct LISTEXTOOLTIP
{
std::wstring wstrText;
std::wstring wstrCaption;
};
using PLISTEXTOOLTIP = LISTEXTOOLTIP*;

/********************************************
* LISTEXHDRICON - Icon for header column. *
********************************************/
struct LISTEXHDRICON
{
POINT pt { }; //Point of the top-left corner.
int iIndex { }; //Icon index in the header's image list.
bool fClickable { true }; //Is icon sending LISTEX_MSG_HDRICONCLICK message when clicked.
};

/********************************************
* IListEx pure virtual base class. *
********************************************/
class IListEx : public CMFCListCtrl
{
Expand All @@ -91,20 +112,26 @@ namespace LISTEX
[[nodiscard]] virtual UINT GetFontSize()const = 0;
[[nodiscard]] virtual int GetSortColumn()const = 0;
[[nodiscard]] virtual bool GetSortAscending()const = 0;
virtual void HideColumn(int iIndex, bool fHide) = 0;
virtual int InsertColumn(int nCol, const LVCOLUMN* pColumn) = 0;
virtual int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1) = 0;
[[nodiscard]] virtual bool IsCreated()const = 0;
[[nodiscard]] virtual bool IsColumnSortable(int iColumn) = 0;
virtual void ResetSort() = 0; //Reset all the sort by any column to its default state.
virtual void SetCellColor(int iItem, int iSubitem, COLORREF clrBk, COLORREF clrText = -1) = 0;
virtual void SetCellData(int iItem, int iSubitem, ULONGLONG ullData) = 0;
virtual void SetCellMenu(int iItem, int iSubitem, CMenu* pMenu) = 0;
virtual void SetCellIcon(int iItem, int iSubitem, int iIndex) = 0;
virtual void SetCellTooltip(int iItem, int iSubitem, std::wstring_view wstrTooltip, std::wstring_view wstrCaption = L"") = 0;
virtual void SetColors(const LISTEXCOLORS& lcs) = 0;
virtual void SetColumnColor(int iColumn, COLORREF clrBk, COLORREF clrText = -1) = 0;
virtual void SetColumnSortMode(int iColumn, EListExSortMode enSortMode) = 0;
virtual void SetColumnSortMode(int iColumn, bool fSortable, EListExSortMode enSortMode = { }) = 0;
virtual void SetFont(const LOGFONTW* pLogFontNew) = 0;
virtual void SetFontSize(UINT uiSize) = 0;
virtual void SetHdrHeight(DWORD dwHeight) = 0;
virtual void SetHdrFont(const LOGFONTW* pLogFontNew) = 0;
virtual void SetHdrColumnColor(int iColumn, COLORREF clrBk, COLORREF clrText = -1) = 0;
virtual void SetListMenu(CMenu* pMenu) = 0;
virtual void SetHdrColumnIcon(int iColumn, const LISTEXHDRICON& stIcon) = 0; //Icon for a given column.
virtual void SetHdrFont(const LOGFONTW* pLogFontNew) = 0;
virtual void SetHdrHeight(DWORD dwHeight) = 0;
virtual void SetHdrImageList(CImageList* pList) = 0;
virtual void SetRowColor(DWORD dwRow, COLORREF clrBk, COLORREF clrText = -1) = 0;
virtual void SetSortable(bool fSortable, PFNLVCOMPARE pfnCompare = nullptr,
EListExSortMode enSortMode = EListExSortMode::SORT_LEX) = 0;
Expand All @@ -125,7 +152,7 @@ namespace LISTEX

inline IListExUnPtr CreateListEx()
{
return IListExUnPtr(CreateRawListEx(), [](IListEx * p) { p->Destroy(); });
return IListExUnPtr(CreateRawListEx(), [](IListEx* p) { p->Destroy(); });
};

using IListExPtr = IListExUnPtr;
Expand All @@ -135,7 +162,11 @@ namespace LISTEX
* WM_NOTIFY codes (NMHDR.code values) *
****************************************************************************/

constexpr auto LISTEX_MSG_MENUSELECTED = 0x1000U; //User defined menu item selected.
constexpr auto LISTEX_MSG_CELLCOLOR = 0x1001U; //Get cell color.
constexpr auto LISTEX_MSG_LINKCLICK = 0x1002U; //Hyperlink has been clicked.
constexpr auto LISTEX_MSG_GETCOLOR = 0x1000U; //Get cell color.
constexpr auto LISTEX_MSG_GETICON = 0x1001U; //Get cell icon.
constexpr auto LISTEX_MSG_GETTOOLTIP = 0x1002U; //Get cell tool-tip data.
constexpr auto LISTEX_MSG_LINKCLICK = 0x1003U; //Hyperlink has been clicked.
constexpr auto LISTEX_MSG_HDRICONCLICK = 0x1004U; //Header's icon has been clicked.
constexpr auto LISTEX_MSG_HDRRBTNDOWN = 0x1005U; //Header's WM_RBUTTONDOWN message.
constexpr auto LISTEX_MSG_HDRRBTNUP = 0x1006U; //Header's WM_RBUTTONUP message.
}
Loading

0 comments on commit 3069914

Please sign in to comment.