mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
new layout system, new UI state/styles system
This commit is contained in:
@@ -8,12 +8,6 @@ Module
|
||||
dependencies:
|
||||
- core_fonts
|
||||
onLoad: |
|
||||
importStyles('buttons.otui')
|
||||
importStyles('labels.otui')
|
||||
importStyles('panels.otui')
|
||||
importStyles('separators.otui')
|
||||
importStyles('lineedits.otui')
|
||||
importStyles('windows.otui')
|
||||
importStyles('listboxes.otui')
|
||||
require 'ui'
|
||||
return true
|
||||
|
||||
|
@@ -11,7 +11,7 @@ Button < UIButton
|
||||
source: /core_ui/images/button_hover.png
|
||||
border: 5
|
||||
|
||||
state.down:
|
||||
state.pressed:
|
||||
text-translate: 1 1
|
||||
border-image:
|
||||
source: /core_ui/images/button_down.png
|
5
modules/core_ui/styles/listboxes.otui
Normal file
5
modules/core_ui/styles/listboxes.otui
Normal file
@@ -0,0 +1,5 @@
|
||||
TextList < UIWidget
|
||||
size: 200 200
|
||||
border-image:
|
||||
source: /core_ui/images/panel_flat.png
|
||||
border: 4
|
@@ -2,3 +2,4 @@ HorizontalSeparator < UIWidget
|
||||
border-image:
|
||||
source: /core_ui/images/horizontal_separator.png
|
||||
border.top: 2
|
||||
height: 2
|
@@ -1,6 +1,8 @@
|
||||
Window < UIWindow
|
||||
font: helvetica-12px-bold
|
||||
size: 200 200
|
||||
opacity: 255
|
||||
background-color: #ffffff
|
||||
head:
|
||||
height: 20
|
||||
border-image:
|
||||
@@ -17,5 +19,8 @@ Window < UIWindow
|
||||
border: 4
|
||||
border.top: 0
|
||||
|
||||
state.pressed:
|
||||
opacity: 192
|
||||
|
||||
MainWindow < Window
|
||||
anchors.centerIn: parent
|
30
modules/core_ui/ui.lua
Normal file
30
modules/core_ui/ui.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
UI = { }
|
||||
UI.root = getRootWidget()
|
||||
|
||||
function UI.loadAndDisplayLocked(otuiFile)
|
||||
local widget = loadUI(otuiFile, UI.root)
|
||||
UI.root:lockChild(widget)
|
||||
return widget
|
||||
end
|
||||
|
||||
function UI.loadAndDisplay(otuiFile)
|
||||
local widget = loadUI(otuiFile, UI.root)
|
||||
return widget
|
||||
end
|
||||
|
||||
function UI.display(widget)
|
||||
UI.root:addChild(widget)
|
||||
end
|
||||
|
||||
function UI.displayLocked(widget)
|
||||
UI.root:addChild(widget)
|
||||
UI.root:lockChild(widget)
|
||||
end
|
||||
|
||||
importStyles('styles/buttons.otui')
|
||||
importStyles('styles/labels.otui')
|
||||
importStyles('styles/panels.otui')
|
||||
importStyles('styles/separators.otui')
|
||||
importStyles('styles/lineedits.otui')
|
||||
importStyles('styles/windows.otui')
|
||||
importStyles('styles/listboxes.otui')
|
Reference in New Issue
Block a user