Minor fixes

This commit is contained in:
Emmanuel Lepage Vallee 2014-03-18 23:52:19 -04:00
parent c10a94c0cb
commit b17f802318
3 changed files with 14 additions and 5 deletions

View File

@ -26,15 +26,20 @@ local function setup_drawable(data)
data.set_visible = function(_,v) if data._embeded_parent then data._embeded_parent.visible = v end end data.set_visible = function(_,v) if data._embeded_parent then data._embeded_parent.visible = v end end
-- Enumate geometry --BUG this is fake, but better than nothing -- Enumate geometry --BUG this is fake, but better than nothing
data.get_width = function() return data._embeded_parent and data._embeded_parent.width end data.get_width = function() return data._embeded_parent and (data._embeded_parent.width + (internal.current_width or 0))end
data.get_y = function() return data._embeded_parent and data._embeded_parent.y end data.get_y = function() return data._embeded_parent and (data._embeded_parent.y + (internal.current_y or 0)) end
data.get_x = function() return data._embeded_parent and data._embeded_parent.x end data.get_x = function() return data._embeded_parent and (data._embeded_parent.x + (internal.current_x or 0)) end
if not data.layout then if not data.layout then
data.layout = layout.vertical data.layout = layout.vertical
end end
internal.layout = data.layout(data) internal.layout = data.layout(data)
data.width,data.height = data._internal.layout:fit() data.width,data.height = data._internal.layout:fit()
data.margins={left=0,right=0,bottom=0,top=0} data.margins={left=0,right=0,bottom=0,top=0}
internal.layout:connect_signal("mouse::enter",function(_,geo)
internal.current_x = geo.x
internal.current_y = geo.y
internal.current_width = geo.width
end)
end end
local function setup_item(data,item,args) local function setup_item(data,item,args)
@ -70,6 +75,10 @@ local function setup_item(data,item,args)
buttons[button_id](_m,_i,mods) buttons[button_id](_m,_i,mods)
end end
end) end)
-- item.widget:connect_signal("mouse::enter",function(_,geo)
-- item._internal.tmp_y
-- end)
end end
local function new(args) local function new(args)

View File

@ -62,7 +62,7 @@ end
function module.execute_sub_menu(data,item) function module.execute_sub_menu(data,item)
if (item._private_data.sub_menu_f or item._private_data.sub_menu_m) then if (item._private_data.sub_menu_f or item._private_data.sub_menu_m) then
local sub_menu = item._private_data.sub_menu_m or item._private_data.sub_menu_f(data,item) local sub_menu = item._private_data.sub_menu_m or item._private_data.sub_menu_f(data,item)
if sub_menu and sub_menu.rowcount > 0 then if sub_menu and (item._private_data.sub_menu_f or sub_menu.rowcount > 0) then
sub_menu.arrow_type = module.arrow_type.NONE sub_menu.arrow_type = module.arrow_type.NONE
sub_menu.parent_item = item sub_menu.parent_item = item
sub_menu.parent_geometry = data sub_menu.parent_geometry = data

View File

@ -260,7 +260,7 @@ local function create_item(item,data,args)
item._internal.margin_w = m item._internal.margin_w = m
-- Draw -- Draw
local item_style = item.item_style or data.item_style local item_style = item.style or data.item_style
item_style(item,{}) item_style(item,{})
item.widget:set_fg(item._private_data.fg) item.widget:set_fg(item._private_data.fg)