Some flexibility changes

master
Henrique Santiago 12 years ago
parent e5df872600
commit 5a367cfe27

@ -143,6 +143,10 @@ function Locales.setLocale(name)
return true
end
function Locales.getComboBox()
return localeComboBox
end
-- global function used to translate texts
function tr(text, ...)
if currentLocale then

@ -48,6 +48,20 @@ function UIComboBox:addOption(text, data)
return index
end
function UIComboBox:removeOption(text)
for i,v in ipairs(self.options) do
if v.text == text then
table.remove(self.options, i)
if self.currentIndex == i then
self:setCurrentIndex(1)
elseif self.currentIndex > i then
self.currentIndex = self.currentIndex - 1
end
return
end
end
end
function UIComboBox:onMousePress(mousePos, mouseButton)
local menu = g_ui.createWidget(self:getStyleName() .. 'PopupMenu')
menu:setId(self:getId() .. 'PopupMenu')

@ -13,11 +13,23 @@ function UIMiniWindowContainer:getClassName()
return 'UIMiniWindowContainer'
end
-- TODO: connect to window onResize event
-- TODO: try to resize another widget?
-- TODO: try to find another panel?
function UIMiniWindowContainer:fitAll(noRemoveChild)
if not self:isVisible() then
return
end
if not noRemoveChild then
local children = self:getChildren()
if #children > 0 then
noRemoveChild = children[#children]
else
return
end
end
local sumHeight = 0
local children = self:getChildren()
for i=1,#children do
@ -40,10 +52,6 @@ function UIMiniWindowContainer:fitAll(noRemoveChild)
addEvent(function() noRemoveChild:setHeight(maximumHeight) end)
end
-- TODO: most likely, minimum and maximum size are not set yet, so code above might not work properly. onSetup event
-- TODO: try to resize another widget?
-- TODO: try to find another panel?
-- try to remove no-save widget
for i=#children,1,-1 do
if sumHeight <= selfHeight then

@ -80,7 +80,7 @@ function ProtocolLogin:onRecv(msg)
elseif opcode == LoginServerMotd then
self:parseMotd(msg)
elseif opcode == LoginServerUpdateNeeded then
signalcall(self.onError, self, tr("Client needs update."))
signalcall(self.onError, self, tr("Client needs update. Verify your spr/dat/pic versions."))
elseif opcode == LoginServerCharacterList then
self:parseCharacterList(msg)
else

Loading…
Cancel
Save