- DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
-
- public:
-
- wxTreeCtrl(void);
- wxTreeCtrl(wxWindow *parent, const wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- const long style = wxTR_HAS_BUTTONS,
- const wxString& name = "wxTreeCtrl" );
- ~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 wxString& name = "wxTreeCtrl");
-
- int GetCount(void) const;
- long InsertItem( const long parent, const wxString& label, const int image = -1,
- const int selImage = -1, const long insertAfter = wxTREE_INSERT_LAST );
- long InsertItem( const long parent, wxTreeItem &info, const long insertAfter = wxTREE_INSERT_LAST );
- bool DeleteAllItems(void);
- bool ExpandItem( const long item, const int action );
- bool GetItem( wxTreeItem &info ) const;
- long GetItemData( const long item ) const;
- wxString GetItemText( const long item ) const;
- long GetParent( const long item ) const;
- long GetRootItem(void) const;
- long GetSelection(void) const;
- bool SelectItem( const long item ) const;
- bool ItemHasChildren( const long item ) const;
- void SetIndent( const int indent );
- int GetIndent(void) const;
- bool SetItem( wxTreeItem &info );
- bool SetItemData( const long item, const long data );
- bool SetItemText( const long item, const wxString &text );
- long HitTest( const wxPoint& point, int &flags );
+public:
+ wxTreeCtrl();
+ wxTreeCtrl(wxWindow *parent, const wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_HAS_BUTTONS,
+ const wxString& name = "wxTreeCtrl" );
+ ~wxTreeCtrl();
+ bool Create(wxWindow *parent, const wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_HAS_BUTTONS,
+ const wxString& name = "wxTreeCtrl");
+
+ int GetCount() const;
+ long InsertItem( long parent, const wxString& label, int image = -1,
+ int selImage = -1, long insertAfter = wxTREE_INSERT_LAST );
+ long InsertItem( long parent, wxTreeItem &info,
+ long insertAfter = wxTREE_INSERT_LAST );
+ void DeleteItem( long item );
+ void DeleteChildren( long item );
+ bool DeleteAllItems();
+ bool ExpandItem( long item, int action );
+ bool GetItem( wxTreeItem &info ) const;
+ long GetItemData( long item ) const;
+ wxString GetItemText( long item ) const;
+ int GetItemImage(long item) const;
+ long GetParent( long item ) const;
+ long GetRootItem() const;
+ long GetSelection() const;
+ bool SelectItem( long item ) const;
+ bool ItemHasChildren( long item ) const;
+ void SetIndent( int indent );
+ int GetIndent() const;
+ bool SetItem( wxTreeItem &info );
+ bool SetItemData( long item, long data );
+ bool SetItemText( long item, const wxString &text );
+ void SetItemImage(long item, int image, int imageSel) const;
+ long HitTest( const wxPoint& point, int &flags );
+
+ void AdjustMyScrollbars();
+ void PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level, int &y );
+ void OnPaint( const wxPaintEvent &event );
+ void OnSetFocus( const wxFocusEvent &event );
+ void OnKillFocus( const wxFocusEvent &event );
+ void OnChar( wxKeyEvent &event );
+ void OnMouse( const wxMouseEvent &event );
+
+ void SetImageList(wxImageList *imageList) { m_imageList = imageList; }
+ wxImageList *GetImageList() const { return m_imageList; }
+
+private:
+ wxGenericTreeItem *m_anchor;
+ wxGenericTreeItem *m_current;
+ bool m_hasFocus;
+ int m_xScroll,m_yScroll;
+ int m_indent;
+ long m_lastId;
+ int m_lineHeight;
+ wxPen m_dottedPen;
+ bool m_isCreated;
+ wxPaintDC *m_dc;
+ wxBrush *m_hilightBrush;
+ wxImageList *m_imageList;
+
+ void CalculateLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level, int &y );
+ void CalculatePositions();
+ wxGenericTreeItem *FindItem( long itemId ) const;
+ void RefreshLine( wxGenericTreeItem *item );