mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 12:31:41 +09:00
Doc Changes
This commit is contained in:
@@ -13,6 +13,22 @@ local Gui = require 'expcore.gui.core'
|
||||
@tparam ?string|Concepts.LocalisedString caption the message that is shown on the button
|
||||
@tparam ?string|Concepts.LocalisedString tooltip the tooltip that shows when a player hovers over the button
|
||||
@tparam SpritePath sprite upto three sprites in the order: default, hovered, clicked
|
||||
@usage-- Making a basic button
|
||||
local basic_button =
|
||||
Gui.clone_concept('button','basic_button')
|
||||
:set_caption('Basic Button')
|
||||
:set_tooltip('Basic button')
|
||||
:on_click(function(event)
|
||||
event.player.print('You pressed basic button!')
|
||||
end)
|
||||
@usage-- Making a sprite button
|
||||
local sprite_button =
|
||||
Gui.clone_concept('button','sprite_button')
|
||||
:set_sprite('utility/warning_icon')
|
||||
:set_tooltip('Sprite button')
|
||||
:on_click(function(event)
|
||||
event.player.print('You pressed sprite button!')
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('button')
|
||||
:new_event('on_click',defines.events.on_gui_click)
|
||||
|
||||
@@ -11,6 +11,14 @@ local Gui = require 'expcore.gui.core'
|
||||
@tparam ?string|Concepts.LocalisedString caption the message that is shown next to the checkbox
|
||||
@tparam ?string|Concepts.LocalisedString tooltip the tooltip that shows when a player hovers over the checkbox
|
||||
@tparam boolean use_radio setting to true will use radio buttons rather than checkboxs
|
||||
@usage-- Making a basic checkbox
|
||||
local basic_checkbox =
|
||||
Gui.clone_concept('checkbox','basic_checkbox')
|
||||
:set_caption('Basic Checkbox')
|
||||
:set_tooltip('Basic checkbox')
|
||||
:on_state_change(function(event)
|
||||
event.player.print('Basic checkbox is now: '..tostring(event.element.state))
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('checkbox')
|
||||
:new_event('on_state_change',defines.events.on_gui_checked_state_changed)
|
||||
|
||||
@@ -13,6 +13,30 @@ local array_insert = ext_require('expcore.common','array_insert')
|
||||
@tparam boolean use_list_box when true a list box will be used rather than a dropdown menu
|
||||
@tparam ?nil|table static_items when called with a table the values will be added as items for the dropdown, if called with nil then all items are cleared
|
||||
@tparam function dynamic_items the given function will be called to return a list of items and optional start index to add items to the dropdown when it is first drawn
|
||||
@usage-- Making a basic dropdown
|
||||
local static_dropdown =
|
||||
Gui.clone_concept('dropdown','static_dropdown')
|
||||
:set_static_items{'Option 1','Option 2','Option 3'}
|
||||
:on_selection_change(function(event)
|
||||
local value = Gui.get_dropdown_value(event.element)
|
||||
event.player.print('Static dropdown is now: '..value)
|
||||
end)
|
||||
@usage-- Making a dropdown with dynamic items, example is name of online players
|
||||
local dynamic_dropdown =
|
||||
Gui.clone_concept('dropdown','dynamic_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_change(function(event)
|
||||
local value = Gui.get_dropdown_value(event.element)
|
||||
event.player.print('Dynamic dropdown is now: '..value)
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('dropdown')
|
||||
:new_event('on_selection_change',defines.events.on_gui_selection_state_changed)
|
||||
|
||||
@@ -8,6 +8,16 @@ local Gui = require 'expcore.gui.core'
|
||||
--[[-- The basic frame element
|
||||
@element frame
|
||||
@tparam ?string|Concepts.LocalisedString title the title that will show in the frame
|
||||
@usage-- Making a basic frame, contains a label with hello world
|
||||
local basic_frame =
|
||||
Gui.clone_concept('dropdown','basic_frame')
|
||||
:set_title('Basic Frame')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element.add{
|
||||
type = 'label',
|
||||
caption = 'Hello, World!'
|
||||
}
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('frame')
|
||||
:new_property('title')
|
||||
|
||||
Reference in New Issue
Block a user