Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
BasicMenu::Handle Class Reference

#include <BasicMenu.h>

Public Member Functions

 Handle (wxMenu *pMenu)
 
 Handle (const Handle &other)=delete
 
Handleoperator= (const Handle &other)=delete
 
void Popup (const BasicUI::WindowPlacement &window, const Point &pos={})
 Display the menu at pos, invoke at most one action, then hide it. More...
 

Private Attributes

wxMenu * mpMenu
 

Detailed Description

Definition at line 25 of file BasicMenu.h.

Constructor & Destructor Documentation

◆ Handle() [1/2]

BasicMenu::Handle::Handle ( wxMenu *  pMenu)
inlineexplicit

Definition at line 29 of file BasicMenu.h.

29: mpMenu{ pMenu } {}
wxMenu * mpMenu
Definition: BasicMenu.h:39

◆ Handle() [2/2]

BasicMenu::Handle::Handle ( const Handle other)
delete

Member Function Documentation

◆ operator=()

Handle & BasicMenu::Handle::operator= ( const Handle other)
delete

◆ Popup()

void BasicMenu::Handle::Popup ( const BasicUI::WindowPlacement window,
const Point pos = {} 
)

Display the menu at pos, invoke at most one action, then hide it.

Definition at line 209 of file BasicMenu.cpp.

210{
211 wxMenu *const pMenu = mpMenu;
212 if ( !pMenu )
213 return;
214
215 if ( auto pWindow = wxWidgetsWindowPlacement::GetParent( window ) ) {
216 sHandledEvent = false;
217
218 // Put the menu pointers where the event filter can find them
219 sMenuStack.push_back( FindDescendants( *pMenu ) );
220 auto cleanup = finally( []{ sMenuStack.pop_back(); } );
221
222 if ( Journal::IsReplaying() )
223 ReplayPopup( pMenu );
224 else
225 pWindow->PopupMenu( pMenu, { pos.x, pos.y } );
226
227 if ( !sHandledEvent )
228 // Menu popped but no command was selected. Record that.
230 }
231}
constexpr auto JournalCode
void Output(const wxString &string)
bool IsReplaying()
Definition: Journal.cpp:216
static wxWindow * GetParent(const WindowPlacement &placement)
Retrieve the pointer to window, if placement is of this type; else null.

References BasicMenu::anonymous_namespace{BasicMenu.cpp}::FindDescendants(), wxWidgetsWindowPlacement::GetParent(), Journal::IsReplaying(), JournalCode, mpMenu, Journal::Output(), BasicMenu::anonymous_namespace{BasicMenu.cpp}::ReplayPopup(), BasicMenu::anonymous_namespace{BasicMenu.cpp}::sHandledEvent, BasicMenu::anonymous_namespace{BasicMenu.cpp}::sMenuStack, BasicUI::Point::x, and BasicUI::Point::y.

Referenced by SelectionBar::AddSelectionSetupButton(), CommonTrackPanelCell::DoContextMenu(), AudioSetupToolBar::OnAudioSetup(), NumericTextCtrl::OnContext(), KeyConfigPrefs::OnDefaults(), EffectUIHost::OnMenu(), anonymous_namespace{SnappingToolBar.cpp}::SnapModePopup::OnPopup(), anonymous_namespace{PopupMenuTable.cpp}::PopupMenuImpl::Popup(), LabelTrackView::ShowContextMenu(), AdornedRulerPanel::ShowMenu(), MeterPanel::ShowMenu(), and AdornedRulerPanel::ShowScrubMenu().

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

Member Data Documentation

◆ mpMenu

wxMenu* BasicMenu::Handle::mpMenu
private

Definition at line 39 of file BasicMenu.h.

Referenced by Popup().


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