mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:57:43 +00:00
LibGUI: Add set_selection() convenience helper to GlyphMapWidget
This commit is contained in:
parent
5c6326ae23
commit
df443863bd
2 changed files with 9 additions and 0 deletions
|
@ -89,6 +89,14 @@ void GlyphMapWidget::set_active_glyph(int glyph, ShouldResetSelection should_res
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlyphMapWidget::set_selection(int start, int size, Optional<u32> active_glyph)
|
||||||
|
{
|
||||||
|
m_selection.set_start(start);
|
||||||
|
m_selection.set_size(size);
|
||||||
|
if (active_glyph.has_value())
|
||||||
|
set_active_glyph(active_glyph.value(), ShouldResetSelection::No);
|
||||||
|
}
|
||||||
|
|
||||||
Gfx::IntRect GlyphMapWidget::get_outer_rect(int glyph) const
|
Gfx::IntRect GlyphMapWidget::get_outer_rect(int glyph) const
|
||||||
{
|
{
|
||||||
glyph -= m_active_range.first;
|
glyph -= m_active_range.first;
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
|
|
||||||
void set_active_range(Unicode::CodePointRange);
|
void set_active_range(Unicode::CodePointRange);
|
||||||
void set_active_glyph(int, ShouldResetSelection = ShouldResetSelection::Yes);
|
void set_active_glyph(int, ShouldResetSelection = ShouldResetSelection::Yes);
|
||||||
|
void set_selection(int start, int size, Optional<u32> active_glyph = {});
|
||||||
void clear_selection() { m_selection.set_size(0); }
|
void clear_selection() { m_selection.set_size(0); }
|
||||||
void scroll_to_glyph(int);
|
void scroll_to_glyph(int);
|
||||||
void update_glyph(int);
|
void update_glyph(int);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue