#9591: Item state (icons) for wxTreeCtrl on any platform

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-06-16 17:50:40 +00:00
parent 3f16e52c13
commit 03966fcb3f
8 changed files with 181 additions and 143 deletions

View File

@@ -284,6 +284,9 @@ protected:
bool unselect_others = true,
bool extended_select = false);
virtual int DoGetItemState(const wxTreeItemId& item) const;
virtual void DoSetItemState(const wxTreeItemId& item, int state);
virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
size_t previous,
const wxString& text,

View File

@@ -202,14 +202,6 @@ public:
virtual bool SetBackgroundColour(const wxColour &colour);
virtual bool SetForegroundColour(const wxColour &colour);
// get/set the check state for the item (only for wxTR_MULTIPLE)
bool IsItemChecked(const wxTreeItemId& item) const;
void SetItemCheck(const wxTreeItemId& item, bool check = true);
// set/get the item state.image (state == -1 means cycle to the next one)
void SetState(const wxTreeItemId& node, int state);
int GetState(const wxTreeItemId& node);
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
@@ -223,6 +215,9 @@ protected:
// end edit label
void DoEndEditLabel(bool discardChanges = false);
virtual int DoGetItemState(const wxTreeItemId& item) const;
virtual void DoSetItemState(const wxTreeItemId& item, int state);
virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
size_t pos,
const wxString& text,

View File

@@ -150,6 +150,11 @@ enum wxTreeItemIcon
wxTreeItemIcon_Max
};
// special values for the 'state' parameter of wxTreeCtrl::SetItemState()
static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image)
static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state
static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state
// ----------------------------------------------------------------------------
// wxTreeCtrl flags
// ----------------------------------------------------------------------------

View File

@@ -118,6 +118,12 @@ public:
// get the item's font
virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0;
// get the items state
int GetItemState(const wxTreeItemId& item) const
{
return DoGetItemState(item);
}
// modifiers
// ---------
@@ -156,6 +162,9 @@ public:
virtual void SetItemFont(const wxTreeItemId& item,
const wxFont& font) = 0;
// set the items state (special state values: wxTREE_ITEMSTATE_NONE/NEXT/PREV)
void SetItemState(const wxTreeItemId& item, int state);
// item status inquiries
// ---------------------
@@ -387,6 +396,10 @@ public:
protected:
virtual wxSize DoGetBestSize() const;
// comon part of Get/SetItemState()
virtual int DoGetItemState(const wxTreeItemId& item) const = 0;
virtual void DoSetItemState(const wxTreeItemId& item, int state) = 0;
// common part of Append/Prepend/InsertItem()
//
// pos is the position at which to insert the item or (size_t)-1 to append