Audacity  3.0.3
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 ()
 

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 389 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 112 of file Menus.cpp.

113 {
114  bool isMenu = false;
115  bool isExtension = false;
116  auto pItem = &item;
117  if ( pItem->Transparent() ) {
118  }
119  else if ( dynamic_cast<MenuTable::MenuSection*>( pItem ) ) {
120  if ( !needSeparator.empty() )
121  needSeparator.back() = true;
122  }
123  else if ( auto pWhole = dynamic_cast<MenuTable::WholeMenu*>( pItem ) ) {
124  isMenu = true;
125  isExtension = pWhole->extension;
127  }
128 
129  DoBeginGroup( item, path );
130 
131  if ( isMenu ) {
132  needSeparator.push_back( false );
133  firstItem.push_back( !isExtension );
134  }
135 }

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{PopupMenuTable.cpp}::PopupMenuBuilder, and anonymous_namespace{Menus.cpp}::MenuItemVisitor.

Definition at line 173 of file Menus.cpp.

174 {
175 }

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{PopupMenuTable.cpp}::PopupMenuBuilder, and anonymous_namespace{Menus.cpp}::MenuItemVisitor.

Definition at line 177 of file Menus.cpp.

178 {
179 }

Referenced by EndGroup().

Here is the caller graph for this function:

◆ DoSeparator()

void MenuVisitor::DoSeparator ( )
virtual

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

Definition at line 185 of file Menus.cpp.

186 {
187 }

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{Menus.cpp}::MenuItemVisitor, and anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder.

Definition at line 181 of file Menus.cpp.

182 {
183 }

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 137 of file Menus.cpp.

138 {
139  auto pItem = &item;
140  if ( pItem->Transparent() ) {
141  }
142  else if ( dynamic_cast<MenuTable::MenuSection*>( pItem ) ) {
143  if ( !needSeparator.empty() )
144  needSeparator.back() = true;
145  }
146  else if ( dynamic_cast<MenuTable::WholeMenu*>( pItem ) ) {
147  firstItem.pop_back();
148  needSeparator.pop_back();
149  }
150 
151  DoEndGroup( item, path );
152 }

References DoEndGroup(), firstItem, and needSeparator.

Here is the call graph for this function:

◆ MaybeDoSeparator()

void MenuVisitor::MaybeDoSeparator ( )
private

Definition at line 160 of file Menus.cpp.

161 {
162  bool separate = false;
163  if ( !needSeparator.empty() ) {
164  separate = needSeparator.back() && !firstItem.back();
165  needSeparator.back() = false;
166  firstItem.back() = false;
167  }
168 
169  if ( separate )
170  DoSeparator();
171 }

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 154 of file Menus.cpp.

155 {
157  DoVisit( item, path );
158 }

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 404 of file CommandManager.h.

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

◆ needSeparator

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

Definition at line 405 of file CommandManager.h.

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


The documentation for this struct was generated from the following files:
MenuVisitor::firstItem
std::vector< bool > firstItem
Definition: CommandManager.h:404
MenuVisitor::DoBeginGroup
virtual void DoBeginGroup(Registry::GroupItem &item, const Path &path)
Definition: Menus.cpp:173
MenuVisitor::needSeparator
std::vector< bool > needSeparator
Definition: CommandManager.h:405
MenuVisitor::MaybeDoSeparator
void MaybeDoSeparator()
Definition: Menus.cpp:160
MenuVisitor::DoVisit
virtual void DoVisit(Registry::SingleItem &item, const Path &path)
Definition: Menus.cpp:181
MenuTable::MenuSection
Definition: CommandManager.h:420
MenuVisitor::DoSeparator
virtual void DoSeparator()
Definition: Menus.cpp:185
MenuVisitor::DoEndGroup
virtual void DoEndGroup(Registry::GroupItem &item, const Path &path)
Definition: Menus.cpp:177
MenuTable::WholeMenu
Definition: CommandManager.h:423