#193 pocket main application core

This commit is contained in:
Mikayla Fischler
2023-04-16 15:05:28 -04:00
parent d9ec3d7825
commit e9290540f5
9 changed files with 174 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local cpair = core.graphics.cpair
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
-- new boiler page view
---@param root graphics_element parent
local function new_view(root)
local main = Div{parent=root,x=1,y=1}
TextBox{parent=main,text="BOILERS",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
return main
end
return new_view

View File

@@ -0,0 +1,22 @@
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local cpair = core.graphics.cpair
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
-- new home page view
---@param root graphics_element parent
local function new_view(root)
local main = Div{parent=root,x=1,y=1}
TextBox{parent=main,text="HOME",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
return main
end
return new_view

View File

@@ -0,0 +1,22 @@
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local cpair = core.graphics.cpair
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
-- new reactor page view
---@param root graphics_element parent
local function new_view(root)
local main = Div{parent=root,x=1,y=1}
TextBox{parent=main,text="REACTOR",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
return main
end
return new_view

View File

@@ -0,0 +1,22 @@
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local cpair = core.graphics.cpair
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
-- new turbine page view
---@param root graphics_element parent
local function new_view(root)
local main = Div{parent=root,x=1,y=1}
TextBox{parent=main,text="TURBINES",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
return main
end
return new_view

View File

@@ -0,0 +1,22 @@
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local cpair = core.graphics.cpair
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
-- new unit page view
---@param root graphics_element parent
local function new_view(root)
local main = Div{parent=root,x=1,y=1}
TextBox{parent=main,text="UNITS",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
return main
end
return new_view

View File

@@ -8,11 +8,18 @@ local style = require("pocket.ui.style")
local conn_waiting = require("pocket.ui.components.conn_waiting")
local home_page = require("pocket.ui.components.home_page")
local unit_page = require("pocket.ui.components.unit_page")
local reactor_page = require("pocket.ui.components.reactor_page")
local boiler_page = require("pocket.ui.components.boiler_page")
local turbine_page = require("pocket.ui.components.turbine_page")
local core = require("graphics.core")
local ColorMap = require("graphics.elements.colormap")
local DisplayBox = require("graphics.elements.displaybox")
local Div = require("graphics.elements.div")
local MultiPane = require("graphics.elements.multipane")
local TextBox = require("graphics.elements.textbox")
local PushButton = require("graphics.elements.controls.push_button")
@@ -59,7 +66,19 @@ local function init(monitor)
}
}
local sidebar = Sidebar{parent=main,x=1,y=2,tabs=sidebar_tabs,fg_bg=cpair(colors.white,colors.gray),callback=function()end}
local mp_div = Div{parent=main,x=4,y=2}
local pane_1 = home_page(mp_div)
local pane_2 = unit_page(mp_div)
local pane_3 = reactor_page(mp_div)
local pane_4 = boiler_page(mp_div)
local pane_5 = turbine_page(mp_div)
local panes = { pane_1, pane_2, pane_3, pane_4, pane_5 }
local multipane = MultiPane{parent=mp_div,x=1,y=1,panes=panes}
local sidebar = Sidebar{parent=main,x=1,y=2,tabs=sidebar_tabs,fg_bg=cpair(colors.white,colors.gray),callback=multipane.set_value}
return main
end