new layout system, new UI state/styles system

This commit is contained in:
Eduardo Bart
2011-08-26 12:06:52 -03:00
parent d31d32bf82
commit 7359370251
57 changed files with 1097 additions and 1099 deletions

View File

@@ -34,26 +34,21 @@ function Console.addLine(text, color)
-- create new label
local label = UILabel.create()
label:setStyle('ConsoleLabel')
console:insertChild(-2, label)
label:setId('consoleLabel' .. numLines)
label:setText(text)
label:setForegroundColor(color)
console:insertChild(3, label)
local lastLabel = console:getChildByIndex(4)
if lastLabel then
lastLabel:addAnchor(AnchorBottom, "prev", AnchorTop)
end
label:setStyle('ConsoleLabel')
numLines = numLines + 1
if numLines > maxLines then
local firstLabel = console:getChildByIndex(-1)
local firstLabel = console:getChildByIndex(1)
firstLabel:destroy()
end
end
function Console.create()
console = loadUI("/console/console.otui")
rootWidget:addChild(console)
console = UI.loadAndDisplay("/console/console.otui")
console:hide()
Logger.setOnLog(Console.onLog)

View File

@@ -1,7 +1,7 @@
ConsoleLabel < UILabel
font: terminus-14px-bold
height: 16
anchors.bottom: commandBox.top
anchors.bottom: next.top
anchors.left: parent.left
anchors.right: parent.right
margin.left: 2
@@ -14,7 +14,8 @@ RectPanel
UILabel
id: commandSymbolLabel
size: 18 20
size: 20 16
size fixed: true
anchors.bottom: parent.bottom
anchors.left: parent.left
margin.left: 2
@@ -23,11 +24,10 @@ RectPanel
UILineEdit
id: commandBox
height: 20
height: 16
anchors.bottom: parent.bottom
anchors.left: prev.right
anchors.left: commandSymbolLabel.right
anchors.right: parent.right
margin.left: 4
font: terminus-14px-bold
onAction: |
function(self)