This is the main widget implementation of UltimateListCtrl
.
Default class constructor. |
|
Checks/unchecks all the items. |
|
Toggles all the items. |
|
Saves the current line attributes. |
|
Changes the current line to the specified one. |
|
Actually checks/uncheks an item, sending (eventually) the two |
|
Deletes all items in the |
|
Deletes the specified column. |
|
Deletes all items in the |
|
Deletes the specified item. |
|
Deletes the window associated to an item (if any). |
|
Actually performs the deletion of all the items. |
|
Gets the size which best suits the window: for a control, it would be the |
|
A drag and drop operation has just finished. |
|
Draws the item checkbox/radiobutton image. |
|
Draws a drag and drop visual representation of an arrow. |
|
Draws one of the item images. |
|
Starts editing an item label. |
|
Enables/disables an item. |
|
Globally enables/disables drawing of gradient selections. |
|
Globally enables/disables drawing of Windows Vista selections. |
|
Ensures this item is visible. |
|
Find an item whose label matches this string. |
|
Find an item nearest this position. |
|
Find an item whose data matches this data. |
|
Returns the |
|
Returns the checkbox/radiobutton image size. |
|
Returns the number of checked items in the given column. |
|
Returns information about this column. |
|
Returns the total number of columns in the |
|
Returns the custom renderer used to draw the column header |
|
Returns the column width for the input column. |
|
Returns a native looking checkbox or radio button bitmap. |
|
Returns the number of items that can fit vertically in the visible area |
|
Returns the items disabled colour. |
|
Returns a dummy line. |
|
Returns the first gradient colour for gradient-style selections. |
|
Returns the gradient style for gradient-style selections. |
|
Returns the header window width, in pixels. |
|
Returns the brush to use for the item highlighting. |
|
Returns the font used to render an hypertext item. |
|
Returns the colour used to render a non-visited hypertext item. |
|
Returns the colour used to render a visited hypertext item. |
|
Returns the image size for the item. |
|
Returns the information about the input item. |
|
Returns the number of items in the |
|
Returns the custom renderer used to draw the input item (if any). |
|
Returns the item kind. |
|
Returns if the item is in the overflow state. |
|
Returns the position of the item, in icon or small icon view. |
|
Returns the rectangle representing the item’s size and position, in physical |
|
Returns the spacing between item texts and icons, in pixels. |
|
Returns the item state flags for the input item. |
|
Returns the item text. |
|
Returns the item width, in pixels, considering only the item text. |
|
Returns whether an hypertext item was visited. |
|
Returns the item width, in pixels, considering the item text and its images. |
|
Returns the window associated to the item (if any). |
|
Returns whether the window associated to the item is enabled. |
|
Returns the line data for the given index. |
|
Returns the line client rectangle for the item checkbox image only. |
|
Returns the line height for a specific item. |
|
Returns the line client rectangle when the line is highlighted. |
|
Returns the line client rectangle for the item image only. |
|
Returns the line client rectangle for the item text only. |
|
Returns the line client rectangle. |
|
Returns the size of the total line client rectangle. |
|
Returns the line y position. |
|
Returns the parent widget, an instance of |
|
Returns the |
|
Returns the next active item. Used Internally at present. |
|
Searches for an item with the given geometry or state, starting from item |
|
Returns the colour to be used for drawing the horizontal and vertical rules. |
|
Returns the second gradient colour for gradient-style selections. |
|
Returns the number of selected items in |
|
Returns the rectangle representing the size and position, in physical coordinates, |
|
Returns the text width for the input string. |
|
Returns the total width of the columns in |
|
Returns the custom value for the |
|
Returns the rectangle taken by all items in the control. In other words, |
|
Returns the range of visible items on screen. |
|
Returns the |
|
Handles the hyperlink items, sending the |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Hides the windows associated to the items. Used internally. |
|
Highlights/unhighlights all the lines in |
|
Highlights a line in |
|
Highlights a range of lines in |
|
HitTest method for a |
|
HitTest method for a |
|
Initializes the |
|
Returns |
|
Inserts a column into |
|
Inserts an item into |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns whether an item is checked or not. |
|
Returns whether an item is enabled or not. |
|
Returns whether an item is hypertext or not. |
|
Returns |
|
Returns |
|
Brings the current item into view. |
|
Scrolls the input item into view. |
|
Handles the keyboard arrows key events. |
|
Handles the |
|
Handles the |
|
Returns whether 2 lines have the same index. |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Called by |
|
Called by |
|
The timer for renaming has expired. Start editing. |
|
Handles the |
|
Handles the |
|
Draws a watermark at the bottom right of |
|
Recalculates all the items positions, and sets the scrollbars positions |
|
Redraws all the lines after the input one. |
|
Refreshes the entire |
|
Redraws the input line. |
|
Redraws a range of lines in |
|
Redraws the selected lines. |
|
Resets the current item to |
|
Resets the line dimensions, so that client rectangles and positions are |
|
Called by |
|
Forces us to recalculate the range of visible lines. |
|
If |
|
Toggles the line state and refreshes it. |
|
Scrolls the |
|
Actually sends a |
|
Sets the |
|
Sets information about this column. |
|
Associate a custom renderer to this column’s header |
|
Sets the column width. |
|
Sets the items disabled colour. |
|
Sets the first gradient colour for gradient-style selections. |
|
Overridden base class virtual to reset the line height when the font changes. |
|
Sets the gradient style for gradient-style selections. |
|
Sets the font used to render hypertext items. |
|
Sets the colour used to render a non-visited hypertext item. |
|
Sets the colour used to render a visited hypertext item. |
|
Sets the image list associated with the control. |
|
Sets the checkbox/radiobutton image list. |
|
Sets information about the item. |
|
This method can only be used with virtual |
|
Associate a custom renderer to this item. |
|
Sets whether the item is hypertext or not. |
|
Sets the item kind. |
|
Sets the item in the overflow/non overflow state. |
|
Sets the spacing between item texts and icons. |
|
Sets the item state flags for the input item. |
|
Sets the item state flags for all the items. |
|
Sets the item text. |
|
Sets whether an hypertext item was visited. |
|
Sets the window for the given item. |
|
Enables/disables the window associated to the item. |
|
Sets whether |
|
Sets the second gradient colour for gradient-style selections. |
|
Sets a custom value for the |
|
Sets the |
|
Call this function to sort the items in the |
|
Tiles the background image to fill all the available area. |
|
Updates the current line selection. |
UltimateListMainWindow
(wx.ScrolledWindow)¶This is the main widget implementation of UltimateListCtrl
.
__init__
(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="listctrlmainwindow")¶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
window style;
agwStyle –
the AGW-specific window style; can be almost any combination of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x1 |
Draws light vertical rules between rows in report mode. |
|
0x2 |
Draws light horizontal rules between rows in report mode. |
|
0x4 |
Large icon view, with optional labels. |
|
0x8 |
Small icon view, with optional labels. |
|
0x10 |
Multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don’t set columns as in |
|
0x20 |
Single or multicolumn report view, with optional header. |
|
0x40 |
Icons align to the top. Win32 default, Win32 only. |
|
0x80 |
Icons align to the left. |
|
0x100 |
Icons arrange themselves. Win32 only. |
|
0x200 |
The application provides items text on demand. May only be used with |
|
0x400 |
Labels are editable: the application will be notified when editing starts. |
|
0x800 |
No header in report mode. |
|
0x1000 |
No Docs. |
|
0x2000 |
Single selection (default is multiple). |
|
0x4000 |
Sort in ascending order. (You must still supply a comparison callback in |
|
0x8000 |
Sort in descending order. (You must still supply a comparison callback in |
|
0x10000 |
Each item appears as a full-sized icon with a label of one or more lines beside it (partially implemented). |
|
0x20000 |
No highlight when an item is selected. |
|
0x40000 |
Items are selected by simply hovering on them, with no need to click on them. |
|
0x80000 |
Don’t send a selection event when using |
|
0x100000 |
Send a left click event when an item is selected. |
|
0x200000 |
The list has variable row heights. |
|
0x400000 |
When a column header has a checkbox associated, auto-check all the subitems in that column. |
|
0x800000 |
When a column header has a checkbox associated, toggle all the subitems in that column. |
|
0x1000000 |
Only meaningful foe checkbox-type items: when an item is checked/unchecked its column header item is checked/unchecked as well. |
|
0x2000000 |
Show tooltips for ellipsized items/subitems (text too long to be shown in the available space) containing the full item/subitem text. |
|
0x4000000 |
Enable hot tracking of items on mouse motion. |
|
0x8000000 |
Changes border colour when an item is selected, instead of highlighting the item. |
|
0x10000000 |
Enables hot-track selection in a list control. Hot track selection means that an item is automatically selected when the cursor remains over the item for a certain period of time. The delay is retrieved on Windows using the win32api call win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERTIME), and is defaulted to 400ms on other platforms. This style applies to all views of |
|
0x20000000 |
Show column headers in all view modes. |
|
0x40000000 |
When an item is selected, the only the item in the first column is highlighted. |
|
0x80000000 |
Show a footer too (only when header is present). |
|
0x100000000 |
Allows to set a custom row height (one value for all the items, only in report mode). |
|
0x200000000 |
Disable item dragging |
name – the window name.
AutoCheckChild
(self, isChecked, column)¶Checks/unchecks all the items.
isChecked – True
to check the items, False
to uncheck them;
column – the column to which the items belongs to.
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
AutoToggleChild
(self, column)¶Toggles all the items.
column – the column to which the items belongs to.
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
CacheLineData
(self, line)¶Saves the current line attributes.
line – an instance of UltimateListLineData
.
Note
This method is used only if the UltimateListCtrl
has the ULC_VIRTUAL
style set.
ChangeCurrent
(self, current)¶Changes the current line to the specified one.
current – an integer specifying the index of the current line.
CheckItem
(self, item, checked=True, sendEvent=True)¶Actually checks/uncheks an item, sending (eventually) the two
events EVT_LIST_ITEM_CHECKING
/ EVT_LIST_ITEM_CHECKED
.
item – an instance of UltimateListItem
;
checked – True
to check an item, False
to uncheck it;
sendEvent – True
to send a {UltimateListEvent}, False
otherwise.
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
DeleteAllItems
(self)¶Deletes all items in the UltimateListCtrl
.
Note
This function does not send the EVT_LIST_DELETE_ITEM
event because
deleting many items from the control would be too slow then (unlike DeleteItem
).
DeleteColumn
(self, col)¶Deletes the specified column.
col – the index of the column to delete.
DeleteEverything
(self)¶Deletes all items in the UltimateListCtrl
, resetting column widths to zero.
DeleteItem
(self, lindex)¶Deletes the specified item.
lindex – the index of the item to delete.
Note
This function sends the EVT_LIST_DELETE_ITEM
event for the item
being deleted.
DeleteItemWindow
(self, item)¶Deletes the window associated to an item (if any).
item – an instance of UltimateListItem
.
DoDeleteAllItems
(self)¶Actually performs the deletion of all the items.
DoGetBestSize
(self)¶Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().
DragFinish
(self, event)¶A drag and drop operation has just finished.
event – a MouseEvent
event to be processed.
DrawCheckbox
(self, dc, x, y, kind, checked, enabled)¶Draws the item checkbox/radiobutton image.
dc – an instance of wx.DC
;
x – the x position where to draw the image;
y – the y position where to draw the image;
kind – may be one of the following integers:
Item Kind |
Description |
---|---|
0 |
A normal item |
1 |
A checkbox-like item |
2 |
A radiobutton-type item |
checked – True
if the item is checked, False
otherwise;
enabled – True
if the item is enabled, False
if it is disabled.
DrawDnDArrow
(self)¶Draws a drag and drop visual representation of an arrow.
DrawImage
(self, index, dc, x, y, enabled)¶Draws one of the item images.
index – the index of the image inside the image list;
dc – an instance of wx.DC
;
x – the x position where to draw the image;
y – the y position where to draw the image;
enabled – True
if the item is enabled, False
if it is disabled.
EditLabel
(self, item)¶Starts editing an item label.
item – an instance of UltimateListItem
.
EnableItem
(self, item, enable=True)¶Enables/disables an item.
item – an instance of UltimateListItem
;
enable – True
to enable the item, False
otherwise.
EnableSelectionGradient
(self, enable=True)¶Globally enables/disables drawing of gradient selections.
enable – True
to enable gradient-style selections, False
to disable it.
Note
Calling this method disables any Vista-style selection previously enabled.
EnableSelectionVista
(self, enable=True)¶Globally enables/disables drawing of Windows Vista selections.
enable – True
to enable Vista-style selections, False
to
disable it.
Note
Calling this method disables any gradient-style selection previously enabled.
EnsureVisible
(self, index)¶Ensures this item is visible.
index – the index of the item to scroll into view.
FindItem
(self, start, string, partial=False)¶Find an item whose label matches this string.
start – the starting point of the input string
or the beginning
if start is -1;
string – the string to look for matches;
partial – if True
then this method will look for items which
begin with string
.
Note
The string comparison is case insensitive.
FindItemAtPos
(self, pt)¶Find an item nearest this position.
pt – an instance of wx.Point
.
FindItemData
(self, start, data)¶Find an item whose data matches this data.
start – the starting point of the input data or the beginning if start is -1;
data – the data to look for matches.
GetBackgroundImage
(self)¶Returns the UltimateListCtrl
background image (if any).
Note
At present, the background image can only be used in “tile” mode.
Todo
Support background images also in stretch and centered modes.
GetCheckboxImageSize
(self)¶Returns the checkbox/radiobutton image size.
GetCheckedItemCount
(self, col=0)¶Returns the number of checked items in the given column.
col – an integer specifying the column index.
the number of checked items.
int
GetColumn
(self, col)¶Returns information about this column.
col – an integer specifying the column index.
GetColumnCount
(self)¶Returns the total number of columns in the UltimateListCtrl
.
GetColumnCustomRenderer
(self, col)¶Returns the custom renderer used to draw the column header
col – the column index.
GetColumnWidth
(self, col)¶Returns the column width for the input column.
col – an integer specifying the column index.
GetControlBmp
(self, checkbox=True, checked=False, enabled=True, x=16, y=16)¶Returns a native looking checkbox or radio button bitmap.
checkbox – True
to get a checkbox image, False
for a radiobutton
one;
checked – True
if the control is marked, False
if it is not;
enabled – True
if the control is enabled, False
if it is not;
x – the width of the bitmap, in pixels;
y – the height of the bitmap, in pixels.
GetCountPerPage
(self)¶Returns the number of items that can fit vertically in the visible area
of the UltimateListCtrl
(list or report view) or the total number of
items in the list control (icon or small icon view).
GetDisabledTextColour
(self)¶Returns the items disabled colour.
GetDummyLine
(self)¶Returns a dummy line.
Note
This method is used only if the UltimateListCtrl
has the ULC_VIRTUAL
style set.
GetFirstGradientColour
(self)¶Returns the first gradient colour for gradient-style selections.
GetGradientStyle
(self)¶Returns the gradient style for gradient-style selections.
0 for horizontal gradient-style selections, 1 for vertical gradient-style selections.
GetHeaderWidth
(self)¶Returns the header window width, in pixels.
GetHighlightBrush
(self)¶Returns the brush to use for the item highlighting.
GetHyperTextFont
(self)¶Returns the font used to render an hypertext item.
GetHyperTextNewColour
(self)¶Returns the colour used to render a non-visited hypertext item.
GetHyperTextVisitedColour
(self)¶Returns the colour used to render a visited hypertext item.
GetImageSize
(self, index)¶Returns the image size for the item.
index – the image index.
GetItem
(self, item, col=0)¶Returns the information about the input item.
item – an instance of UltimateListItem
;
col – the column to which the item belongs to.
GetItemCount
(self)¶Returns the number of items in the UltimateListCtrl
.
GetItemCustomRenderer
(self, item)¶Returns the custom renderer used to draw the input item (if any).
item – an instance of UltimateListItem
.
GetItemKind
(self, item)¶Returns the item kind.
item – an instance of UltimateListItem
.
See also
SetItemKind
for a list of valid item kinds.
GetItemOverFlow
(self, item)¶Returns if the item is in the overflow state.
An item/subitem may overwrite neighboring items/subitems if its text would not normally fit in the space allotted to it.
item – an instance of UltimateListItem
.
GetItemPosition
(self, item)¶Returns the position of the item, in icon or small icon view.
item – the row in which the item lives.
GetItemRect
(self, item)¶Returns the rectangle representing the item’s size and position, in physical coordinates.
item – the row in which the item lives.
GetItemSpacing
(self, isSmall=False)¶Returns the spacing between item texts and icons, in pixels.
isSmall – True
if using a wx.IMAGE_LIST_SMALL
image list,
False
if using a wx.IMAGE_LIST_NORMAL
image list.
GetItemState
(self, item, stateMask)¶Returns the item state flags for the input item.
item – the index of the item;
stateMask – the bitmask for the state flag.
See also
SetItemStateAll
for a list of valid state flags.
GetItemText
(self, item)¶Returns the item text.
item – an instance of UltimateListItem
.
GetItemTextSize
(self, item)¶Returns the item width, in pixels, considering only the item text.
item – an instance of UltimateListItem
.
GetItemVisited
(self, item)¶Returns whether an hypertext item was visited.
item – an instance of UltimateListItem
.
GetItemWidthWithImage
(self, item)¶Returns the item width, in pixels, considering the item text and its images.
item – an instance of UltimateListItem
.
GetItemWindow
(self, item)¶Returns the window associated to the item (if any).
item – an instance of UltimateListItem
.
GetItemWindowEnabled
(self, item)¶Returns whether the window associated to the item is enabled.
item – an instance of UltimateListItem
.
GetLine
(self, n)¶Returns the line data for the given index.
n – the line index.
GetLineCheckboxRect
(self, line)¶Returns the line client rectangle for the item checkbox image only.
line – an instance of UltimateListLineData
.
GetLineHeight
(self, item=None)¶Returns the line height for a specific item.
item – if not None
, an instance of UltimateListItem
.
GetLineHighlightRect
(self, line)¶Returns the line client rectangle when the line is highlighted.
line – an instance of UltimateListLineData
.
GetLineIconRect
(self, line)¶Returns the line client rectangle for the item image only.
line – an instance of UltimateListLineData
.
GetLineLabelRect
(self, line, col=0)¶Returns the line client rectangle for the item text only. Note this is the full column width unless an image or checkbox exists. It is not the width of the text itself
line – an instance of UltimateListLineData
.
GetLineRect
(self, line)¶Returns the line client rectangle.
line – an instance of UltimateListLineData
.
GetLineSize
(self, line)¶Returns the size of the total line client rectangle.
line – an instance of UltimateListLineData
.
GetLineY
(self, line)¶Returns the line y position.
line – an instance of UltimateListLineData
.
GetListCtrl
(self)¶Returns the parent widget, an instance of UltimateListCtrl
.
GetMainWindowOfCompositeControl
(self)¶Returns the UltimateListMainWindow
parent.
GetNextActiveItem
(self, item, down=True)¶Returns the next active item. Used Internally at present.
item – an instance of UltimateListItem
;
down – True
to search downwards for an active item, False
to search upwards.
GetNextItem
(self, item, geometry=ULC_NEXT_ALL, state=ULC_STATE_DONTCARE)¶Searches for an item with the given geometry or state, starting from item but excluding the item itself.
item – the item at which starting the search. If set to -1, the first item that matches the specified flags will be returned.
geometry – can be one of:
Geometry Flag |
Hex Value |
Description |
---|---|---|
|
0x0 |
Searches for an item above the specified item |
|
0x1 |
Searches for subsequent item by index |
|
0x2 |
Searches for an item below the specified item |
|
0x3 |
Searches for an item to the left of the specified item |
|
0x4 |
Searches for an item to the right of the specified item |
state – any combination of the following bits:
State Bits |
Hex Value |
Description |
---|---|---|
|
0x0 |
Don’t care what the state is |
|
0x1 |
The item is highlighted to receive a drop event |
|
0x2 |
The item has the focus |
|
0x4 |
The item is selected |
|
0x8 |
The item is in the cut state |
|
0x10 |
The item is disabled |
|
0x20 |
The item has been filtered |
|
0x40 |
The item is in use |
|
0x80 |
The item has been picked |
|
0x100 |
The item is a drag and drop source |
The first item with given state following item or -1 if no such item found.
Note
This function may be used to find all selected items in the control like this:
item = -1
while 1:
item = listctrl.GetNextItem(item, ULC_NEXT_ALL, ULC_STATE_SELECTED)
if item == -1:
break
# This item is selected - do whatever is needed with it
wx.LogMessage("Item %ld is selected."%item)
GetRuleColour
(self)¶Returns the colour to be used for drawing the horizontal and vertical rules.
GetSecondGradientColour
(self)¶Returns the second gradient colour for gradient-style selections.
GetSelectedItemCount
(self)¶Returns the number of selected items in UltimateListCtrl
.
GetSubItemRect
(self, item, subItem)¶Returns the rectangle representing the size and position, in physical coordinates, of the given subitem, i.e. the part of the row item in the column subItem.
item – the row in which the item lives;
subItem – the column in which the item lives. If set equal to the special
value ULC_GETSUBITEMRECT_WHOLEITEM
the return value is the same as for
GetItemRect
.
Note
This method is only meaningful when the UltimateListCtrl
is in the
report mode.
GetTextLength
(self, s)¶Returns the text width for the input string.
s – the string to measure.
GetTotalWidth
(self)¶Returns the total width of the columns in UltimateListCtrl
.
GetUserLineHeight
(self)¶Returns the custom value for the UltimateListMainWindow
item height, if previously set with
SetUserLineHeight
.
Note
This method can be used only with ULC_REPORT
and ULC_USER_ROW_HEIGHT
styles set.
GetViewRect
(self)¶Returns the rectangle taken by all items in the control. In other words, if the controls client size were equal to the size of this rectangle, no scrollbars would be needed and no free space would be left.
Note
This function only works in the icon and small icon views, not in list or report views.
GetVisibleLinesRange
(self)¶Returns the range of visible items on screen.
Note
This method can be used only if UltimateListCtrl
has the ULC_REPORT
style set.
GetWaterMark
(self)¶Returns the UltimateListCtrl
watermark image (if any), displayed in the
bottom right part of the window.
Todo
Better support for this is needed.
HandleHyperLink
(self, item)¶Handles the hyperlink items, sending the EVT_LIST_ITEM_HYPERLINK
event.
item – an instance of UltimateListItem
.
HasAGWFlag
(self, flag)¶Returns True
if the window has the given flag bit set.
flag – the bit to check.
See also
UltimateListCtrl.SetSingleStyle()
for a list of valid flags.
HasCurrent
(self)¶Returns True
if the current item has been set, either programmatically
or by user intervention.
HasFocus
(self)¶Returns True
if the window has focus.
Returns True
if the footer window is shown.
HasHeader
(self)¶Returns True
if the header window is shown.
HideWindows
(self)¶Hides the windows associated to the items. Used internally.
HighlightAll
(self, on=True)¶Highlights/unhighlights all the lines in UltimateListCtrl
.
on – True
to highlight all the lines, False
to unhighlight them.
HighlightLine
(self, line, highlight=True)¶Highlights a line in UltimateListCtrl
.
line – an instance of UltimateListLineData
;
highlight – True
to highlight the line, False
otherwise.
HighlightLines
(self, lineFrom, lineTo, highlight=True)¶Highlights a range of lines in UltimateListCtrl
.
lineFrom – an integer representing the first line to highlight;
lineTo – an integer representing the last line to highlight;
highlight – True
to highlight the lines, False
otherwise.
HitTest
(self, x, y)¶HitTest method for a UltimateListCtrl
.
x – the mouse x position;
y – the mouse y position.
See also
HitTestLine
for a list of return flags.
HitTestLine
(self, line, x, y)¶HitTest method for a UltimateListCtrl
line.
line – an instance of UltimateListLineData
;
x – the mouse x position;
y – the mouse y position.
a tuple of values, representing the item hit and a hit flag. The hit flag can be one of the following bits:
HitTest Flag |
Hex Value |
Description |
---|---|---|
|
0x1 |
Above the client area |
|
0x2 |
Below the client area |
|
0x4 |
In the client area but below the last item |
|
0x2a0 |
Anywhere on the item (text, icon, checkbox image) |
|
0x20 |
On the bitmap associated with an item |
|
0x80 |
On the label (string) associated with an item |
|
0x200 |
On the state icon for a list view item that is in a user-defined state |
|
0x400 |
To the left of the client area |
|
0x800 |
To the right of the client area |
|
0x1000 |
On the item checkbox (if any) |
Init
(self)¶Initializes the UltimateListMainWindow
widget.
InReportView
(self)¶Returns True
if the window is in report mode.
InsertColumn
(self, col, item)¶Inserts a column into UltimateListCtrl
.
col – the column index at which we wish to insert a new column;
item – an instance of UltimateListItem
.
the index at which the column has been inserted.
Note
This method is meaningful only if UltimateListCtrl
has the ULC_REPORT
or the ULC_TILE
styles set.
InsertItem
(self, item)¶Inserts an item into UltimateListCtrl
.
item – an instance of UltimateListItem
.
InTileView
(self)¶Returns True
if the window is in tile mode (partially implemented).
Todo
Fully implement tile view for UltimateListCtrl
.
IsColumnShown
(self, column)¶Returns True
if the input column is shown, False
if it is hidden.
column – an integer specifying the column index.
IsEmpty
(self)¶Returns True
if the window has no items in it.
IsHighlighted
(self, line)¶Returns True
if the input line is highlighted.
line – an instance of UltimateListLineData
.
IsItemChecked
(self, item)¶Returns whether an item is checked or not.
item – an instance of UltimateListItem
.
IsItemEnabled
(self, item)¶Returns whether an item is enabled or not.
item – an instance of UltimateListItem
.
IsItemHyperText
(self, item)¶Returns whether an item is hypertext or not.
item – an instance of UltimateListItem
.
IsSingleSel
(self)¶Returns True
if we are in single selection mode, False
if multi selection.
IsVirtual
(self)¶Returns True
if the window has the ULC_VIRTUAL
style set.
MoveToFocus
(self)¶Brings the current item into view.
MoveToItem
(self, item)¶Scrolls the input item into view.
item – an instance of UltimateListItem
.
OnArrowChar
(self, newCurrent, event)¶Handles the keyboard arrows key events.
newCurrent – an integer specifying the new current item;
event – a KeyEvent
event to be processed.
OnChar
(self, event)¶Handles the wx.EVT_CHAR
event for UltimateListMainWindow
.
event – a KeyEvent
event to be processed.
OnChildFocus
(self, event)¶Handles the wx.EVT_CHILD_FOCUS
event for UltimateListMainWindow
.
event – a ChildFocusEvent
event to be processed.
Note
This method is intentionally empty to prevent the default handler in
ScrolledWindow
from needlessly scrolling the window when the edit
control is dismissed.
OnCompareItems
(self, line1, line2)¶Returns whether 2 lines have the same index.
Override this function in the derived class to change the sort order of the items
in the UltimateListCtrl
. The function should return a negative, zero or positive
value if the first line is less than, equal to or greater than the second one.
line1 – an instance of UltimateListItem
;
line2 – another instance of UltimateListItem
.
Note
The base class version compares lines by their index.
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for UltimateListMainWindow
.
event – a EraseEvent
event to be processed.
Note
This method is intentionally empty to reduce flicker.
OnHoverTimer
(self, event)¶Handles the wx.EVT_TIMER
event for UltimateListMainWindow
.
event – a TimerEvent
event to be processed.
OnKeyDown
(self, event)¶Handles the wx.EVT_KEY_DOWN
event for UltimateListMainWindow
.
event – a KeyEvent
event to be processed.
OnKeyUp
(self, event)¶Handles the wx.EVT_KEY_UP
event for UltimateListMainWindow
.
event – a KeyEvent
event to be processed.
OnKillFocus
(self, event)¶Handles the wx.EVT_KILL_FOCUS
event for UltimateListMainWindow
.
event – a FocusEvent
event to be processed.
OnMouse
(self, event)¶Handles the wx.EVT_MOUSE_EVENTS
event for UltimateListMainWindow
.
event – a MouseEvent
event to be processed.
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for UltimateListMainWindow
.
event – a PaintEvent
event to be processed.
OnRenameAccept
(self, itemEdit, value)¶Called by UltimateListTextCtrl
, to accept the changes and to send the
EVT_LIST_END_LABEL_EDIT
event.
itemEdit – an instance of UltimateListItem
;
value – the new value of the item label.
OnRenameCancelled
(self, itemEdit)¶Called by UltimateListTextCtrl
, to cancel the changes and to send the
EVT_LIST_END_LABEL_EDIT
event.
item – an instance of UltimateListItem
.
OnRenameTimer
(self)¶The timer for renaming has expired. Start editing.
OnScroll
(self, event)¶Handles the wx.EVT_SCROLLWIN
event for UltimateListMainWindow
.
event – a ScrollEvent
event to be processed.
OnSetFocus
(self, event)¶Handles the wx.EVT_SET_FOCUS
event for UltimateListMainWindow
.
event – a FocusEvent
event to be processed.
PaintWaterMark
(self, dc)¶Draws a watermark at the bottom right of UltimateListCtrl
.
dc – an instance of wx.DC
.
Todo
Better support for this is needed.
RecalculatePositions
(self, noRefresh=False)¶Recalculates all the items positions, and sets the scrollbars positions too.
noRefresh – True
to avoid calling Refresh
, False
otherwise.
RefreshAfter
(self, lineFrom)¶Redraws all the lines after the input one.
lineFrom – an integer representing the first line to refresh.
RefreshAll
(self)¶Refreshes the entire UltimateListCtrl
.
RefreshLine
(self, line)¶Redraws the input line.
line – an instance of UltimateListLineData
.
RefreshLines
(self, lineFrom, lineTo)¶Redraws a range of lines in UltimateListCtrl
.
lineFrom – an integer representing the first line to refresh;
lineTo – an integer representing the last line to refresh.
RefreshSelected
(self)¶Redraws the selected lines.
ResetCurrent
(self)¶Resets the current item to None
.
ResetLineDimensions
(self, force=False)¶Resets the line dimensions, so that client rectangles and positions are recalculated.
force – True
to reset all line dimensions.
ResetTextControl
(self)¶Called by UltimateListTextCtrl
when it marks itself for deletion.
ResetVisibleLinesRange
(self, reset=False)¶Forces us to recalculate the range of visible lines.
reset – True
to reset all line dimensions, which will then be
recalculated.
ResizeColumns
(self)¶If ULC_AUTOSIZE_FILL
was passed to UltimateListCtrl.SetColumnWidth()
then
that column’s width will be expanded to fill the window on a resize event.
Called by UltimateListCtrl.OnSize()
when the window is resized.
ReverseHighlight
(self, line)¶Toggles the line state and refreshes it.
line – an instance of UltimateListLineData
.
ScrollList
(self, dx, dy)¶Scrolls the UltimateListCtrl
.
dx – if in icon, small icon or report view mode, specifies the number of pixels to scroll. If in list view mode, dx specifies the number of columns to scroll.
dy – always specifies the number of pixels to scroll vertically.
SendNotify
(self, line, command, point=wx.DefaultPosition, col=0)¶Actually sends a UltimateListEvent
.
line – an instance of UltimateListLineData
;
command – the event type to send;
point – an instance of wx.Point
.
col – an integer specifying the column index.
SetBackgroundImage
(self, image)¶Sets the UltimateListCtrl
background image.
image – if not None
, an instance of wx.Bitmap
.
Note
At present, the background image can only be used in “tile” mode.
Todo
Support background images also in stretch and centered modes.
SetColumn
(self, col, item)¶Sets information about this column.
col – an integer specifying the column index;
item – an instance of UltimateListItem
.
SetColumnCustomRenderer
(self, col=0, renderer=None)¶Associate a custom renderer to this column’s header
col – the column index.
renderer – a class able to correctly render the input item.
Note
the renderer class must implement the methods DrawHeaderButton and GetForegroundColor.
SetColumnWidth
(self, col, width)¶Sets the column width.
width – can be a width in pixels or wx.LIST_AUTOSIZE
(-1) or
wx.LIST_AUTOSIZE_USEHEADER
(-2) or ULC_AUTOSIZE_FILL
(-3).
wx.LIST_AUTOSIZE
will resize the column to the length of its longest
item. wx.LIST_AUTOSIZE_USEHEADER
will resize the column to the
length of the header (Win32) or 80 pixels (other platforms).
ULC_AUTOSIZE_FILL
will resize the column fill the remaining width
of the window.
Note
In small or normal icon view, col must be -1, and the column width is set for all columns.
SetDisabledTextColour
(self, colour)¶Sets the items disabled colour.
colour – an instance of wx.Colour
.
SetFirstGradientColour
(self, colour=None)¶Sets the first gradient colour for gradient-style selections.
colour – if not None
, a valid wx.Colour
instance. Otherwise,
the colour is taken from the system value wx.SYS_COLOUR_HIGHLIGHT
.
SetFont
(self, font)¶Overridden base class virtual to reset the line height when the font changes.
font – a valid wx.Font
object.
Note
Overridden from ScrolledWindow
.
SetGradientStyle
(self, vertical=0)¶Sets the gradient style for gradient-style selections.
vertical – 0 for horizontal gradient-style selections, 1 for vertical gradient-style selections.
SetHyperTextFont
(self, font)¶Sets the font used to render hypertext items.
font – a valid wx.Font
instance.
SetHyperTextNewColour
(self, colour)¶Sets the colour used to render a non-visited hypertext item.
colour – a valid wx.Colour
instance.
SetHyperTextVisitedColour
(self, colour)¶Sets the colour used to render a visited hypertext item.
colour – a valid wx.Colour
instance.
SetImageList
(self, imageList, which)¶Sets the image list associated with the control.
imageList – an instance of wx.ImageList
or an instance of PyImageList
;
which – one of wx.IMAGE_LIST_NORMAL
, wx.IMAGE_LIST_SMALL
,
wx.IMAGE_LIST_STATE
(the last is unimplemented).
Note
Using PyImageList
enables you to have images of different size inside the
image list. In your derived class, instead of doing this:
imageList = wx.ImageList(16, 16)
imageList.Add(someBitmap)
self.SetImageList(imageList, wx.IMAGE_LIST_SMALL)
You should do this:
imageList = PyImageList(16, 16)
imageList.Add(someBitmap)
self.SetImageList(imageList, wx.IMAGE_LIST_SMALL)
SetImageListCheck
(self, sizex, sizey, imglist=None)¶Sets the checkbox/radiobutton image list.
sizex – the width of the bitmaps in the imglist;
sizey – the height of the bitmaps in the imglist;
imglist – an instance of wx.ImageList
.
SetItem
(self, item)¶Sets information about the item.
item – an instance of UltimateListItemData
.
SetItemCount
(self, count)¶This method can only be used with virtual UltimateListCtrl
. It is used to
indicate to the control the number of items it contains. After calling it,
the main program should be ready to handle calls to various item callbacks
(such as UltimateListCtrl.OnGetItemText()
) for all items in the range from 0 to count.
count – the total number of items in UltimateListCtrl
.
SetItemCustomRenderer
(self, item, renderer=None)¶Associate a custom renderer to this item.
item – an instance of UltimateListItem
;
renderer – a class able to correctly render the item.
Note
the renderer class must implement the methods DrawSubItem,
GetLineHeight
and GetSubItemWidth.
SetItemHyperText
(self, item, hyper=True)¶Sets whether the item is hypertext or not.
item – an instance of UltimateListItem
;
hyper – True
to have an item with hypertext behaviour, False
otherwise.
SetItemKind
(self, item, kind)¶Sets the item kind.
item – an instance of UltimateListItem
;
kind – may be one of the following integers:
Item Kind |
Description |
---|---|
0 |
A normal item |
1 |
A checkbox-like item |
2 |
A radiobutton-type item |
SetItemOverFlow
(self, item, over=True)¶Sets the item in the overflow/non overflow state.
An item/subitem may overwrite neighboring items/subitems if its text would not normally fit in the space allotted to it.
item – an instance of UltimateListItem
;
over – True
to set the item in a overflow state, False
otherwise.
SetItemSpacing
(self, spacing, isSmall=False)¶Sets the spacing between item texts and icons.
spacing – the spacing between item texts and icons, in pixels;
isSmall – True
if using a wx.IMAGE_LIST_SMALL
image list,
False
if using a wx.IMAGE_LIST_NORMAL
image list.
SetItemState
(self, litem, state, stateMask)¶Sets the item state flags for the input item.
litem – the index of the item; if defaulted to -1, the state flag will be set for all the items;
state – the item state flag;
stateMask – the bitmask for the state flag.
See also
SetItemStateAll
for a list of valid state flags.
SetItemStateAll
(self, state, stateMask)¶Sets the item state flags for all the items.
state – any combination of the following bits:
State Bits |
Hex Value |
Description |
---|---|---|
|
0x0 |
Don’t care what the state is |
|
0x1 |
The item is highlighted to receive a drop event |
|
0x2 |
The item has the focus |
|
0x4 |
The item is selected |
|
0x8 |
The item is in the cut state |
|
0x10 |
The item is disabled |
|
0x20 |
The item has been filtered |
|
0x40 |
The item is in use |
|
0x80 |
The item has been picked |
|
0x100 |
The item is a drag and drop source |
stateMask – the bitmask for the state flag.
Note
The valid state flags are influenced by the value of the state mask.
SetItemText
(self, item, value)¶Sets the item text.
item – an instance of UltimateListItem
;
value – the new item text.
SetItemVisited
(self, item, visited=True)¶Sets whether an hypertext item was visited.
item – an instance of UltimateListItem
;
visited – True
to mark an hypertext item as visited, False
otherwise.
SetItemWindow
(self, item, wnd, expand=False)¶Sets the window for the given item.
item – an instance of UltimateListItem
;
wnd – if not None
, a non-toplevel window to be displayed next to
the item;
expand – True
to expand the column where the item/subitem lives,
so that the window will be fully visible.
SetItemWindowEnabled
(self, item, enable=True)¶Enables/disables the window associated to the item.
item – an instance of UltimateListItem
;
enable – True
to enable the associated window, False
to
disable it.
SetReportView
(self, inReportView)¶Sets whether UltimateListCtrl
is in report view or not.
inReportView – True
to set UltimateListCtrl
in report view, False
otherwise.
SetSecondGradientColour
(self, colour=None)¶Sets the second gradient colour for gradient-style selections.
colour – if not None
, a valid wx.Colour
instance. Otherwise,
the colour generated is a slightly darker version of the UltimateListCtrl
background colour.
SetUserLineHeight
(self, height)¶Sets a custom value for the UltimateListMainWindow
item height.
height – the custom height for all the items, in pixels.
Note
This method can be used only with ULC_REPORT
and ULC_USER_ROW_HEIGHT
styles set.
SetWaterMark
(self, watermark)¶Sets the UltimateListCtrl
watermark image to be displayed in the bottom
right part of the window.
watermark – if not None
, an instance of wx.Bitmap
.
Todo
Better support for this is needed.
SortItems
(self, func)¶Call this function to sort the items in the UltimateListCtrl
. Sorting is done
using the specified function func. This function must have the
following prototype:
def OnCompareItems(self, line1, line2):
DoSomething(line1, line2)
# function code
It is called each time when the two items must be compared and should return 0 if the items are equal, negative value if the first item is less than the second one and positive value if the first one is greater than the second one.
func – the method to use to sort the items. The default is to use the
OnCompareItems
method.
TileBackground
(self, dc)¶Tiles the background image to fill all the available area.
dc – an instance of wx.DC
.
Todo
Support background images also in stretch and centered modes.
UpdateCurrent
(self)¶Updates the current line selection.