1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:57:44 +00:00

LibGUI: Shrink the default selection rect of TreeView items

Instead of filling the whole row with selection color, only fill behind
the text. This gives a snugger, more focused appearance.

For embedders that want the entire row to get filled with the selection
color when selected, they can opt in to the old behavior by calling
TreeView::set_should_fill_selected_rows(). This is used by Profiler.
This commit is contained in:
Andreas Kling 2020-10-27 20:33:30 +01:00
parent df98c9ebbe
commit 0391806eec
3 changed files with 23 additions and 6 deletions

View file

@ -48,6 +48,9 @@ public:
Function<void(const ModelIndex&, const bool)> on_toggle;
void set_should_fill_selected_rows(bool fill) { m_should_fill_selected_rows = fill; }
bool should_fill_selected_rows() const { return m_should_fill_selected_rows; }
protected:
TreeView();
@ -84,6 +87,8 @@ private:
RefPtr<Gfx::Bitmap> m_expand_bitmap;
RefPtr<Gfx::Bitmap> m_collapse_bitmap;
bool m_should_fill_selected_rows { false };
};
}