mirror of
https://github.com/kepler155c/opus
synced 2025-12-19 14:48:07 +00:00
ui overhaul
This commit is contained in:
51
sys/apis/ui/components/SlideOut.lua
Normal file
51
sys/apis/ui/components/SlideOut.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
local class = require('class')
|
||||
local UI = require('ui')
|
||||
|
||||
--[[-- SlideOut --]]--
|
||||
UI.SlideOut = class(UI.Window)
|
||||
UI.SlideOut.defaults = {
|
||||
UIElement = 'SlideOut',
|
||||
pageType = 'modal',
|
||||
}
|
||||
function UI.SlideOut:setParent()
|
||||
-- TODO: size should be set at this point
|
||||
self:layout()
|
||||
self.canvas = self:addLayer()
|
||||
|
||||
UI.Window.setParent(self)
|
||||
end
|
||||
|
||||
function UI.SlideOut:enable()
|
||||
end
|
||||
|
||||
function UI.SlideOut:show(...)
|
||||
self:addTransition('expandUp')
|
||||
self.canvas:raise()
|
||||
self.canvas:setVisible(true)
|
||||
UI.Window.enable(self, ...)
|
||||
self:draw()
|
||||
self:capture(self)
|
||||
self:focusFirst()
|
||||
end
|
||||
|
||||
function UI.SlideOut:disable()
|
||||
self.canvas:setVisible(false)
|
||||
UI.Window.disable(self)
|
||||
end
|
||||
|
||||
function UI.SlideOut:hide()
|
||||
self:disable()
|
||||
self:release(self)
|
||||
self:refocus()
|
||||
end
|
||||
|
||||
function UI.SlideOut:eventHandler(event)
|
||||
if event.type == 'slide_show' then
|
||||
self:show()
|
||||
return true
|
||||
|
||||
elseif event.type == 'slide_hide' then
|
||||
self:hide()
|
||||
return true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user