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

LibGUI: Improve and simplify IconView item name wrapping

Move the wrapping logic to get_item_rects(). This makes mouse events
able to hit the wrapped labels, and various other little things stop
glitching out as well.

Also, instead of having a per-line width when wrapping icon names,
make the text rect wide enough to fit every line.
This commit is contained in:
Andreas Kling 2020-10-27 16:10:30 +01:00
parent 7112031bfb
commit 272af7685b
4 changed files with 78 additions and 43 deletions

View file

@ -143,6 +143,8 @@ protected:
virtual void add_selection(const ModelIndex&);
virtual void remove_selection(const ModelIndex&);
virtual void toggle_selection(const ModelIndex&);
virtual void did_change_hovered_index([[maybe_unused]] const ModelIndex& old_index, [[maybe_unused]] const ModelIndex& new_index) { }
virtual void did_change_cursor_index([[maybe_unused]] const ModelIndex& old_index, [[maybe_unused]] const ModelIndex& new_index) { }
void draw_item_text(Gfx::Painter&, const ModelIndex&, bool, const Gfx::IntRect&, const StringView&, const Gfx::Font&, Gfx::TextAlignment, Gfx::TextElision);