Merge branch 'core'

This commit is contained in:
Cooldude2606
2018-05-20 18:41:32 +01:00
6 changed files with 15 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ center._center = {}
function center.add(obj)
if not is_type(obj,'table') then return end
if not is_type(obj.name,'string') then return end
verbose('Created Center Gui: '..name)
setmetatable(obj,{__index=center._center})
obj.tabs = {}
obj._tabs = {}
@@ -167,6 +168,7 @@ end
-- @tparam function callback this is called when button is pressed with function(root_frame)
-- @return self to allow chaining of _center:add_tab
function center._center:add_tab(name,caption,tooltip,callback)
verbose('Created Tab: '..self.name..'/'..name)
self._tabs[self.name..'_'..name] = callback
self.tabs[name] = Gui.inputs.add{
type='button',

View File

@@ -91,15 +91,16 @@ function inputs.add(obj)
if not is_type(obj.type,'string') then return end
local type = obj.type
if type == 'button' or
type == 'sprite-button' or
type == 'choose-elem-button' or
type == 'checkbox' or
type == 'radiobutton' or
type == 'textfield' or
type == 'text-box' or
type == 'slider' or
type == 'drop-down'
type == 'sprite-button' or
type == 'choose-elem-button' or
type == 'checkbox' or
type == 'radiobutton' or
type == 'textfield' or
type == 'text-box' or
type == 'slider' or
type == 'drop-down'
then else return end
verbose('Created Input: '..obj.name..' ('..obj.type..')')
if obj.type == 'button' or obj.type == 'sprite-button' then obj.style = mod_gui.button_style end
obj.draw_data = table.deepcopy(obj)
obj.data = {}

View File

@@ -21,6 +21,7 @@ end
function left.add(obj)
if not is_type(obj,'table') then return end
if not is_type(obj.name,'string') then return end
verbose('Created Left Gui: '..obj.name)
setmetatable(obj,{__index=left._left})
Gui._add_data('left',obj.name,obj)
Gui.toolbar.add(obj.name,obj.caption,obj.tooltip,obj.toggle)

View File

@@ -29,6 +29,7 @@ end
function popup.add(obj)
if not is_type(obj,'table') then return end
if not is_type(obj.name,'string') then return end
verbose('Created Popup Gui: '..obj.name)
setmetatable(obj,{__index=popup._popup})
local name = obj.name; obj.name = nil
Gui._add_data('popup',name,obj)

View File

@@ -17,6 +17,7 @@ local toolbar = {}
-- @tparam function callback the function which is called on_click
-- @treturn table the button object that was made
function toolbar.add(name,caption,tooltip,callback)
verbose('Created Toolbar Button: '..name)
local button = Gui.inputs.add{type='button',name=name,caption=caption,tooltip=tooltip}
button:on_event(Gui.inputs.events.click,callback)
Gui._add_data('toolbar',name,button)

View File

@@ -135,6 +135,7 @@ commands.add_command = function(name, description, inputs, event)
if command_calls[name] then return end
if not is_type(name,'string') then return end
if not is_type(event,'function') then return end
verbose('Created Command: '..name)
local description = is_type(description,'string') and description or 'No Description'
local inputs = is_type(inputs,'table') and inputs or {'parameter',true}
command_data[name] = {