1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

GTreeView: Support multiple root-level items

Previously it was only possible to have a single root-level item in a
GTreeView. This was an oversight and I didn't realize it because this
code was only ever used in the FileManager, which has one root ("/").

Also factored out item toggling into a separate function, and increase
the base indentation level so that root items can be toggled as well.

Finally, let the user toggle the selected item with the spacebar. :^)
This commit is contained in:
Andreas Kling 2019-08-18 10:17:00 +02:00
parent f6cb2fd2fb
commit 5c7bb09a73
2 changed files with 25 additions and 8 deletions

View file

@ -27,6 +27,7 @@ private:
int toggle_size() const { return 9; }
int text_padding() const { return 2; }
void update_content_size();
void toggle_index(const GModelIndex&);
template<typename Callback>
void traverse_in_paint_order(Callback) const;