2015-01-02 23:52:36 +01:00
|
|
|
local setmetatable = setmetatable
|
2016-02-11 07:36:50 +01:00
|
|
|
local beautiful = require( "beautiful" )
|
|
|
|
local color = require( "gears.color" )
|
|
|
|
local cairo = require( "lgi" ).cairo
|
|
|
|
local theme = require( "radical.theme" )
|
2015-01-02 23:52:36 +01:00
|
|
|
|
|
|
|
local module = {
|
|
|
|
margins = {
|
|
|
|
TOP = 2,
|
|
|
|
BOTTOM = 2,
|
|
|
|
RIGHT = 2,
|
|
|
|
LEFT = 4
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-11 07:36:50 +01:00
|
|
|
local function after_draw_children(self, context, cr, width, height)
|
2015-01-02 23:52:36 +01:00
|
|
|
cr:set_source(self.col1)
|
|
|
|
cr:rectangle(0,3,1,height-6)
|
|
|
|
cr:fill()
|
|
|
|
cr:set_source(self.col2)
|
|
|
|
cr:rectangle(width-1,3,1,height-6)
|
|
|
|
cr:fill()
|
|
|
|
end
|
|
|
|
|
2016-06-24 22:53:47 +02:00
|
|
|
local function draw(item)
|
2015-01-02 23:52:36 +01:00
|
|
|
if not item.widget._overlay_init then
|
2016-02-11 07:36:50 +01:00
|
|
|
item.widget.after_draw_children = after_draw_children
|
2015-01-02 23:52:36 +01:00
|
|
|
item.widget._overlay_init = true
|
2015-12-29 11:19:23 +01:00
|
|
|
|
2015-01-02 23:52:36 +01:00
|
|
|
-- Build the 2 item border colors, this item_style doesn't support gradient
|
|
|
|
-- or patterns
|
|
|
|
item.widget.col1 = color(item.item_border_color or item.border_color or beautiful.border_color)
|
2016-06-24 22:53:47 +02:00
|
|
|
local _,r,g,b,a = item.widget.col1:get_rgba()
|
2015-01-02 23:52:36 +01:00
|
|
|
r,g,b = r-.2,g-.2,b-.2
|
|
|
|
item.widget.col2 = cairo.Pattern.create_rgba(r,g,b,a)
|
|
|
|
end
|
|
|
|
|
2016-02-11 07:36:50 +01:00
|
|
|
theme.update_colors(item)
|
2015-01-02 23:52:36 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return setmetatable(module, { __call = function(_, ...) return draw(...) end })
|
|
|
|
-- kate: space-indent on; indent-width 2; replace-tabs on;
|