mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibGUI: Update active tooltip when source widget changes the label
Application::show_tooltip() now keeps track of the application's active tooltip source widget so it can be updated while being shown when the same widget updates its tooltip label. Application::hide_tooltip() will unset the tooltip source widget, respectively. This is pretty useful for the ResourceGraph applet's tooltips! Also re-use the Application::TooltipWindow's rect position in its set_tooltip() method to avoid flickering from the window temporarily being moved to 100, 100 and the position adjusted moments later.
This commit is contained in:
parent
f19b88c965
commit
47d7faa998
5 changed files with 27 additions and 7 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Shortcut.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
|
||||
namespace GUI {
|
||||
|
@ -53,8 +54,9 @@ public:
|
|||
void register_global_shortcut_action(Badge<Action>, Action&);
|
||||
void unregister_global_shortcut_action(Badge<Action>, Action&);
|
||||
|
||||
void show_tooltip(const StringView&, const Gfx::IntPoint& screen_location);
|
||||
void show_tooltip(const StringView&, const Gfx::IntPoint& screen_location, const Widget* tooltip_source_widget);
|
||||
void hide_tooltip();
|
||||
Widget* tooltip_source_widget() { return m_tooltip_source_widget; };
|
||||
|
||||
bool quit_when_last_window_deleted() const { return m_quit_when_last_window_deleted; }
|
||||
void set_quit_when_last_window_deleted(bool b) { m_quit_when_last_window_deleted = b; }
|
||||
|
@ -82,6 +84,7 @@ private:
|
|||
HashMap<Shortcut, Action*> m_global_shortcut_actions;
|
||||
class TooltipWindow;
|
||||
RefPtr<TooltipWindow> m_tooltip_window;
|
||||
RefPtr<Widget> m_tooltip_source_widget;
|
||||
bool m_quit_when_last_window_deleted { true };
|
||||
bool m_focus_debugging_enabled { false };
|
||||
String m_invoked_as;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue