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
commit 9d9a31384e
Notes: sideshowbarker 2024-07-19 06:17:32 +09:00
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;