summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-12-15 19:48:06 -0500
committerAndreas Kling <kling@serenityos.org>2022-12-20 10:22:27 +0100
commit0f5ce017c5be265f7eef1716e142ab00e8422a5f (patch)
tree60fb360b1b04bf793cfc218660d2f7db0cb92c8a
parentc4ac73d0738243fd3cd0246d5038b2319f0f07a4 (diff)
downloadserenity-0f5ce017c5be265f7eef1716e142ab00e8422a5f.zip
LibGUI: Implement calculated_min_size() for GlyphMapWidget
-rw-r--r--Userland/Libraries/LibGUI/GlyphMapWidget.cpp8
-rw-r--r--Userland/Libraries/LibGUI/GlyphMapWidget.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp
index 6ddc8319d2..eff4612537 100644
--- a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp
+++ b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp
@@ -498,4 +498,12 @@ ErrorOr<void> GlyphMapWidget::set_font(Gfx::Font const& font)
return {};
}
+Optional<UISize> GlyphMapWidget::calculated_min_size() const
+{
+ auto scrollbar = vertical_scrollbar().effective_min_size().height().as_int();
+ auto min_height = max(font().glyph_height() + m_vertical_spacing, scrollbar);
+ auto min_width = font().max_glyph_width() + m_horizontal_spacing + width_occupied_by_vertical_scrollbar();
+ return { { min_width + frame_thickness() * 2, min_height + frame_thickness() * 2 } };
+}
+
}
diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.h b/Userland/Libraries/LibGUI/GlyphMapWidget.h
index acc0c7a19a..ffd312527c 100644
--- a/Userland/Libraries/LibGUI/GlyphMapWidget.h
+++ b/Userland/Libraries/LibGUI/GlyphMapWidget.h
@@ -88,6 +88,7 @@ private:
virtual void resize_event(ResizeEvent&) override;
virtual void did_change_font() override;
virtual void context_menu_event(ContextMenuEvent&) override;
+ virtual Optional<UISize> calculated_min_size() const override;
Gfx::IntRect get_outer_rect(int glyph) const;
Optional<int> glyph_at_position(Gfx::IntPoint) const;