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

HackStudio: Show documentation preview in tooltip on identifier hover

When hovering over a C++ token that we have a man page for, we now show
the man page in a tooltip window.

This feels rather bulky at the moment, but the basic mechanism is quite
neat and just needs a bunch of tuning.
This commit is contained in:
Andreas Kling 2019-10-29 21:39:12 +01:00
parent a4709502d1
commit 7c71040ba9
4 changed files with 128 additions and 7 deletions

View file

@ -3,11 +3,12 @@
#include <LibGUI/GTextEditor.h>
class EditorWrapper;
class HtmlView;
class Editor final : public GTextEditor {
C_OBJECT(Editor)
public:
virtual ~Editor() override {}
virtual ~Editor() override;
Function<void()> on_focus;
@ -18,9 +19,12 @@ private:
virtual void focusin_event(CEvent&) override;
virtual void focusout_event(CEvent&) override;
virtual void paint_event(GPaintEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
Editor(GWidget* parent)
: GTextEditor(GTextEditor::MultiLine, parent)
{
}
void show_documentation_tooltip_if_available(const String&, const Point& screen_location);
explicit Editor(GWidget* parent);
RefPtr<GWindow> m_documentation_tooltip_window;
RefPtr<HtmlView> m_documentation_html_view;
};