Add 'arrow_single' item style

This commit is contained in:
Emmanuel LEpage Vallee 2014-01-25 01:33:50 -05:00
parent ae627671f1
commit ebac399d72
4 changed files with 51 additions and 1 deletions

View File

@ -9,7 +9,7 @@ local util = require( "awful.util" )
local fkey = require( "radical.widgets.fkey" )
local button = require( "awful.button" )
local checkbox = require( "radical.widgets.checkbox" )
local item_style = require( "radical.item_style.arrow_prefix" )
local item_style = require( "radical.item_style.arrow_single" )
local vertical = require( "radical.layout.vertical" )
local capi,module = { mouse = mouse , screen = screen, keygrabber = keygrabber },{}

View File

@ -0,0 +1,49 @@
local setmetatable = setmetatable
local base = require( "radical.base" )
local beautiful = require("beautiful" )
local color = require("gears.color" )
local cairo = require("lgi" ).cairo
local wibox = require("wibox" )
local arrow_alt = require("radical.item_style.arrow_alt")
local module = {
margins = {
TOP = 0,
BOTTOM = 0,
RIGHT = 50,
LEFT = 50
}
}
local function suffix_draw(self, w, cr, width, height)
cr:save()
cr:move_to(height/2,0)
cr:line_to(width-height/2,0)
cr:line_to(width,height/2)
cr:line_to(width-height/2,height)
cr:line_to(height/2,height)
cr:line_to(0,height/2)
cr:line_to(height/2,0)
cr:close_path()
cr:clip()
wibox.widget.background.draw(self, w, cr, width, height)
cr:restore()
end
local function draw(data,item,args)
local args,flags = args or {},{}
for _,v in pairs(args) do flags[v] = true end
item.widget.draw = suffix_draw
if flags[base.item_flags.SELECTED] or (item._tmp_menu) then
item.widget:set_bg(args.color or data.bg_focus)
else
item.widget:set_bg(args.color or nil)
end
end
return setmetatable(module, { __call = function(_, ...) return draw(...) end })
-- kate: space-indent on; indent-width 2; replace-tabs on;

View File

@ -4,4 +4,5 @@ return {
rounded = require("radical.item_style.rounded" ),
arrow_alt = require("radical.item_style.arrow_alt" ),
arrow_prefix = require("radical.item_style.arrow_prefix" ),
arrow_single = require("radical.item_style.arrow_single" ),
}