2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: treebase.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxTreeItemId
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxTreeItemId
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
An opaque reference to a tree item.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
2009-02-20 11:34:52 +00:00
|
|
|
@category{data}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-05-20 07:48:30 +00:00
|
|
|
@see wxTreeCtrl, wxTreeItemData, @ref overview_treectrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxTreeItemId
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-20 07:48:30 +00:00
|
|
|
Default constructor. A wxTreeItemId is not meant to be constructed
|
|
|
|
explicitly by the user; only those returned by the wxTreeCtrl functions
|
|
|
|
should be used.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxTreeItemId();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if this instance is referencing a valid tree item.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsOk() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-05-20 07:48:30 +00:00
|
|
|
Operators for comparison between wxTreeItemId objects.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-05-20 07:48:30 +00:00
|
|
|
bool operator ==(const wxTreeItemId& item) const;
|
|
|
|
bool operator !=(const wxTreeItemId& item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
2008-05-20 07:48:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Antonym of IsOk(), i.e. returns @true only if the item is not valid.
|
|
|
|
*/
|
|
|
|
bool operator !() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-05-20 07:48:30 +00:00
|
|
|
/**
|
|
|
|
@class wxTreeItemData
|
|
|
|
|
|
|
|
wxTreeItemData is some (arbitrary) user class associated with some item. The
|
|
|
|
main advantage of having this class is that wxTreeItemData objects are
|
|
|
|
destroyed automatically by the tree and, as this class has virtual
|
|
|
|
destructor, it means that the memory and any other resources associated with
|
|
|
|
a tree item will be automatically freed when it is deleted. Note that we
|
|
|
|
don't use wxObject as the base class for wxTreeItemData because the size of
|
|
|
|
this class is critical: in many applications, each tree leaf will have
|
|
|
|
wxTreeItemData associated with it and the number of leaves may be quite big.
|
|
|
|
|
|
|
|
Also please note that because the objects of this class are deleted by the
|
|
|
|
tree using the operator @c delete, they must always be allocated on the heap
|
|
|
|
using @c new.
|
|
|
|
|
|
|
|
@library{wxcore}
|
|
|
|
@category{containers}
|
|
|
|
|
|
|
|
@see wxTreeCtrl
|
|
|
|
*/
|
|
|
|
class wxTreeItemData : public wxClientData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
@beginWxPythonOnly
|
|
|
|
The following methods are added in wxPython for accessing the object:
|
|
|
|
- GetData(): Returns a reference to the Python Object.
|
|
|
|
- SetData(obj): Associates a new Python Object with the wxTreeItemData.
|
|
|
|
@endWxPythonOnly
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl the constructor accepts a scalar as an optional parameter
|
|
|
|
and stores it as client data; use
|
|
|
|
- GetData() to retrieve the value.
|
|
|
|
- SetData(data) to set it.
|
|
|
|
@endWxPerlOnly
|
2008-05-20 07:48:30 +00:00
|
|
|
*/
|
|
|
|
wxTreeItemData();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Virtual destructor.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxTreeItemData();
|
2008-05-20 07:48:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the item associated with this node.
|
|
|
|
*/
|
2008-10-28 14:29:36 +00:00
|
|
|
const wxTreeItemId& GetId() const;
|
2008-05-20 07:48:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the item associated with this node.
|
2009-04-05 13:07:24 +00:00
|
|
|
|
|
|
|
Notice that this function is automatically called by wxTreeCtrl methods
|
|
|
|
associating an object of this class with a tree control item such as
|
|
|
|
wxTreeCtrl::AppendItem(), wxTreeCtrl::InsertItem() and
|
|
|
|
wxTreeCtrl::SetItemData() so there is usually no need to call it
|
|
|
|
yourself.
|
2008-05-20 07:48:30 +00:00
|
|
|
*/
|
|
|
|
void SetId(const wxTreeItemId& id);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Indicates which type to associate an image with a wxTreeCtrl item.
|
2008-10-28 14:29:36 +00:00
|
|
|
|
2008-05-20 07:48:30 +00:00
|
|
|
@see wxTreeCtrl::GetItemImage(), wxTreeCtrl::SetItemImage()
|
|
|
|
*/
|
|
|
|
enum wxTreeItemIcon
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
To get/set the item image for when the item is
|
|
|
|
@b not selected and @b not expanded.
|
|
|
|
*/
|
|
|
|
wxTreeItemIcon_Normal,
|
|
|
|
/**
|
|
|
|
To get/set the item image for when the item is
|
|
|
|
@b selected and @b not expanded.
|
|
|
|
*/
|
|
|
|
wxTreeItemIcon_Selected,
|
|
|
|
/**
|
|
|
|
To get/set the item image for when the item is
|
|
|
|
@b not selected and @b expanded.
|
|
|
|
*/
|
|
|
|
wxTreeItemIcon_Expanded,
|
|
|
|
/**
|
|
|
|
To get/set the item image for when the item is
|
|
|
|
@b selected and @b expanded.
|
|
|
|
*/
|
|
|
|
wxTreeItemIcon_SelectedExpanded,
|
|
|
|
wxTreeItemIcon_Max
|
|
|
|
};
|