X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ec5f0c24123fe801fb82b69771c171c0b9d064fc..dcae64c221450a7ca9b530ecf44757543c33a754:/src/msw/wince/tbarwce.cpp diff --git a/src/msw/wince/tbarwce.cpp b/src/msw/wince/tbarwce.cpp index 33f429e306..cc3aa112d2 100644 --- a/src/msw/wince/tbarwce.cpp +++ b/src/msw/wince/tbarwce.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/wince/tbarwce.cpp +// Name: src/msw/wince/tbarwce.cpp // Purpose: wxToolBar for Windows CE // Author: Julian Smart // Modified by: @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "tbarwce.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -124,7 +120,7 @@ public: // a control in the toolbar void SetSeparatorsCount(size_t count) { m_nSepCount = count; } size_t GetSeparatorsCount() const { return m_nSepCount; } - + void SetBitmapIndex(int idx) { m_bitmapIndex = idx; } int GetBitmapIndex() const { return m_bitmapIndex; } @@ -167,8 +163,8 @@ wxToolBarToolBase *wxToolMenuBar::CreateTool(wxControl *control) void wxToolMenuBar::Init() { wxToolBar::Init(); - - m_nButtons = 0; + + m_nButtons = 0; m_menuBar = NULL; } @@ -393,6 +389,7 @@ bool wxToolMenuBar::Realize() case wxTOOL_STYLE_CONTROL: button.idCommand = tool->GetId(); // fall through: create just a separator too + // TODO: controls are not yet supported on wxToolMenuBar. case wxTOOL_STYLE_SEPARATOR: button.fsState = TBSTATE_ENABLED; @@ -400,7 +397,7 @@ bool wxToolMenuBar::Realize() break; case wxTOOL_STYLE_BUTTON: - + if ( HasFlag(wxTB_TEXT) ) { const wxString& label = tool->GetLabel(); @@ -419,7 +416,8 @@ bool wxToolMenuBar::Realize() wxMemoryDC memDC; wxBitmap b(16,16); memDC.SelectObject(b); - memDC.SetBackground(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))); + wxColour col = wxColour(192,192,192); + memDC.SetBackground(wxBrush(col)); memDC.Clear(); int x = (16 - bmp.GetWidth())/2; int y = (16 - bmp.GetHeight())/2; @@ -477,9 +475,10 @@ bool wxToolMenuBar::Realize() break; } - BOOL bRc = ::CommandBar_AddButtons( (HWND) GetHWND(), 1, buttons ); - - wxASSERT_MSG( bRc, wxT("Could not add toolbar button.")); + if ( !::CommandBar_AddButtons( (HWND) GetHWND(), 1, buttons ) ) + { + wxFAIL_MSG( wxT("Could not add toolbar button.")); + } lastWasRadio = isRadio; } @@ -492,6 +491,15 @@ bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id) wxToolBarToolBase *tool = FindById((int)id); if ( !tool ) { + if (m_menuBar) + { + wxMenuItem *item = m_menuBar->FindItem(id); + if (item && item->IsCheckable()) + { + item->Toggle(); + } + } + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED); event.SetEventObject(this); event.SetId(id); @@ -527,6 +535,27 @@ bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id) return true; } +WXLRESULT wxToolMenuBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + switch ( nMsg ) + { + case WM_SIZE: + break; + + case WM_MOUSEMOVE: + // we don't handle mouse moves, so always pass the message to + // wxControl::MSWWindowProc + HandleMouseMove(wParam, lParam); + break; + + case WM_PAINT: + break; + } + + return wxControl::MSWWindowProc(nMsg, wParam, lParam); +} + + #else ////////////// For Smartphone @@ -569,10 +598,10 @@ bool wxToolBar::Create(wxWindow *parent, // satisfy other parts of wxWidgets. parent->AddChild(this); - + SetWindowStyle(style); SetName(name); - + return true; } @@ -617,7 +646,4 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog #endif // !__SMARTPHONE__ - - -#endif // wxUSE_TOOLBAR && Win95 - +#endif // wxUSE_TOOLBAR