Buttons for client options

This commit is contained in:
Eduardo Bart
2013-02-06 17:35:59 -02:00
parent cf77df05ca
commit 7ece0ed8c7
11 changed files with 63 additions and 12 deletions

View File

@@ -284,3 +284,7 @@ end
function addTab(name, panel, icon)
optionsTabBar:addTab(name, panel, icon)
end
function addButton(name, func, icon)
optionsTabBar:addButton(name, func, icon)
end

View File

@@ -60,6 +60,18 @@ function UITabBar:addTab(text, panel, icon)
return tab
end
function UITabBar:addButton(text, func, icon)
local button = g_ui.createWidget(self:getStyleName() .. 'Button', self.buttonsPanel)
button:setText(text)
local style = {}
style['icon-source'] = icon
button:mergeStyle(style)
button.onClick = func
return button
end
function UITabBar:removeTab(tab)
local index = table.find(self.tabs, tab)
if index == nil then return end

View File

@@ -40,7 +40,7 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
textEdit:setText(text)
textEdit:setEditable(writeable)
textEdit:setCursorVisible(writeable)
local desc = ''
if #writter > 0 then
desc = tr('You read the following, written by \n%s\n', writter)
@@ -71,6 +71,10 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
textWindow:setText(tr('Edit Text'))
end
if description:getHeight() < 64 then
description:setHeight(64)
end
local function destroy()
textWindow:destroy()
table.removevalue(windows, textWindow)
@@ -109,20 +113,22 @@ function onGameEditList(id, doorId, text)
description:setText(tr('Enter one name per line.'))
textWindow:setText(tr('Edit List'))
if description:getHeight() < 64 then
description:setHeight(64)
end
local function destroy()
textWindow:destroy()
table.removevalue(windows, textWindow)
end
doneFunc = function()
local doneFunc = function()
g_game.editList(id, doorId, textEdit:getText())
destroy()
end
okButton.onClick = doneFunc
cancelButton.onClick = destroy
textWindow.onEnter = doneFunc
textWindow.onEscape = destroy
table.insert(windows, textWindow)