ENH use table style objects

This commit is contained in:
Nathan Dwarshuis 2021-07-11 16:53:25 -04:00
parent 4e1ee6936e
commit 30a39aa34b
2 changed files with 50 additions and 17 deletions

2
core

@ -1 +1 @@
Subproject commit baf94bef542099065d73c268bfb8ff0ae96908b9 Subproject commit d21bbf57059f91a63e01fdb874f02e2c603cb85b

View File

@ -536,21 +536,52 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- table -- table
M.default_table_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false)
M.default_table_style = _G_Widget_.table_style(
_G_Widget_.rect_style(
1,
_G_Patterns_.BORDER_FG
),
_G_Widget_.line_style(
1,
_G_Patterns_.BORDER_FG,
CAIRO_LINE_CAP_BUTT
),
_G_Widget_.table_header_style(
M.default_table_font_spec,
_G_Patterns_.PRIMARY_FG,
20
),
_G_Widget_.table_body_style(
M.default_table_font_spec,
_G_Patterns_.INACTIVE_TEXT_FG,
8
),
_G_Widget_.padding(5, 15, 5, 15)
)
M.initTable = function(x, y, w, h, n, labels) M.initTable = function(x, y, w, h, n, labels)
return _G_Widget_.Table{ -- return _G_Widget_.Table{
x = x, -- x = x,
y = y, -- y = y,
width = w, -- width = w,
height = h, -- height = h,
num_rows = n, -- num_rows = n,
body_color = _G_Patterns_.INACTIVE_TEXT_FG, -- body_color = _G_Patterns_.INACTIVE_TEXT_FG,
header_color = _G_Patterns_.PRIMARY_FG, -- header_color = _G_Patterns_.PRIMARY_FG,
line_pattern = _G_Patterns_.BORDER_FG, -- line_pattern = _G_Patterns_.BORDER_FG,
separator_pattern = _G_Patterns_.BORDER_FG, -- separator_pattern = _G_Patterns_.BORDER_FG,
body_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false), -- body_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false),
header_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false), -- header_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false),
table.unpack(labels), -- table.unpack(labels),
} -- }
return _G_Widget_.Table(
_G_Widget_.make_box(_G_Widget_.make_point(x, y), w, h),
n,
labels,
M.default_table_style
)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -563,8 +594,10 @@ M.initPanel = function(x, y, w, h, thickness)
w, w,
h h
), ),
_G_Widget_.rect_style(
thickness, thickness,
_G_Patterns_.BORDER_FG, _G_Patterns_.BORDER_FG
),
_G_Patterns_.PANEL_BG _G_Patterns_.PANEL_BG
) )
end end