// Author: Denis Pershin
// Modified by:
// Created: 08/08/98
-// RCS-ID: $Id$
// Copyright: (c) Denis Pershin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// a callback function used for sorting tree items, it should return -1 if the
// first item precedes the second, +1 if the second precedes the first or 0 if
// they're equivalent
-class WXDLLIMPEXP_CORE wxTreeItemData;
+class WXDLLIMPEXP_FWD_CORE wxTreeItemData;
typedef int (*wxTreeItemCmpFunc)(wxTreeItemData *item1, wxTreeItemData *item2);
// ----------------------------------------------------------------------------
wxTREE_HITTEST_ONITEMLABEL |
wxTREE_HITTEST_ONITEMSTATEICON;
-// NB: all the following flags are for compatbility only and will be removed in
-// next versions
-
-// flags for deprecated InsertItem() variant
-#define wxTREE_INSERT_FIRST 0xFFFF0001
-#define wxTREE_INSERT_LAST 0xFFFF0002
+#if WXWIN_COMPATIBILITY_2_6
+ // NB: all the following flags are for compatbility only and will be removed in
+ // next versions
+ // flags for deprecated InsertItem() variant
+ #define wxTREE_INSERT_FIRST 0xFFFF0001
+ #define wxTREE_INSERT_LAST 0xFFFF0002
+#endif
// ----------------------------------------------------------------------------
// wxTreeItemId identifies an element of the tree. In this implementation, it's
// just a trivial wrapper around GTK GtkTreeItem *. It's opaque for the
// application.
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxTreeItemId {
+class WXDLLIMPEXP_CORE wxTreeItemId {
public:
// ctors
wxTreeItemId() { m_itemId = NULL; }
// Because the objects of this class are deleted by the tree, they should
// always be allocated on the heap!
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxTreeItemData : private wxTreeItemId {
+class WXDLLIMPEXP_CORE wxTreeItemData : private wxTreeItemId {
public:
// default ctor/copy ctor/assignment operator are ok
const wxTreeItemId& GetId() const { return (wxTreeItemId&) m_itemId; }
};
-class WXDLLEXPORT wxTreeCtrl: public wxControl {
+class WXDLLIMPEXP_CORE wxTreeCtrl: public wxControl {
public:
// creation
// --------
wxString GetItemText(const wxTreeItemId& item) const;
// get the normal item image
int GetItemImage(const wxTreeItemId& item) const;
- // get the selected item image
- int GetItemSelectedImage(const wxTreeItemId& item) const;
// get the data associated with the item
wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
void SetItemText(const wxTreeItemId& item, const wxString& text);
// set the normal item image
void SetItemImage(const wxTreeItemId& item, int image);
- // set the selected item image
- void SetItemSelectedImage(const wxTreeItemId& item, int image);
// associate some data with the item
void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
// the "cookie" passed to GetFirstChild() and GetNextChild() should be
// the same!
- // get the first child of this item
- wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const;
- // get the next child (after GetFirstChild or GetNextChild)
- wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const;
// get the last child of this item - this method doesn't use cookies
wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
// been before. textCtrlClass parameter allows you to create an edit
// control of arbitrary user-defined class deriving from wxTextCtrl.
wxTextCtrl* EditLabel(const wxTreeItemId& item,
- wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl));
+ wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl));
// returns the same pointer as StartEdit() if the item is being edited,
// NULL otherwise (it's assumed that no more than one item may be
// edited simultaneously)
// deprecated
// ----------
+#if WXWIN_COMPATIBILITY_2_6
// 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
- void ExpandItem(const wxTreeItemId& item, int action);
+ wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) );
+
+ // use SetImageList
+ wxDEPRECATED( void SetImageList(wxImageList *imageList, int) )
+ { SetImageList(imageList); }
+
+ // use Set/GetItemImage directly
+ wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const );
+ wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) );
+
+ // get the first child of this item
+ wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const );
+ // get the next child (after GetFirstChild or GetNextChild)
+ wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const );
// use AddRoot, PrependItem or AppendItem
- wxTreeItemId InsertItem(const wxTreeItemId& parent,
- const wxString& text,
- int image = -1, int selImage = -1,
- long insertAfter = wxTREE_INSERT_LAST);
+ wxDEPRECATED( wxTreeItemId InsertItem(const wxTreeItemId& parent,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ long insertAfter = wxTREE_INSERT_LAST) );
+
+#endif // WXWIN_COMPATIBILITY_2_6
// use Set/GetImageList and Set/GetStateImageList
wxImageList *GetImageList(int) const
{ return GetImageList(); }
- void SetImageList(wxImageList *imageList, int)
- { SetImageList(imageList); }
- void SendExpanding(const wxTreeItemId& item);
- void SendExpanded(const wxTreeItemId& item);
- void SendCollapsing(const wxTreeItemId& item);
- void SendCollapsed(const wxTreeItemId& item);
- void SendSelChanging(const wxTreeItemId& item);
- void SendSelChanged(const wxTreeItemId& item);
+ void SendExpanding(const wxTreeItemId& item);
+ void SendExpanded(const wxTreeItemId& item);
+ void SendCollapsing(const wxTreeItemId& item);
+ void SendCollapsed(const wxTreeItemId& item);
+ void SendSelChanging(const wxTreeItemId& item);
+ void SendSelChanged(const wxTreeItemId& item);
+
protected:
- wxTreeItemId m_editItem;
- GtkTree *m_tree;
- GtkTreeItem *m_anchor;
- wxTextCtrl* m_textCtrl;
- wxImageList* m_imageListNormal;
- wxImageList* m_imageListState;
- long m_curitemId;
+ wxTreeItemId m_editItem;
+ GtkTree *m_tree;
+ GtkTreeItem *m_anchor;
+ wxTextCtrl* m_textCtrl;
+ wxImageList* m_imageListNormal;
+ wxImageList* m_imageListState;
+
+ long m_curitemId;
- void SendMessage(wxEventType command, const wxTreeItemId& item);
+ void SendMessage(wxEventType command, const wxTreeItemId& item);
// GtkTreeItem *findGtkTreeItem(wxTreeCtrlId &id) const;
// the common part of all ctors
- void Init();
- // insert a new item in as the last child of the parent
- wxTreeItemId p_InsertItem(GtkTreeItem *p,
- const wxString& text,
- int image, int selectedImage,
- wxTreeItemData *data);
+ void Init();
+ // insert a new item in as the last child of the parent
+ wxTreeItemId p_InsertItem(GtkTreeItem *p,
+ const wxString& text,
+ int image, int selectedImage,
+ wxTreeItemData *data);
- DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
+ DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
};
#endif