2014-05-20 13:02:39 +02:00
|
|
|
|
-------------------------------------------------------------------------
|
2009-09-09 14:57:27 +02:00
|
|
|
|
--- Tooltip module for awesome objects.
|
2015-02-14 20:31:53 +01:00
|
|
|
|
--
|
2009-09-09 14:57:27 +02:00
|
|
|
|
-- A tooltip is a small hint displayed when the mouse cursor
|
|
|
|
|
-- hovers a specific item.
|
|
|
|
|
-- In awesome, a tooltip can be linked with almost any
|
2014-05-20 13:02:39 +02:00
|
|
|
|
-- object having a `:connect_signal()` method and receiving
|
|
|
|
|
-- `mouse::enter` and `mouse::leave` signals.
|
|
|
|
|
--
|
|
|
|
|
-- How to create a tooltip?
|
|
|
|
|
-- ---
|
|
|
|
|
--
|
2016-05-23 06:46:01 +02:00
|
|
|
|
-- myclock = wibox.widget.textclock({}, "%T", 1)
|
2014-05-20 13:02:39 +02:00
|
|
|
|
-- myclock_t = awful.tooltip({
|
|
|
|
|
-- objects = { myclock },
|
|
|
|
|
-- timer_function = function()
|
|
|
|
|
-- return os.date("Today is %A %B %d %Y\nThe time is %T")
|
|
|
|
|
-- end,
|
|
|
|
|
-- })
|
|
|
|
|
--
|
2016-06-03 00:40:02 +02:00
|
|
|
|
-- How to add the same tooltip to multiple objects?
|
2014-05-20 13:02:39 +02:00
|
|
|
|
-- ---
|
|
|
|
|
--
|
|
|
|
|
-- myclock_t:add_to_object(obj1)
|
|
|
|
|
-- myclock_t:add_to_object(obj2)
|
|
|
|
|
--
|
|
|
|
|
-- Now the same tooltip is attached to `myclock`, `obj1`, `obj2`.
|
|
|
|
|
--
|
2016-06-03 00:40:02 +02:00
|
|
|
|
-- How to remove a tooltip from several objects?
|
2014-05-20 13:02:39 +02:00
|
|
|
|
-- ---
|
|
|
|
|
--
|
|
|
|
|
-- myclock_t:remove_from_object(obj1)
|
|
|
|
|
-- myclock_t:remove_from_object(obj2)
|
|
|
|
|
--
|
|
|
|
|
-- Now the same tooltip is only attached to `myclock`.
|
|
|
|
|
--
|
|
|
|
|
-- @author Sébastien Gross <seb•ɱɩɲʋʃ•awesome•ɑƬ•chezwam•ɖɵʈ•org>
|
2015-02-14 20:31:53 +01:00
|
|
|
|
-- @copyright 2009 Sébastien Gross
|
|
|
|
|
-- @release @AWESOME_VERSION@
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @classmod awful.tooltip
|
2015-02-14 20:31:53 +01:00
|
|
|
|
-------------------------------------------------------------------------
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
2015-02-14 20:31:53 +01:00
|
|
|
|
local mouse = mouse
|
|
|
|
|
local timer = require("gears.timer")
|
2016-05-29 05:26:33 +02:00
|
|
|
|
local util = require("awful.util")
|
2016-03-02 20:04:19 +01:00
|
|
|
|
local object = require("gears.object")
|
2015-02-14 20:31:53 +01:00
|
|
|
|
local wibox = require("wibox")
|
|
|
|
|
local a_placement = require("awful.placement")
|
2015-07-29 20:59:43 +02:00
|
|
|
|
local abutton = require("awful.button")
|
2015-02-14 20:31:53 +01:00
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
|
local textbox = require("wibox.widget.textbox")
|
2016-05-23 05:56:45 +02:00
|
|
|
|
local background = require("wibox.container.background")
|
2015-07-15 18:47:20 +02:00
|
|
|
|
local dpi = require("beautiful").xresources.apply_dpi
|
2015-02-14 20:31:53 +01:00
|
|
|
|
local setmetatable = setmetatable
|
|
|
|
|
local ipairs = ipairs
|
2016-05-29 23:40:39 +02:00
|
|
|
|
local capi = {mouse=mouse}
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
2015-02-14 20:31:53 +01:00
|
|
|
|
local tooltip = { mt = {} }
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
2016-05-29 23:40:39 +02:00
|
|
|
|
-- The mouse point is 1x1, so anything aligned based on it as parent
|
|
|
|
|
-- geometry will go out of bound. To get the desired placement, it is
|
|
|
|
|
-- necessary to swap left with right and top with bottom
|
|
|
|
|
local align_convert = {
|
|
|
|
|
top_left = "bottom_right",
|
|
|
|
|
left = "right",
|
|
|
|
|
bottom_left = "top_right",
|
|
|
|
|
right = "left",
|
|
|
|
|
top_right = "bottom_left",
|
|
|
|
|
bottom_right = "top_left",
|
|
|
|
|
top = "bottom",
|
|
|
|
|
bottom = "top",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- If the wibox is under the cursor, it will trigger a mouse::leave
|
|
|
|
|
local offset = {
|
|
|
|
|
top_left = {x = 0, y = 0 },
|
|
|
|
|
left = {x = 0, y = 0 },
|
|
|
|
|
bottom_left = {x = 0, y = 0 },
|
|
|
|
|
right = {x = 1, y = 0 },
|
|
|
|
|
top_right = {x = 0, y = 0 },
|
|
|
|
|
bottom_right = {x = 1, y = 1 },
|
|
|
|
|
top = {x = 0, y = 0 },
|
|
|
|
|
bottom = {x = 0, y = 1 },
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-09 14:57:27 +02:00
|
|
|
|
-- Place the tooltip under the mouse.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self A tooltip object.
|
2009-09-09 14:57:27 +02:00
|
|
|
|
local function set_geometry(self)
|
|
|
|
|
-- calculate width / height
|
2015-10-17 18:44:07 +02:00
|
|
|
|
local n_w, n_h = self.textbox:get_preferred_size(mouse.screen)
|
2015-07-15 18:47:20 +02:00
|
|
|
|
n_w = n_w + self.marginbox.left + self.marginbox.right
|
|
|
|
|
n_h = n_h + self.marginbox.top + self.marginbox.bottom
|
2016-05-29 05:26:33 +02:00
|
|
|
|
|
2016-05-29 23:40:39 +02:00
|
|
|
|
local w = self:get_wibox()
|
|
|
|
|
w:geometry({ width = n_w, height = n_h })
|
|
|
|
|
|
|
|
|
|
local align = self._private.align
|
|
|
|
|
|
|
|
|
|
local real_placement = align_convert[align]
|
|
|
|
|
|
|
|
|
|
a_placement[real_placement](w, {
|
|
|
|
|
parent = capi.mouse,
|
|
|
|
|
offset = offset[align]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
a_placement.no_offscreen(w)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Show a tooltip.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self The tooltip to show.
|
2009-09-09 14:57:27 +02:00
|
|
|
|
local function show(self)
|
|
|
|
|
-- do nothing if the tooltip is already shown
|
2016-05-29 21:22:07 +02:00
|
|
|
|
if self._private.visible then return end
|
2015-09-27 16:04:20 +02:00
|
|
|
|
if self.timer then
|
|
|
|
|
if not self.timer.started then
|
2016-06-03 00:40:02 +02:00
|
|
|
|
self:timer_function()
|
2015-09-27 16:04:20 +02:00
|
|
|
|
self.timer:start()
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
2009-11-07 20:09:39 +01:00
|
|
|
|
set_geometry(self)
|
2016-03-02 20:00:44 +01:00
|
|
|
|
self.wibox.visible = true
|
2016-05-29 21:22:07 +02:00
|
|
|
|
self._private.visible = true
|
2016-03-02 20:04:19 +01:00
|
|
|
|
self:emit_signal("property::visible")
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Hide a tooltip.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self The tooltip to hide.
|
2009-09-09 14:57:27 +02:00
|
|
|
|
local function hide(self)
|
|
|
|
|
-- do nothing if the tooltip is already hidden
|
2016-05-29 21:22:07 +02:00
|
|
|
|
if not self._private.visible then return end
|
2015-09-27 16:04:20 +02:00
|
|
|
|
if self.timer then
|
|
|
|
|
if self.timer.started then
|
|
|
|
|
self.timer:stop()
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
2016-03-02 20:00:44 +01:00
|
|
|
|
self.wibox.visible = false
|
2016-05-29 21:22:07 +02:00
|
|
|
|
self._private.visible = false
|
2016-03-02 20:04:19 +01:00
|
|
|
|
self:emit_signal("property::visible")
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
2016-05-29 05:26:33 +02:00
|
|
|
|
--- The wibox.
|
|
|
|
|
-- @property wibox
|
|
|
|
|
-- @param `wibox`
|
|
|
|
|
|
|
|
|
|
function tooltip:get_wibox()
|
|
|
|
|
if self._private.wibox then
|
|
|
|
|
return self._private.wibox
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local wb = wibox(self.wibox_properties)
|
|
|
|
|
wb:set_widget(self.marginbox)
|
|
|
|
|
|
|
|
|
|
-- Close the tooltip when clicking it. This gets done on release, to not
|
|
|
|
|
-- emit the release event on an underlying object, e.g. the titlebar icon.
|
|
|
|
|
wb:buttons(abutton({}, 1, nil, self.hide))
|
|
|
|
|
|
|
|
|
|
self._private.wibox = wb
|
|
|
|
|
|
|
|
|
|
return wb
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--- Is the tooltip visible?
|
|
|
|
|
-- @property visible
|
|
|
|
|
-- @param boolean
|
|
|
|
|
|
2016-05-29 21:22:07 +02:00
|
|
|
|
function tooltip:get_visible()
|
|
|
|
|
return self._private.visible
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function tooltip:set_visible(value)
|
|
|
|
|
if self._private.visible == value then return end
|
|
|
|
|
|
|
|
|
|
if value then
|
|
|
|
|
show(self)
|
|
|
|
|
else
|
|
|
|
|
hide(self)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2016-05-29 23:40:39 +02:00
|
|
|
|
--- The horizontal alignment.
|
|
|
|
|
--
|
|
|
|
|
-- The following values are valid:
|
|
|
|
|
--
|
|
|
|
|
-- * top_left
|
|
|
|
|
-- * left
|
|
|
|
|
-- * bottom_left
|
|
|
|
|
-- * right
|
|
|
|
|
-- * top_right
|
|
|
|
|
-- * bottom_right
|
|
|
|
|
-- * bottom
|
|
|
|
|
-- * top
|
|
|
|
|
--
|
|
|
|
|
-- @property align
|
|
|
|
|
-- @see beautiful.tooltip_align
|
|
|
|
|
|
|
|
|
|
--- The default tooltip alignment.
|
|
|
|
|
-- @beautiful beautiful.tooltip_align
|
|
|
|
|
-- @param string
|
|
|
|
|
-- @see align
|
|
|
|
|
|
|
|
|
|
function tooltip:get_align()
|
|
|
|
|
return self._private.align
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function tooltip:set_align(value)
|
|
|
|
|
if not align_convert[value] then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
self._private.align = value
|
|
|
|
|
|
|
|
|
|
set_geometry(self)
|
|
|
|
|
self:emit_signal("property::align")
|
|
|
|
|
end
|
|
|
|
|
|
2009-09-09 14:57:27 +02:00
|
|
|
|
--- Change displayed text.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @property text
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self The tooltip object.
|
|
|
|
|
-- @tparam string text New tooltip text, passed to
|
|
|
|
|
-- `wibox.widget.textbox.set_text`.
|
2016-05-29 05:26:33 +02:00
|
|
|
|
|
|
|
|
|
function tooltip:set_text(text)
|
2014-03-16 13:25:01 +01:00
|
|
|
|
self.textbox:set_text(text)
|
2016-05-29 21:22:07 +02:00
|
|
|
|
if self._private.visible then
|
2015-07-29 18:50:02 +02:00
|
|
|
|
set_geometry(self)
|
|
|
|
|
end
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
2015-07-29 19:02:01 +02:00
|
|
|
|
--- Change displayed markup.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @property markup
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self The tooltip object.
|
|
|
|
|
-- @tparam string text New tooltip markup, passed to
|
|
|
|
|
-- `wibox.widget.textbox.set_markup`.
|
2016-05-29 05:26:33 +02:00
|
|
|
|
|
|
|
|
|
function tooltip:set_markup(text)
|
2014-03-30 23:35:35 +02:00
|
|
|
|
self.textbox:set_markup(text)
|
2016-05-29 21:22:07 +02:00
|
|
|
|
if self._private.visible then
|
2015-07-29 18:50:02 +02:00
|
|
|
|
set_geometry(self)
|
|
|
|
|
end
|
2014-03-30 23:35:35 +02:00
|
|
|
|
end
|
|
|
|
|
|
2009-09-09 14:57:27 +02:00
|
|
|
|
--- Change the tooltip's update interval.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @property timeout
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self A tooltip object.
|
|
|
|
|
-- @tparam number timeout The timeout value.
|
2016-05-29 05:26:33 +02:00
|
|
|
|
|
|
|
|
|
function tooltip:set_timeout(timeout)
|
2015-09-27 16:04:20 +02:00
|
|
|
|
if self.timer then
|
|
|
|
|
self.timer.timeout = timeout
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--- Add tooltip to an object.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self The tooltip.
|
2016-03-02 20:04:19 +01:00
|
|
|
|
-- @tparam gears.object obj An object with `mouse::enter` and
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- `mouse::leave` signals.
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @function add_to_object
|
|
|
|
|
function tooltip:add_to_object(obj)
|
2016-03-02 20:04:19 +01:00
|
|
|
|
obj:connect_signal("mouse::enter", self.show)
|
|
|
|
|
obj:connect_signal("mouse::leave", self.hide)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--- Remove tooltip from an object.
|
2014-05-20 13:02:39 +02:00
|
|
|
|
--
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam tooltip self The tooltip.
|
2016-03-02 20:04:19 +01:00
|
|
|
|
-- @tparam gears.object obj An object with `mouse::enter` and
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- `mouse::leave` signals.
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @function remove_from_object
|
|
|
|
|
function tooltip:remove_from_object(obj)
|
2016-03-02 20:04:19 +01:00
|
|
|
|
obj:disconnect_signal("mouse::enter", self.show)
|
|
|
|
|
obj:disconnect_signal("mouse::leave", self.hide)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Create a new tooltip and link it to a widget.
|
2016-03-02 20:04:19 +01:00
|
|
|
|
-- Tooltips emit `property::visible` when their visibility changes.
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam table args Arguments for tooltip creation.
|
|
|
|
|
-- @tparam function args.timer_function A function to dynamically set the
|
|
|
|
|
-- tooltip text. Its return value will be passed to
|
|
|
|
|
-- `wibox.widget.textbox.set_markup`.
|
2016-06-03 00:40:02 +02:00
|
|
|
|
-- @tparam[opt=1] number args.timeout The timeout value for
|
|
|
|
|
-- `timer_function`.
|
2015-07-30 20:29:07 +02:00
|
|
|
|
-- @tparam[opt] table args.objects A list of objects linked to the tooltip.
|
|
|
|
|
-- @tparam[opt] number args.delay_show Delay showing the tooltip by this many
|
|
|
|
|
-- seconds.
|
|
|
|
|
-- @tparam[opt=apply_dpi(5)] integer args.margin_leftright The left/right margin for the text.
|
|
|
|
|
-- @tparam[opt=apply_dpi(3)] integer args.margin_topbottom The top/bottom margin for the text.
|
|
|
|
|
-- @treturn awful.tooltip The created tooltip.
|
2009-09-09 14:57:27 +02:00
|
|
|
|
-- @see add_to_object
|
2016-05-29 05:26:33 +02:00
|
|
|
|
-- @see timeout
|
|
|
|
|
-- @see text
|
|
|
|
|
-- @see markup
|
|
|
|
|
-- @function awful.tooltip
|
|
|
|
|
function tooltip.new(args)
|
|
|
|
|
local self = object {
|
|
|
|
|
enable_properties = true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rawset(self,"_private", {})
|
|
|
|
|
|
2016-05-29 21:22:07 +02:00
|
|
|
|
self._private.visible = false
|
2016-05-29 23:40:39 +02:00
|
|
|
|
self._private.align = beautiful.tooltip_align or "right"
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
|
|
|
|
-- private data
|
2015-02-14 20:37:30 +01:00
|
|
|
|
if args.delay_show then
|
2015-07-29 18:55:22 +02:00
|
|
|
|
local delay_timeout
|
|
|
|
|
|
2015-02-14 20:37:30 +01:00
|
|
|
|
delay_timeout = timer { timeout = args.delay_show }
|
2015-07-29 18:55:22 +02:00
|
|
|
|
delay_timeout:connect_signal("timeout", function ()
|
|
|
|
|
show(self)
|
|
|
|
|
delay_timeout:stop()
|
|
|
|
|
end)
|
|
|
|
|
|
2015-09-27 16:04:20 +02:00
|
|
|
|
function self.show()
|
|
|
|
|
if not delay_timeout.started then
|
|
|
|
|
delay_timeout:start()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function self.hide()
|
|
|
|
|
if delay_timeout.started then
|
|
|
|
|
delay_timeout:stop()
|
|
|
|
|
end
|
|
|
|
|
hide(self)
|
|
|
|
|
end
|
2015-07-29 18:55:22 +02:00
|
|
|
|
else
|
2015-09-27 16:04:20 +02:00
|
|
|
|
function self.show()
|
|
|
|
|
show(self)
|
|
|
|
|
end
|
|
|
|
|
function self.hide()
|
|
|
|
|
hide(self)
|
|
|
|
|
end
|
2015-02-14 20:37:30 +01:00
|
|
|
|
end
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
|
|
|
|
-- export functions
|
2016-05-29 05:26:33 +02:00
|
|
|
|
util.table.crush(self, tooltip, true)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
|
|
|
|
-- setup the timer action only if needed
|
|
|
|
|
if args.timer_function then
|
2015-09-27 16:04:20 +02:00
|
|
|
|
self.timer = timer { timeout = args.timeout and args.timeout or 1 }
|
|
|
|
|
self.timer_function = function()
|
2014-03-30 23:35:35 +02:00
|
|
|
|
self:set_markup(args.timer_function())
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
2015-09-27 16:04:20 +02:00
|
|
|
|
self.timer:connect_signal("timeout", self.timer_function)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
|
2014-03-30 23:31:38 +02:00
|
|
|
|
-- Set default properties
|
2016-02-28 15:34:43 +01:00
|
|
|
|
self.wibox_properties = {
|
|
|
|
|
visible = false,
|
|
|
|
|
ontop = true,
|
|
|
|
|
border_width = beautiful.tooltip_border_width or beautiful.border_width or 1,
|
|
|
|
|
border_color = beautiful.tooltip_border_color or beautiful.border_normal or "#ffcb60",
|
|
|
|
|
opacity = beautiful.tooltip_opacity or 1,
|
|
|
|
|
bg = beautiful.tooltip_bg_color or beautiful.bg_focus or "#ffcb60"
|
|
|
|
|
}
|
2014-03-30 23:31:38 +02:00
|
|
|
|
local fg = beautiful.tooltip_fg_color or beautiful.fg_focus or "#000000"
|
|
|
|
|
local font = beautiful.tooltip_font or beautiful.font or "terminus 6"
|
|
|
|
|
|
2014-03-16 13:25:01 +01:00
|
|
|
|
self.textbox = textbox()
|
2014-03-30 23:31:38 +02:00
|
|
|
|
self.textbox:set_font(font)
|
2014-03-16 13:25:01 +01:00
|
|
|
|
self.background = background(self.textbox)
|
2014-03-30 23:31:38 +02:00
|
|
|
|
self.background:set_fg(fg)
|
2015-07-15 18:47:20 +02:00
|
|
|
|
|
|
|
|
|
-- Add margin.
|
2015-07-24 01:52:51 +02:00
|
|
|
|
local m_lr = args.margin_leftright or dpi(5)
|
|
|
|
|
local m_tb = args.margin_topbottom or dpi(3)
|
2016-05-23 05:56:45 +02:00
|
|
|
|
self.marginbox = wibox.container.margin(self.background, m_lr, m_lr, m_tb, m_tb)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
|
|
|
|
-- Add tooltip to objects
|
|
|
|
|
if args.objects then
|
2016-03-02 20:04:19 +01:00
|
|
|
|
for _, obj in ipairs(args.objects) do
|
|
|
|
|
self:add_to_object(obj)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
2012-06-12 20:13:09 +02:00
|
|
|
|
function tooltip.mt:__call(...)
|
2015-02-14 20:31:53 +01:00
|
|
|
|
return tooltip.new(...)
|
2012-06-12 20:13:09 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return setmetatable(tooltip, tooltip.mt)
|
2009-09-09 14:57:27 +02:00
|
|
|
|
|
2015-12-12 17:42:33 +01:00
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|