diff --git a/data/core/statusview.lua b/data/core/statusview.lua index 67a4c8be..2710b1ba 100644 --- a/data/core/statusview.lua +++ b/data/core/statusview.lua @@ -39,6 +39,17 @@ function StatusView:show_message(icon, icon_color, text) end +function StatusView:show_tooltip(text) + self.message = { style.text, text } + self.message_timeout = system.get_time() + 1000 +end + + +function StatusView:remove_tooltip() + self.message_timeout = 0 +end + + function StatusView:update() self.size.y = style.font:get_height() + style.padding.y * 2 diff --git a/data/plugins/toolbarview.lua b/data/plugins/toolbarview.lua index 245a5da0..7dec7690 100644 --- a/data/plugins/toolbarview.lua +++ b/data/plugins/toolbarview.lua @@ -24,6 +24,7 @@ function ToolbarView:new() ToolbarView.super.new(self) self.visible = true self.init_size = toolbar_height + self.tooltip = false end @@ -89,10 +90,15 @@ function ToolbarView:on_mouse_moved(px, py, ...) for item, x, y, w, h in self:each_item() do if px > x and py > y and px <= x + w and py <= y + h then self.hovered_item = item - core.log(command.prettify_name(item.command)) - break + core.status_view:show_tooltip(command.prettify_name(item.command)) + self.tooltip = true + return end end + if self.tooltip then + core.status_view:remove_tooltip() + self.tooltip = false + end end -- The toolbarview pane is not plugged here but it is added in the