File: treebase.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (189 lines) | stat: -rw-r--r-- 6,561 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/////////////////////////////////////////////////////////////////////////////
// Name:        treebase.h
// Purpose:     interface of wxTreeItemId
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxTreeItemId

    An opaque reference to a tree item.

    @library{wxcore}
    @category{data}

    @see wxTreeCtrl, wxTreeItemData, @ref overview_treectrl
*/
class wxTreeItemId
{
public:
    /**
        Default constructor. A wxTreeItemId is not meant to be constructed
        explicitly by the user; only those returned by the wxTreeCtrl functions
        should be used.
    */
    wxTreeItemId();

    /**
        Returns @true if this instance is referencing a valid tree item.
    */
    bool IsOk() const;

    void* GetID() const;
    void Unset();
};

bool operator==(const wxTreeItemId& left, const wxTreeItemId& right);
bool operator!=(const wxTreeItemId& left, const wxTreeItemId& right);



/**
    @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.

        @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
    */
    wxTreeItemData();

    /**
        Virtual destructor.
    */
    virtual ~wxTreeItemData();

    /**
        Returns the item associated with this node.
    */
    const wxTreeItemId& GetId() const;

    /**
        Sets the item associated with this node.

        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.
    */
    void SetId(const wxTreeItemId& id);
};

/**
    Indicates which type to associate an image with a wxTreeCtrl item.

    @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
};


/// special values for the 'state' parameter of wxTreeCtrl::SetItemState()
static const int wxTREE_ITEMSTATE_NONE  = -1;   // not state (no display state image)
static const int wxTREE_ITEMSTATE_NEXT  = -2;   // cycle to the next state
static const int wxTREE_ITEMSTATE_PREV  = -3;   // cycle to the previous state

#define wxTR_NO_BUTTONS              0x0000     // for convenience
#define wxTR_HAS_BUTTONS             0x0001     // draw collapsed/expanded btns
#define wxTR_NO_LINES                0x0004     // don't draw lines at all
#define wxTR_LINES_AT_ROOT           0x0008     // connect top-level nodes
#define wxTR_TWIST_BUTTONS           0x0010     // still used by wxTreeListCtrl

#define wxTR_SINGLE                  0x0000     // for convenience
#define wxTR_MULTIPLE                0x0020     // can select multiple items

#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080     // what it says

#define wxTR_EDIT_LABELS             0x0200     // can edit item labels
#define wxTR_ROW_LINES               0x0400     // put border around items
#define wxTR_HIDE_ROOT               0x0800     // don't display root node

#define wxTR_FULL_ROW_HIGHLIGHT      0x2000     // highlight full horz space

// make the default control appearance look more native-like depending on the
// platform
#define wxTR_DEFAULT_STYLE       (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)


// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
// where exactly the specified point is situated:

static const int wxTREE_HITTEST_ABOVE            = 0x0001;
static const int wxTREE_HITTEST_BELOW            = 0x0002;
static const int wxTREE_HITTEST_NOWHERE          = 0x0004;
    // on the button associated with an item.
static const int wxTREE_HITTEST_ONITEMBUTTON     = 0x0008;
    // on the bitmap associated with an item.
static const int wxTREE_HITTEST_ONITEMICON       = 0x0010;
    // on the indent associated with an item.
static const int wxTREE_HITTEST_ONITEMINDENT     = 0x0020;
    // on the label (string) associated with an item.
static const int wxTREE_HITTEST_ONITEMLABEL      = 0x0040;
    // on the right of the label associated with an item.
static const int wxTREE_HITTEST_ONITEMRIGHT      = 0x0080;
    // on the label (string) associated with an item.
static const int wxTREE_HITTEST_ONITEMSTATEICON  = 0x0100;
    // on the left of the wxTreeCtrl.
static const int wxTREE_HITTEST_TOLEFT           = 0x0200;
    // on the right of the wxTreeCtrl.
static const int wxTREE_HITTEST_TORIGHT          = 0x0400;
    // on the upper part (first half) of the item.
static const int wxTREE_HITTEST_ONITEMUPPERPART  = 0x0800;
    // on the lower part (second half) of the item.
static const int wxTREE_HITTEST_ONITEMLOWERPART  = 0x1000;

    // anywhere on the item
static const int wxTREE_HITTEST_ONITEM  = wxTREE_HITTEST_ONITEMICON |
                                          wxTREE_HITTEST_ONITEMLABEL;