diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2019-09-25 12:44:22 +0300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-28 18:29:42 +0200 |
commit | b9493ba783e833769e04b8276a42be8c18c98339 (patch) | |
tree | 2f5dbe52dd6e5140cf3083cfe6c2ec4d8b240aa4 /Libraries/LibHTML/HtmlView.h | |
parent | 8a2beaf52b848c9069856e28ab25c7ce6df92459 (diff) | |
download | serenity-b9493ba783e833769e04b8276a42be8c18c98339.zip |
LibHTML: Introduce the HtmlView widget
This is a GWidget that can display contents of an HTML document.
It replaces the Frame class.
Diffstat (limited to 'Libraries/LibHTML/HtmlView.h')
-rw-r--r-- | Libraries/LibHTML/HtmlView.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Libraries/LibHTML/HtmlView.h b/Libraries/LibHTML/HtmlView.h new file mode 100644 index 0000000000..8d04f738fe --- /dev/null +++ b/Libraries/LibHTML/HtmlView.h @@ -0,0 +1,26 @@ +#pragma once + +#include <LibGUI/GScrollableWidget.h> +#include <LibHTML/DOM/Document.h> + +class HtmlView : public GScrollableWidget { + C_OBJECT(HtmlView) +public: + virtual ~HtmlView() override {} + + Document* document() { return m_document; } + const Document* document() const { return m_document; } + void set_document(Document*); + +protected: + HtmlView(GWidget* parent = nullptr); + + virtual void resize_event(GResizeEvent&) override; + virtual void paint_event(GPaintEvent&) override; + +private: + void layout_and_sync_size(); + + RefPtr<Document> m_document; + RefPtr<LayoutNode> m_layout_root; +}; |