Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MenuVisitor Struct Reference

#include <CommandManager.h>

Inheritance diagram for MenuVisitor:
[legend]
Collaboration diagram for MenuVisitor:
[legend]

Public Member Functions

void BeginGroup (Registry::GroupItem &item, const Path &path) final
 
void EndGroup (Registry::GroupItem &item, const Path &) final
 
void Visit (Registry::SingleItem &item, const Path &path) final
 
virtual void DoBeginGroup (Registry::GroupItem &item, const Path &path)
 
virtual void DoEndGroup (Registry::GroupItem &item, const Path &path)
 
virtual void DoVisit (Registry::SingleItem &item, const Path &path)
 
virtual void DoSeparator ()
 
- Public Member Functions inherited from Registry::Visitor
virtual ~Visitor ()
 
virtual void BeginGroup (GroupItem &item, const Path &path)
 
virtual void EndGroup (GroupItem &item, const Path &path)
 
virtual void Visit (SingleItem &item, const Path &path)
 

Private Member Functions

void MaybeDoSeparator ()
 

Private Attributes

std::vector< bool > firstItem
 
std::vector< bool > needSeparator
 

Additional Inherited Members

- Public Types inherited from Registry::Visitor
using Path = std::vector< Identifier >
 

Detailed Description

Definition at line 390 of file CommandManager.h.

Member Function Documentation

◆ BeginGroup()

void MenuVisitor::BeginGroup ( Registry::GroupItem item,
const Path path 
)
finalvirtual

Reimplemented from Registry::Visitor.

Definition at line 108 of file Menus.cpp.

109{
110 bool isMenu = false;
111 bool isExtension = false;
112 auto pItem = &item;
113 if ( pItem->Transparent() ) {
114 }
115 else if ( dynamic_cast<MenuTable::MenuSection*>( pItem ) ) {
116 if ( !needSeparator.empty() )
117 needSeparator.back() = true;
118 }
119 else if ( auto pWhole = dynamic_cast<MenuTable::WholeMenu*>( pItem ) ) {
120 isMenu = true;
121 isExtension = pWhole->extension;
123 }
124
125 DoBeginGroup( item, path );
126
127 if ( isMenu ) {
128 needSeparator.push_back( false );
129 firstItem.push_back( !isExtension );
130 }
131}
void MaybeDoSeparator()
Definition: Menus.cpp:156
virtual void DoBeginGroup(Registry::GroupItem &item, const Path &path)
Definition: Menus.cpp:169
std::vector< bool > firstItem
std::vector< bool > needSeparator

References DoBeginGroup(), firstItem, MaybeDoSeparator(), and needSeparator.

Here is the call graph for this function:

◆ DoBeginGroup()

void MenuVisitor::DoBeginGroup ( Registry::GroupItem item,
const Path path 
)
virtual

Reimplemented in anonymous_namespace{Menus.cpp}::MenuItemVisitor, and anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder.

Definition at line 169 of file Menus.cpp.

170{
171}

Referenced by BeginGroup().

Here is the caller graph for this function:

◆ DoEndGroup()

void MenuVisitor::DoEndGroup ( Registry::GroupItem item,
const Path path 
)
virtual

Reimplemented in anonymous_namespace{Menus.cpp}::MenuItemVisitor, and anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder.

Definition at line 173 of file Menus.cpp.

174{
175}

Referenced by EndGroup().

Here is the caller graph for this function:

◆ DoSeparator()

void MenuVisitor::DoSeparator ( )
virtual

Reimplemented in anonymous_namespace{Menus.cpp}::MenuItemVisitor, and anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder.

Definition at line 181 of file Menus.cpp.

182{
183}

Referenced by MaybeDoSeparator().

Here is the caller graph for this function:

◆ DoVisit()

void MenuVisitor::DoVisit ( Registry::SingleItem item,
const Path path 
)
virtual

Reimplemented in anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder, and anonymous_namespace{Menus.cpp}::MenuItemVisitor.

Definition at line 177 of file Menus.cpp.

178{
179}

Referenced by Visit().

Here is the caller graph for this function:

◆ EndGroup()

void MenuVisitor::EndGroup ( Registry::GroupItem item,
const Path path 
)
finalvirtual

Reimplemented from Registry::Visitor.

Definition at line 133 of file Menus.cpp.

134{
135 auto pItem = &item;
136 if ( pItem->Transparent() ) {
137 }
138 else if ( dynamic_cast<MenuTable::MenuSection*>( pItem ) ) {
139 if ( !needSeparator.empty() )
140 needSeparator.back() = true;
141 }
142 else if ( dynamic_cast<MenuTable::WholeMenu*>( pItem ) ) {
143 firstItem.pop_back();
144 needSeparator.pop_back();
145 }
146
147 DoEndGroup( item, path );
148}
virtual void DoEndGroup(Registry::GroupItem &item, const Path &path)
Definition: Menus.cpp:173

References DoEndGroup(), firstItem, and needSeparator.

Here is the call graph for this function:

◆ MaybeDoSeparator()

void MenuVisitor::MaybeDoSeparator ( )
private

Definition at line 156 of file Menus.cpp.

157{
158 bool separate = false;
159 if ( !needSeparator.empty() ) {
160 separate = needSeparator.back() && !firstItem.back();
161 needSeparator.back() = false;
162 firstItem.back() = false;
163 }
164
165 if ( separate )
166 DoSeparator();
167}
virtual void DoSeparator()
Definition: Menus.cpp:181

References DoSeparator(), firstItem, and needSeparator.

Referenced by BeginGroup(), and Visit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Visit()

void MenuVisitor::Visit ( Registry::SingleItem item,
const Path path 
)
finalvirtual

Reimplemented from Registry::Visitor.

Definition at line 150 of file Menus.cpp.

151{
153 DoVisit( item, path );
154}
virtual void DoVisit(Registry::SingleItem &item, const Path &path)
Definition: Menus.cpp:177

References DoVisit(), and MaybeDoSeparator().

Here is the call graph for this function:

Member Data Documentation

◆ firstItem

std::vector<bool> MenuVisitor::firstItem
private

Definition at line 405 of file CommandManager.h.

Referenced by BeginGroup(), EndGroup(), and MaybeDoSeparator().

◆ needSeparator

std::vector<bool> MenuVisitor::needSeparator
private

Definition at line 406 of file CommandManager.h.

Referenced by BeginGroup(), EndGroup(), and MaybeDoSeparator().


The documentation for this struct was generated from the following files: