Add option

This commit is contained in:
Emmanuel Lepage Vallee 2015-01-01 02:08:40 -05:00
parent 2f9af8d5dd
commit c2cf7ba3fa
5 changed files with 11 additions and 1 deletions

View File

@ -168,6 +168,7 @@ Multiple items can have multiple sets of options.
| bg_header | Header (see widgets section) color | String/gradient/pattern |
| bg_prefix | Prefix background for item_styles that support it | String/gradient/pattern |
| border_color | Border color | String/gradient/pattern |
| item_border_color | Alternative border color for item separation | String/gradient/pattern |
| border_width | Border width | number |
| item_height | Default height of items | number |
| item_width | Default width of items | number |
@ -200,6 +201,7 @@ Multiple items can have multiple sets of options.
| overlay | A layer on top of the item | function(data,item,cr,w,h) |
| opacity | Make this menu translucent (require a compositor) | number (0 to 1) |
| icon_transformation | Hijack the icon drawing function | function(icon,data,item) |
| icon_per_state | Call icon_transformation when state change | boolean |
| disable_submenu_icon| Do not show the submenu icon (arrow) | boolean |
| margins | Read/Write table (left,right,top and bottom) | dynamic table |
| visible_row_count | Number of visible items -(#max-(#total-#filtered)) | number |

View File

@ -358,6 +358,7 @@ local function new(args)
filter_underlay_color = args.filter_underlay_color,
filter_placeholder = args.filter_placeholder or "",
disable_submenu_icon = args.disable_submenu_icon or false,
item_border_color = args.item_border_color or nil,
},
force_private = {
parent = true,

View File

@ -118,6 +118,7 @@ local function new_item(data,args)
style = args.style or data.item_style ,
layout = args.layout or args.item_layout or nil ,
overlay = args.overlay or data.overlay or nil ,
item_border_color = args.item_border_color or data.item_border_color or nil ,
},
force_private = {
visible = true,

View File

@ -25,12 +25,15 @@ end
local function draw2(self,w, cr, width, height)
cr:save()
cr:set_source_rgba(1,0,0,1)
local mx,my = self.left or 0, self.top or 0
local mw,mh = width - mx - (self.right or 0), height - my - (self.bottom or 0)
rounded_rect(cr,mx,my,mw,mh,6)
local path = cr:copy_path()
cr:clip()
self.___draw(self,w, cr, width, height)
cr:append_path(path)
cr:set_source(color(self.data.border_color))
cr:stroke()
cr:restore()
end
@ -41,6 +44,7 @@ local function draw(data)
if m then
m.___draw = m.draw
m.draw = draw2
m.data = data
end
end

View File

@ -100,6 +100,8 @@ function module.add_colors_from_namespace(data,namespace)
end
priv["fg"] = beautiful[namespace.."_fg"] or priv["fg"]
priv["bg"] = beautiful[namespace.."_bg"] or priv["bg"]
priv["border_color"] = beautiful[namespace.."_border_color"] or priv["border_color"]
priv["item_border_color"] = beautiful[namespace.."_item_border_color"] or priv["item_border_color"]
priv.namespace = priv.namespace or {}
priv.namespace[#priv.namespace+1] = namespace
end