This class represents the main window (and thus the main column) in HyperTreeList
.
Note
This is a subclass of CustomTreeCtrl
.
wx.lib.agw.customtreectrl.CustomTreeCtrl
Default class constructor. |
|
Adds a root item to the |
|
Internal method used to adjust the |
|
Calculates the level of an item inside the tree hierarchy. |
|
Recalculates all the items positions. |
|
Calculates overall position and size of an item. |
|
We are about to destroy the item’s children. |
|
Deletes an item. |
|
Delete all items in the |
|
Deletes the window in the column associated to an item (if any). |
|
Removes the tree root item (and subsequently all the items in |
|
Actually inserts an item in the tree. |
|
Starts editing an item label. |
|
Enables/disables an item. |
|
Returns the best column’s width based on the items width in this column. |
|
Returns the total number of columns. |
|
Returns the current item. |
|
Returns the first item which is in the expanded state. |
|
Returns the first visible item. |
|
Returns the column background colour of the item |
|
Returns the item image. |
|
Returns the item text label. |
|
Returns the item width. |
|
Returns the window associated with an item. |
|
Returns whether the window associated with an item is enabled or not. |
|
Returns the |
|
Returns the next expanded item after the input one. |
|
Returns the previous child of an item. |
|
Returns the previous expanded item before the input one. |
|
Returns the previous visible item before the input one. |
|
Hides all windows belonging to given item and its children. |
|
Scans all item windows in the tree and hides those whose items |
|
Calculates which (if any) item is under the given point, returning the tree item |
|
Returns whether an item is enabled or disabled. |
|
Returns whether the item is visible or not. |
|
Returns |
|
Called by |
|
Called by |
|
The timer for editing has expired. Start editing. |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Actually draws an item. |
|
Paint a level in the hierarchy of |
|
Scrolls the specified item into view. |
|
Sets/unsets the double buffering for the main window. |
|
Sets the specified item as member of a current drag and drop operation. |
|
Sets the column background colour of the item |
|
Sets the item image for a particular item state. |
|
Sets the item text label. |
|
Sets the window associated to an item. |
|
Sets whether the window associated with an item is enabled or not. |
|
Sets the |
TreeListMainWindow
(CustomTreeCtrl)¶This class represents the main window (and thus the main column) in HyperTreeList
.
Note
This is a subclass of CustomTreeCtrl
.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=wx.TR_DEFAULT_STYLE, validator=wx.DefaultValidator, name="wxtreelistmainwindow")¶Default class constructor.
parent – parent window. Must not be None
;
id – window identifier. A value of -1 indicates a default value;
pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
style – the underlying ScrolledWindow
style;
agwStyle – can be a combination of various bits. See
hypertreelist
for a full list of flags.
validator – window validator;
name – window name.
AddRoot
(self, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None)¶Adds a root item to the TreeListMainWindow
.
text – the item text label;
ct_type – the item type (see CustomTreeCtrl.SetItemType()
for a list of valid item types);
wnd – if not None
, a non-toplevel window to show next to the item;
image – an index within the normal image list specifying the image to use for the item in unselected state;
selImage – an index within the normal image list specifying the image to use for the item in selected state; if image > -1 and selImage is -1, the same image is used for both selected and unselected items;
data – associate the given Python object data with the item.
Warning
Only one root is allowed to exist in any given instance of TreeListMainWindow
.
AdjustMyScrollbars
(self)¶Internal method used to adjust the ScrolledWindow
scrollbars.
CalculateLevel
(self, item, dc, level, y, x_colstart)¶Calculates the level of an item inside the tree hierarchy.
item – an instance of TreeListItem
;
dc – an instance of wx.DC
;
level – the item level in the tree hierarchy;
y – the current vertical position inside the ScrolledWindow
;
x_colstart – the x coordinate at which the item’s column starts.
CalculatePositions
(self)¶Recalculates all the items positions.
CalculateSize
(self, item, dc)¶Calculates overall position and size of an item.
item – an instance of TreeListItem
;
dc – an instance of wx.DC
.
ChildrenClosing
(self, item)¶We are about to destroy the item’s children.
item – an instance of TreeListItem
.
Delete
(self, item)¶Deletes an item.
item – an instance of TreeListItem
.
DeleteAllItems
(self)¶Delete all items in the TreeListMainWindow
.
DeleteItemWindow
(self, item, column=None)¶Deletes the window in the column associated to an item (if any).
item – an instance of GenericTreeItem
.
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
DeleteRoot
(self)¶Removes the tree root item (and subsequently all the items in
TreeListMainWindow
.
DoInsertItem
(self, parent, previous, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, *ignored_args)¶Actually inserts an item in the tree.
parentId – an instance of TreeListItem
representing the
item’s parent;
previous – the index at which we should insert the item;
text – the item text label;
ct_type – the item type (see CustomTreeCtrl.SetItemType()
for a list of valid
item types);
wnd – if not None
, a non-toplevel window to show next to the item;
image – an index within the normal image list specifying the image to use for the item in unselected state;
selImage – an index within the normal image list specifying the image to use for the item in selected state; if image > -1 and selImage is -1, the same image is used for both selected and unselected items;
data – associate the given Python object data with the item.
ignored_args – unused at the moment, this parameter is present to comply with
CustomTreeCtrl.DoInsertItem()
changed API.
EditLabel
(self, item, column=None)¶Starts editing an item label.
item – an instance of TreeListItem
;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
EnableItem
(self, item, enable=True, torefresh=True)¶Enables/disables an item.
item – an instance of TreeListItem
;
enable – True
to enable the item, False
otherwise;
torefresh – whether to redraw the item or not.
GetBestColumnWidth
(self, column, parent=None)¶Returns the best column’s width based on the items width in this column.
column – an integer specifying the column index;
parent – an instance of TreeListItem
.
GetColumnCount
(self)¶Returns the total number of columns.
GetCurrentItem
(self)¶Returns the current item.
This is the same as GetSelection
.
GetFirstExpandedItem
(self)¶Returns the first item which is in the expanded state.
GetFirstVisibleItem
(self)¶Returns the first visible item.
GetItemBackgroundColour
(self, item, column=0)¶Returns the column background colour of the item
item – an instance of TreeListItem
:param integer column
GetItemImage
(self, item, column=None, which=wx.TreeItemIcon_Normal)¶Returns the item image.
item – an instance of TreeListItem
;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used;
which – can be one of the following bits:
Item State |
Description |
---|---|
|
To get the normal item image |
|
To get the selected item image (i.e. the image which is shown when the item is currently selected) |
|
To get the expanded image (this only makes sense for items which have children - then this image is shown when the item is expanded and the normal image is shown when it is collapsed) |
|
To get the selected expanded image (which is shown when an expanded item is currently selected) |
GetItemText
(self, item, column=None)¶Returns the item text label.
item – an instance of TreeListItem
;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
GetItemWidth
(self, item, column)¶Returns the item width.
item – an instance of TreeListItem
;
column – an integer specifying the column index.
GetItemWindow
(self, item, column=None)¶Returns the window associated with an item.
item – an instance of TreeListItem
;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
GetItemWindowEnabled
(self, item, column=None)¶Returns whether the window associated with an item is enabled or not.
item – an instance of TreeListItem
;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
GetMainColumn
(self)¶Returns the HyperTreeList
main column (i.e. the position of the underlying
CustomTreeCtrl
.
GetNextExpanded
(self, item)¶Returns the next expanded item after the input one.
item – an instance of TreeListItem
.
GetPrevChild
(self, item, cookie)¶Returns the previous child of an item.
item – an instance of TreeListItem
;
cookie – a parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously).
Note
This method returns None
if there are no further siblings.
GetPrevExpanded
(self, item)¶Returns the previous expanded item before the input one.
item – an instance of TreeListItem
.
GetPrevVisible
(self, item)¶Returns the previous visible item before the input one.
item – an instance of TreeListItem
.
HideItemWindows
(self, item)¶Hides all windows belonging to given item and its children.
HideWindows
(self)¶Scans all item windows in the tree and hides those whose items they belong to are not currently visible. Used internally.
HitTest
(self, point, flags=0)¶Calculates which (if any) item is under the given point, returning the tree item at this point plus extra information flags plus the item’s column.
point – an instance of wx.Point
, a point to test for hits;
flags – a bitlist of the following values:
HitTest Flags |
Hex Value |
Description |
---|---|---|
|
0x1 |
Above the client area |
|
0x2 |
Below the client area |
|
0x4 |
No item has been hit |
|
0x8 |
On the button associated to an item |
|
0x10 |
On the icon associated to an item |
|
0x20 |
On the indent associated to an item |
|
0x40 |
On the label (string) associated to an item |
|
0x50 |
Anywhere on the item |
|
0x80 |
On the right of the label associated to an item |
|
0x200 |
On the left of the client area |
|
0x400 |
On the right of the client area |
|
0x800 |
On the upper part (first half) of the item |
|
0x1000 |
On the lower part (second half) of the item |
|
0x2000 |
On the check/radio icon, if present |
the item (if any, None
otherwise), the flags and the column are always
returned as a tuple.
IsItemEnabled
(self, item)¶Returns whether an item is enabled or disabled.
item – an instance of TreeListItem
.
IsItemVisible
(self, item)¶Returns whether the item is visible or not.
item – an instance of TreeListItem
;
Note
This method is renamed from IsVisible
IsVirtual
(self)¶Returns True
if TreeListMainWindow
has the TR_VIRTUAL
flag set.
OnAcceptEdit
(self, value)¶Called by EditTextCtrl
, to accept the changes and to send the
EVT_TREE_END_LABEL_EDIT
event.
value – the new value of the item label.
OnCancelEdit
(self)¶Called by EditCtrl
, to cancel the changes and to send the
EVT_TREE_END_LABEL_EDIT
event.
OnEditTimer
(self)¶The timer for editing has expired. Start editing.
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for TreeListMainWindow
.
event – a EraseEvent
event to be processed.
OnMouse
(self, event)¶Handles the wx.EVT_MOUSE_EVENTS
event for TreeListMainWindow
.
event – a MouseEvent
event to be processed.
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for TreeListMainWindow
.
event – a PaintEvent
event to be processed.
OnScroll
(self, event)¶Handles the wx.EVT_SCROLLWIN
event for TreeListMainWindow
.
event – a ScrollEvent
event to be processed.
PaintItem
(self, item, dc)¶Actually draws an item.
item – an instance of TreeListItem
;
dc – an instance of wx.DC
.
PaintLevel
(self, item, dc, level, y, x_maincol)¶Paint a level in the hierarchy of TreeListMainWindow
.
item – an instance of TreeListItem
;
dc – an instance of wx.DC
;
level – the item level in the tree hierarchy;
y – the current vertical position in the ScrolledWindow
;
x_maincol – the horizontal position of the main column.
ScrollTo
(self, item)¶Scrolls the specified item into view.
item – an instance of TreeListItem
.
SetBuffered
(self, buffered)¶Sets/unsets the double buffering for the main window.
buffered – True
to use double-buffering, False
otherwise.
Note
Currently we are using double-buffering only on Windows XP.
SetDragItem
(self, item)¶Sets the specified item as member of a current drag and drop operation.
item – an instance of TreeListItem
.
SetItemBackgroundColour
(self, item, colour, column=0)¶Sets the column background colour of the item
item – an instance of TreeListItem
colour – a valid wx.Colour
instance.
:param integer column
SetItemImage
(self, item, image, column=None, which=wx.TreeItemIcon_Normal)¶Sets the item image for a particular item state.
item – an instance of TreeListItem
;
image – an index within the normal image list specifying the image to use;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used;
which – the item state.
See also
GetItemImage
for a list of valid item states.
SetItemText
(self, item, text, column=None)¶Sets the item text label.
item – an instance of TreeListItem
;
text – a string specifying the new item label;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
SetItemWindow
(self, item, window, column=None)¶Sets the window associated to an item.
item – an instance of TreeListItem
;
wnd – a non-toplevel window to be displayed next to the item;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
Note
The window being added should have its parent set to the TreeListMainWindow
which can be obtained with GetHeaderWindow
. If this is not the case
the window will be re-parented which may cause some flicker.
SetItemWindowEnabled
(self, item, enable=True, column=None)¶Sets whether the window associated with an item is enabled or not.
item – an instance of TreeListItem
;
enable – True
to enable the associated window, False
to disable it;
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.
SetMainColumn
(self, column)¶Sets the HyperTreeList
main column (i.e. the position of the underlying
CustomTreeCtrl
.
column – if not None
, an integer specifying the column index.
If it is None
, the main column index is used.