当前位置: 首页>>代码示例>>C++>>正文


C++ wxMenuEvent::GetEventType方法代码示例

本文整理汇总了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 );
}
开发者ID:RyuKojiro,项目名称:kicad-source-mirror,代码行数:56,代码来源:context_menu.cpp

示例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();
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:36,代码来源:eda_draw_frame.cpp

示例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();
}
开发者ID:MrSwiss,项目名称:visualboyadvance-m,代码行数:39,代码来源:wxvbam.cpp


注:本文中的wxMenuEvent::GetEventType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。