X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..404b319a85dadd7decf7a5a5331020520031a41c:/src/msw/wince/menuce.cpp diff --git a/src/msw/wince/menuce.cpp b/src/msw/wince/menuce.cpp index 673d364855..6231ea1e22 100644 --- a/src/msw/wince/menuce.cpp +++ b/src/msw/wince/menuce.cpp @@ -6,7 +6,7 @@ // Created: 28.05.2004 // RCS-ID: $Id$ // Copyright: (c) Wlodzimierz Skiba -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -24,9 +24,7 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) #ifndef WX_PRECOMP #include "wx/app.h" @@ -34,12 +32,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" @@ -56,11 +54,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) @@ -80,7 +74,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, false); + m_label = wxGetStockLabel(id, wxSTOCK_NOFLAGS); else m_label = label; m_menu = subMenu; @@ -227,7 +221,7 @@ void wxTopLevelWindowMSW::ReloadAllButtons() if (!SHCreateMenuBar(&menu_bar)) { - wxFAIL_MSG( _T("SHCreateMenuBar failed") ); + wxFAIL_MSG( wxT("SHCreateMenuBar failed") ); return; } @@ -242,6 +236,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)) @@ -258,5 +256,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__