2013-07-07 06:39:17 +02:00
|
|
|
local setmetatable = setmetatable
|
2013-07-09 03:31:33 +02:00
|
|
|
local color = require( "gears.color" )
|
|
|
|
local cairo = require( "lgi" ).cairo
|
|
|
|
local pango = require( "lgi" ).Pango
|
|
|
|
local pangocairo = require( "lgi" ).PangoCairo
|
|
|
|
local wibox = require( "wibox" )
|
|
|
|
local beautiful = require( "beautiful" )
|
2016-06-27 08:12:48 +02:00
|
|
|
local constrainedtext = require("radical.widgets.constrainedtext")
|
|
|
|
local shape = require("gears.shape")
|
2013-07-07 06:39:17 +02:00
|
|
|
|
2016-06-27 08:12:48 +02:00
|
|
|
local function new(data,item)
|
|
|
|
local pref = wibox.widget {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
padding = 1,
|
|
|
|
width_for_text = "F99",
|
|
|
|
text = item._internal.f_key or "F1",
|
|
|
|
widget = constrainedtext,
|
|
|
|
id = "textbox",
|
|
|
|
},
|
|
|
|
left = data.item_height / 2 - 2*2,
|
|
|
|
right = data.item_height / 2 - 2*2,
|
|
|
|
widget = wibox.container.margin
|
|
|
|
},
|
|
|
|
shape = shape.rounded_bar,
|
|
|
|
bg = color(beautiful.fg_normal),
|
|
|
|
fg = color(beautiful.bg_normal),
|
|
|
|
widget = wibox.container.background
|
|
|
|
},
|
|
|
|
margins = 2,
|
|
|
|
widget = wibox.container.margin
|
|
|
|
}
|
2013-07-07 06:39:17 +02:00
|
|
|
|
2016-06-27 08:12:48 +02:00
|
|
|
local tb = pref:get_children_by_id("textbox")[1]
|
|
|
|
assert(tb)
|
2013-07-09 03:31:33 +02:00
|
|
|
|
2016-06-27 08:12:48 +02:00
|
|
|
item:connect_signal("f_key::changed" , function()
|
|
|
|
tb:set_text("F"..item._internal.f_key)
|
|
|
|
end)
|
2016-06-23 06:02:30 +02:00
|
|
|
|
2016-06-27 08:12:48 +02:00
|
|
|
return pref
|
2013-07-07 06:39:17 +02:00
|
|
|
end
|
|
|
|
|
2014-01-06 04:51:42 +01:00
|
|
|
return setmetatable({}, { __call = function(_, ...) return new(...) end })
|
2016-06-27 08:12:48 +02:00
|
|
|
-- kate: space-indent on; indent-width 4; replace-tabs on;
|