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

LibGUI: Allow expand/collapse subtrees in TreeView with Alt+Left/Right

This makes TreeView a lot more keyboard friendly.
This commit is contained in:
Andreas Kling 2020-05-21 13:36:08 +02:00
parent 63d98bbd76
commit 9d9a31384e
2 changed files with 46 additions and 0 deletions

View file

@ -41,6 +41,9 @@ public:
virtual int item_count() const override;
virtual void toggle_index(const ModelIndex&) override;
void expand_tree(const ModelIndex& root = {});
void collapse_tree(const ModelIndex& root = {});
protected:
TreeView();
@ -69,6 +72,7 @@ private:
struct MetadataForIndex;
MetadataForIndex& ensure_metadata_for_index(const ModelIndex&) const;
void set_open_state_of_all_in_subtree(const ModelIndex& root, bool open);
mutable HashMap<void*, NonnullOwnPtr<MetadataForIndex>> m_view_metadata;