本文整理汇总了C++中wxMenuEvent::GetEventType方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMenuEvent::GetEventType方法的具体用法?C++ wxMenuEvent::GetEventType怎么用?C++ wxMenuEvent::GetEventType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxMenuEvent
的用法示例。
在下文中一共展示了wxMenuEvent::GetEventType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMenuEvent
void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
{
OPT_TOOL_EVENT evt;
wxEventType type = aEvent.GetEventType();
// When the currently chosen item in the menu is changed, an update event is issued.
// For example, the selection tool can use this to dynamically highlight the current item
// from selection clarification popup.
if( type == wxEVT_MENU_HIGHLIGHT )
evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_UPDATE, aEvent.GetId() );
// One of menu entries was selected..
else if( type == wxEVT_COMMAND_MENU_SELECTED )
{
// Store the selected position
m_selected = aEvent.GetId();
// Check if there is a TOOL_ACTION for the given ID
if( m_toolActions.count( aEvent.GetId() ) == 1 )
{
evt = m_toolActions[aEvent.GetId()]->MakeEvent();
}
else
{
runEventHandlers( aEvent, evt );
// Under Linux, every submenu can have a separate event handler, under
// Windows all submenus are handled by the main menu.
#ifdef __WINDOWS__
if( !evt )
{
// Try to find the submenu which holds the selected item
wxMenu* menu = NULL;
FindItem( m_selected, &menu );
if( menu && menu != this )
{
menu->ProcessEvent( aEvent );
return;
}
}
#endif
// Handling non-action menu entries (e.g. items in clarification list)
if( !evt )
evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, aEvent.GetId() );
}
}
assert( m_tool ); // without tool & tool manager we cannot handle events
// forward the action/update event to the TOOL_MANAGER
if( evt && m_tool )
m_tool->GetManager()->ProcessEvent( *evt );
}
示例2: OnMenuOpen
void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
{
// On wxWidgets 3.0.x Windows, EVT_MENU_OPEN ( and other EVT_MENU_xx) events are not
// captured by the ACTON_MENU menus. While it is fixed in wxWidgets 3.1.x, we still
// need a solution for the earlier verions.
//
// This could be made conditional, but for now I'm going to use the same strategy
// everywhere so it gets wider testing.
// Note that if the conditional compilation is reactivated, the Connect() lines in
// ACTION_MENU::setupEvents() will need to be re-enabled.
//#if defined( __WINDOWS__ ) && wxCHECK_VERSION( 3, 0, 0 ) && !wxCHECK_VERSION( 3, 1, 0 )
// As if things weren't bad enough, wxWidgets doesn't pass the menu pointer when the
// event is a wxEVT_MENU_HIGHLIGHT, so we store the menu from the EVT_MENU_OPEN call.
static ACTION_MENU* currentMenu;
if( event.GetEventType() == wxEVT_MENU_OPEN )
{
currentMenu = dynamic_cast<ACTION_MENU*>( event.GetMenu() );
if( currentMenu )
currentMenu->OnMenuEvent( event );
}
else if( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
{
if( currentMenu )
currentMenu->OnMenuEvent( event );
}
else // if( event.GetEventType() == wxEVT_MENU_CLOSE )
{
currentMenu = nullptr;
}
//#endif
event.Skip();
}
示例3: MenuPopped
// FIXME: this does not work.
// Not all open events are followed by close events.
// Removing the nesting counter may help, but on wxGTK I still get lockups.
void MainFrame::MenuPopped(wxMenuEvent &evt)
{
bool popped = evt.GetEventType() == wxEVT_MENU_OPEN;
#if 0
if (popped)
++menus_opened;
else
--menus_opened;
if (menus_opened < 0) // how could this ever be???
menus_opened = 0;
#else
if (popped)
menus_opened = 1;
else
menus_opened = 0;
#endif
// workaround for lack of wxGTK mouse motion events: unblank
// pointer when menu popped up
// of course this does not help in finding the menus in the first place
// the user is better off clicking in the window or entering/
// exiting the window (which does generate a mouse event)
// it will auto-hide again once game resumes
if (popped)
panel->ShowPointer();
if (menus_opened)
panel->Pause();
else if (!IsPaused())
panel->Resume();
}