-class WXDLLEXPORT wxTreeCtrl: public wxControl
-{
- DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
- public:
- /*
- * Public interface
- */
-
- wxTreeCtrl(void);
-
- inline wxTreeCtrl(wxWindow *parent, const wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- const long style = wxTR_HAS_BUTTONS,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = "wxTreeCtrl")
- {
- Create(parent, id, pos, size, style, validator, name);
- }
- ~wxTreeCtrl(void);
-
- bool Create(wxWindow *parent, const wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- const long style = wxTR_HAS_BUTTONS,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = "wxTreeCtrl");
-
- // Attributes
- int GetCount(void) const ;
- int GetIndent(void) const ;
- void SetIndent(int indent) ;
- wxImageList *GetImageList(const int which = wxIMAGE_LIST_NORMAL) const ;
- void SetImageList(wxImageList *imageList, const int which = wxIMAGE_LIST_NORMAL) ;
- long GetNextItem(const long item, int code) const ;
- bool ItemHasChildren(const long item) const ;
- long GetChild(const long item) const ;
- long GetParent(const long item) const ;
- long GetFirstVisibleItem(void) const ;
- long GetNextVisibleItem(const long item) const ;
- long GetSelection(void) const ;
- long GetRootItem(void) const ;
- bool GetItem(wxTreeItem& info) const ;
- bool SetItem(wxTreeItem& info) ;
- int GetItemState(const long item, const long stateMask) const ;
- bool SetItemState(const long item, const long state, const long stateMask) ;
- bool SetItemImage(const long item, const int image, const int selImage) ;
- wxString GetItemText(const long item) const ;
- void SetItemText(const long item, const wxString& str) ;
- long GetItemData(const long item) const ;
- bool SetItemData(const long item, long data) ;
- bool GetItemRect(const long item, wxRectangle& rect, bool textOnly = FALSE) const;
- wxTextCtrl& GetEditControl(void) const;
-
- // Operations
- bool DeleteItem(const long item);
- bool ExpandItem(const long item, const int action);
- long InsertItem(const long parent, wxTreeItem& info, const long insertAfter = wxTREE_INSERT_LAST);
-
- // If image > -1 and selImage == -1, the same image is used for
- // both selected and unselected items.
- long InsertItem(const long parent, const wxString& label, const int image = -1, const int selImage = -1, const long insertAfter = wxTREE_INSERT_LAST);
- bool SelectItem(const long item);
- bool ScrollTo(const long item);
- bool DeleteAllItems(void) ;
- wxTextCtrl& Edit(const long item) ;
- long HitTest(const wxPoint& point, int& flags);
-// wxImageList *CreateDragImage(const long item) ;
- bool SortChildren(const long item) ;
- bool EnsureVisible(const long item) ;
-
- void Command(wxCommandEvent& event) { ProcessCommand(event); };
-
- // IMPLEMENTATION
- bool MSWCommand(const WXUINT param, const WXWORD id);
- bool MSWNotify(const WXWPARAM wParam, const WXLPARAM lParam);
+ wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTreeCtrlNameStr)
+ {
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ virtual ~wxTreeCtrl();
+
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTreeCtrlNameStr);
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual unsigned int GetCount() const;
+
+ virtual unsigned int GetIndent() const;
+ virtual void SetIndent(unsigned int indent);
+
+ virtual void SetImageList(wxImageList *imageList);
+ virtual void SetStateImageList(wxImageList *imageList);
+
+ virtual wxString GetItemText(const wxTreeItemId& item) const;
+ virtual int GetItemImage(const wxTreeItemId& item,
+ wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
+ virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
+ virtual wxColour GetItemTextColour(const wxTreeItemId& item) const;
+ virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const;
+ virtual wxFont GetItemFont(const wxTreeItemId& item) const;
+
+ virtual void SetItemText(const wxTreeItemId& item, const wxString& text);
+ virtual void SetItemImage(const wxTreeItemId& item, int image,
+ wxTreeItemIcon which = wxTreeItemIcon_Normal);
+ virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
+ virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true);
+ virtual void SetItemBold(const wxTreeItemId& item, bool bold = true);
+ virtual void SetItemDropHighlight(const wxTreeItemId& item,
+ bool highlight = true);
+ virtual void SetItemTextColour(const wxTreeItemId& item,
+ const wxColour& col);
+ virtual void SetItemBackgroundColour(const wxTreeItemId& item,
+ const wxColour& col);
+ virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font);
+
+ // item status inquiries
+ // ---------------------
+
+ virtual bool IsVisible(const wxTreeItemId& item) const;
+ virtual bool ItemHasChildren(const wxTreeItemId& item) const;
+ virtual bool IsExpanded(const wxTreeItemId& item) const;
+ virtual bool IsSelected(const wxTreeItemId& item) const;
+ virtual bool IsBold(const wxTreeItemId& item) const;
+
+ virtual size_t GetChildrenCount(const wxTreeItemId& item,
+ bool recursively = true) const;
+
+ // navigation
+ // ----------
+
+ virtual wxTreeItemId GetRootItem() const;
+ virtual wxTreeItemId GetSelection() const;
+ virtual size_t GetSelections(wxArrayTreeItemIds& selections) const;
+
+ virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item,
+ wxTreeItemIdValue& cookie) const;
+ virtual wxTreeItemId GetNextChild(const wxTreeItemId& item,
+ wxTreeItemIdValue& cookie) const;
+ virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
+
+ virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
+
+ virtual wxTreeItemId GetFirstVisibleItem() const;
+ virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
+
+ // operations
+ // ----------
+
+ virtual wxTreeItemId AddRoot(const wxString& text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData *data = NULL);
+
+ virtual void Delete(const wxTreeItemId& item);
+ virtual void DeleteChildren(const wxTreeItemId& item);
+ virtual void DeleteAllItems();
+
+ virtual void Expand(const wxTreeItemId& item);
+ virtual void Collapse(const wxTreeItemId& item);
+ virtual void CollapseAndReset(const wxTreeItemId& item);
+ virtual void Toggle(const wxTreeItemId& item);
+
+ virtual void Unselect();
+ virtual void UnselectAll();
+ virtual void SelectItem(const wxTreeItemId& item, bool select = true);
+
+ virtual void EnsureVisible(const wxTreeItemId& item);
+ virtual void ScrollTo(const wxTreeItemId& item);
+
+ virtual wxTextCtrl *EditLabel(const wxTreeItemId& item,
+ wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl));
+ virtual wxTextCtrl *GetEditControl() const;
+ virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item),
+ bool discardChanges = false)
+ {
+ DoEndEditLabel(discardChanges);
+ }
+
+ virtual void SortChildren(const wxTreeItemId& item);
+
+ virtual bool GetBoundingRect(const wxTreeItemId& item,
+ wxRect& rect,
+ bool textOnly = 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& item, int action) );
+
+ // use Set/GetImageList and Set/GetStateImageList
+ // Use base class GetImageList()
+ wxDEPRECATED( void SetImageList(wxImageList *imageList, int) );
+
+ // use Set/GetItemImage directly
+ wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const );
+ wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) );
+
+ // use the versions taking wxTreeItemIdValue cookies
+ wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item,
+ long& cookie) const );
+ wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item,
+ long& cookie) const );
+#endif // WXWIN_COMPATIBILITY_2_4
+
+
+ // implementation
+ // --------------
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+
+ virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+ virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+ virtual bool MSWCommand(WXUINT param, WXWORD id);
+ virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
+ virtual bool MSWShouldPreProcessMessage(WXMSG* msg);
+
+ // override some base class virtuals
+ 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);