Пример #1
0
bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
#if wxUSE_MENUS

    // we only need to handle the menu and accelerator commands from the items
    // of our menu bar, base wxWindow class already handles the rest
    if ( !control && (cmd == 0 /* menu */ || cmd == 1 /* accel */) )
    {
#if wxUSE_MENUS_NATIVE
        if ( !wxCurrentPopupMenu )
#endif // wxUSE_MENUS_NATIVE
        {
            wxMenuItem * const mitem = FindItemInMenuBar((signed short)id);
            if ( mitem )
                return ProcessCommand(mitem);
        }
    }
#endif // wxUSE_MENUS

#if wxUSE_TASKBARBUTTON
    if ( cmd == wxTHBN_CLICKED && m_taskBarButton )
    {
        wxTaskBarButtonImpl * const
            tbButton = reinterpret_cast<wxTaskBarButtonImpl*>(m_taskBarButton);
        // we use the index as id when adding thumbnail toolbar button.
        wxThumbBarButton * const
            thumbBarButton = tbButton->GetThumbBarButtonByIndex(id);
        wxCommandEvent event(wxEVT_BUTTON, thumbBarButton->GetID());
        event.SetEventObject(thumbBarButton);
        return ProcessEvent(event);
    }
#endif // wxUSE_TASKBARBUTTON

    return wxFrameBase::HandleCommand(id, cmd, control);;
}
Пример #2
0
bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
#if wxUSE_MENUS

#if defined(WINCE_WITHOUT_COMMANDBAR)
    if (GetToolBar() && GetToolBar()->FindById(id))
        return GetToolBar()->MSWCommand(cmd, id);
#endif

    // we only need to handle the menu and accelerator commands from the items
    // of our menu bar, base wxWindow class already handles the rest
    if ( !control && (cmd == 0 /* menu */ || cmd == 1 /* accel */) )
    {
#if wxUSE_MENUS_NATIVE
        if ( !wxCurrentPopupMenu )
#endif // wxUSE_MENUS_NATIVE
        {
            wxMenuItem * const mitem = FindItemInMenuBar((signed short)id);
            if ( mitem )
                return ProcessCommand(mitem);
        }
    }
#endif // wxUSE_MENUS

    return wxFrameBase::HandleCommand(id, cmd, control);;
}
Пример #3
0
bool wxFrameBase::ProcessCommand(int id)
{
    wxMenuItem* const item = FindItemInMenuBar(id);
    if ( !item )
        return false;

    return ProcessCommand(item);
}
Пример #4
0
bool wxFrameBase::ShowMenuHelp(int menuId)
{
#if wxUSE_MENUS
    // if no help string found, we will clear the status bar text
    //
    // NB: wxID_NONE is used for (sub)menus themselves by wxMSW
    wxString helpString;
    if ( menuId != wxID_SEPARATOR && menuId != wxID_NONE )
    {
        const wxMenuItem * const item = FindItemInMenuBar(menuId);
        if ( item && !item->IsSeparator() )
            helpString = item->GetHelp();

        // notice that it's ok if we don't find the item because it might
        // belong to the popup menu, so don't assert here
    }

    DoGiveHelp(helpString, true);

    return !helpString.empty();
#else // !wxUSE_MENUS
    return false;
#endif // wxUSE_MENUS/!wxUSE_MENUS
}