diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-15 00:24:14 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-15 00:24:14 +0100 |
commit | e1ff4fa034377c5a13d5ab23d6e58ea3d3d7fafb (patch) | |
tree | c69f1b825e8a00274ccaa9ed2dc7e8c07107365d /Libraries | |
parent | 69400c2ca14125c606f31543d7e0f449687cf628 (diff) | |
download | serenity-e1ff4fa034377c5a13d5ab23d6e58ea3d3d7fafb.zip |
LibGUI: Remove more header dependencies from Widget.h
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGUI/CppSyntaxHighlighter.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibGUI/InputBox.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibGUI/TextDocument.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/TextEditor.cpp | 11 | ||||
-rw-r--r-- | Libraries/LibGUI/TextEditor.h | 7 | ||||
-rw-r--r-- | Libraries/LibGUI/Widget.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibGUI/Widget.h | 2 | ||||
-rw-r--r-- | Libraries/LibHTML/DOM/HTMLInputElement.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibVT/TerminalWidget.h | 3 |
9 files changed, 22 insertions, 7 deletions
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 <LibGUI/CppLexer.h> #include <LibGUI/CppSyntaxHighlighter.h> #include <LibGUI/TextEditor.h> +#include <LibGfx/Font.h> 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 <LibGUI/InputBox.h> #include <LibGUI/Label.h> #include <LibGUI/TextEditor.h> +#include <LibGfx/Font.h> #include <stdio.h> 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 <LibGUI/TextRange.h> #include <LibGUI/UndoStack.h> #include <LibGfx/Color.h> -#include <LibGfx/Font.h> +#include <LibGfx/Forward.h> 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 <LibGUI/TextEditor.h> #include <LibGUI/Window.h> #include <LibGfx/Bitmap.h> +#include <LibGfx/Font.h> #include <LibGfx/Palette.h> #include <ctype.h> #include <fcntl.h> @@ -1500,4 +1501,14 @@ void TextEditor::set_syntax_highlighter(OwnPtr<SyntaxHighlighter> 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 <AK/HashMap.h> #include <AK/NonnullOwnPtrVector.h> #include <AK/NonnullRefPtrVector.h> +#include <LibCore/ElapsedTimer.h> #include <LibCore/Timer.h> -#include <LibGfx/TextAlignment.h> #include <LibGUI/ScrollableWidget.h> #include <LibGUI/TextDocument.h> #include <LibGUI/TextRange.h> +#include <LibGfx/TextAlignment.h> 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 <LibGUI/Window.h> #include <LibGUI/WindowServerConnection.h> #include <LibGfx/Bitmap.h> +#include <LibGfx/Font.h> #include <LibGfx/Palette.h> #include <unistd.h> 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 <AK/Badge.h> #include <AK/HashMap.h> #include <AK/String.h> -#include <LibCore/ElapsedTimer.h> #include <LibCore/Object.h> #include <LibGUI/Event.h> -#include <LibGUI/Shortcut.h> #include <LibGfx/Color.h> #include <LibGfx/Forward.h> #include <LibGfx/Orientation.h> 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 <LibCore/ElapsedTimer.h> #include <LibGUI/Button.h> #include <LibGUI/TextBox.h> #include <LibHTML/DOM/Document.h> 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 <AK/String.h> #include <LibCore/ConfigFile.h> +#include <LibCore/ElapsedTimer.h> #include <LibCore/Notifier.h> #include <LibCore/Timer.h> +#include <LibGUI/Frame.h> #include <LibGfx/Bitmap.h> #include <LibGfx/Rect.h> -#include <LibGUI/Frame.h> #include <LibVT/Terminal.h> namespace GUI { |