2014-02-03 05:01:31 +01:00
|
|
|
local setmetatable = setmetatable
|
2014-02-16 20:46:10 +01:00
|
|
|
local beautiful = require( "beautiful" )
|
|
|
|
local color = require( "gears.color" )
|
|
|
|
local cairo = require( "lgi" ).cairo
|
|
|
|
local wibox = require( "wibox" )
|
|
|
|
local checkbox = require( "radical.widgets.checkbox" )
|
|
|
|
local fkey = require( "radical.widgets.fkey" )
|
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 module = {}
|
|
|
|
|
|
|
|
local function create_item(item,data,args)
|
2014-02-05 05:29:38 +01:00
|
|
|
-- Background
|
2014-02-03 05:01:31 +01:00
|
|
|
local bg = wibox.widget.background()
|
|
|
|
|
|
|
|
-- Margins
|
|
|
|
local m = wibox.layout.margin(la)
|
2014-10-18 05:52:26 +02:00
|
|
|
local mrgns = margins2(m,util.table.join(data.item_style.margins,data.default_item_margins))
|
2014-10-05 23:54:55 +02:00
|
|
|
item.get_margins = function()
|
|
|
|
return mrgns
|
|
|
|
end
|
2014-02-03 05:01:31 +01:00
|
|
|
|
|
|
|
local text = wibox.widget.textbox()
|
2014-02-05 05:29:38 +01:00
|
|
|
text:set_align("center")
|
2014-02-03 05:01:31 +01:00
|
|
|
|
|
|
|
-- Layout
|
|
|
|
local align = wibox.layout.align.horizontal()
|
|
|
|
align:set_middle( text )
|
|
|
|
m:set_widget(align)
|
|
|
|
bg:set_widget(m)
|
2014-02-05 05:29:38 +01:00
|
|
|
|
|
|
|
item._internal.text_w = text
|
|
|
|
item._internal.icon_w = nil
|
|
|
|
item._internal.margin_w = m
|
2014-02-16 03:57:07 +01:00
|
|
|
|
2014-02-16 20:46:10 +01:00
|
|
|
-- Setup events
|
|
|
|
horizontal.setup_event(data,item,bg)
|
|
|
|
|
2014-02-03 05:01:31 +01:00
|
|
|
return bg
|
|
|
|
end
|
|
|
|
|
|
|
|
return setmetatable(module, { __call = function(_, ...) return create_item(...) end })
|
|
|
|
-- kate: space-indent on; indent-width 2; replace-tabs on;
|