- // adding/deleting items
- bool DeleteItem(long item);
- long InsertItem(long parent, wxTreeItem& info,
- long insertAfter = wxTREE_INSERT_LAST);
- // If image > -1 and selImage == -1, the same image is used for
- // both selected and unselected items.
- long InsertItem(long parent, const wxString& label,
- int image = -1, int selImage = -1,
- long insertAfter = wxTREE_INSERT_LAST);
-
- // changing item state
- bool ExpandItem(long item) { return ExpandItem(item, wxTREE_EXPAND_EXPAND); }
- bool CollapseItem(long item) { return ExpandItem(item, wxTREE_EXPAND_COLLAPSE); }
- bool ToggleItem(long item) { return ExpandItem(item, wxTREE_EXPAND_TOGGLE); }
- // common interface for {Expand|Collapse|Toggle}Item
- bool ExpandItem(long item, int action);
-
- //
- bool SelectItem(long item);
- bool ScrollTo(long item);
- bool DeleteAllItems();
-
- // Edit the label (tree must have the focus)
- wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
-
- // End label editing, optionally cancelling the edit
- bool EndEditLabel(bool cancel);
-
- long HitTest(const wxPoint& point, int& flags);
- // wxImageList *CreateDragImage(long item);
- bool SortChildren(long item);
- bool EnsureVisible(long item);
-
- void Command(wxCommandEvent& event) { ProcessCommand(event); };
+ //
+
+ //
+ // Add the root node to the tree
+ //
+ wxTreeItemId AddRoot( const wxString& rsText
+ ,int nImage = -1
+ ,int nSelectedImage = -1
+ ,wxTreeItemData* pData = NULL
+ );
+
+ //
+ // Insert a new item in as the first child of the parent
+ //
+ wxTreeItemId PrependItem( const wxTreeItemId& rParent
+ ,const wxString& rsText
+ ,int nImage = -1
+ ,int nSelectedImage = -1
+ ,wxTreeItemData* pData = NULL
+ );
+
+ //
+ // Insert a new item after a given one
+ //
+ wxTreeItemId InsertItem( const wxTreeItemId& rParent
+ ,const wxTreeItemId& rIdPrevious
+ ,const wxString& rsText
+ ,int nImage = -1
+ ,int nSelectedImage = -1
+ ,wxTreeItemData* pData = NULL
+ );
+
+ //
+ // Insert a new item before the one with the given index
+ //
+ wxTreeItemId InsertItem( const wxTreeItemId& pParent
+ ,size_t nIndex
+ ,const wxString& rsText
+ ,int nImage = -1
+ ,int nSelectedImage = -1
+ ,wxTreeItemData* pData = NULL
+ );
+
+ //
+ // Insert a new item in as the last child of the parent
+ //
+ wxTreeItemId AppendItem( const wxTreeItemId& rParent
+ ,const wxString& rsText
+ ,int nImage = -1
+ ,int nSelectedImage = -1
+ ,wxTreeItemData* pData = NULL
+ );
+
+ //
+ // Delete this item and associated data if any
+ //
+ void Delete(const wxTreeItemId& rItem);
+
+ //
+ // Delete all children (but don't delete the item itself)
+ //
+ void DeleteChildren(const wxTreeItemId& rItem);
+
+ //
+ // Delete all items from the tree
+ //
+ void DeleteAllItems(void);
+
+ //
+ // Expand this item
+ //
+ void Expand(const wxTreeItemId& rItem);
+
+ //
+ // Collapse the item without removing its children
+ //
+ void Collapse(const wxTreeItemId& rItem);
+
+ //
+ // Collapse the item and remove all children
+ //
+ void CollapseAndReset(const wxTreeItemId& rItem);
+
+ //
+ // Toggles the current state
+ //
+ void Toggle(const wxTreeItemId& rItem);
+
+ //
+ // Remove the selection from currently selected item (if any)
+ //
+ void Unselect(void);
+
+ //
+ // Unselect all items (only makes sense for multiple selection control)
+ //
+ void UnselectAll(void);
+
+ //
+ // Select this item
+ //
+ void SelectItem(const wxTreeItemId& rItem);
+
+ //
+ // Make sure this item is visible (expanding the parent item and/or
+ // scrolling to this item if necessary)
+ //
+ void EnsureVisible(const wxTreeItemId& rItem);
+
+ //
+ // Scroll to this item (but don't expand its parent)
+ //
+ void ScrollTo(const wxTreeItemId& rItem);
+
+ //
+ // OS/2 does not use a separate edit field for editting text. Here for
+ // interface compatibility, only.
+ //
+ wxTextCtrl* EditLabel( const wxTreeItemId& rItem
+ ,wxClassInfo* pTextCtrlClass = CLASSINFO(wxTextCtrl)
+ );
+
+ //
+ // returns NULL for OS/2 in ALL cases
+ //
+ wxTextCtrl* GetEditControl(void) const {return (wxTextCtrl*)NULL;}
+
+ //
+ // End editing and accept or discard the changes to item label
+ //
+ void EndEditLabel( const wxTreeItemId& rItem
+ ,bool bDiscardChanges = false
+ );
+
+ //
+ // Sorting
+ // -------
+ //
+
+ //
+ // This function is called to compare 2 items and should return -1, 0
+ // or +1 if the first item is less than, equal to or greater than the
+ // second one. The base class version performs alphabetic comparaison
+ // of item labels (GetText)
+ //
+ virtual int OnCompareItems( const wxTreeItemId& rItem1
+ ,const wxTreeItemId& rItem2
+ );
+
+ //
+ // Sort the children of this item using OnCompareItems
+ //
+ void SortChildren(const wxTreeItemId& rItem);
+
+ //
+ // Helpers
+ // -------
+ //
+
+ //
+ // Determine to which item (if any) belongs the given point (the
+ // coordinates specified are relative to the client area of tree ctrl)
+ // and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx
+ // constants.
+
+ //
+ // The first function is more portable (because easier to implement
+ // on other platforms), but the second one returns some extra info.
+ //
+ wxTreeItemId HitTest(const wxPoint& rPoint)
+ { int nDummy = 0; return HitTest(rPoint, nDummy); }
+ wxTreeItemId HitTest( const wxPoint& rPoint
+ ,int& rFlags
+ );
+
+ //
+ // Get the bounding rectangle of the item (or of its label only)
+ //
+ bool GetBoundingRect( const wxTreeItemId& rItem
+ ,wxRect& rRect
+ ,bool bTextOnly = false
+ ) const;
+
+ //
+ // Deprecated
+ // ----------
+
+#if WXWIN_COMPATIBILITY_2_4
+ // These methods are deprecated and will be removed in future versions of
+ // wxWidgets, they're here for compatibility only, don't use them in new
+ // code (the comments indicate why these methods are now useless and how to
+ // replace them)
+ //
+
+ //
+ // Use Expand, Collapse, CollapseAndReset or Toggle
+ //
+ wxDEPRECATED( void ExpandItem( const wxTreeItemId& rItem
+ ,int nAction
+ ) );
+
+ //
+ // Use AddRoot, PrependItem or AppendItem
+ //
+ wxDEPRECATED( wxTreeItemId InsertItem( const wxTreeItemId& pParent
+ ,const wxString& rsText
+ ,int nImage = -1
+ ,int nSelImage = -1
+ ,long lInsertAfter = wxTREE_INSERT_LAST
+ ) );
+
+ //
+ // Use Set/GetImageList and Set/GetStateImageList
+ //
+ wxDEPRECATED( wxImageList* GetImageList(int nVal) const );
+ wxDEPRECATED( void SetImageList(wxImageList* pImageList, int nVal) );
+
+ //
+ // Use Set/GetItemImage directly
+ //
+ wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& rItem) const );
+ wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& rItem, int nImage) );
+
+ //
+ // For this enumeration function you must pass in a "cookie" parameter
+ // which is opaque for the application but is necessary for the library
+ // to make these functions reentrant (i.e. allow more than one
+ // enumeration on one and the same object simultaneously). Of course,
+ // the "cookie" passed to GetFirstChild() and GetNextChild() should be
+ // the same!
+ //
+
+ //
+ // Get the first child of this item
+ //
+ wxDEPRECATED( wxTreeItemId GetFirstChild( const wxTreeItemId& rItem
+ ,long& rCookie
+ ) const );
+
+ //
+ // Get the next child
+ //
+ wxDEPRECATED( wxTreeItemId GetNextChild( const wxTreeItemId& rItem
+ ,long& rCookie
+ ) const );
+#endif // WXWIN_COMPATIBILITY_2_4
+
+ //
+ // Implementation
+ // --------------
+ //
+
+ virtual MRESULT OS2WindowProc( WXUINT uMsg
+ ,WXWPARAM wParam
+ ,WXLPARAM lParam
+ );
+ virtual bool OS2Command( WXUINT uParam
+ ,WXWORD wId
+ );
+// virtual bool OMSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
+
+ //
+ // Override some base class virtuals
+ //
+ virtual bool SetBackgroundColour(const wxColour& rColour);
+ virtual bool SetForegroundColour(const wxColour& rColour);
+
+ //
+ // Get/set the check state for the item (only for wxTR_MULTIPLE)
+ //
+ bool IsItemChecked(const wxTreeItemId& rItem) const;
+ void SetItemCheck( const wxTreeItemId& rItem
+ ,bool bCheck = true
+ );