mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +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
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Margins.h>
|
||||
|
@ -113,7 +114,7 @@ public:
|
|||
|
||||
bool has_tooltip() const { return !m_tooltip.is_empty(); }
|
||||
String tooltip() const { return m_tooltip; }
|
||||
void set_tooltip(const StringView& tooltip) { m_tooltip = tooltip; }
|
||||
void set_tooltip(const StringView&);
|
||||
|
||||
bool is_enabled() const { return m_enabled; }
|
||||
void set_enabled(bool);
|
||||
|
@ -313,6 +314,8 @@ private:
|
|||
void focus_previous_widget(FocusSource);
|
||||
void focus_next_widget(FocusSource);
|
||||
|
||||
void show_tooltip();
|
||||
|
||||
Window* m_window { nullptr };
|
||||
RefPtr<Layout> m_layout;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue