88 lines
2.9 KiB
Cheetah
88 lines
2.9 KiB
Cheetah
|
local base = require( "radical.base" )
|
||
|
local print = print
|
||
|
local unpack = unpack
|
||
|
local setmetatable = setmetatable
|
||
|
local color = require( "gears.color" )
|
||
|
local wibox = require( "wibox" )
|
||
|
local beautiful = require( "beautiful" )
|
||
|
local cairo = require( "lgi" ).cairo
|
||
|
local awful = require( "awful" )
|
||
|
local util = require( "awful.util" )
|
||
|
local button = require( "awful.button" )
|
||
|
local checkbox = require( "radical.widgets.checkbox" )
|
||
|
|
||
|
local capi,module = { mouse = mouse , screen = screen, keygrabber = keygrabber },{}
|
||
|
|
||
|
local function get_direction(data)
|
||
|
return "left" -- Nothing to do
|
||
|
end
|
||
|
|
||
|
local function set_position(self)
|
||
|
return --Nothing to do
|
||
|
end
|
||
|
|
||
|
local function setup_drawable(data)
|
||
|
local internal = data._internal
|
||
|
local get_map,set_map,private_data = internal.get_map,internal.set_map,internal.private_data
|
||
|
|
||
|
--Init
|
||
|
-- internal.w = wibox({})
|
||
|
internal.margin = wibox.layout.margin()
|
||
|
if not data.layout then
|
||
|
data.layout = layout.vertical
|
||
|
end
|
||
|
internal.layout = wibox.layout.fixed.horizontal() --data.layout(data) --TODO fix
|
||
|
internal.margin:set_widget(internal.layout)
|
||
|
|
||
|
--Getters
|
||
|
get_map.wibox = function() return nil end -- Will this break?
|
||
|
get_map.x = function() return 0 end
|
||
|
get_map.y = function() return 0 end
|
||
|
get_map.width = function() return 500 end
|
||
|
get_map.height = function() return 40 end
|
||
|
get_map.visible = function() return private_data.visible end
|
||
|
get_map.direction = function() return private_data.direction end
|
||
|
get_map.margins = function()
|
||
|
local ret = {left=data.border_width,right=data.border_width,top=data.style.margins.TOP,bottom=data.style.margins.BOTTOM}
|
||
|
if data.arrow_type ~= base.arrow_type.NONE then
|
||
|
ret[data.direction] = ret[data.direction]+13
|
||
|
end
|
||
|
return ret
|
||
|
end
|
||
|
|
||
|
--Setters
|
||
|
function internal:set_visible(value)
|
||
|
-- TODO
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
local function setup_item(data,item,args)
|
||
|
-- Add widgets
|
||
|
local tb = wibox.widget.textbox()
|
||
|
data._internal.layout:add(tb)
|
||
|
item.widget = tb
|
||
|
tb:set_text("bob")
|
||
|
end
|
||
|
|
||
|
local function new(args)
|
||
|
local args = args or {}
|
||
|
args.internal = args.internal or {}
|
||
|
args.internal.get_direction = args.internal.get_direction or get_direction
|
||
|
args.internal.set_position = args.internal.set_position or set_position
|
||
|
args.internal.setup_drawable = args.internal.setup_drawable or setup_drawable
|
||
|
args.internal.setup_item = args.internal.setup_item or setup_item
|
||
|
args.style = args.style or arrow_style
|
||
|
local ret = base(args)
|
||
|
ret:connect_signal("clear::menu",function(_,vis)
|
||
|
ret._internal.layout:reset()
|
||
|
end)
|
||
|
ret:connect_signal("_hidden::changed",function(_,item)
|
||
|
item.widget:emit_signal("widget::updated")
|
||
|
end)
|
||
|
return ret
|
||
|
end
|
||
|
|
||
|
return setmetatable(module, { __call = function(_, ...) return new(...) end })
|
||
|
-- kate: space-indent on; indent-width 2; replace-tabs on;
|