2014-02-03 05:01:31 +01:00
|
|
|
local setmetatable = setmetatable
|
2014-02-16 20:46:10 +01:00
|
|
|
local wibox = require( "wibox" )
|
2014-10-18 05:52:26 +02:00
|
|
|
local util = require( "awful.util" )
|
2014-02-23 05:59:03 +01:00
|
|
|
local horizontal = require( "radical.item.layout.horizontal" )
|
2014-10-05 23:54:55 +02:00
|
|
|
local margins2 = require("radical.margins")
|
2014-02-03 05:01:31 +01:00
|
|
|
|
|
|
|
local function create_item(item,data,args)
|
2014-02-16 20:46:10 +01:00
|
|
|
|
2016-02-12 05:39:45 +01:00
|
|
|
-- Define the item layout
|
|
|
|
local w = wibox.widget.base.make_widget_declarative {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nil,
|
|
|
|
{
|
|
|
|
id = "main_text" ,
|
|
|
|
align = "center" ,
|
|
|
|
widget = wibox.widget.textbox,
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
layout = wibox.layout.align.horizontal,
|
|
|
|
},
|
|
|
|
id = "main_margin",
|
|
|
|
layout = wibox.layout.margin
|
|
|
|
},
|
|
|
|
widget = wibox.widget.background,
|
|
|
|
}
|
|
|
|
|
|
|
|
item._internal.margin_w = item.widget:get_children_by_id("main_margin")[1]
|
|
|
|
item._internal.text_w = item.widget:get_children_by_id("main_text" )[1]
|
|
|
|
|
|
|
|
-- Margins
|
|
|
|
local mrgns = margins2(
|
|
|
|
item._internal.margin_w,
|
|
|
|
util.table.join(data.item_style.margins,data.default_item_margins)
|
|
|
|
)
|
|
|
|
|
|
|
|
function item:get_margins()
|
|
|
|
return mrgns
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Setup events
|
|
|
|
horizontal.setup_event(data, item, w)
|
|
|
|
|
|
|
|
return w
|
2014-02-03 05:01:31 +01:00
|
|
|
end
|
|
|
|
|
2016-02-12 05:39:45 +01:00
|
|
|
return setmetatable({}, { __call = function(_, ...) return create_item(...) end })
|
|
|
|
-- kate: space-indent on; indent-width 4; replace-tabs on;
|