/////////////////////////////////////////////////////////////////////////////
// Name: wx/palmos/treectrl.h
// Purpose: wxTreeCtrl class
-// Author: William Osborne
+// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Created: 10/13/04
-// RCS-ID: $Id:
+// RCS-ID: $Id$
// Copyright: (c) William Osborne
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma interface "treectrl.h"
-#endif
-
#if wxUSE_TREECTRL
#include "wx/textctrl.h"
#include "wx/treebase.h"
#include "wx/hashmap.h"
-#ifdef __GNUWIN32__
- // Cygwin windows.h defines these identifiers
- #undef GetFirstChild
- #undef GetNextSibling
-#endif // Cygwin
-
// fwd decl
class WXDLLEXPORT wxImageList;
class WXDLLEXPORT wxDragImage;
-struct WXDLLEXPORT wxTreeViewItem;
-
-// NB: all the following flags are for compatbility only and will be removed in the
-// 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 (their values are the same as of
-// TVI_FIRST and TVI_LAST)
-#define wxTREE_INSERT_FIRST 0xFFFF0001
-#define wxTREE_INSERT_LAST 0xFFFF0002
+struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem;
// hash storing attributes for our items
WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr);
// --------
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,
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,
// ---------
// 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
void SetIndent(unsigned int indent);
// spacing is the number of pixels between the start and the Text
- // not implemented under wxMSW
unsigned int GetSpacing() const { return 18; } // return wxGTK default
void SetSpacing(unsigned int WXUNUSED(spacing)) { }
// allow the user to expand the items which don't have any children now
// - but instead add them only when needed, thus minimizing memory
// usage and loading time.
- void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
+ void SetItemHasChildren(const wxTreeItemId& item, bool has = true);
// the item will be shown in bold
- void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
+ void SetItemBold(const wxTreeItemId& item, bool bold = true);
// the item will be shown with a drop highlight
- void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE);
+ void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true);
// set the items text colour
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
// 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) const;
+ bool recursively = true) const;
// 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;
// get the parent of this item (may return NULL if root)
wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
-#if WXWIN_COMPATIBILITY_2_2
- // deprecated: Use GetItemParent instead.
- wxTreeItemId GetParent(const wxTreeItemId& item) const
- { return GetItemParent( item ); }
-
- // Expose the base class method hidden by the one above.
- wxWindow *GetParent() const { return wxControl::GetParent(); }
-#endif // WXWIN_COMPATIBILITY_2_2
-
// for this enumeration function you must pass in a "cookie" parameter
// which is opaque for the application but is necessary for the library
// to make these functions reentrant (i.e. allow more than one
// 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);
// sorting
// this function is called to compare 2 items and should return -1, 0
// get the bounding rectangle of the item (or of its label only)
bool GetBoundingRect(const wxTreeItemId& item,
wxRect& rect,
- bool textOnly = FALSE) const;
-
- // deprecated
- // ----------
-
-#if WXWIN_COMPATIBILITY_2_4
- // 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
- wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) );
-
- // use AddRoot, PrependItem or AppendItem
- wxDEPRECATED( wxTreeItemId InsertItem(const wxTreeItemId& parent,
- const wxString& text,
- int image = -1, int selImage = -1,
- long insertAfter = wxTREE_INSERT_LAST) );
-
- // use Set/GetImageList and Set/GetStateImageList
- wxImageList *GetImageList(int) const { return GetImageList(); }
- void SetImageList(wxImageList *imageList, int) { SetImageList(imageList); }
-
- // use Set/GetItemImage directly
- int GetItemSelectedImage(const wxTreeItemId& item) const
- { return GetItemImage(item, wxTreeItemIcon_Selected); }
- void SetItemSelectedImage(const wxTreeItemId& item, int image)
- { SetItemImage(item, image, wxTreeItemIcon_Selected); }
-
- // use the versions taking wxTreeItemIdValue cookies
- wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item,
- long& cookie) const );
- wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item,
- long& cookie) const );
-#endif // WXWIN_COMPATIBILITY_2_4
-
+ bool textOnly = false) const;
// implementation
// --------------
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
-
- virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
- virtual bool MSWCommand(WXUINT param, WXWORD id);
- virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
-
// override some base class virtuals
virtual bool SetBackgroundColour(const wxColour &colour);
virtual bool SetForegroundColour(const wxColour &colour);
// get/set the check state for the item (only for wxTR_MULTIPLE)
bool IsItemChecked(const wxTreeItemId& item) const;
- void SetItemCheck(const wxTreeItemId& item, bool check = TRUE);
+ void SetItemCheck(const wxTreeItemId& item, bool check = true);
// set/get the item state.image (state == -1 means cycle to the next one)
void SetState(const wxTreeItemId& node, int state);
void DeleteTextCtrl();
// support for additional item images which we implement using
- // wxTreeItemIndirectData technique - see the comments in msw/treectrl.cpp
+ // wxTreeItemIndirectData technique
void SetIndirectItemData(const wxTreeItemId& item,
class wxTreeItemIndirectData *data);
bool HasIndirectData(const wxTreeItemId& item) const;
// the hash storing the items attributes (indexed by item ids)
wxMapTreeAttr m_attrs;
- // TRUE if the hash above is not empty
+ // true if the hash above is not empty
bool m_hasAnyAttr;
// used for dragging
#endif // wxUSE_TREECTRL
-#endif
- // _WX_TREECTRL_H_
+#endif // _WX_TREECTRL_H_