]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
Use wxVisualAttributes (partially #if'd out until tested further.)
[wxWidgets.git] / src / msw / tbar95.cpp
index 44bd62f13b195467955f341b84dba7da0fca46e6..d439d680f41b111378113d6a43582dcdc29d9259 100644 (file)
     #include "wx/control.h"
 #endif
 
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && defined(WIN32_PLATFORM_WFSP)))
 
 #include "wx/toolbar.h"
+#include "wx/sysopt.h"
 
 #include "wx/msw/private.h"
 
@@ -239,6 +240,8 @@ bool wxToolBar::Create(wxWindow *parent,
     if ( !MSWCreateToolbar(pos, size) )
         return FALSE;
 
+    wxSetCCUnicodeFormat(GetHwnd());
+
     // set up the colors and fonts
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
     SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
@@ -539,6 +542,22 @@ bool wxToolBar::Realize()
         MemoryHDC memoryDC2;
 #endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS
 
+        if (wxSystemOptions::HasOption(wxT("msw.remap")) && wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 0)
+        {
+#if USE_BITMAP_MASKS
+            dcAllButtons.SelectObject(wxNullBitmap);
+#endif
+
+            // Even if we're not remapping the bitmap
+            // content, we still have to remap the background.
+            hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
+                totalBitmapWidth, totalBitmapHeight);
+
+#if USE_BITMAP_MASKS
+            dcAllButtons.SelectObject(bitmap);
+#endif
+        }
+
         // the button position
         wxCoord x = 0;
 
@@ -553,13 +572,15 @@ bool wxToolBar::Realize()
                 const wxBitmap& bmp = tool->GetNormalBitmap();
                 if ( bmp.Ok() )
                 {
+                    int xOffset = wxMax(0, (m_defaultWidth - bmp.GetWidth())/2);
+                    int yOffset = wxMax(0, (m_defaultHeight - bmp.GetHeight())/2);
 #if USE_BITMAP_MASKS
                     // notice the last parameter: do use mask
-                    dcAllButtons.DrawBitmap(bmp, x, 0, TRUE);
+                    dcAllButtons.DrawBitmap(bmp, x+xOffset, yOffset, TRUE);
 #else // !USE_BITMAP_MASKS
                     SelectInHDC hdcSelector2(memoryDC2, GetHbitmapOf(bmp));
                     if ( !BitBlt(memoryDC,
-                                 x, 0,  m_defaultWidth, m_defaultHeight,
+                                 x+xOffset, yOffset,  m_defaultWidth, m_defaultHeight,
                                  memoryDC2,
                                  0, 0, SRCCOPY) )
                     {
@@ -587,9 +608,12 @@ bool wxToolBar::Realize()
         bitmap.SetHBITMAP(0);
 #endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS
 
-        // Map to system colours
-        hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
-                                     totalBitmapWidth, totalBitmapHeight);
+        if (!wxSystemOptions::HasOption(wxT("msw.remap")) || wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 1)
+        {
+            // Map to system colours
+            hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
+                totalBitmapWidth, totalBitmapHeight);
+        }
 
         bool addBitmap = TRUE;
 
@@ -1346,7 +1370,7 @@ void wxToolBar::HandleMouseMove(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
     }
 }
 
-long wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
 {
     switch ( nMsg )
     {