X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..3b49331b7441e091fc5997b830801d76a1243f28:/include/wx/gtk1/treectrl.h diff --git a/include/wx/gtk1/treectrl.h b/include/wx/gtk1/treectrl.h index 9c6dd83266..09ee499296 100644 --- a/include/wx/gtk1/treectrl.h +++ b/include/wx/gtk1/treectrl.h @@ -1,21 +1,17 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: treectrl.h +// Name: wx/gtk1/treectrl.h // Purpose: wxTreeCtrl class // Author: Denis Pershin // Modified by: // Created: 08/08/98 // RCS-ID: $Id$ // Copyright: (c) Denis Pershin -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TREECTRL_H_ #define _WX_TREECTRL_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "treectrl.h" -#endif - #include "wx/textctrl.h" #include "wx/imaglist.h" @@ -25,13 +21,13 @@ typedef long wxDataType; // fwd decl -class wxImageList; +class WXDLLIMPEXP_CORE wxImageList; struct wxTreeViewItem; // 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 wxTreeItemData; +class WXDLLIMPEXP_FWD_CORE wxTreeItemData; typedef int (*wxTreeItemCmpFunc)(wxTreeItemData *item1, wxTreeItemData *item2); // ---------------------------------------------------------------------------- @@ -67,21 +63,13 @@ static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | 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 `Expand(int action)' -enum -{ - wxTREE_EXPAND_EXPAND, - wxTREE_EXPAND_COLLAPSE, - wxTREE_EXPAND_COLLAPSE_RESET, - wxTREE_EXPAND_TOGGLE -}; - -// 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 @@ -145,7 +133,7 @@ public: // -------- wxTreeCtrl() { Init(); } - wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, @@ -156,7 +144,7 @@ public: virtual ~wxTreeCtrl(); - bool Create(wxWindow *parent, wxWindowID id = -1, + 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, @@ -167,7 +155,7 @@ public: // --------- // get the total number of items in the control - size_t GetCount() const; + virtual unsigned int GetCount() const; // indent is the number of pixels the children are indented relative to // the parents position. SetIndent() also redraws the control @@ -203,8 +191,6 @@ public: 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; @@ -215,8 +201,6 @@ public: 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); @@ -235,14 +219,14 @@ public: // number of children // ------------------ - // if 'recursively' is FALSE, only immediate children count, otherwise + // if 'recursively' is false, only immediate children count, otherwise // the returned number is the number of all items in this branch - size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); + size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = true); // navigation // ---------- - // wxTreeItemId.IsOk() will return FALSE if there is no such item + // wxTreeItemId.IsOk() will return false if there is no such item // get the root tree item wxTreeItemId GetRootItem() const; @@ -260,10 +244,6 @@ public: // 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; @@ -342,7 +322,7 @@ public: // edited simultaneously) wxTextCtrl* GetEditControl() const; // end editing and accept or discard the changes to item label - void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE); + void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false); // sort the children of this item using the specified callback function // (it should return -1, 0 or +1 as usual), if it's not specified @@ -355,55 +335,71 @@ public: // 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