1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibGUI: add 'always_wrap_item_labels' property to IconView.

In some circumstances (like template selection dialogs,) displaying as much
item label as possible, on all items, may be desired.

The default setting is 'false', which matches the default behaviour from before;
only wrapping on hover or selection.
This commit is contained in:
Nick Vella 2021-01-29 16:26:04 +11:00 committed by Andreas Kling
parent 35a1e12459
commit a6fdc17f3f
2 changed files with 6 additions and 1 deletions

View file

@ -431,7 +431,7 @@ void IconView::get_item_rects(int item_index, ItemData& item_data, const Gfx::Fo
item_data.text_rect = { 0, item_data.icon_rect.bottom() + 6 + 1, 0, font.glyph_height() };
item_data.wrapped_text_lines.clear();
if ((unwrapped_text_width > available_width) && (item_data.selected || m_hovered_index == item_data.index || cursor_index() == item_data.index)) {
if ((unwrapped_text_width > available_width) && (item_data.selected || m_hovered_index == item_data.index || cursor_index() == item_data.index || m_always_wrap_item_labels)) {
int current_line_width = 0;
int current_line_start = 0;
int widest_line_width = 0;