make log messages more readable
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41420 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
076e07b60b
commit
5c2603c2e8
@ -890,17 +890,22 @@ void MyTreeCtrl::DoToggleIcon(const wxTreeItemId& item)
|
||||
SetItemImage(item, image, wxTreeItemIcon_Selected);
|
||||
}
|
||||
|
||||
void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event)
|
||||
{
|
||||
wxTreeItemId item = event.GetItem();
|
||||
wxString text;
|
||||
if ( item.IsOk() )
|
||||
text << _T('"') << GetItemText(item).c_str() << _T('"');
|
||||
else
|
||||
text = _T("invalid item");
|
||||
wxLogMessage(wxT("%s(%s)"), name, text.c_str());
|
||||
}
|
||||
|
||||
// avoid repetition
|
||||
#define TREE_EVENT_HANDLER(name) \
|
||||
void MyTreeCtrl::name(wxTreeEvent& event) \
|
||||
{ \
|
||||
wxLogMessage( wxT("%s from:"), wxT(#name) ); \
|
||||
wxTreeItemId item = event.GetItem(); \
|
||||
if (item.IsOk()) \
|
||||
wxLogMessage( GetItemText(item) ); \
|
||||
else \
|
||||
wxLogMessage(wxT("invalid item")); \
|
||||
LogEvent(_T(#name), event); \
|
||||
SetLastItem(wxTreeItemId()); \
|
||||
event.Skip(); \
|
||||
}
|
||||
|
@ -127,6 +127,8 @@ private:
|
||||
size_t depth,
|
||||
size_t folder);
|
||||
|
||||
void LogEvent(const wxChar *name, const wxTreeEvent& event);
|
||||
|
||||
int m_imageSize; // current size of images
|
||||
bool m_reverseSort; // flag for OnCompareItems
|
||||
wxTreeItemId m_lastItem, // for OnEnsureVisible()
|
||||
|
Loading…
Reference in New Issue
Block a user