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:
Vadim Zeitlin 2006-09-24 15:24:19 +00:00
parent 076e07b60b
commit 5c2603c2e8
2 changed files with 13 additions and 6 deletions

View File

@ -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(); \
}

View File

@ -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()