Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
MenuTable::detail::VisitorBase Struct Reference

#include <CommandManager.h>

Inheritance diagram for MenuTable::detail::VisitorBase:
[legend]
Collaboration diagram for MenuTable::detail::VisitorBase:
[legend]

Public Member Functions

std::pair< bool, bool > ShouldBeginGroup (const MenuItemProperties *pProperties)
 
void AfterBeginGroup (const MenuItemProperties *pProperties)
 
bool ShouldEndGroup (const MenuItemProperties *pProperties)
 
bool ShouldDoSeparator ()
 

Public Attributes

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

Detailed Description

Definition at line 409 of file CommandManager.h.

Member Function Documentation

◆ AfterBeginGroup()

void MenuTable::detail::VisitorBase::AfterBeginGroup ( const MenuItemProperties pProperties)

Definition at line 137 of file Menus.cpp.

139{
140 const auto properties =
141 pProperties ? pProperties->GetProperties() : MenuItemProperties::None;
142
143 bool isMenu = false;
144 bool isExtension = false;
145
146 switch (properties) {
149 isMenu = true;
150 isExtension = (properties == MenuItemProperties::Extension);
151 break;
152 }
153 default:
154 break;
155 }
156
157 if (isMenu) {
158 needSeparator.push_back(false);
159 firstItem.push_back(!isExtension);
160 }
161}
virtual Properties GetProperties() const =0
std::vector< bool > firstItem
std::vector< bool > needSeparator

References MenuTable::MenuItemProperties::Extension, MenuTable::MenuItemProperties::GetProperties(), MenuTable::MenuItemProperties::None, and MenuTable::MenuItemProperties::Whole.

Referenced by MenuTable::Visitor< MenuTraits >::Visitor().

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

◆ ShouldBeginGroup()

std::pair< bool, bool > MenuTable::detail::VisitorBase::ShouldBeginGroup ( const MenuItemProperties pProperties)

Definition at line 106 of file Menus.cpp.

108{
109 const auto properties =
110 pProperties ? pProperties->GetProperties() : MenuItemProperties::None;
111
112 bool inlined = false;
113 bool shouldDoSeparator = false;
114
115 switch (properties) {
117 inlined = true;
118 break;
119 }
121 if (!needSeparator.empty())
122 needSeparator.back() = true;
123 break;
124 }
127 shouldDoSeparator = ShouldDoSeparator();
128 break;
129 }
130 default:
131 break;
132 }
133
134 return { !inlined, shouldDoSeparator };
135}

References MenuTable::MenuItemProperties::Extension, MenuTable::MenuItemProperties::GetProperties(), MenuTable::MenuItemProperties::Inline, needSeparator, MenuTable::MenuItemProperties::None, MenuTable::MenuItemProperties::Section, ShouldDoSeparator(), and MenuTable::MenuItemProperties::Whole.

Referenced by MenuTable::Visitor< MenuTraits >::Visitor().

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

◆ ShouldDoSeparator()

bool MenuTable::detail::VisitorBase::ShouldDoSeparator ( )

Definition at line 194 of file Menus.cpp.

195{
196 bool separate = false;
197 if (!needSeparator.empty()) {
198 separate = needSeparator.back() && !firstItem.back();
199 needSeparator.back() = false;
200 firstItem.back() = false;
201 }
202 return separate;
203}

Referenced by ShouldBeginGroup(), and MenuTable::Visitor< MenuTraits >::Visitor().

Here is the caller graph for this function:

◆ ShouldEndGroup()

bool MenuTable::detail::VisitorBase::ShouldEndGroup ( const MenuItemProperties pProperties)

Definition at line 163 of file Menus.cpp.

165{
166 const auto properties =
167 pProperties ? pProperties->GetProperties() : MenuItemProperties::None;
168
169 bool inlined = false;
170
171 switch (properties) {
173 inlined = true;
174 break;
175 }
177 if ( !needSeparator.empty() )
178 needSeparator.back() = true;
179 break;
180 }
183 firstItem.pop_back();
184 needSeparator.pop_back();
185 break;
186 }
187 default:
188 break;
189 }
190
191 return !inlined;
192}

References MenuTable::MenuItemProperties::Extension, MenuTable::MenuItemProperties::GetProperties(), MenuTable::MenuItemProperties::Inline, MenuTable::MenuItemProperties::None, MenuTable::MenuItemProperties::Section, and MenuTable::MenuItemProperties::Whole.

Referenced by MenuTable::Visitor< MenuTraits >::Visitor().

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

Member Data Documentation

◆ firstItem

std::vector<bool> MenuTable::detail::VisitorBase::firstItem

Definition at line 416 of file CommandManager.h.

◆ needSeparator

std::vector<bool> MenuTable::detail::VisitorBase::needSeparator

Definition at line 417 of file CommandManager.h.

Referenced by ShouldBeginGroup().


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