1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Define abstract Visitor for menu items, and concrete subclass...

... The general visitation procedure will find reuse with other specific
actions, and maybe for other non-menu trees too
This commit is contained in:
Paul Licameli
2019-01-08 12:19:51 -05:00
parent 4eee417ded
commit 356e5d545e
3 changed files with 143 additions and 53 deletions

View File

@@ -524,6 +524,23 @@ namespace Registry {
using GroupItem::GroupItem;
~TransparentGroupItem() override;
};
// Define actions to be done in Visit.
// Default implementations do nothing
// The supplied path does not include the name of the item
class Visitor
{
public:
virtual ~Visitor();
using Path = std::vector< Identifier >;
virtual void BeginGroup( GroupItem &item, const Path &path );
virtual void EndGroup( GroupItem &item, const Path &path );
virtual void Visit( SingleItem &item, const Path &path );
};
// Top-down visitation of all items and groups in a tree
void Visit(
Visitor &visitor, AudacityProject &project, BaseItem *pTopItem );
}
// Define items that populate tables that specifically describe menu trees