From a595b79dd7f03da97a518547ab9a68301f8707f9 Mon Sep 17 00:00:00 2001
From: Cooldude2606
Core Module - Gui
+Core Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started
@@ -251,69 +263,6 @@ --- Making the base button concept
-local button =
-Gui.new_concept() -- Make a new empty concept
-:save_as('button') -- Save it as Gui.concepts.button so it can be used in other files
-:new_event('on_click',defines.events.on_gui_click) -- Add an on click event for this concept
-:new_property('tooltip') -- Add a property with the default setter method called tooltip
-:new_property('caption',function(properties,value) -- Add a property with a custom setter method called caption
- properties.caption = value
- properties.sprite = nil
- properties.type = 'button'
-end)
-:new_property('sprite',function(properties,value) -- Add a property with a custom setter method called sprite
- properties.image = value
- properties.caption = nil
- properties.type = 'sprite-button'
-end)
-:define_draw(function(properties,parent,element) -- Add the draw function to create the element from the concept
- -- Properties will include all the information that you need to draw the element
- -- Parent is the parent element for the element, this may have been altered by previous draw functions
- -- Element is the current element being made, this may have a nil value, if it is nil then this is the first draw function
- if properties.type == 'button' then
- element = parent.add{
- type = properties.type,
- name = properties.name,
- caption = properties.caption,
- tooltip = properties.tooltip
- }
-
- else
- element = parent.add{
- type = properties.type,
- name = properties.name,
- sprite = properties.sprite,
- tooltip = properties.tooltip
- }
-
- end
-
- -- If you return element or parent then their values will be updated for the next draw function in the chain
- -- It is best practice to always return the values if you have made any changes to them
- return element, parent
-end)
- -- Making a new button which has a custom style
-local custom_button =
-Gui.new_concept('button') -- We can use button here since we used save as on the concept
--- button:clone() -- If we had not used save as then this is how we would use it as a base
-:set_caption('Custom Button') -- Set the caption of the concept, this is possible as we added caption as a property
-:set_tooltip('Only admins can press this button') -- Set the tooltip of the concept, this is possible as we added tooltip as a property
-:on_click(function(event) -- Register a handler to the click event we added with new event
- if not event.player.admin then
- event.player.print('You must be admin to use this button')
- end
-end)
-:new_event('on_admin_clicked',defines.events.on_gui_click,function(event) -- Add a click event which has a filter function
- return event.player.admin -- Check if the player is admin
-end)
-:on_admin_clicked(function(event) -- Register a handler to the admin click event we have just created
- -- The admin click event is only an example, because of how sinmple the filter is we could have just used an if else statement
- game.print(event.player.name..' pressed my admin button')
-end)
- -- Drawing a concept
-custom_button:draw(game.player.gui.left)
@@ -321,69 +270,461 @@ Gui.new_concept('button') -- W
| button | -Clickable elements that fire on_gui_click when clicked. | +expcore.gui.core |
| checkbox | -Clickable elements with a cross in the middle that can be turned off or on. | +expcore.gui.instances |
| dropdown | -A drop down list of other elements. | +expcore.gui.elements.buttons |
| elem_button | -A button that lets the player pick one of an: item, entity, tile, or signal similar to the filter-select window. | +expcore.gui.elements.checkbox |
| empty | -A empty widget that just exists. | +expcore.gui.elements.dropdown |
| flow | -Invisible containers that lay out children either horizontally or vertically. | +expcore.gui.elements.slider |
| frame | -Grey semi-transparent boxes that contain other elements. | +expcore.gui.elements.text |
| label | -A piece of text. | +expcore.gui.elements.elem-button |
| line | -A vertical or horizontal line. | +expcore.gui.elements.progress-bar |
| progress_bar | -Indicate progress by displaying a partially filled bar. | +expcore.gui.concepts.toolbar |
| scroll | -Similar to a flow but includes the ability to show and use scroll bars. | +expcore.gui.concepts.left |
| slider | -A number picker. | +expcore.gui.concepts.center |
| table | -An invisible container that lays out children in a specific number of columns. | +expcore.gui.concepts.popups | +
| expcore.gui.core | ||
| text_box | -A multi-line text box that supports selection and copy-paste. | +expcore.gui.prototype |
| text_field | -Boxes of text the user can type in. | +expcore.gui.concepts.toolbar | +
| utils.game | +||
| CenterFrames.get_flow(player) | +Gets the center flow for a player | +|
| CenterFrames.clear_flow(player) | +Clears the center flow for a player | +|
| CenterFrames.draw_frame(player, name) | +Draws the center frame for a player, if already open then will do nothing | +|
| CenterFrames.redraw_frame(player, name) | +Draws the center frame for a player, if already open then will destroy it and redraw | +|
| CenterFrames.toggle_frame(player, name[, state]) | +Toggles if the frame is currently open or not, will open if closed and close if open | +|
| CenterFrames.new_frame(permission_name) | +Creates a new center frame define | +|
| CenterFrames._prototype:set_auto_focus([state=true]) | +Sets the frame to be the current active gui when opened and closes all other frames | +|
| CenterFrames._prototype:draw_frame(player) | +Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame) | +|
| CenterFrames._prototype:redraw_frame(player) | +Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame) | +|
| CenterFrames._prototype:toggle_frame(player) | +Toggles if the frame is open, if open it will close it and if closed it will open it | +|
| CenterFrames._prototype:event_handler([action=update]) | +Creates an event handler that will trigger one of its functions, use with Event.add | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| expcore.gui.concepts.toolbar | +|
| expcore.gui.elements.buttons | +|
| mod-gui | +|
| utils.game | +|
| utils.event | +|
| LeftFrames.get_flow(player) | +Gets the left frame flow for a player | +
| LeftFrames.get_frame(name, player) | +Gets one frame from the left flow by its name | +
| LeftFrames.get_open(player) | +Gets all open frames for a player, if non are open it will remove the close all button | +
| LeftFrames.toggle_frame(name, player[, state]) | +Toggles the visibility of a left frame, or sets its visibility state | +
| LeftFrames.new_frame(permission_name) | +Creates a new left frame define | +
| LeftFrames._prototype:set_open_by_default([state=true]) | +Sets if the frame is visible when a player joins, can also be a function to return a boolean | +
| LeftFrames._prototype:set_direction(direction) | +Sets the direction of the frame, either vertical or horizontal | +
| LeftFrames._prototype:_internal_draw(player) | +Creates the gui for the first time, used internally | +
| LeftFrames._prototype:get_frame(player) | +Gets the frame for this define from the left frame flow | +
| LeftFrames._prototype:is_open(player) | +Returns if the player currently has this define visible | +
| LeftFrames._prototype:toggle(player) | +Toggles the visibility of the left frame | +
| LeftFrames._prototype:update(player) | +Updates the contents of the left frame, first tries update callback, other wise will clear and redraw | +
| LeftFrames._prototype:update_all([update_offline=false]) | +Updates the frame for all players, see update | +
| LeftFrames._prototype:redraw(player) | +Redraws the frame by calling on_draw, will always clear the frame | +
| LeftFrames._prototype:redraw_all([update_offline=false]) | +Redraws the frame for all players, see redraw | +
| LeftFrames._prototype:event_handler([action=update]) | +Creates an event handler that will trigger one of its functions, use with Event.add | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.game | +|
| utils.event | +|
| expcore.gui.elements.progress-bar | +|
| expcore.gui.elements.buttons | +|
| mod-gui | +|
| resources.color_presets | +|
| utils.global | +|
| PopupFrames.get_flow(player) | +Gets the left flow that contains the popup frames | +
| PopupFrames.open(define_name, player[, open_time], ...) | +Opens a popup for the player, can give the amount of time it is open as well as params for the draw function | +
| PopupFrames.close_progress | +Progress bar which when depleted will close the popup frame | +
| PopupFrames.close_button | +A button which can be used to close the gui before the timer runs out | +
| PopupFrames.new_popup([name]) | +Creates a new popup frame define | +
| PopupFrames._prototype:set_default_open_time(amount) | +Sets the default open time for the popup, will be used if non is provided with open | +
| PopupFrames._prototype:open(player[, open_time], ...) | +Opens this define for a player, can be given open time and any other params for the draw function | +
| expcore.gui.core | +|
| expcore.gui.elements.buttons | +|
| expcore.roles | +|
| utils.event | +|
| utils.game | +|
| mod-gui | +|
| Toolbar.new_button([name]) | +Adds a new button to the toolbar | +
| Toolbar.add_button(button) | +Adds an existing buttton to the toolbar | +
| Toolbar.update(player) | +Updates the player's toolbar with an new buttons or expected change in auth return | +
| utils.gui | +|
| utils.game | +|
| new_define(prototype[, debug_name]) | +Used to create new element defines from a class prototype, please use the own given by the class | +
| get_define(name[, internal]) | +Gets an element define give the uid, debug name or a copy of the element define | +
| categorize_by_player(element) | +A categorize function to be used with add_store, each player has their own value | +
| categorize_by_force(element) | +A categorize function to be used with add_store, each force has its own value | +
| categorize_by_surface(element) | +A categorize function to be used with add_store, each surface has its own value | +
| draw(name, element) | +Draws a copy of the element define to the parent element, see draw_to | +
| toggle_enabled(element) | +Will toggle the enabled state of an element | +
| toggle_visible(element) | +Will toggle the visiblity of an element | +
| set_padding(element[, up=0][, down=0][, left=0][, right=0]) | +Sets the padding for a gui element | +
| set_padding_style(style[, up=0][, down=0][, left=0][, right=0]) | +Sets the padding for a gui style | +
| create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center']) | +Allows the creation of an alignment flow to place elements into | +
| destroy_if_valid(element) | +Destroies an element but tests for it being present and valid first | +
| create_scroll_table(element, table_size, maximal_height[, name='scroll']) | +Creates a scroll area with a table inside, table can be any size | +
| create_header(element, caption[, tooltip][, right_align][, name='header']) | +Creates a header section with a label and button area | +
| mod-gui | +|
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| Button.new_button([name]) | +Creates a new button element define | +
| Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) | +Adds sprites to a button making it a sprite button | +
| Button._prototype:set_click_filter(filter[, ...]) | +Adds a click / mouse button filter to the button | +
| Button._prototype:set_key_filter(filter[, ...]) | +Adds a control key filter to the button | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| expcore.store | +|
| utils.game | +|
| Checkbox.new_checkbox([name]) | +Creates a new checkbox element define | +
| Checkbox.new_radiobutton([name]) | +Creates a new radiobutton element define, has all functions checkbox has | +
| Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) | +Adds this radiobutton to be an option in the given option set (only one can be true at a time) | +
| Checkbox._prototype_radiobutton:get_store(category, internal) | +Gets the stored value of the radiobutton or the option set if present | +
| Checkbox._prototype_radiobutton:set_store(category, value, internal) | +Sets the stored value of the radiobutton or the option set if present | +
| Checkbox.new_option_set(name, callback, categorize) | +Registers a new option set that can be linked to radiobuttons (only one can be true at a time) | +
| Checkbox.draw_option_set(name, element) | +Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) | +
| Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) | +Sets all radiobutton in a element to false (unless excluded) and can act recursively |
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.game | +|
| ElemButton.new_elem_button([name]) | +Creates a new elem button element define | +
| ElemButton._prototype.set_type | +Sets the type of the elem button, the type is required so this must be called at least once | +
| ElemButton._prototype:set_default(value) | +Sets the default value for the elem button, this may be a function or a string |
| require_concept(concept_name) | -Loads a concept from the concepts file | +expcore.gui.core | |
| require_style(style_name) | -Loads a set of concepts from the styles file | +expcore.gui.prototype | |
| get_concept(name) | -Gets a gui concept from name, id, or its self | +expcore.gui.instances | |
| Prototype:save_as(save_name) | -Used to save the concept to the main gui module to allow access from other files | +utils.game | |
| new_concept([base_concept]) | -Returns a new gui concept, option to provide a base concept to copy properties and draw functions from | +Slider.new_slider([name]) | +Creates a new slider element define |
| draw_concept(concept, parent) | -Used to draw a concept to a parent element | +Slider._prototype:set_range([min][, max]) | +Sets the range of a slider, if not used will use default values for a slider | +
| Slider._prototype:draw_label(element) | +Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player | +||
| Slider._prototype:enable_auto_draw_label([state=true]) | +Enables auto draw of the label, the label will share the same parent element as the slider |
| get_player_from_element(element) | -Gets the player who owns this element | +expcore.gui.core | |
| valid(element) | -Simple check for if an element is valid | +expcore.gui.prototype | |
| destroy(element) | -Destroies and element if it is valid | +utils.game | |
| find(element, ...) | -Finds and returns a gui element if it is valid from a long chain of element names or concepts | +Text.new_text_field([name]) | +Creates a new text field element define |
| exists | -Checks if a gui element exists or not, returns it if found else the path where it failed | +Text.new_text_box([name]) | +Creates a new text box element define |
| toggle_enabled(element) | -Toggles the enabled state of an element | +Text._prototype_box:set_selectable([state=true]) | +Sets the text box to be selectable |
| toggle_visible(element) | -Toggles the visible state of an element | +Text._prototype_box:set_word_wrap([state=true]) | +Sets the text box to have word wrap |
| set_padding(element[, up=0][, down=0][, left=0][, right=0]) | -Sets the padding for a gui element | +Text._prototype_box:set_read_only([state=true]) | +Sets the text box to be read only |
| categorize_by_player(element) | -A categorize function to be used with add_store, each player has their own category | +utils.global | |
| categorize_by_force(element) | -A categorize function to be used with add_store, each force has its own category | +Instances.has_categories(name) | +Returns if a instance group has a categorise function; must be registered |
| categorize_by_surface(element) | -A categorize function to be used with add_store, each surface has its own category | +Instances.is_registered(name) | +Returns if the given name is a registered instance group | +
| Instances.register(name[, categorise]) | +Registers the name of an instance group to allow for storing element instances | +||
| Instances.add_element(name, element) | +Adds an element to the instance group under the correct category; must be registered | +||
| Instances.get_elements_raw(name[, category]) | +Gets all element instances without first removing any invalid ones; used internally and must be registered | +||
| Instances.get_valid_elements(name[, category][, callback]) | +Gets all valid element instances and has the option of running a callback on those that are valid | +||
| Instances.unregistered_add_element(name, category, element) | +A version of add_element that does not require the group to be registered | +||
| Instances.unregistered_get_elements(name, category[, callback]) | +A version of get_elements that does not require the group to be registered |
| Prototype:clone(concept_name) | -Used to copy all the settings from one concept to another and removing links to the orginal | +utils.game | |
| Prototype:define_clone(clone_callback) | -Use to add your own callbacks to the clone function, for example adding to a local table | +expcore.store | |
| Prototype:save_as(save_name) | -Used to save the concept to the main gui module to allow access from other files | +expcore.gui.instances | |
| Prototype:debug(name) | -Sets a debug name that can be used with error handlers | +Constructor.event(event_name) | +Creates a new function to add functions to an event handler |
| Prototype:new_event(event_name[, factorio_event][, event_condition]) | -Adds a new event trigger to the concept which can be linked to a factorio event | +Constructor.extend(new_prototype) | +Extents a prototype with the base functions of all gui prototypes, no metatables |
| Prototype:on_custom_event(handler) | -Adds a custom event handler, replace with the name of the event | +Constructor.store(sync, callback) | +Creates a new function which adds a store to a gui define |
| Prototype:raise_event(event_name[, event={}][, from_factorio=false]) | -Raises a custom event, folowing keys included automaticlly: concept, event name, game tick, player from player_index, element if valid | +Constructor.setter(value_type, key[, second_key]) | +Creates a setter function that checks the type when a value is set |
| Prototype:new_property(property_name[, setter_callback][, default]) | -Adds a new property to the concept, such as caption, tooltip, or some custom property you want to control | +Prototype:uid() | +Gets the uid for the element define |
| Prototype:set_custom_property(value) | -Sets a new value for a property, triggers setter method if provided, replace with property name | +Prototype.debug_name | +Sets a debug alias for the define |
| Prototype:define_draw(draw_callback) | -Used to define how the concept is turned into an ingame element or "instance" as we may refer to them | +Prototype.set_caption | +Sets the caption for the element define |
| Prototype:draw(parent_element[, override_name]) | -Calls all the draw functions in order to create this concept in game; will also store and sync the instance if stores are used | +Prototype.set_tooltip | +Sets the tooltip for the element define | +
| Prototype.set_pre_authenticator | +Sets an authenticator that blocks the draw function if check fails | +||
| Prototype.set_post_authenticator | +Sets an authenticator that disables the element if check fails | +||
| Prototype.on_draw | +Registers a callback to the on_draw event | +||
| Prototype.on_style_update | +Registers a callback to the on_style_update event | +||
| Prototype:set_style(style[, callback]) | +Sets the style for the element define | +||
| Prototype:set_embedded_flow(state) | +Sets the element to be drawn inside a nameless flow, can be given a name using a function | +||
| Prototype:raise_event(event_name, ...) | +Raises a custom event for this define, any number of params can be given | +||
| Prototype:draw_to(element) | +The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions | +||
| Prototype:get_store(category) | +Gets the value in this elements store, category needed if categorize function used | +||
| Prototype:set_store(category, value) | +Sets the value in this elements store, category needed if categorize function used | +||
| Prototype:clear_store([category]) | +Sets the value in this elements store to nil, category needed if categorize function used |
| Prototype:define_instance_store([category_callback]) | -Adds an instance store to the concept; when a new instance is made it is stored so you can access it later | +expcore.gui |
| Prototype.get_instances([category]) | -Gets all insatnces in a category, category may be nil to return all | +expcore.common |
| Prototype.add_instance(element[, category]) | -Adds an instance to this concept, used automatically during concept:draw | +resources.color_presets |
| Prototype.update_instances([category], update_callback) | -Applies an update function to all instances, simialr use to what table.forEach would be | -
| Prototype:define_data_store([category_callback]) | -Adds a data store to this concept which allows you to store synced/percistent data between instances | +utils.event |
| Prototype.get_data([category]) | -Gets the data that is stored for this category | -|
| Prototype.set_data([category], value) | -Sets the data that is stored for this category | -|
| Prototype.clear_data([category]) | -Clears the data that is stored for this category | -|
| Prototype.update_data([category], update_callback) | -Updates the data that is stored for this category | -
| Prototype:define_combined_store([category_callback], sync_callback) | -Used to add a both instance and data store which are linked together, new instances are synced to the current value, changing the stored value will change all instances | -
| Prototype.sync_instance(element) | -Will sync an instance to match the stored value based on the given sync callback | -
| run_tests(player[, category]) | -Runs a set of gui tests to ensure that the system is working | +expcore.store |
Clickable elements that fire on_gui_click when clicked.
- - Properties / Events: - --- Making a basic button
-local basic_button =
-Gui.new_concept('button')
-:set_caption('Basic Button')
-:set_tooltip('Basic button')
-:on_click(function(event)
- event.player.print('You pressed basic button!')
-end)
- -- Making a sprite button
-local sprite_button =
-Gui.new_concept('button')
-:set_sprite('utility/warning_icon')
-:set_tooltip('Sprite button')
-:on_click(function(event)
- event.player.print('You pressed sprite button!')
-end)
Clickable elements with a cross in the middle that can be turned off or on.
- - Properties / Events: - --- Making a basic checkbox
-local basic_checkbox =
-Gui.new_concept('checkbox')
-:set_caption('Basic Checkbox')
-:set_tooltip('Basic checkbox')
-:on_state_changed(function(event)
- event.player.print('Basic checkbox is now: '..tostring(event.element.state))
-end)
A drop down list of other elements.
- - Properties / Events: - --- Making a basic dropdown
-local static_dropdown =
-Gui.new_concept('dropdown')
-:set_static_items{'Option 1','Option 2','Option 3'}
-:on_selection_changed(function(event)
- local value = Gui.get_dropdown_value(event.element)
- event.player.print('Static dropdown is now: '..value)
-end)
- -- Making a dropdown with dynamic items, example is name of online players
-local dynamic_dropdown =
-Gui.new_concept('dropdown')
-:set_dynamic_items(function(element)
- local items = {}
- for _,player in pairs(game.connected_players) do
- items[#items+1] = player.name
- end
- return items
-end)
-:on_selection_changed(function(event)
- local value = Gui.get_dropdown_value(event.element)
- event.player.print('Dynamic dropdown is now: '..value)
-end)
A button that lets the player pick one of an: item, entity, tile, or signal similar to the filter-select window.
- - Properties / Events: - --- Making a basic elem button
-local basic_elem_button =
-Gui.new_concept('elem_button')
-:on_selection_changed(function(event)
- event.player.print('Basic elem button is now: '..event.element.elem_value)
-end)
A empty widget that just exists.
-The root GUI element screen is an empty-widget.
- Properties / Events: - --- Making a draggable space styled widget
-local draggable_space =
-Gui.new_concept('empty')
-:set_style('draggable_space')
Invisible containers that lay out children either horizontally or vertically.
-The root GUI elements (top, left and center; see LuaGui) are flows.
- Properties / Events: - --- Making a basic flow, contains a label with hello world
-local basic_flow =
-Gui.new_concept('flow')
-:define_draw(function(properties,parent,element)
- element.add{
- type = 'label',
- caption = 'Hello, World!'
- }
-end)
Grey semi-transparent boxes that contain other elements.
-They have a caption, and, just like flows, they lay out children either horizontally or vertically.
- Properties / Events: - --- Making a basic frame, contains a label with hello world
-local basic_frame =
-Gui.new_concept('frame')
-:set_title('Basic Frame')
-:define_draw(function(properties,parent,element)
- element.add{
- type = 'label',
- caption = 'Hello, World!'
- }
-end)
A piece of text.
- - Properties / Events: - --- Making a basic label
-local basic_label =
-Gui.new_concept('label')
-:set_caption('Hello, World!')
A vertical or horizontal line.
- - Properties / Events: - --- Making a basic frame, contains a label with hello world
-local basic_line =
-Gui.new_concept('line')
Indicate progress by displaying a partially filled bar.
- - Properties / Events: - --- Making a basic progress bar, will increase when pressed then will reset when full
-local basic_progress_bar =
-Gui.new_concept('progress_bar')
-:set_tooltip('Basic progress bar')
-:set_maximum(5)
-:new_event('on_click',defines.events.on_gui_click)
-:on_click(function(event)
- event.concept:increment(event.element)
-end)
-:set_delay_completion(true)
-:on_completion(function(event)
- event.concept:reset(event.element)
-end)
Similar to a flow but includes the ability to show and use scroll bars.
- - Properties / Events: - --- Making a basic flow, contains a label with hello world
-local basic_scroll =
-Gui.new_concept('scroll')
-:define_draw(function(properties,parent,element)
- element.style.hieght = 50
- for i = 1,10 do
- element.add{
- type = 'label',
- caption = i
- }
- end
-end)
A number picker.
- - Properties / Events: - --- Making a basic slider
-local basic_slider =
-Gui.new_concept('slider')
-:set_range(1,10)
-:on_value_changed(function(event)
- event.player.print('Basic slider is now: '..event.element.slider_value)
-end)
- -- Making a discrete_slider
-local discrete_slider =
-Gui.new_concept('slider')
-:set_range(1,10)
-:set_value_step(1)
-:set_discrete_slider(true)
-:on_value_changed(function(event)
- event.player.print('Interval slider is now: '..event.element.slider_value)
-end)
An invisible container that lays out children in a specific number of columns.
-Column width is given by the largest element contained in that row.
- Properties / Events: - --- Making a basic table, contains 25 labels
-local basic_table =
-Gui.new_concept('table')
-:set_column_count(5)
-:define_draw(function(properties,parent,element)
- for i = 1,25 do
- element.add{
- type = 'lable',
- caption = i
- }
- end
-end)
-
-
-
- A multi-line text box that supports selection and copy-paste.
- - - - Properties / Events: - --- Making a text box
-local basic_text_box =
-Gui.new_concept('text_box')
-:set_default('I am the text that will show in the text box')
- -- Making a text box which can be edited
-local editible_text_box =
-Gui.new_concept('text_box')
-:set_is_read_only(false)
-:set_default('I am the text that will show in the text box')
-:on_confirmation(function(event)
- event.player.print('Editible text box is now: '..event.element.text)
-end)
-
-
-
- Boxes of text the user can type in.
- - - - Properties / Events: - --- Making a text field
-local basic_text_field =
-Gui.new_concept('text_field')
-:on_confirmation(function(event)
- event.player.print('Basic text field is now: '..event.element.text)
-end)
- -- Making a text field which will clear on right click and un forcus on confirmation
-local better_text_field =
-Gui.new_concept('text_field')
-:set_clear_on_rmb(true)
-:set_lose_forcus(true)
-:on_confirmation(function(event)
- event.player.print('Better text field is now: '..event.element.text)
-end)
- -- Making a decimal input
-local decimal_text_field =
-Gui.new_concept('text_field')
-:set_is_decimal(true)
-:on_confirmation(function(event)
- event.player.print('Decimal text field is now: '..event.element.text)
-end)
- Selects the index of a dropdown with this value
+ + + + + + + + + + + + + + + +Gets the center flow for a player
@@ -2383,29 +1571,13 @@ Gui.new_concept('text_field')Clears the center flow for a player
+ + + + Parameters: + +Draws the center frame for a player, if already open then will do nothing
+ + + + Parameters: + +Draws the center frame for a player, if already open then will destroy it and redraw
+ + + + Parameters: + +Toggles if the frame is currently open or not, will open if closed and close if open
+ + + + Parameters: + +-- Selecting the item with the value 'foo'
-Gui.set_dropdown_value(element,'foo')
-
-
-
- Gets the selected item value of a dropdown
- - - - Parameters: - --- Getting the selected value
-local selected_value = Gui.get_dropdown_value(element)
-
-
-
- Adds the given items into the list of items for this dropdown
- - - - Parameters: - -Creates a new center frame define
+ + + + Parameters: + +-- Add the items 'foo' and 'bar' to the end
-Gui.add_dropdown_items(element,{'foo','bar'})
- -- Add the items 'foo' and 'bar' to the start
-Gui.add_dropdown_items(element,1,{'foo','bar'})
-
- Will increase the progress of a progress bar based on this concept, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances
+Sets the frame to be the current active gui when opened and closes all other frames
@@ -2617,31 +1971,15 @@ Gui.new_concept('text_field')-- Incrementing progress bar with no instance store
-local new_value = progress_bar:increment(element)
- -- Incrementing progress bar with an instance store
-progress_bar:increment(category)
Will decrease the progress of a progress bar based on this concept, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances
+Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
@@ -2696,92 +2022,13 @@ Gui.new_concept('text_field')-- Decrementing progress bar with no instance store
-local new_value = progress_bar:decrement(element)
- -- Decrementing progress bar with an instance store
-progress_bar:decrement(category)
-
-
-
- Resets the progress back to 0% for this element, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances
- - - - Parameters: - --- Reseting a progress bar with no instance store
-local new_value = progress_bar:reset(element)
- -- Reseting a progress bar with an instance store
-progress_bar:reset(category)
-
-
-
- Increment any progress bar by the given percentage
- - - - Parameters: - -Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)
+ + + + Parameters: + +Toggles if the frame is open, if open it will close it and if closed it will open it
+ + + + Parameters: + +-- Increment any progress bar by 10%
-Gui.increment_progress_bar(element,0.1)
Decrement any progress bar by the given percentage
+Creates an event handler that will trigger one of its functions, use with Event.add
@@ -2914,31 +2193,243 @@ Gui.new_concept('text_field')Gets the left frame flow for a player
+ + + + Parameters: + +-- Decrement any progress bar by 10%
-Gui.decrement_progress_bar(element,0.1)
-
-
-
-
- Loads a concept from the concepts file
- - - - Parameters: - --- Load a base concept
-Gui.require_concept('frame') --- @dep Gui.concept.frame
Loads a set of concepts from the styles file
- - - - Parameters: - --- Load a base style
-Gui.require_concept('expgaming') --- @dep Gui.style.frame
-
-
-
- Gets a gui concept from name, id, or its self
+Gets one frame from the left flow by its name
@@ -3104,9 +2483,25 @@ Gui.new_concept('text_field') : - (string, number or table) + (string) - the name, id, or the concept you want to get + the name of the gui frame to get + + + + + + + +-- Getting a gui concept
-local button = Gui.get_concept('Button')
Used to save the concept to the main gui module to allow access from other files
+Gets all open frames for a player, if non are open it will remove the close all button
@@ -3153,69 +2552,102 @@ Gui.new_concept('text_field')Toggles the visibility of a left frame, or sets its visibility state
+ + + + Parameters: + +-- Save a concept to allow access in another file
-button:save_as('button')
- -- Access concept after being saved
-Gui.concepts.button
-Gui.get_concept('button')
-
-
-
- Returns a new gui concept, option to provide a base concept to copy properties and draw functions from
- - - - Parameters: - --- Making a new button, see module usage
-local button = Gui.new_concept('Button')
Used to draw a concept to a parent element
+Creates a new left frame define
@@ -3263,29 +2699,174 @@ Gui.get_concept('button')Sets if the frame is visible when a player joins, can also be a function to return a boolean
+ + + + Parameters: + +Sets the direction of the frame, either vertical or horizontal
+ + + + Parameters: + +Creates the gui for the first time, used internally
+ + + + Parameters: + +-- Drawing a new element
-Gui.draw_concept('Button',element)
+
+
+
+ Gets the frame for this define from the left frame flow
+ + + + Parameters: + +Returns if the player currently has this define visible
+ + + + Parameters: + +Toggles the visibility of the left frame
+ + + + Parameters: + +Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
+ + + + Parameters: + +Updates the frame for all players, see update
+ + + + Parameters: + +Redraws the frame by calling on_draw, will always clear the frame
+ + + + Parameters: + +Redraws the frame for all players, see redraw
+ + + + Parameters: + +Creates an event handler that will trigger one of its functions, use with Event.add
+ + + + Parameters: + +Gets the player who owns this element
+ + + + + + + + + + + + + + + +Gets the left flow that contains the popup frames
@@ -3342,73 +3569,13 @@ Gui.get_concept('button')-- Getting the player of an element
-local player = Gui.get_player_from_element(element)
-
-
-
- Simple check for if an element is valid
- - - - Parameters: - --- Return if not valid
-if not Gui.valid(element) then return end
Destroies and element if it is valid
+Opens a popup for the player, can give the amount of time it is open as well as params for the draw function
@@ -3462,73 +3626,29 @@ Gui.get_concept('button')-- Destoring an element
-Gui.destroy(element)
-
-
-
- Finds and returns a gui element if it is valid from a long chain of element names or concepts
- - - - Parameters: - -Progress bar which when depleted will close the popup frame
+ + + + + + + + + + + + + + + + +A button which can be used to close the gui before the timer runs out
+ + + + + + + + + + + + + + + + +Creates a new popup frame define
+ + + + Parameters: + +Sets the default open time for the popup, will be used if non is provided with open
+ + + + Parameters: + +Opens this define for a player, can be given open time and any other params for the draw function
+ + + + Parameters: + +Adds a new button to the toolbar
+ + + + Parameters: + +Adds an existing buttton to the toolbar
+ + + + Parameters: + +Updates the player's toolbar with an new buttons or expected change in auth return
+ + + + Parameters: + +Used to create new element defines from a class prototype, please use the own given by the class
+ + + + Parameters: + +Gets an element define give the uid, debug name or a copy of the element define
+ + + + Parameters: + +A categorize function to be used with add_store, each player has their own value
+ + + + Parameters: + +-- Getting the center gui
-local exists, center = Gui.find(player,'gui','center')
Checks if a gui element exists or not, returns it if found else the path where it failed
+A categorize function to be used with add_store, each force has its own value
+ Parameters:A categorize function to be used with add_store, each surface has its own value
+ + + + Parameters: + +Draws a copy of the element define to the parent element, see draw_to
+ + + + Parameters: + +-- Getting the center gui
-local exists, center = Gui.exists(player,'gui','center')
@@ -3671,7 +4733,7 @@ Gui.get_concept('button')
Toggles the enabled state of an element
+Will toggle the enabled state of an element
@@ -3691,7 +4753,7 @@ Gui.get_concept('button') (LuaGuiElement) - the element that you want to toggle the enabled state of + the gui element to toggle @@ -3705,7 +4767,7 @@ Gui.get_concept('button')-- Toggle the enabled state of an element
-Gui.toggle_enabled(element)
@@ -3731,7 +4790,7 @@ Gui.get_concept('button')
Toggles the visible state of an element
+Will toggle the visiblity of an element
@@ -3751,7 +4810,7 @@ Gui.get_concept('button') (LuaGuiElement) - the element that you want to toggle the visible state of + the gui element to toggle @@ -3765,7 +4824,7 @@ Gui.get_concept('button')-- Toggle the visible state of an element
-Gui.toggle_visible(element)
@@ -3825,9 +4881,9 @@ Gui.get_concept('button')
:
- (number or boolean)
+ (number)
- the amount of padding on the top, true leaves unchanged
+ the amount of padding on the top
(default: 0)
@@ -3842,9 +4898,9 @@ Gui.get_concept('button')
:
- (number or boolean)
+ (number)
- the amount of padding on the bottom, true leaves unchanged
+ the amount of padding on the bottom
(default: 0)
@@ -3859,9 +4915,9 @@ Gui.get_concept('button')
:
- (number or boolean)
+ (number)
- the amount of padding on the left, true leaves unchanged
+ the amount of padding on the left
(default: 0)
@@ -3876,9 +4932,9 @@ Gui.get_concept('button')
:
- (number or boolean)
+ (number)
- the amount of padding on the right, true leaves unchanged
+ the amount of padding on the right
(default: 0)
@@ -3896,368 +4952,537 @@ Gui.get_concept('button')
- Usage:
- -- Remove all padding of an element
-Gui.set_padding(element)
- -- Remove side padding but keep vertical padding
-Gui.set_padding(element,true,true)
- -- Remove all padding but set right to 2
-Gui.set_padding(element,false,false,false,2)
+
+
+
+ Sets the padding for a gui style
+ + + + Parameters: + +Allows the creation of an alignment flow to place elements into
+ + + + Parameters: + +Destroies an element but tests for it being present and valid first
+ + + + Parameters: + +Creates a scroll area with a table inside, table can be any size
+ + + + Parameters: + +Creates a header section with a label and button area
+ + + + Parameters: + +A categorize function to be used with add_store, each player has their own category
- - Parameters: - --- Storing data on a per player basis, can be used with instances
-Gui.get_concept('CustomButton')
-:define_data_store(Gui.categorize_by_player)
-
-
-
- A categorize function to be used with add_store, each force has its own category
- - - - Parameters: - --- Storing data on a per force basis, can be used with instances
-Gui.get_concept('CustomButton')
-:define_data_store(Gui.categorize_by_force)
-
-
-
- A categorize function to be used with add_store, each surface has its own category
- - - - Parameters: - --- Storing data on a per surface basis, can be used with instances
-Gui.get_concept('CustomButton')
-:define_data_store(Gui.categorize_by_surface)
-
-
-
-
- Used to copy all the settings from one concept to another and removing links to the orginal
- - - - Parameters: - --- Clones the base Button concept to make a alternative button
-local custom_button =
-Gui.get_concept(Gui.concepts.button):clone()
-
-
-
- Use to add your own callbacks to the clone function, for example adding to a local table
- - - - Parameters: - --- Adding concept to a local table
-local buttons = {}
-local button =
-Gui.get_concept('Button')
-:define_clone(function(concept)
- buttons[concept.name] = concept
-end)
-
-
-
- Used to save the concept to the main gui module to allow access from other files
- - - - Parameters: - --- Save a concept to allow access in another file
-button:save_as('button')
- -- Access concept after being saved
-Gui.concepts.button
-Gui.get_concept('button')
Sets a debug name that can be used with error handlers
+ + + + + + + + + + + + + + + +Creates a new button element define
@@ -4307,7 +5576,539 @@ Gui.get_concept('button') (string) - the name that will be used in error messages + the optional debug name that can be added + + (optional) + + + + + + + + + Returns: +Adds sprites to a button making it a sprite button
+ + + + Parameters: + +Adds a click / mouse button filter to the button
+ + + + Parameters: + +Adds a control key filter to the button
+ + + + Parameters: + +