diff options
author | FrHun <28605587+frhun@users.noreply.github.com> | 2022-02-22 20:25:30 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-06-28 17:52:42 +0100 |
commit | 19fac58e4981e50f7915a48eaf1741757b8dabf9 (patch) | |
tree | 4bd93cb4667428af12e8c15561dcad72892ce2dd /Userland/Libraries/LibGUI/TextEditor.cpp | |
parent | bfbaad9f418bea6a1866e0ed3f86bf517345ed0a (diff) | |
download | serenity-19fac58e4981e50f7915a48eaf1741757b8dabf9.zip |
LibGUI: Use new layout system for basic widgets
Diffstat (limited to 'Userland/Libraries/LibGUI/TextEditor.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 53441febec..aa91b8dfa9 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -743,6 +743,17 @@ void TextEditor::paint_event(PaintEvent& event) painter.fill_rect(cursor_content_rect(), palette().text_cursor()); } +Optional<UISize> TextEditor::calculated_min_size() const +{ + auto margins = content_margins(); + int horizontal = margins.left() + margins.right(), + vertical = margins.top() + margins.bottom(); + int vertical_content_size = font().glyph_height() + 4; + if (!is_multi_line() && m_icon) + vertical_content_size = max(vertical_content_size, icon_size() + 2); + return UISize(horizontal, vertical); +} + void TextEditor::select_all() { TextPosition start_of_document { 0, 0 }; |