X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..345319d60c69cac3f5e9e74ee570d20370fc532f:/include/wx/mac/carbon/treectrl.h diff --git a/include/wx/mac/carbon/treectrl.h b/include/wx/mac/carbon/treectrl.h index 7077070bd4..1e37d9f3d4 100644 --- a/include/wx/mac/carbon/treectrl.h +++ b/include/wx/mac/carbon/treectrl.h @@ -1,21 +1,17 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: treectrl.h +// Name: wx/mac/carbon/treectrl.h // Purpose: wxTreeCtrl class // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// 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/control.h" #include "wx/event.h" #include "wx/imaglist.h" @@ -56,7 +52,7 @@ enum { wxTREE_NEXT_CHILD, // Retrieves the first child item. The hItem parameter must be NULL. wxTREE_NEXT_DROPHILITE, // Retrieves the item that is the target of a drag-and-drop operation. wxTREE_NEXT_FIRSTVISIBLE, // Retrieves the first visible item. - wxTREE_NEXT_NEXT, // Retrieves the next sibling item. + wxTREE_NEXT_NEXT, // Retrieves the next sibling item. wxTREE_NEXT_NEXTVISIBLE, // Retrieves the next visible item that follows the specified item. wxTREE_NEXT_PARENT, // Retrieves the parent of the specified item. wxTREE_NEXT_PREVIOUS, // Retrieves the previous sibling item. @@ -64,25 +60,21 @@ enum { wxTREE_NEXT_ROOT // Retrieves the first child item of the root item of which the specified item is a part. }; -// Flags for ExpandItem -enum { - wxTREE_EXPAND_EXPAND, - wxTREE_EXPAND_COLLAPSE, - wxTREE_EXPAND_COLLAPSE_RESET, - wxTREE_EXPAND_TOGGLE -}; - -// Flags for InsertItem -enum { - wxTREE_INSERT_LAST = -1, - wxTREE_INSERT_FIRST = -2, - wxTREE_INSERT_SORT = -3 -}; +#if WXWIN_COMPATIBILITY_2_6 + // Flags for InsertItem + enum { + wxTREE_INSERT_LAST = -1, + wxTREE_INSERT_FIRST = -2, + wxTREE_INSERT_SORT = -3 + }; +#endif class WXDLLEXPORT wxTreeItem: public wxObject { - DECLARE_DYNAMIC_CLASS(wxTreeItem) + DECLARE_DYNAMIC_CLASS(wxTreeItem) + public: + long m_mask; long m_itemId; long m_state; @@ -123,12 +115,12 @@ public: /* * Public interface */ - + // creation // -------- wxTreeCtrl(); - - inline wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, + + inline wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, @@ -137,26 +129,25 @@ public: { Create(parent, id, pos, size, style, validator, name); } - ~wxTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = -1, + 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 = "wxTreeCtrl"); - + // accessors // --------- // - int GetCount() const; + virtual unsigned int GetCount() const; // indent int GetIndent() const; void SetIndent(int indent); // image list wxImageList *GetImageList(int which = wxIMAGE_LIST_NORMAL) const; - void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL); // navigation inside the tree long GetNextItem(long item, int code) const; @@ -183,37 +174,42 @@ public: long GetItemData(long item) const; bool SetItemData(long item, long data); // convenience function - bool IsItemExpanded(long item) - { - return (GetItemState(item, wxTREE_STATE_EXPANDED) & - wxTREE_STATE_EXPANDED) != 0; + bool IsItemExpanded(long item) + { + return (GetItemState(item, wxTREE_STATE_EXPANDED) & + wxTREE_STATE_EXPANDED) != 0; } // bounding rect - bool GetItemRect(long item, wxRect& rect, bool textOnly = FALSE) const; + bool GetItemRect(long item, wxRect& rect, bool textOnly = false) const; // wxTextCtrl* GetEditControl() const; - + // operations // ---------- // adding/deleting items bool DeleteItem(long item); - long InsertItem(long parent, wxTreeItem& info, - long insertAfter = wxTREE_INSERT_LAST); - // If image > -1 and selImage == -1, the same image is used for - // both selected and unselected items. - long InsertItem(long parent, const wxString& label, - int image = -1, int selImage = -1, - long insertAfter = wxTREE_INSERT_LAST); + +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( long InsertItem(long parent, wxTreeItem& info, + long insertAfter = wxTREE_INSERT_LAST) ); + // If image > -1 and selImage == -1, the same image is used for + // both selected and unselected items. + wxDEPRECATED( long InsertItem(long parent, const wxString& label, + int image = -1, int selImage = -1, + long insertAfter = wxTREE_INSERT_LAST) ); + + // use Expand, Collapse, CollapseAndReset or Toggle + wxDEPRECATED( bool ExpandItem(long item, int action) ); + wxDEPRECATED( void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL) ); +#endif // WXWIN_COMPATIBILITY_2_6 // changing item state bool ExpandItem(long item) { return ExpandItem(item, wxTREE_EXPAND_EXPAND); } bool CollapseItem(long item) { return ExpandItem(item, wxTREE_EXPAND_COLLAPSE); } bool ToggleItem(long item) { return ExpandItem(item, wxTREE_EXPAND_TOGGLE); } - // common interface for {Expand|Collapse|Toggle}Item - bool ExpandItem(long item, int action); - - // + + // bool SelectItem(long item); bool ScrollTo(long item); bool DeleteAllItems(); @@ -228,7 +224,7 @@ public: // wxImageList *CreateDragImage(long item); bool SortChildren(long item); bool EnsureVisible(long item); - + void Command(wxCommandEvent& event) { ProcessCommand(event); }; protected: @@ -258,20 +254,20 @@ protected: class WXDLLEXPORT wxTreeEvent: public wxCommandEvent { - DECLARE_DYNAMIC_CLASS(wxTreeEvent) + DECLARE_DYNAMIC_CLASS(wxTreeEvent) - public: - wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); +public: + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); - int m_code; - wxTreeItem m_item; - long m_oldItem; - wxPoint m_pointDrag; + int m_code; + wxTreeItem m_item; + long m_oldItem; + wxPoint m_pointDrag; - inline long GetOldItem() const { return m_oldItem; } - inline wxTreeItem& GetItem() const { return (wxTreeItem&) m_item; } - inline wxPoint GetPoint() const { return m_pointDrag; } - inline int GetCode() const { return m_code; } + inline long GetOldItem() const { return m_oldItem; } + inline wxTreeItem& GetItem() const { return (wxTreeItem&) m_item; } + inline wxPoint GetPoint() const { return m_pointDrag; } + inline int GetCode() const { return m_code; } }; typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&);