X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb3e6de33b0df985a3d2af7d040f16e733dec3ce..cdbd62d6ff290fd58acd1bc5574dfc79db3a6f70:/src/msw/wince/menuce.cpp diff --git a/src/msw/wince/menuce.cpp b/src/msw/wince/menuce.cpp index 8ef705abce..9f8822d9bc 100644 --- a/src/msw/wince/menuce.cpp +++ b/src/msw/wince/menuce.cpp @@ -4,9 +4,8 @@ // Author: Wlodzimierz ABX Skiba // Modified by: // Created: 28.05.2004 -// RCS-ID: $Id$ // Copyright: (c) Wlodzimierz Skiba -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,10 +16,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "menuce" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,9 +23,7 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) #ifndef WX_PRECOMP #include "wx/app.h" @@ -38,12 +31,12 @@ #include "wx/menu.h" #endif //WX_PRECOMP -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include #include #include #include +#include +#include #include "wx/msw/wince/missing.h" #include "wx/msw/wince/resources.h" @@ -60,11 +53,7 @@ wxTopLevelWindowMSW::ButtonMenu::ButtonMenu() wxTopLevelWindowMSW::ButtonMenu::~ButtonMenu() { - if(m_menu) - { - delete m_menu; - m_menu = NULL; - }; + wxDELETE(m_menu); } void wxTopLevelWindowMSW::SetLeftMenu(int id, const wxString& label, wxMenu *subMenu) @@ -84,7 +73,7 @@ void wxTopLevelWindowMSW::ButtonMenu::SetButton(int id, const wxString& label, w m_assigned = true; m_id = id; if(label.empty() && wxIsStockID(id)) - m_label = wxGetStockLabel(id); + m_label = wxGetStockLabel(id, wxSTOCK_NOFLAGS); else m_label = label; m_menu = subMenu; @@ -231,7 +220,7 @@ void wxTopLevelWindowMSW::ReloadAllButtons() if (!SHCreateMenuBar(&menu_bar)) { - wxFAIL_MSG( _T("SHCreateMenuBar failed") ); + wxFAIL_MSG( wxT("SHCreateMenuBar failed") ); return; } @@ -246,6 +235,10 @@ void wxTopLevelWindowMSW::ReloadAllButtons() ::ShowWindow( prev_MenuBar, SW_HIDE ); ::ShowWindow( m_MenuBarHWND, SW_SHOW ); + // Setup backspace key handling + SendMessage(m_MenuBarHWND, SHCMBM_OVERRIDEKEY, VK_TBACK, + MAKELPARAM( SHMBOF_NODEFAULT | SHMBOF_NOTIFY, + SHMBOF_NODEFAULT | SHMBOF_NOTIFY )); } bool wxTopLevelWindowMSW::HandleCommand(WXWORD id, WXWORD WXUNUSED(cmd), WXHWND WXUNUSED(control)) @@ -254,7 +247,7 @@ bool wxTopLevelWindowMSW::HandleCommand(WXWORD id, WXWORD WXUNUSED(cmd), WXHWND if ( id == IDM_LEFT || id == IDM_RIGHT ) { int menuId = id == IDM_LEFT ? m_LeftButton.GetId() : m_RightButton.GetId() ; - wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, menuId); + wxCommandEvent commandEvent(wxEVT_MENU, menuId); commandEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(commandEvent); return true; @@ -262,5 +255,18 @@ bool wxTopLevelWindowMSW::HandleCommand(WXWORD id, WXWORD WXUNUSED(cmd), WXHWND return false; } -#endif // __SMARTPHONE__ && __WXWINCE__ +bool wxTopLevelWindowMSW::MSWShouldPreProcessMessage(WXMSG* pMsg) +{ + MSG *msg = (MSG *)pMsg; + + // Process back key to be like backspace. + if (msg->message == WM_HOTKEY) + { + if (HIWORD(msg->lParam) == VK_TBACK) + SHSendBackToFocusWindow(msg->message, msg->wParam, msg->lParam); + } + + return wxTopLevelWindowBase::MSWShouldPreProcessMessage(pMsg); +} +#endif // __SMARTPHONE__ && __WXWINCE__