1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibGUI+WindowServer: Add support for GWidget tooltips.

Any GWidget can have a tooltip and it will automatically pop up below the
center of the widget when hovered. GActions added to GToolBars will use
the action text() as their tooltip automagically. :^)
This commit is contained in:
Andreas Kling 2019-04-08 18:58:44 +02:00
parent 3e175c9a96
commit 7f2eeb0b35
15 changed files with 136 additions and 27 deletions

View file

@ -9,6 +9,7 @@ class GAction;
class GKeyEvent;
class GEventLoop;
class GMenuBar;
class Point;
class GApplication {
public:
@ -25,8 +26,13 @@ public:
void register_shortcut_action(Badge<GAction>, GAction&);
void unregister_shortcut_action(Badge<GAction>, GAction&);
void show_tooltip(const String&, const Point& screen_location);
void hide_tooltip();
private:
OwnPtr<GEventLoop> m_event_loop;
OwnPtr<GMenuBar> m_menubar;
HashMap<GShortcut, GAction*> m_shortcut_actions;
class TooltipWindow;
TooltipWindow* m_tooltip_window { nullptr };
};