pub struct LuaGuiElement;Expand description
An element of a custom GUI. This type is used to represent any kind of a GUI element - labels, buttons and frames are all instances of this type. Just like LuaEntity, different kinds of elements support different attributes; attempting to access an attribute on an element that doesn’t support it (for instance, trying to access the column_count of a textfield) will result in a runtime error.
For information on all supported GUI elements, see GuiElementType.
Each GUI element allows access to its children by having them as attributes. Thus, one can use the parent.child syntax to refer to children. Lua also supports the parent["child"] syntax to refer to the same element. This can be used in cases where the child has a name that isn’t a valid Lua identifier.
Implementations§
Source§impl LuaGuiElement
impl LuaGuiElement
Sourcepub fn allow_decimal(&self) -> bool
pub fn allow_decimal(&self) -> bool
Whether this textfield (when in numeric mode) allows decimal numbers.
Sourcepub fn set_allow_decimal(&self, value: bool)
pub fn set_allow_decimal(&self, value: bool)
Set the allow_decimal attribute (Lua: self.allow_decimal = value).
Whether this textfield (when in numeric mode) allows decimal numbers.
Sourcepub fn allow_negative(&self) -> bool
pub fn allow_negative(&self) -> bool
Whether this textfield (when in numeric mode) allows negative numbers.
Sourcepub fn set_allow_negative(&self, value: bool)
pub fn set_allow_negative(&self, value: bool)
Set the allow_negative attribute (Lua: self.allow_negative = value).
Whether this textfield (when in numeric mode) allows negative numbers.
Sourcepub fn allow_none_state(&self) -> bool
pub fn allow_none_state(&self) -> bool
Whether the "none" state is allowed for this switch.
This can’t be set to false if the current switch_state is ‘none’.
Sourcepub fn set_allow_none_state(&self, value: bool)
pub fn set_allow_none_state(&self, value: bool)
Set the allow_none_state attribute (Lua: self.allow_none_state = value).
Whether the "none" state is allowed for this switch.
This can’t be set to false if the current switch_state is ‘none’.
Sourcepub fn anchor(&self) -> GuiAnchor
pub fn anchor(&self) -> GuiAnchor
The anchor for this relative widget, if any. Setting nil clears the anchor.
Sourcepub fn set_anchor(&self, value: GuiAnchor)
pub fn set_anchor(&self, value: GuiAnchor)
Set the anchor attribute (Lua: self.anchor = value).
The anchor for this relative widget, if any. Setting nil clears the anchor.
Sourcepub fn auto_center(&self) -> bool
pub fn auto_center(&self) -> bool
Whether this frame auto-centers on window resize when stored in LuaGui::screen.
Sourcepub fn set_auto_center(&self, value: bool)
pub fn set_auto_center(&self, value: bool)
Set the auto_center attribute (Lua: self.auto_center = value).
Whether this frame auto-centers on window resize when stored in LuaGui::screen.
Sourcepub fn auto_toggle(&self) -> bool
pub fn auto_toggle(&self) -> bool
Whether this button will automatically toggle when clicked.
Sourcepub fn set_auto_toggle(&self, value: bool)
pub fn set_auto_toggle(&self, value: bool)
Set the auto_toggle attribute (Lua: self.auto_toggle = value).
Whether this button will automatically toggle when clicked.
Sourcepub fn badge_text(&self) -> LocalisedString
pub fn badge_text(&self) -> LocalisedString
The text to display after the normal tab text (designed to work with numbers)
Sourcepub fn set_badge_text(&self, value: impl Into<LocalisedString>)
pub fn set_badge_text(&self, value: impl Into<LocalisedString>)
Set the badge_text attribute (Lua: self.badge_text = value).
The text to display after the normal tab text (designed to work with numbers)
Sourcepub fn caption(&self) -> LocalisedString
pub fn caption(&self) -> LocalisedString
The text displayed on this element. For frames, this is the “heading”. For other elements, like buttons or labels, this is the content.
Whilst this attribute may be used on all elements without producing an error, it doesn’t make sense for tables and flows as they won’t display it.
Sourcepub fn set_caption(&self, value: impl Into<LocalisedString>)
pub fn set_caption(&self, value: impl Into<LocalisedString>)
Set the caption attribute (Lua: self.caption = value).
The text displayed on this element. For frames, this is the “heading”. For other elements, like buttons or labels, this is the content.
Whilst this attribute may be used on all elements without producing an error, it doesn’t make sense for tables and flows as they won’t display it.
Sourcepub fn children(&self) -> Vec<LuaGuiElement>
pub fn children(&self) -> Vec<LuaGuiElement>
The child-elements of this GUI element.
Sourcepub fn children_names(&self) -> Vec<&'static str>
pub fn children_names(&self) -> Vec<&'static str>
Names of all the children of this element. These are the identifiers that can be used to access the child as an attribute of this element.
Sourcepub fn clicked_sprite(&self) -> SpritePath
pub fn clicked_sprite(&self) -> SpritePath
The sprite to display on this sprite-button when it is clicked.
Sourcepub fn set_clicked_sprite(&self, value: SpritePath)
pub fn set_clicked_sprite(&self, value: SpritePath)
Set the clicked_sprite attribute (Lua: self.clicked_sprite = value).
The sprite to display on this sprite-button when it is clicked.
Sourcepub fn column_count(&self) -> u32
pub fn column_count(&self) -> u32
The number of columns in this table.
Sourcepub fn direction(&self) -> GuiDirection
pub fn direction(&self) -> GuiDirection
Direction of this element’s layout.
Sourcepub fn drag_target(&self) -> LuaGuiElement
pub fn drag_target(&self) -> LuaGuiElement
The frame that is being moved when dragging this GUI element, if any. This element needs to be a child of the drag_target at some level.
Only top-level elements in LuaGui::screen can be drag_targets.
Sourcepub fn set_drag_target(&self, value: LuaGuiElement)
pub fn set_drag_target(&self, value: LuaGuiElement)
Set the drag_target attribute (Lua: self.drag_target = value).
The frame that is being moved when dragging this GUI element, if any. This element needs to be a child of the drag_target at some level.
Only top-level elements in LuaGui::screen can be drag_targets.
Sourcepub fn draw_horizontal_line_after_headers(&self) -> bool
pub fn draw_horizontal_line_after_headers(&self) -> bool
Whether this table should draw a horizontal grid line below the first table row.
Sourcepub fn set_draw_horizontal_line_after_headers(&self, value: bool)
pub fn set_draw_horizontal_line_after_headers(&self, value: bool)
Set the draw_horizontal_line_after_headers attribute (Lua: self.draw_horizontal_line_after_headers = value).
Whether this table should draw a horizontal grid line below the first table row.
Sourcepub fn draw_horizontal_lines(&self) -> bool
pub fn draw_horizontal_lines(&self) -> bool
Whether this table should draw horizontal grid lines.
Sourcepub fn set_draw_horizontal_lines(&self, value: bool)
pub fn set_draw_horizontal_lines(&self, value: bool)
Set the draw_horizontal_lines attribute (Lua: self.draw_horizontal_lines = value).
Whether this table should draw horizontal grid lines.
Sourcepub fn draw_vertical_lines(&self) -> bool
pub fn draw_vertical_lines(&self) -> bool
Whether this table should draw vertical grid lines.
Sourcepub fn set_draw_vertical_lines(&self, value: bool)
pub fn set_draw_vertical_lines(&self, value: bool)
Set the draw_vertical_lines attribute (Lua: self.draw_vertical_lines = value).
Whether this table should draw vertical grid lines.
Sourcepub fn elem_filters(&self) -> LuaAny
pub fn elem_filters(&self) -> LuaAny
The elem filters of this choose-elem-button, if any. The compatible type of filter is determined by elem_type.
Writing to this field does not change or clear the currently selected element.
Sourcepub fn set_elem_filters(&self, value: LuaAny)
pub fn set_elem_filters(&self, value: LuaAny)
Set the elem_filters attribute (Lua: self.elem_filters = value).
The elem filters of this choose-elem-button, if any. The compatible type of filter is determined by elem_type.
Writing to this field does not change or clear the currently selected element.
Sourcepub fn elem_tooltip(&self) -> ElemID
pub fn elem_tooltip(&self) -> ElemID
The element tooltip to display when hovering over this element, or nil.
Sourcepub fn set_elem_tooltip(&self, value: ElemID)
pub fn set_elem_tooltip(&self, value: ElemID)
Set the elem_tooltip attribute (Lua: self.elem_tooltip = value).
The element tooltip to display when hovering over this element, or nil.
Sourcepub fn elem_value(&self) -> LuaAny
pub fn elem_value(&self) -> LuaAny
The elem value of this choose-elem-button, if any.
The "signal" type operates with SignalID.
The "with-quality" types operate with PrototypeWithQuality.
The remaining types use strings.
Sourcepub fn set_elem_value(&self, value: LuaAny)
pub fn set_elem_value(&self, value: LuaAny)
Set the elem_value attribute (Lua: self.elem_value = value).
The elem value of this choose-elem-button, if any.
The "signal" type operates with SignalID.
The "with-quality" types operate with PrototypeWithQuality.
The remaining types use strings.
pub fn empty_slot_info(&self) -> EmptySlotInfo
Sourcepub fn set_empty_slot_info(&self, value: EmptySlotInfo)
pub fn set_empty_slot_info(&self, value: EmptySlotInfo)
Set the empty_slot_info attribute (Lua: self.empty_slot_info = value).
Sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Whether this GUI element is enabled. Disabled GUI elements don’t trigger events when clicked.
Sourcepub fn set_enabled(&self, value: bool)
pub fn set_enabled(&self, value: bool)
Set the enabled attribute (Lua: self.enabled = value).
Whether this GUI element is enabled. Disabled GUI elements don’t trigger events when clicked.
Sourcepub fn entity(&self) -> LuaEntity
pub fn entity(&self) -> LuaEntity
The entity associated with this entity-preview, camera, minimap, if any.
Sourcepub fn set_entity(&self, value: LuaEntity)
pub fn set_entity(&self, value: LuaEntity)
Set the entity attribute (Lua: self.entity = value).
The entity associated with this entity-preview, camera, minimap, if any.
Sourcepub fn set_force(&self, value: &'static str)
pub fn set_force(&self, value: &'static str)
Set the force attribute (Lua: self.force = value).
The force this minimap is using, if any.
Sourcepub fn game_controller_interaction(&self) -> &'static str
pub fn game_controller_interaction(&self) -> &'static str
How this element should interact with game controllers.
Sourcepub fn set_game_controller_interaction(&self, value: &'static str)
pub fn set_game_controller_interaction(&self, value: &'static str)
Set the game_controller_interaction attribute (Lua: self.game_controller_interaction = value).
How this element should interact with game controllers.
pub fn handle_cursor_split(&self) -> bool
Sourcepub fn set_handle_cursor_split(&self, value: bool)
pub fn set_handle_cursor_split(&self, value: bool)
Set the handle_cursor_split attribute (Lua: self.handle_cursor_split = value).
pub fn handle_cursor_transfer(&self) -> bool
Sourcepub fn set_handle_cursor_transfer(&self, value: bool)
pub fn set_handle_cursor_transfer(&self, value: bool)
Set the handle_cursor_transfer attribute (Lua: self.handle_cursor_transfer = value).
pub fn handle_open_item(&self) -> bool
Sourcepub fn set_handle_open_item(&self, value: bool)
pub fn set_handle_open_item(&self, value: bool)
Set the handle_open_item attribute (Lua: self.handle_open_item = value).
pub fn handle_open_mod_item(&self) -> bool
Sourcepub fn set_handle_open_mod_item(&self, value: bool)
pub fn set_handle_open_mod_item(&self, value: bool)
Set the handle_open_mod_item attribute (Lua: self.handle_open_mod_item = value).
pub fn handle_send_stack_to_trash(&self) -> bool
Sourcepub fn set_handle_send_stack_to_trash(&self, value: bool)
pub fn set_handle_send_stack_to_trash(&self, value: bool)
Set the handle_send_stack_to_trash attribute (Lua: self.handle_send_stack_to_trash = value).
pub fn handle_send_stacks_to_trash(&self) -> bool
Sourcepub fn set_handle_send_stacks_to_trash(&self, value: bool)
pub fn set_handle_send_stacks_to_trash(&self, value: bool)
Set the handle_send_stacks_to_trash attribute (Lua: self.handle_send_stacks_to_trash = value).
Sourcepub fn horizontal_scroll_policy(&self) -> ScrollPolicy
pub fn horizontal_scroll_policy(&self) -> ScrollPolicy
Policy of the horizontal scroll bar.
Sourcepub fn set_horizontal_scroll_policy(&self, value: ScrollPolicy)
pub fn set_horizontal_scroll_policy(&self, value: ScrollPolicy)
Set the horizontal_scroll_policy attribute (Lua: self.horizontal_scroll_policy = value).
Policy of the horizontal scroll bar.
Sourcepub fn hovered_sprite(&self) -> SpritePath
pub fn hovered_sprite(&self) -> SpritePath
The sprite to display on this sprite-button when it is hovered.
Sourcepub fn set_hovered_sprite(&self, value: SpritePath)
pub fn set_hovered_sprite(&self, value: SpritePath)
Set the hovered_sprite attribute (Lua: self.hovered_sprite = value).
The sprite to display on this sprite-button when it is hovered.
Sourcepub fn icon_selector(&self) -> bool
pub fn icon_selector(&self) -> bool
Whether this textfield or text-box was created with an icon selector.
Sourcepub fn ignored_by_interaction(&self) -> bool
pub fn ignored_by_interaction(&self) -> bool
Whether this GUI element is ignored by interaction. This makes clicks on this element ‘go through’ to the GUI element or even the game surface below it.
Sourcepub fn set_ignored_by_interaction(&self, value: bool)
pub fn set_ignored_by_interaction(&self, value: bool)
Set the ignored_by_interaction attribute (Lua: self.ignored_by_interaction = value).
Whether this GUI element is ignored by interaction. This makes clicks on this element ‘go through’ to the GUI element or even the game surface below it.
Sourcepub fn index(&self) -> u32
pub fn index(&self) -> u32
The index of this GUI element (unique amongst the GUI elements of a LuaPlayer).
Sourcepub fn inventory(&self) -> LuaInventory
pub fn inventory(&self) -> LuaInventory
The inventory target for this custom inventory widget.
Sourcepub fn set_inventory(&self, value: LuaInventory)
pub fn set_inventory(&self, value: LuaInventory)
Set the inventory attribute (Lua: self.inventory = value).
The inventory target for this custom inventory widget.
Sourcepub fn is_password(&self) -> bool
pub fn is_password(&self) -> bool
Whether this textfield displays as a password field, which renders all characters as *.
Sourcepub fn set_is_password(&self, value: bool)
pub fn set_is_password(&self, value: bool)
Set the is_password attribute (Lua: self.is_password = value).
Whether this textfield displays as a password field, which renders all characters as *.
Sourcepub fn items(&self) -> Vec<LocalisedString>
pub fn items(&self) -> Vec<LocalisedString>
The items in this dropdown or listbox.
Sourcepub fn set_items(&self, value: Vec<LocalisedString>)
pub fn set_items(&self, value: Vec<LocalisedString>)
Set the items attribute (Lua: self.items = value).
The items in this dropdown or listbox.
Sourcepub fn left_label_caption(&self) -> LocalisedString
pub fn left_label_caption(&self) -> LocalisedString
The text shown for the left switch label.
Sourcepub fn set_left_label_caption(&self, value: impl Into<LocalisedString>)
pub fn set_left_label_caption(&self, value: impl Into<LocalisedString>)
Set the left_label_caption attribute (Lua: self.left_label_caption = value).
The text shown for the left switch label.
Sourcepub fn left_label_tooltip(&self) -> LocalisedString
pub fn left_label_tooltip(&self) -> LocalisedString
The tooltip shown on the left switch label.
Sourcepub fn set_left_label_tooltip(&self, value: impl Into<LocalisedString>)
pub fn set_left_label_tooltip(&self, value: impl Into<LocalisedString>)
Set the left_label_tooltip attribute (Lua: self.left_label_tooltip = value).
The tooltip shown on the left switch label.
Sourcepub fn location(&self) -> GuiLocation
pub fn location(&self) -> GuiLocation
The location of this widget when stored in LuaGui::screen. nil if not set or not in LuaGui::screen.
Sourcepub fn set_location(&self, value: GuiLocation)
pub fn set_location(&self, value: GuiLocation)
Set the location attribute (Lua: self.location = value).
The location of this widget when stored in LuaGui::screen. nil if not set or not in LuaGui::screen.
Sourcepub fn set_locked(&self, value: bool)
pub fn set_locked(&self, value: bool)
Set the locked attribute (Lua: self.locked = value).
Whether this choose-elem-button can be changed by the player.
Sourcepub fn lose_focus_on_confirm(&self) -> bool
pub fn lose_focus_on_confirm(&self) -> bool
Whether this textfield loses focus after defines.events.on_gui_confirmed is fired.
Sourcepub fn set_lose_focus_on_confirm(&self, value: bool)
pub fn set_lose_focus_on_confirm(&self, value: bool)
Set the lose_focus_on_confirm attribute (Lua: self.lose_focus_on_confirm = value).
Whether this textfield loses focus after defines.events.on_gui_confirmed is fired.
Sourcepub fn minimap_player_index(&self) -> u32
pub fn minimap_player_index(&self) -> u32
The player index this minimap is using.
Sourcepub fn set_minimap_player_index(&self, value: u32)
pub fn set_minimap_player_index(&self, value: u32)
Set the minimap_player_index attribute (Lua: self.minimap_player_index = value).
The player index this minimap is using.
The mouse button filters for this button or sprite-button.
Set the mouse_button_filter attribute (Lua: self.mouse_button_filter = value).
The mouse button filters for this button or sprite-button.
Sourcepub fn set_name(&self, value: &'static str)
pub fn set_name(&self, value: &'static str)
Set the name attribute (Lua: self.name = value).
The name of this element. "" if no name was set.
Sourcepub fn number(&self) -> f64
pub fn number(&self) -> f64
The number to be shown in the bottom right corner of this sprite-button, or nil to show nothing.
Sourcepub fn set_number(&self, value: f64)
pub fn set_number(&self, value: f64)
Set the number attribute (Lua: self.number = value).
The number to be shown in the bottom right corner of this sprite-button, or nil to show nothing.
Sourcepub fn set_numeric(&self, value: bool)
pub fn set_numeric(&self, value: bool)
Set the numeric attribute (Lua: self.numeric = value).
Whether this textfield is limited to only numeric characters.
Sourcepub fn object_name(&self) -> &'static str
pub fn object_name(&self) -> &'static str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Sourcepub fn parent(&self) -> LuaGuiElement
pub fn parent(&self) -> LuaGuiElement
The direct parent of this element. nil if this is a top-level element.
Sourcepub fn player_index(&self) -> u32
pub fn player_index(&self) -> u32
Index into LuaGameScript::players specifying the player who owns this element.
Sourcepub fn position(&self) -> MapPosition
pub fn position(&self) -> MapPosition
The position this camera or minimap is focused on, if any.
Sourcepub fn set_position(&self, value: MapPosition)
pub fn set_position(&self, value: MapPosition)
Set the position attribute (Lua: self.position = value).
The position this camera or minimap is focused on, if any.
Sourcepub fn quality(&self) -> LuaQualityPrototype
pub fn quality(&self) -> LuaQualityPrototype
The quality to be shown in the bottom left corner of this sprite-button, or nil to show nothing.
Sourcepub fn set_quality(&self, value: QualityID)
pub fn set_quality(&self, value: QualityID)
Set the quality attribute (Lua: self.quality = value).
The quality to be shown in the bottom left corner of this sprite-button, or nil to show nothing.
Sourcepub fn raise_hover_events(&self) -> bool
pub fn raise_hover_events(&self) -> bool
Whether this element will raise on_gui_hover and on_gui_leave.
Sourcepub fn set_raise_hover_events(&self, value: bool)
pub fn set_raise_hover_events(&self, value: bool)
Set the raise_hover_events attribute (Lua: self.raise_hover_events = value).
Whether this element will raise on_gui_hover and on_gui_leave.
Sourcepub fn set_read_only(&self, value: bool)
pub fn set_read_only(&self, value: bool)
Set the read_only attribute (Lua: self.read_only = value).
Whether this text-box is read-only. Defaults to false.
Sourcepub fn resize_to_sprite(&self) -> bool
pub fn resize_to_sprite(&self) -> bool
Whether the sprite widget should resize according to the sprite in it. Defaults to true.
Sourcepub fn set_resize_to_sprite(&self, value: bool)
pub fn set_resize_to_sprite(&self, value: bool)
Set the resize_to_sprite attribute (Lua: self.resize_to_sprite = value).
Whether the sprite widget should resize according to the sprite in it. Defaults to true.
Sourcepub fn right_label_caption(&self) -> LocalisedString
pub fn right_label_caption(&self) -> LocalisedString
The text shown for the right switch label.
Sourcepub fn set_right_label_caption(&self, value: impl Into<LocalisedString>)
pub fn set_right_label_caption(&self, value: impl Into<LocalisedString>)
Set the right_label_caption attribute (Lua: self.right_label_caption = value).
The text shown for the right switch label.
Sourcepub fn right_label_tooltip(&self) -> LocalisedString
pub fn right_label_tooltip(&self) -> LocalisedString
The tooltip shown on the right switch label.
Sourcepub fn set_right_label_tooltip(&self, value: impl Into<LocalisedString>)
pub fn set_right_label_tooltip(&self, value: impl Into<LocalisedString>)
Set the right_label_tooltip attribute (Lua: self.right_label_tooltip = value).
The tooltip shown on the right switch label.
Sourcepub fn selectable(&self) -> bool
pub fn selectable(&self) -> bool
Whether the contents of this text-box are selectable. Defaults to true.
Sourcepub fn set_selectable(&self, value: bool)
pub fn set_selectable(&self, value: bool)
Set the selectable attribute (Lua: self.selectable = value).
Whether the contents of this text-box are selectable. Defaults to true.
Sourcepub fn selected_index(&self) -> u32
pub fn selected_index(&self) -> u32
The selected index for this dropdown or listbox. Returns 0 if none is selected.
Sourcepub fn set_selected_index(&self, value: u32)
pub fn set_selected_index(&self, value: u32)
Set the selected_index attribute (Lua: self.selected_index = value).
The selected index for this dropdown or listbox. Returns 0 if none is selected.
Sourcepub fn selected_tab_index(&self) -> u32
pub fn selected_tab_index(&self) -> u32
The selected tab index for this tabbed pane, if any.
Sourcepub fn set_selected_tab_index(&self, value: u32)
pub fn set_selected_tab_index(&self, value: u32)
Set the selected_tab_index attribute (Lua: self.selected_tab_index = value).
The selected tab index for this tabbed pane, if any.
Sourcepub fn show_percent_for_small_numbers(&self) -> bool
pub fn show_percent_for_small_numbers(&self) -> bool
Related to the number to be shown in the bottom right corner of this sprite-button. When set to true, numbers that are non-zero and smaller than one are shown as a percentage rather than the value. For example, 0.5 will be shown as 50% instead.
Sourcepub fn set_show_percent_for_small_numbers(&self, value: bool)
pub fn set_show_percent_for_small_numbers(&self, value: bool)
Set the show_percent_for_small_numbers attribute (Lua: self.show_percent_for_small_numbers = value).
Related to the number to be shown in the bottom right corner of this sprite-button. When set to true, numbers that are non-zero and smaller than one are shown as a percentage rather than the value. For example, 0.5 will be shown as 50% instead.
Sourcepub fn slider_value(&self) -> f64
pub fn slider_value(&self) -> f64
The value of this slider element.
Sourcepub fn set_slider_value(&self, value: f64)
pub fn set_slider_value(&self, value: f64)
Set the slider_value attribute (Lua: self.slider_value = value).
The value of this slider element.
pub fn slots_per_row(&self) -> u8
Sourcepub fn set_slots_per_row(&self, value: u8)
pub fn set_slots_per_row(&self, value: u8)
Set the slots_per_row attribute (Lua: self.slots_per_row = value).
Sourcepub fn sprite(&self) -> SpritePath
pub fn sprite(&self) -> SpritePath
The sprite to display on this sprite-button or sprite in the default state.
Sourcepub fn set_sprite(&self, value: SpritePath)
pub fn set_sprite(&self, value: SpritePath)
Set the sprite attribute (Lua: self.sprite = value).
The sprite to display on this sprite-button or sprite in the default state.
Sourcepub fn set_state(&self, value: bool)
pub fn set_state(&self, value: bool)
Set the state attribute (Lua: self.state = value).
Is this checkbox or radiobutton checked?
Sourcepub fn surface_index(&self) -> u32
pub fn surface_index(&self) -> u32
The surface index this camera or minimap is using.
Sourcepub fn set_surface_index(&self, value: u32)
pub fn set_surface_index(&self, value: u32)
Set the surface_index attribute (Lua: self.surface_index = value).
The surface index this camera or minimap is using.
Sourcepub fn switch_state(&self) -> SwitchState
pub fn switch_state(&self) -> SwitchState
The switch state for this switch.
If LuaGuiElement::allow_none_state is false this can’t be set to "none".
Sourcepub fn set_switch_state(&self, value: SwitchState)
pub fn set_switch_state(&self, value: SwitchState)
Set the switch_state attribute (Lua: self.switch_state = value).
The switch state for this switch.
If LuaGuiElement::allow_none_state is false this can’t be set to "none".
Sourcepub fn tabs(&self) -> Vec<TabAndContent>
pub fn tabs(&self) -> Vec<TabAndContent>
The tabs and contents being shown in this tabbed-pane.
The tags associated with this LuaGuiElement.
Set the tags attribute (Lua: self.tags = value).
The tags associated with this LuaGuiElement.
Sourcepub fn set_text(&self, value: &'static str)
pub fn set_text(&self, value: &'static str)
Set the text attribute (Lua: self.text = value).
The text contained in this textfield or text-box.
Sourcepub fn toggled(&self) -> bool
pub fn toggled(&self) -> bool
Whether this button is currently toggled. When a button is toggled, it will use the selected_graphical_set and selected_font_color defined in its style.
Sourcepub fn set_toggled(&self, value: bool)
pub fn set_toggled(&self, value: bool)
Set the toggled attribute (Lua: self.toggled = value).
Whether this button is currently toggled. When a button is toggled, it will use the selected_graphical_set and selected_font_color defined in its style.
Sourcepub fn tooltip(&self) -> LocalisedString
pub fn tooltip(&self) -> LocalisedString
The text to display when hovering over this element. Writing "" or nil will disable the tooltip.
Sourcepub fn set_tooltip(&self, value: impl Into<LocalisedString>)
pub fn set_tooltip(&self, value: impl Into<LocalisedString>)
Set the tooltip attribute (Lua: self.tooltip = value).
The text to display when hovering over this element. Writing "" or nil will disable the tooltip.
Sourcepub fn type(&self) -> GuiElementType
pub fn type(&self) -> GuiElementType
The type of this GUI element.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
Sourcepub fn value(&self) -> f64
pub fn value(&self) -> f64
How much this progress bar is filled. It is a value in the range [0, 1].
Sourcepub fn set_value(&self, value: f64)
pub fn set_value(&self, value: f64)
Set the value attribute (Lua: self.value = value).
How much this progress bar is filled. It is a value in the range [0, 1].
Sourcepub fn vertical_centering(&self) -> bool
pub fn vertical_centering(&self) -> bool
Whether the content of this table should be vertically centered. Overrides LuaStyle::column_alignments. Defaults to true.
Sourcepub fn set_vertical_centering(&self, value: bool)
pub fn set_vertical_centering(&self, value: bool)
Set the vertical_centering attribute (Lua: self.vertical_centering = value).
Whether the content of this table should be vertically centered. Overrides LuaStyle::column_alignments. Defaults to true.
Sourcepub fn vertical_scroll_policy(&self) -> ScrollPolicy
pub fn vertical_scroll_policy(&self) -> ScrollPolicy
Policy of the vertical scroll bar.
Sourcepub fn set_vertical_scroll_policy(&self, value: ScrollPolicy)
pub fn set_vertical_scroll_policy(&self, value: ScrollPolicy)
Set the vertical_scroll_policy attribute (Lua: self.vertical_scroll_policy = value).
Policy of the vertical scroll bar.
Sourcepub fn visible(&self) -> bool
pub fn visible(&self) -> bool
Sets whether this GUI element is visible or completely hidden, taking no space in the layout.
Sourcepub fn set_visible(&self, value: bool)
pub fn set_visible(&self, value: bool)
Set the visible attribute (Lua: self.visible = value).
Sets whether this GUI element is visible or completely hidden, taking no space in the layout.
Sourcepub fn word_wrap(&self) -> bool
pub fn word_wrap(&self) -> bool
Whether this text-box will word-wrap automatically. Defaults to false.
Sourcepub fn set_word_wrap(&self, value: bool)
pub fn set_word_wrap(&self, value: bool)
Set the word_wrap attribute (Lua: self.word_wrap = value).
Whether this text-box will word-wrap automatically. Defaults to false.
Sourcepub fn zoom(&self) -> f64
pub fn zoom(&self) -> f64
The zoom this camera or minimap is using. This value must be positive.
Sourcepub fn set_zoom(&self, value: f64)
pub fn set_zoom(&self, value: f64)
Set the zoom attribute (Lua: self.zoom = value).
The zoom this camera or minimap is using. This value must be positive.
Sourcepub fn add(&self, params: LuaGuiElementAddParams) -> LuaGuiElement
pub fn add(&self, params: LuaGuiElementAddParams) -> LuaGuiElement
Add a new child element to this GuiElement.
Sourcepub fn add_item(&self, string: impl Into<LocalisedString>, index: Option<u32>)
pub fn add_item(&self, string: impl Into<LocalisedString>, index: Option<u32>)
Inserts a string at the end or at the given index of this dropdown or listbox.
Sourcepub fn add_tab(&self, tab: LuaGuiElement, content: LuaGuiElement)
pub fn add_tab(&self, tab: LuaGuiElement, content: LuaGuiElement)
Adds the given tab and content widgets to this tabbed pane as a new tab.
Sourcepub fn bring_to_front(&self)
pub fn bring_to_front(&self)
Moves this GUI element to the “front” so it will draw over other elements.
Only works for elements in LuaGui::screen.
Sourcepub fn clear(&self)
pub fn clear(&self)
Remove children of this element. Any LuaGuiElement objects referring to the destroyed elements become invalid after this operation.
Sourcepub fn clear_items(&self)
pub fn clear_items(&self)
Removes the items in this dropdown or listbox.
Sourcepub fn close_dropdown(&self)
pub fn close_dropdown(&self)
Closes the dropdown list if this is a dropdown and it is open.
Sourcepub fn destroy(&self)
pub fn destroy(&self)
Remove this element, along with its children. Any LuaGuiElement objects referring to the destroyed elements become invalid after this operation.
The top-level GUI elements - LuaGui::top, LuaGui::left, LuaGui::center and LuaGui::screen - can’t be destroyed.
Sourcepub fn force_auto_center(&self)
pub fn force_auto_center(&self)
Forces this frame to re-auto-center. Only works on frames stored directly in LuaGui::screen.
Sourcepub fn get_index_in_parent(&self) -> u32
pub fn get_index_in_parent(&self) -> u32
Gets the index that this element has in its parent element.
This iterates through the children of the parent of this element, meaning this has a non-free cost to get, but is faster than doing the equivalent in Lua.
Sourcepub fn get_item(&self, index: u32) -> LocalisedString
pub fn get_item(&self, index: u32) -> LocalisedString
Gets the item at the given index from this dropdown or listbox.
Sourcepub fn get_mod(&self) -> Option<&'static str>
pub fn get_mod(&self) -> Option<&'static str>
The mod that owns this Gui element or nil if it’s owned by the scenario script.
This has a not-super-expensive, but non-free cost to get.
Sourcepub fn get_slider_discrete_values(&self) -> bool
pub fn get_slider_discrete_values(&self) -> bool
Returns whether this slider only allows discrete values.
Sourcepub fn get_slider_maximum(&self) -> f64
pub fn get_slider_maximum(&self) -> f64
Gets this sliders maximum value.
Sourcepub fn get_slider_minimum(&self) -> f64
pub fn get_slider_minimum(&self) -> f64
Gets this sliders minimum value.
Sourcepub fn get_slider_value_step(&self) -> f64
pub fn get_slider_value_step(&self) -> f64
Gets the minimum distance this slider can move.
Sourcepub fn remove_item(&self, index: u32)
pub fn remove_item(&self, index: u32)
Removes the item at the given index from this dropdown or listbox.
Sourcepub fn remove_tab(&self, tab: Option<LuaGuiElement>)
pub fn remove_tab(&self, tab: Option<LuaGuiElement>)
Removes the given tab and its associated content from this tabbed pane.
Removing a tab does not destroy the tab or the tab contents. It just removes them from the view.
Sourcepub fn scroll_to_bottom(&self)
pub fn scroll_to_bottom(&self)
Scrolls this scroll bar to the bottom.
Sourcepub fn scroll_to_element(
&self,
element: LuaGuiElement,
scroll_mode: Option<LuaGuiElementScrollMode>,
)
pub fn scroll_to_element( &self, element: LuaGuiElement, scroll_mode: Option<LuaGuiElementScrollMode>, )
Scrolls this scroll bar such that the specified GUI element is visible to the player.
Sourcepub fn scroll_to_item(
&self,
index: i32,
scroll_mode: Option<LuaGuiElementScrollMode>,
)
pub fn scroll_to_item( &self, index: i32, scroll_mode: Option<LuaGuiElementScrollMode>, )
Scrolls the scroll bar such that the specified listbox item is visible to the player.
Sourcepub fn scroll_to_left(&self)
pub fn scroll_to_left(&self)
Scrolls this scroll bar to the left.
Sourcepub fn scroll_to_right(&self)
pub fn scroll_to_right(&self)
Scrolls this scroll bar to the right.
Sourcepub fn scroll_to_top(&self)
pub fn scroll_to_top(&self)
Scrolls this scroll bar to the top.
Sourcepub fn select(&self, start_index: i32, end_index: i32)
pub fn select(&self, start_index: i32, end_index: i32)
Selects a range of text in this textbox.
Sourcepub fn select_all(&self)
pub fn select_all(&self)
Selects all the text in this textbox.
Sourcepub fn set_item(&self, index: u32, string: impl Into<LocalisedString>)
pub fn set_item(&self, index: u32, string: impl Into<LocalisedString>)
Sets the given string at the given index in this dropdown or listbox.
Sourcepub fn set_slider_discrete_values(&self, value: bool)
pub fn set_slider_discrete_values(&self, value: bool)
Sets whether this slider only allows discrete values.
Sourcepub fn set_slider_minimum_maximum(&self, minimum: f64, maximum: f64)
pub fn set_slider_minimum_maximum(&self, minimum: f64, maximum: f64)
Sets this sliders minimum and maximum values. The minimum can’t be >= the maximum.
Sourcepub fn set_slider_value_step(&self, value: f64)
pub fn set_slider_value_step(&self, value: f64)
Sets the minimum distance this slider can move. The minimum distance can’t be > (max - min).
Sourcepub fn swap_children(&self, index_1: u32, index_2: u32)
pub fn swap_children(&self, index_1: u32, index_2: u32)
Swaps the children at the given indices in this element.
Trait Implementations§
Source§impl Clone for LuaGuiElement
impl Clone for LuaGuiElement
Source§fn clone(&self) -> LuaGuiElement
fn clone(&self) -> LuaGuiElement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more