simplify the client data/non standard images handling code by unconditionally using wxTreeItemParam struct instead of using indirect data only sometimes; also extend it to contain the id which allows to always sort the items correctly (closes bug 1447419) (patch 1449096 from Ryan)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-05-06 19:17:22 +00:00
parent 4c15a37592
commit 4523ebb3f1
2 changed files with 171 additions and 345 deletions

View File

@@ -247,11 +247,6 @@ protected:
// end edit label
void DoEndEditLabel(bool discardChanges = false);
// data used only while editing the item label:
wxTextCtrl *m_textCtrl; // text control in which it is edited
wxTreeItemId m_idEdited; // the item being edited
virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
size_t pos,
const wxString& text,
@@ -264,6 +259,14 @@ protected:
wxTreeItemData *data = NULL);
virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags);
// obtain the user data for the lParam member of TV_ITEM
class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const;
// data used only while editing the item label:
wxTextCtrl *m_textCtrl; // text control in which it is edited
wxTreeItemId m_idEdited; // the item being edited
private:
// the common part of all ctors
void Init();
@@ -274,23 +277,8 @@ private:
inline void DoExpand(const wxTreeItemId& item, int flag);
int DoGetItemImageFromData(const wxTreeItemId& item,
wxTreeItemIcon which) const;
void DoSetItemImageFromData(const wxTreeItemId& item,
int image,
wxTreeItemIcon which) const;
void DoSetItemImages(const wxTreeItemId& item, int image, int imageSel);
void DeleteTextCtrl();
// support for additional item images which we implement using
// wxTreeItemIndirectData technique - see the comments in msw/treectrl.cpp
void SetIndirectItemData(const wxTreeItemId& item,
class wxTreeItemIndirectData *data);
bool HasIndirectData(const wxTreeItemId& item) const;
bool IsDataIndirect(wxTreeItemData *data) const
{ return data && data->GetId().m_pItem == 0; }
// the hash storing the items attributes (indexed by item ids)
wxMapTreeAttr m_attrs;