mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Added some structor concepts
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The basic button element
|
||||
--[[-- Clickable elements that fire on_gui_click when clicked.
|
||||
@element button
|
||||
@param on_click fired when the player clicks the button
|
||||
@param on_left_click fired when the player clicks with the left mouse button
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The basic checkbox element
|
||||
--[[-- Clickable elements with a cross in the middle that can be turned off or on.
|
||||
@element checkbox
|
||||
@param on_state_changed fired when the state of the element is changed
|
||||
@tparam ?string|Concepts.LocalisedString caption the message that is shown next to the checkbox
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
local Gui = require 'expcore.gui.core'
|
||||
local array_insert = ext_require('expcore.common','array_insert')
|
||||
|
||||
--[[-- The basic dropdown element
|
||||
--[[-- A drop down list of other elements.
|
||||
@element dropdown
|
||||
@param on_selection_changed fired when the selected value is changed
|
||||
@tparam ?string|Concepts.LocalisedString|function default the option which is selected by default, or a function which returns the default
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The basic dropdown element
|
||||
--[[-- A button that lets the player pick one of an: item, entity, tile, or signal similar to the filter-select window.
|
||||
@element elem_button
|
||||
@param on_selection_changed fired when the selected value is changed
|
||||
@tparam ?string|Concepts.SignalID|function default the option which is selected by default, or a function which returns the default
|
||||
|
||||
26
expcore/gui/concepts/empty.lua
Normal file
26
expcore/gui/concepts/empty.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- A empty widget that just exists. The root GUI element screen is an empty-widget.
|
||||
@element empty
|
||||
@tparam string style the style that the element will have
|
||||
@usage-- Making a draggable space styled widget
|
||||
local draggable_space =
|
||||
Gui.clone_concept('empty','draggable_space')
|
||||
:set_style('draggable_space')
|
||||
]]
|
||||
Gui.new_concept('empty')
|
||||
:new_property('style')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element = parent.add{
|
||||
name = properties.name,
|
||||
type = 'empty-widget',
|
||||
style = properties.style
|
||||
}
|
||||
|
||||
return element
|
||||
end)
|
||||
32
expcore/gui/concepts/flow.lua
Normal file
32
expcore/gui/concepts/flow.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- Invisible containers that lay out children either horizontally or vertically. The root GUI elements (top, left and center; see LuaGui) are flows.
|
||||
@element flow
|
||||
@tparam string direction the direction that children will be added
|
||||
@usage-- Making a basic flow, contains a label with hello world
|
||||
local basic_flow =
|
||||
Gui.clone_concept('flow','basic_flow')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element.add{
|
||||
type = 'label',
|
||||
caption = 'Hello, World!'
|
||||
}
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('flow')
|
||||
:new_property('direction')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element = parent.add{
|
||||
name = properties.name,
|
||||
type = 'flow',
|
||||
caption = properties.title,
|
||||
direction = properties.direction
|
||||
}
|
||||
|
||||
return element
|
||||
end)
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The basic frame element
|
||||
--[[-- Grey semi-transparent boxes that contain other elements. They have a caption, and, just like flows, they lay out children either horizontally or vertically.
|
||||
@element frame
|
||||
@tparam ?string|Concepts.LocalisedString title the title that will show in the frame
|
||||
@tparam string direction the direction that children will be added
|
||||
@usage-- Making a basic frame, contains a label with hello world
|
||||
local basic_frame =
|
||||
Gui.clone_concept('dropdown','basic_frame')
|
||||
Gui.clone_concept('frame','basic_frame')
|
||||
:set_title('Basic Frame')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element.add{
|
||||
|
||||
29
expcore/gui/concepts/label.lua
Normal file
29
expcore/gui/concepts/label.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- A piece of text.
|
||||
@element frame
|
||||
@tparam ?string|Concepts.LocalisedString caption the caption that will show in the label
|
||||
@tparam ?string|Concepts.LocalisedString description the description that will show on the label
|
||||
@usage-- Making a basic label
|
||||
local basic_label =
|
||||
Gui.clone_concept('label','basic_label')
|
||||
:set_caption('Hello, World!')
|
||||
]]
|
||||
Gui.new_concept('label')
|
||||
:new_property('caption')
|
||||
:new_property('description')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element = parent.add{
|
||||
name = properties.name,
|
||||
type = 'label',
|
||||
caption = properties.caption,
|
||||
description = properties.description
|
||||
}
|
||||
|
||||
return element
|
||||
end)
|
||||
25
expcore/gui/concepts/line.lua
Normal file
25
expcore/gui/concepts/line.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- A vertical or horizontal line.
|
||||
@element line
|
||||
@tparam string direction the direction that children will be added
|
||||
@usage-- Making a basic frame, contains a label with hello world
|
||||
local basic_line =
|
||||
Gui.clone_concept('line','basic_line')
|
||||
]]
|
||||
Gui.new_concept('line')
|
||||
:new_property('direction')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element = parent.add{
|
||||
name = properties.name,
|
||||
type = 'line',
|
||||
direction = properties.direction
|
||||
}
|
||||
|
||||
return element
|
||||
end)
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The basic checkbox element
|
||||
--[[-- Indicate progress by displaying a partially filled bar.
|
||||
@element progress_bar
|
||||
@param on_completion fired when increment reaches the maxium value set by set_maximum
|
||||
@tparam ?string|Concepts.LocalisedString tooltip the tooltip that will show for this element
|
||||
|
||||
37
expcore/gui/concepts/scroll.lua
Normal file
37
expcore/gui/concepts/scroll.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- Similar to a flow but includes the ability to show and use scroll bars.
|
||||
@element scroll
|
||||
@tparam string horizontal_scroll the horizontal scroll policy for this scroll pane
|
||||
@tparam string vertical_scroll the vertical scroll policy for this scroll pane
|
||||
@usage-- Making a basic flow, contains a label with hello world
|
||||
local basic_scroll =
|
||||
Gui.clone_concept('scroll','basic_scroll')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element.style.hieght = 50
|
||||
for i = 1,10 do
|
||||
element.add{
|
||||
type = 'label',
|
||||
caption = i
|
||||
}
|
||||
end
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('scroll')
|
||||
:new_property('horizontal_scroll')
|
||||
:new_property('vertical_scroll')
|
||||
:define_draw(function(properties,parent,element)
|
||||
element = parent.add{
|
||||
name = properties.name,
|
||||
type = 'scroll-pane',
|
||||
horizontal_scroll_policy = properties.horizontal_scroll,
|
||||
vertical_scroll_policy = properties.vertical_scroll
|
||||
}
|
||||
|
||||
return element
|
||||
end)
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The basic slider element
|
||||
--[[-- A number picker.
|
||||
@element slider
|
||||
@param on_value_changed fired when the value of the slider is changed
|
||||
@tparam number value_step the minimum amount by which the value of the slider can be changed
|
||||
|
||||
48
expcore/gui/concepts/table.lua
Normal file
48
expcore/gui/concepts/table.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- 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.
|
||||
@element table
|
||||
@tparam ?number|function column_count the column count of the table or a function that returns the count being given then parent element
|
||||
@tparam boolean vertical_lines when true vertical lines will be drawn on the table
|
||||
@tparam boolean horizontal_lines when true horizontal lines will be drawn on the table
|
||||
@tparam boolean header_lines when true horizontal lines will be drawn under the first row
|
||||
@tparam boolean vertical_centering when true element will be vertically centered with in the table
|
||||
@usage-- Making a basic table, contains 25 labels
|
||||
local basic_table =
|
||||
Gui.clone_concept('table','basic_table')
|
||||
:set_column_count(5)
|
||||
:define_draw(function(properties,parent,element)
|
||||
for i = 1,25 do
|
||||
element.add{
|
||||
type = 'lable',
|
||||
caption = i
|
||||
}
|
||||
end
|
||||
end)
|
||||
]]
|
||||
Gui.new_concept('table')
|
||||
:new_property('column_count')
|
||||
:new_property('vertical_lines')
|
||||
:new_property('horizontal_lines')
|
||||
:new_property('header_lines')
|
||||
:new_property('vertical_centering')
|
||||
:define_draw(function(properties,parent,element)
|
||||
local column_count = Gui.resolve_property(properties.column_count,parent)
|
||||
|
||||
element = parent.add{
|
||||
name = properties.name,
|
||||
type = 'table',
|
||||
column_count = column_count,
|
||||
draw_vertical_lines = properties.vertical_lines,
|
||||
draw_horizontal_lines = properties.horizontal_lines,
|
||||
draw_horizontal_line_after_headers = properties.header_lines,
|
||||
vertical_centering = properties.vertical_centering
|
||||
}
|
||||
|
||||
return element
|
||||
end)
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The text box element
|
||||
--[[-- A multi-line text box that supports selection and copy-paste.
|
||||
@element text_box
|
||||
@param on_text_changed fired when the text within the text box is changed
|
||||
@tparam ?string|Concepts.LocalisedString tooltip the tooltip that shows when a player hovers over the text box
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
local Gui = require 'expcore.gui.core'
|
||||
|
||||
--[[-- The text field element
|
||||
--[[-- Boxes of text the user can type in.
|
||||
@element text_field
|
||||
@param on_text_changed fired when the text within the text field is changed
|
||||
@param on_confirmation fired when the player presses enter with the text field forcused
|
||||
|
||||
Reference in New Issue
Block a user