]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/generic/treectlg.h
rewrote wxFileName::Normalize(), added a few methods, general clean up,
[wxWidgets.git] / include / wx / generic / treectlg.h
index 4d48f81cde1220ebad88e95b9ff9965f2d0424ff..08761557d25728303580a2ef6450553818717f1b 100644 (file)
@@ -13,7 +13,7 @@
 #define _GENERIC_TREECTRL_H_
 
 #ifdef __GNUG__
 #define _GENERIC_TREECTRL_H_
 
 #ifdef __GNUG__
-    #pragma interface "treectrg.h"
+    #pragma interface "treectlg.h"
 #endif
 
 #include "wx/defs.h"
 #endif
 
 #include "wx/defs.h"
@@ -57,6 +57,7 @@ public:
                const wxValidator &validator = wxDefaultValidator,
                const wxString& name = wxTreeCtrlNameStr)
     {
                const wxValidator &validator = wxDefaultValidator,
                const wxString& name = wxTreeCtrlNameStr)
     {
+        Init();
         Create(parent, id, pos, size, style, validator, name);
     }
 
         Create(parent, id, pos, size, style, validator, name);
     }
 
@@ -86,9 +87,11 @@ public:
     void SetSpacing(unsigned int spacing);
 
         // image list: these functions allow to associate an image list with
     void SetSpacing(unsigned int spacing);
 
         // image list: these functions allow to associate an image list with
-        // the control and retrieve it. Note that the control does _not_ delete
+        // the control and retrieve it. Note that when assigned with 
+        // SetImageList, the control does _not_ delete
         // the associated image list when it's deleted in order to allow image
         // the associated image list when it's deleted in order to allow image
-        // lists to be shared between different controls.
+        // lists to be shared between different controls. If you use 
+        // AssignImageList, the control _does_ delete the image list.
         //
         // The normal image list is for the icons which correspond to the
         // normal tree item state (whether it is selected or not).
         //
         // The normal image list is for the icons which correspond to the
         // normal tree item state (whether it is selected or not).
@@ -100,6 +103,8 @@ public:
 
     void SetImageList(wxImageList *imageList);
     void SetStateImageList(wxImageList *imageList);
 
     void SetImageList(wxImageList *imageList);
     void SetStateImageList(wxImageList *imageList);
+    void AssignImageList(wxImageList *imageList);
+    void AssignStateImageList(wxImageList *imageList);
 
     // Functions to work with tree ctrl items.
 
 
     // Functions to work with tree ctrl items.
 
@@ -210,6 +215,10 @@ public:
         // get the previous visible item: item must be visible itself!
     wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
 
         // get the previous visible item: item must be visible itself!
     wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
 
+        // Only for internal use right now, but should probably be public
+    wxTreeItemId GetNext(const wxTreeItemId& item) const;
+    wxTreeItemId GetPrev(const wxTreeItemId& item) const;
+
     // operations
     // ----------
 
     // operations
     // ----------
 
@@ -281,6 +290,11 @@ public:
         { int dummy; return HitTest(point, dummy); }
     wxTreeItemId HitTest(const wxPoint& point, int& flags);
 
         { int dummy; return HitTest(point, dummy); }
     wxTreeItemId HitTest(const wxPoint& point, int& flags);
 
+        // get the bounding rectangle of the item (or of its label only)
+    bool GetBoundingRect(const wxTreeItemId& item,
+                         wxRect& rect,
+                         bool textOnly = FALSE) const;
+
         // Start editing the item label: this (temporarily) replaces the item
         // with a one line edit control. The item will be selected if it hadn't
         // been before.
         // Start editing the item label: this (temporarily) replaces the item
         // with a one line edit control. The item will be selected if it hadn't
         // been before.
@@ -343,6 +357,8 @@ protected:
     wxBrush             *m_hilightBrush;
     wxImageList         *m_imageListNormal,
                         *m_imageListState;
     wxBrush             *m_hilightBrush;
     wxImageList         *m_imageListNormal,
                         *m_imageListState;
+    bool                 m_ownsImageListNormal, 
+                         m_ownsImageListState;
 
     int                  m_dragCount;
     wxPoint              m_dragStart;
 
     int                  m_dragCount;
     wxPoint              m_dragStart;
@@ -366,7 +382,9 @@ protected:
                               int image, int selectedImage,
                               wxTreeItemData *data);
 
                               int image, int selectedImage,
                               wxTreeItemData *data);
 
+public:
     void AdjustMyScrollbars();
     void AdjustMyScrollbars();
+protected:
     int  GetLineHeight(wxGenericTreeItem *item) const;
     void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y );
     void PaintItem( wxGenericTreeItem *item, wxDC& dc);
     int  GetLineHeight(wxGenericTreeItem *item) const;
     void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y );
     void PaintItem( wxGenericTreeItem *item, wxDC& dc);
@@ -394,5 +412,32 @@ private:
     DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl)
 };
 
     DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl)
 };
 
+#if !defined(__WXMSW__) || defined(__WIN16__)
+/*
+ * wxTreeCtrl has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl
+{
+public:
+    DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
+
+    wxTreeCtrl() {}
+
+    wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
+               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);
+    }
+
+};
+
+#endif
+
 #endif // _GENERIC_TREECTRL_H_
 
 #endif // _GENERIC_TREECTRL_H_