UIDropdown Class
Dropdown "window" used for selection of one item from a list.
Inheritance: UIDropdown » UIResizable » Window
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 UIResizable)
- beginDrag(x, y) (overrides Window:beginDrag)
- beginResize(x, y, mode) (inherited from UIResizable)
- bringToTop() (inherited from Window)
- close() (inherited from Window)
- draw(canvas, x, y) (inherited from UIResizable)
- 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 UIResizable)
- hitTestCorners(x, y) (inherited from UIResizable)
- hitTestPanel(x, y, panel) (inherited from Window)
- 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 UIResizable:onMouseDown)
- onMouseMove(x, y, dx, dy) (overrides Window:onMouseMove)
- onMouseUp(button, x, y) (inherited from Window)
- onMouseWheel(x, y) (overrides Window:onMouseWheel)
- onTick() (inherited from Window)
- onWorldTick() (inherited from Window)
- overrideMinSize(min_width, min_height) (inherited from UIResizable)
- removeAllPanels() (inherited from Window)
- removeKeyHandler(keys) (inherited from Window)
- removeWindow(window) (inherited from Window)
- selectItem(number)
- sendToBottom(window) (inherited from Window)
- sendToTop(window) (inherited from Window)
- setColour(colour) (inherited from UIResizable)
- setDefaultPosition(x, y) (inherited from Window)
- setPosition(x, y) (inherited from Window)
- setSize(width, height) (inherited from UIResizable)
- startButtonBlinking(button_index) (inherited from Window)
- stopButtonBlinking() (inherited from Window)
- updateButtons()
Member Index
- active_button (*)
- active_scrollbar (*)
- apply_ui_scale (*)
- background_panel (*)
- blink_counter (*)
- blinking_button (*)
- border_pos (*)
- border_sprites (*)
- btn_repeat_delay (*)
- buttons (*)
- buttons_down (*)
- callback
- closed (*)
- colour
- cursor_x
- cursor_y
- default_button_sound
- disabled_colour
- draggable (*)
- dragging (*)
- esc_closes
- height (*)
- hotkeyboxes (*)
- item_buttons
- item_panels
- items
- key_handlers (*)
- min_height (*)
- min_width (*)
- modal_class
- num_rows
- panel_sprites (*)
- panels (*)
- parent (*)
- parent_button
- parent_window
- resizable
- scrollbar
- scrollbar_colour
- scrollbars (*)
- textboxes (*)
- tooltip_regions (*)
- ui (*)
- visible (*)
- width (*)
- windows (*)
- x (*)
- x_original (*)
- y (*)
- y_original (*)
function UIDropdown:UIDropdown(ui, parent_window, parent_button, items, callback, colour, scrollbar_colour, disabled_colour)
Constructor for the dropdown "window"
Parameters:
| Name | Type | Description |
|---|---|---|
| ui | UI | The ui the window is created in |
| parent_window | Window | The window that this dropdown will be attached to |
| parent_button | Button | The button in the parent_window that this dropdown will be positioned under |
| items | table | A list of items for the list to display, where each item is a table with at least the field text, and optionally fields font and/or tooltip, which is a table containing text, x and y positions. |
| callback | function | A function to be called when an item is selected. It is called with two parameters: The parent window and the index of the selected item |
| colour | table | Colour of the dropdown's list items, in the form of {red = ..., green = ..., blue = ...}. Optional if parent_window is a UIResizable |
| scrollbar_colour | table | Colour of the scrollbar's 'thumb', and button hover in the form of {red = ..., green = ..., blue = ...}. Optional if parent_window is a UIResizable |
| disabled_colour | table | Colour of the disabled items in the form of {red = ..., green = ..., blue = ...}. Optional. |
Declared on: line 28 of Lua/dialogs/resizables/dropdown.lua.
function UIDropdown:beginDrag(x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| x | ? | ? |
| y | ? | ? |
Overrides: Window:beginDrag.
Declared on: line 139 of Lua/dialogs/resizables/dropdown.lua.
function UIDropdown:onMouseDown(button, x, y)
Let dropdown close when clicked outside of
Parameters:
| Name | Type | Description |
|---|---|---|
| button | button | mouseclick |
| x | coord | x coordinate |
| y | coord | y coordinate |
Overrides: UIResizable:onMouseDown.
Declared on: line 146 of Lua/dialogs/resizables/dropdown.lua.
function UIDropdown:onMouseMove(x, y, dx, dy)
Parameters:
| Name | Type | Description |
|---|---|---|
| x | ? | ? |
| y | ? | ? |
| dx | ? | ? |
| dy | ? | ? |
Overrides: Window:onMouseMove.
Declared on: line 189 of Lua/dialogs/resizables/dropdown.lua.
function UIDropdown:onMouseWheel(x, y)
Allow the dropdown to scroll through mousewheel input
Parameters:
| Name | Type | Description |
|---|---|---|
| x | int | UNUSED, 1 on right scroll, -1 on left scroll |
| y | int | 1 on up scroll, -1 on down scroll |
Overrides: Window:onMouseWheel.
Declared on: line 160 of Lua/dialogs/resizables/dropdown.lua.
function UIDropdown:selectItem(number)
Parameters:
| Name | Type | Description |
|---|---|---|
| number | ? | ? |
Declared on: line 129 of Lua/dialogs/resizables/dropdown.lua.
function UIDropdown:updateButtons()
Updates buttons when scrolling.
Declared on: line 109 of Lua/dialogs/resizables/dropdown.lua.