]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
Use wxFontMapperBase::Get instead of wxFontMapper::Get from wxBase code.
[wxWidgets.git] / src / msw / tbar95.cpp
index 6636f4cebd5ff6e219337f03a714eb7ae670f691..b6403a3b856de38d6ac97d79e28cffb3451a3886 100644 (file)
@@ -39,7 +39,7 @@
     #include "wx/control.h"
 #endif
 
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
 
 #include "wx/toolbar.h"
 #include "wx/sysopt.h"
@@ -520,6 +520,11 @@ bool wxToolBar::Realize()
     const bool isVertical = HasFlag(wxTB_VERTICAL);
 
     bool doRemap, doRemapBg, doTransparent;
+#ifdef __WXWINCE__
+    doRemapBg = false;
+    doRemap = false;
+    doTransparent = false;
+#else
     if (wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 2)
     {
         doRemapBg = doRemap = false;
@@ -531,6 +536,7 @@ bool wxToolBar::Realize()
         doRemapBg = !doRemap;
         doTransparent = false;
     }
+#endif
 
     // delete all old buttons, if any
     for ( size_t pos = 0; pos < m_nButtons; pos++ )
@@ -570,15 +576,20 @@ bool wxToolBar::Realize()
         wxMemoryDC dcAllButtons;
         wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight);
         dcAllButtons.SelectObject(bitmap);
+#ifdef __WXWINCE__
+        dcAllButtons.SetBackground(wxBrush(wxColour(192,192,192)));
+#else
         if (doTransparent)
             dcAllButtons.SetBackground(*wxTRANSPARENT_BRUSH);
         else
-        dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH);
+            dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH);
+#endif
         dcAllButtons.Clear();
 
         m_hBitmap = bitmap.GetHBITMAP();
         HBITMAP hBitmap = (HBITMAP)m_hBitmap;
 
+#ifndef __WXWINCE__
         if (doRemapBg)
         {
             dcAllButtons.SelectObject(wxNullBitmap);
@@ -590,6 +601,7 @@ bool wxToolBar::Realize()
 
             dcAllButtons.SelectObject(bitmap);
         }
+#endif
 
         // the button position
         wxCoord x = 0;
@@ -963,8 +975,8 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
         LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0);
         toggled = (state & TBSTATE_CHECKED) != 0;
 
-        // ignore the event when a radio button is released, as this doesn't seem to
-        // happen at all, and is handled otherwise
+        // ignore the event when a radio button is released, as this doesn't
+        // seem to happen at all, and is handled otherwise
         if ( tool->GetKind() == wxITEM_RADIO && !toggled )
             return true;
 
@@ -979,7 +991,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
         // revert back
         tool->Toggle(!toggled);
 
-        ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
+        ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0));
     }
 
     return true;
@@ -1076,7 +1088,7 @@ wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
 {
     wxToolBarToolsList::compatibility_iterator current = tools.GetFirst();
 
-    for ( ; current != 0; current = current->GetNext() )
+    for ( ; current ; current = current->GetNext() )
     {
         if ( index == 0 )
             return current->GetData();
@@ -1239,7 +1251,7 @@ void wxToolBar::OnEraseBackground(wxEraseEvent& event)
         event.Skip();
         return;
     }
-    
+
     // notice that this 'dumb' implementation may cause flicker for some of the
     // controls in which case they should intercept wxEraseEvent and process it
     // themselves somehow
@@ -1434,20 +1446,22 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam
 {
     switch ( nMsg )
     {
-        case WM_SIZE:
-            if ( HandleSize(wParam, lParam) )
-                return 0;
-            break;
-
         case WM_MOUSEMOVE:
             // we don't handle mouse moves, so always pass the message to
-            // wxControl::MSWWindowProc
+            // wxControl::MSWWindowProc (HandleMouseMove just calls OnMouseEnter)
             HandleMouseMove(wParam, lParam);
             break;
 
+        case WM_SIZE:
+            if ( HandleSize(wParam, lParam) )
+                return 0;
+            break;
+
+#ifndef __WXWINCE__
         case WM_PAINT:
             if ( HandlePaint(wParam, lParam) )
                 return 0;
+#endif
     }
 
     return wxControl::MSWWindowProc(nMsg, wParam, lParam);