From e1ff4fa034377c5a13d5ab23d6e58ea3d3d7fafb Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 15 Feb 2020 00:24:14 +0100 Subject: LibGUI: Remove more header dependencies from Widget.h --- Libraries/LibGUI/CppSyntaxHighlighter.cpp | 1 + Libraries/LibGUI/InputBox.cpp | 1 + Libraries/LibGUI/TextDocument.h | 2 +- Libraries/LibGUI/TextEditor.cpp | 11 +++++++++++ Libraries/LibGUI/TextEditor.h | 7 ++++--- Libraries/LibGUI/Widget.cpp | 1 + Libraries/LibGUI/Widget.h | 2 -- Libraries/LibHTML/DOM/HTMLInputElement.cpp | 1 + Libraries/LibVT/TerminalWidget.h | 3 ++- 9 files changed, 22 insertions(+), 7 deletions(-) (limited to 'Libraries') diff --git a/Libraries/LibGUI/CppSyntaxHighlighter.cpp b/Libraries/LibGUI/CppSyntaxHighlighter.cpp index 931063c2d3..65deef31fb 100644 --- a/Libraries/LibGUI/CppSyntaxHighlighter.cpp +++ b/Libraries/LibGUI/CppSyntaxHighlighter.cpp @@ -1,6 +1,7 @@ #include #include #include +#include namespace GUI { diff --git a/Libraries/LibGUI/InputBox.cpp b/Libraries/LibGUI/InputBox.cpp index 7c224e1dcb..a80d7c9d8c 100644 --- a/Libraries/LibGUI/InputBox.cpp +++ b/Libraries/LibGUI/InputBox.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace GUI { diff --git a/Libraries/LibGUI/TextDocument.h b/Libraries/LibGUI/TextDocument.h index 57420777e9..10416937b2 100644 --- a/Libraries/LibGUI/TextDocument.h +++ b/Libraries/LibGUI/TextDocument.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include namespace GUI { diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp index ea106cd502..5e2daad581 100644 --- a/Libraries/LibGUI/TextEditor.cpp +++ b/Libraries/LibGUI/TextEditor.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1500,4 +1501,14 @@ void TextEditor::set_syntax_highlighter(OwnPtr highlighter) } } +int TextEditor::line_height() const +{ + return font().glyph_height() + m_line_spacing; +} + +int TextEditor::glyph_width() const +{ + return font().glyph_width('x'); +} + } diff --git a/Libraries/LibGUI/TextEditor.h b/Libraries/LibGUI/TextEditor.h index be041091a1..d84c485dd1 100644 --- a/Libraries/LibGUI/TextEditor.h +++ b/Libraries/LibGUI/TextEditor.h @@ -30,11 +30,12 @@ #include #include #include +#include #include -#include #include #include #include +#include namespace GUI { @@ -89,11 +90,11 @@ public: void scroll_position_into_view(const TextPosition&); size_t line_count() const { return document().line_count(); } int line_spacing() const { return m_line_spacing; } - int line_height() const { return font().glyph_height() + m_line_spacing; } + int line_height() const; TextPosition cursor() const { return m_cursor; } TextRange normalized_selection() const { return m_selection.normalized(); } // FIXME: This should take glyph spacing into account, no? - int glyph_width() const { return font().glyph_width('x'); } + int glyph_width() const; void insert_at_cursor_or_replace_selection(const StringView&); bool write_to_file(const StringView& path); diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp index a363a730ba..e7ab4aa14a 100644 --- a/Libraries/LibGUI/Widget.cpp +++ b/Libraries/LibGUI/Widget.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include diff --git a/Libraries/LibGUI/Widget.h b/Libraries/LibGUI/Widget.h index a0e3ed13b3..536d554424 100644 --- a/Libraries/LibGUI/Widget.h +++ b/Libraries/LibGUI/Widget.h @@ -29,10 +29,8 @@ #include #include #include -#include #include #include -#include #include #include #include diff --git a/Libraries/LibHTML/DOM/HTMLInputElement.cpp b/Libraries/LibHTML/DOM/HTMLInputElement.cpp index 238eb71a67..7780f08d26 100644 --- a/Libraries/LibHTML/DOM/HTMLInputElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLInputElement.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h index a1b994dd9a..7e465828c4 100644 --- a/Libraries/LibVT/TerminalWidget.h +++ b/Libraries/LibVT/TerminalWidget.h @@ -28,11 +28,12 @@ #include #include +#include #include #include +#include #include #include -#include #include namespace GUI { -- cgit v1.2.3