TreeControl Class
A control (to be placed on a window) which allows the user to navigate a tree of items and select one item from it.
Inheritance: TreeControl ยป Window
Subclasses: FilteredTreeControl
Method Index
- addBevelPanel(x, y, w, h, colour, highlight_colour, shadow_colour, disabled_colour, lowered_colour, apply_ui_scale) (inherited from Window)
- addColourPanel(x, y, w, h, r, g, b, apply_ui_scale) (inherited from Window)
- addKeyHandler(key, handler, ...) (inherited from Window)
- addPanel(sprite_index, x, y, w, h, apply_ui_scale, draw_flags) (inherited from Window)
- addWindow(window) (inherited from Window)
- afterLoad(old, new) (inherited from Window)
- beginDrag(x, y) (inherited from Window)
- bringToTop() (inherited from Window)
- close() (inherited from Window)
- draw(canvas, x, y) (overrides Window:draw)
- drawExtraOnRow(canvas, node, x, y)
- getRealXY() (inherited from Window)
- getSavedWindowPositionName() (inherited from Window)
- getTooltipAt(x, y) (inherited from Window)
- getTooltipForElement(elem, x, y) (inherited from Window)
- getWindow(window_class) (inherited from Window)
- getWindows(window_class) (inherited from Window)
- hitTest(x, y) (inherited from Window)
- hitTestPanel(x, y, panel) (inherited from Window)
- hitTestTree(x, y)
- hoverTest(active_hover, mouse_x, mouse_y, min_x, max_x, min_y, max_y) (inherited from Window)
- makeButtonOnPanel(panel, x, y, w, h, sprite, on_click, on_click_self, on_rightclick) (inherited from Window)
- makeDynamicTooltip(callback, x, y, r, b, tooltip_x, tooltip_y) (inherited from Window)
- makeHotkeyBoxOnPanel(panel, confirm_callback, abort_callback) (inherited from Window)
- makeScrollbarOnPanel(panel, slider_colour, callback, min_value, max_value, page_size, value) (inherited from Window)
- makeTextboxOnPanel(panel, confirm_callback, abort_callback) (inherited from Window)
- makeTooltip(text, x, y, r, b, tooltip_x, tooltip_y, apply_ui_scale) (inherited from Window)
- mustPause() (inherited from Window)
- onChangeLanguage() (inherited from Window)
- onChangeResolution() (inherited from Window)
- onCursorWorldPositionChange(x, y) (inherited from Window)
- onMouseDown(button, x, y) (overrides Window:onMouseDown)
- onMouseMove(x, y, dx, dy) (overrides Window:onMouseMove)
- onMouseUp(button, x, y) (overrides Window:onMouseUp)
- onMouseWheel(x, y) (overrides Window:onMouseWheel)
- onNumVisibleNodesChange()
- onScroll()
- onTick() (inherited from Window)
- onWorldTick() (inherited from Window)
- removeAllPanels() (inherited from Window)
- removeKeyHandler(keys) (inherited from Window)
- removeWindow(window) (inherited from Window)
- sendToBottom(window) (inherited from Window)
- sendToTop(window) (inherited from Window)
- setDefaultPosition(x, y) (inherited from Window)
- setPosition(x, y) (inherited from Window)
- setSelectCallback(callback)
- setSize(width, height, apply_ui_scale) (inherited from Window)
- setValueChangeCallback(callback)
- startButtonBlinking(button_index) (inherited from Window)
- stopButtonBlinking() (inherited from Window)
Member Index
- active_button (*)
- active_scrollbar (*)
- apply_ui_scale (*)
- blink_counter (*)
- blinking_button (*)
- btn_repeat_delay (*)
- buttons (*)
- buttons_down (*)
- closed (*)
- cursor_x (*)
- cursor_y (*)
- default_button_sound (*)
- draggable (*)
- dragging (*)
- first_visible_node
- first_visible_ordinal
- font
- height
- highlighted_node
- hotkeyboxes (*)
- key_handlers (*)
- mouse_down_in_self
- num_rows
- panel_sprites (*)
- panels (*)
- parent (*)
- row_height
- scrollbar
- scrollbars (*)
- select_callback
- selected_node
- textboxes (*)
- tooltip_regions (*)
- tree_rect
- tree_root
- tree_sprites
- ui (*)
- val_change_callback
- visible (*)
- width
- windows (*)
- x
- x_original (*)
- y
- y_offset
- y_original (*)
function TreeControl:TreeControl(root, x, y, width, height, col_bg, col_fg, y_offset, has_font)
Parameters:
| Name | Type | Description |
|---|---|---|
| root | TreeNode | The single root node of the tree (use a `DummyRootNode` here if multiple root nodes are desired). |
| x | integer | The X-position, in pixels, where the control should start within its parent. |
| y | integer | The Y-position, in pixels, where the control should start within its parent. |
| width | integer | The width, in pixels, of the control. |
| height | integer | The height, in pixels, of the control. |
| col_bg | table | The background colour of the control - this should be a table with `red`, `green`, and `blue` fields, each an integer between 0 and 255. |
| col_fg | table | The colour used for the scrollbar and highlighted items. |
| y_offset | ? | ? |
| has_font | ? | ? |
Declared on: line 489 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:draw(canvas, x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| canvas | ? | ? |
| x | ? | ? |
| y | ? | ? |
Overrides: Window:draw.
Declared on: line 681 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:drawExtraOnRow(canvas, node, x, y)
Override this function if a certain row should have certain text
or additional flavour to it.
Parameters:
| Name | Type | Description |
|---|---|---|
| canvas | ? | ? |
| node | ? | ? |
| x | ? | ? |
| y | ? | ? |
Declared on: line 676 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:hitTestTree(x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| x | ? | ? |
| y | ? | ? |
Declared on: line 550 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:onMouseDown(button, x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| button | ? | ? |
| x | ? | ? |
| y | ? | ? |
Overrides: Window:onMouseDown.
Declared on: line 590 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:onMouseMove(x, y, dx, dy)
Parameters:
| Name | Type | Description |
|---|---|---|
| x | ? | ? |
| y | ? | ? |
| dx | ? | ? |
| dy | ? | ? |
Overrides: Window:onMouseMove.
Declared on: line 577 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:onMouseUp(button, x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| button | ? | ? |
| x | ? | ? |
| y | ? | ? |
Overrides: Window:onMouseUp.
Declared on: line 622 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:onMouseWheel(x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| x | ? | ? |
| y | ? | ? |
Overrides: Window:onMouseWheel.
Declared on: line 654 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:setSelectCallback(callback)
Function to handle (final) selection by user that needs to feed back data to
another dialog.
Parameters:
| Name | Type | Description |
|---|---|---|
| callback | function | Code to execute on trigger |
Declared on: line 604 of Lua/dialogs/tree_ctrl.lua.
function TreeControl:setValueChangeCallback(callback)
Function for where an action in the file tree needs to feed back data to another
dialog. Its specific usage should be noted in the parent element
Parameters:
| Name | Type | Description |
|---|---|---|
| callback | function | Code to execute on trigger |
Declared on: line 613 of Lua/dialogs/tree_ctrl.lua.