diff --git a/embed.lua b/embed.lua index 8ee6965..121578d 100644 --- a/embed.lua +++ b/embed.lua @@ -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 -- 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_y = function() return data._embeded_parent and data._embeded_parent.y end - data.get_x = function() return data._embeded_parent and data._embeded_parent.x 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 + (internal.current_y or 0)) 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 data.layout = layout.vertical end internal.layout = data.layout(data) data.width,data.height = data._internal.layout:fit() 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 local function setup_item(data,item,args) @@ -70,6 +75,10 @@ local function setup_item(data,item,args) buttons[button_id](_m,_i,mods) end end) + +-- item.widget:connect_signal("mouse::enter",function(_,geo) +-- item._internal.tmp_y +-- end) end local function new(args) diff --git a/item/init.lua b/item/init.lua index e93ba0e..80dfa1f 100644 --- a/item/init.lua +++ b/item/init.lua @@ -62,7 +62,7 @@ end function module.execute_sub_menu(data,item) 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) - 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.parent_item = item sub_menu.parent_geometry = data diff --git a/item/layout/horizontal.lua b/item/layout/horizontal.lua index 1f9e80a..0f4c5f9 100644 --- a/item/layout/horizontal.lua +++ b/item/layout/horizontal.lua @@ -260,7 +260,7 @@ local function create_item(item,data,args) item._internal.margin_w = m -- Draw - local item_style = item.item_style or data.item_style + local item_style = item.style or data.item_style item_style(item,{}) item.widget:set_fg(item._private_data.fg)