diff options
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/GlyphMapWidget.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/GlyphMapWidget.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp index f6a4923f1c..3bbf36d6a2 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp @@ -97,6 +97,17 @@ void GlyphMapWidget::set_selection(int start, int size, Optional<u32> active_gly set_active_glyph(active_glyph.value(), ShouldResetSelection::No); } +void GlyphMapWidget::restore_selection(int start, int size, int active_glyph) +{ + if (start == active_glyph && size > 1) { + start = active_glyph + size - 1; + size = -size + 1; + } + m_selection.set_start(start); + m_selection.set_size(size); + set_active_glyph(active_glyph, ShouldResetSelection::No); +} + Gfx::IntRect GlyphMapWidget::get_outer_rect(int glyph) const { glyph -= m_active_range.first; diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.h b/Userland/Libraries/LibGUI/GlyphMapWidget.h index 0c2746c731..7b319321ca 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.h +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.h @@ -57,7 +57,10 @@ public: void set_active_range(Unicode::CodePointRange); void set_active_glyph(int, ShouldResetSelection = ShouldResetSelection::Yes); + void set_selection(int start, int size, Optional<u32> active_glyph = {}); + void restore_selection(int start, int size, int active_glyph); + void scroll_to_glyph(int); void update_glyph(int); |