]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
Applied gsockmsw.c 1.20 to 1.25 changes
[wxWidgets.git] / src / msw / tbar95.cpp
index d439d680f41b111378113d6a43582dcdc29d9259..83fcc8a1e6c8818684fe2ab79ad44252ffe20872 100644 (file)
@@ -39,7 +39,7 @@
     #include "wx/control.h"
 #endif
 
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && defined(WIN32_PLATFORM_WFSP)))
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
 
 #include "wx/toolbar.h"
 #include "wx/sysopt.h"
@@ -55,7 +55,7 @@
 // conditional compilation
 // ----------------------------------------------------------------------------
 
-// wxWindows previously always considered that toolbar buttons have light grey
+// wxWidgets previously always considered that toolbar buttons have light grey
 // (0xc0c0c0) background and so ignored any bitmap masks - however, this
 // doesn't work with XPMs which then appear to have black background. To make
 // this work, we must respect the bitmap masks - which we do now. This should
@@ -388,6 +388,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
     // Realize() later
     tool->Attach(this);
 
+    InvalidateBestSize();
     return TRUE;
 }
 
@@ -465,6 +466,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
         }
     }
 
+    InvalidateBestSize();
     return TRUE;
 }
 
@@ -479,6 +481,19 @@ bool wxToolBar::Realize()
 
     const bool isVertical = HasFlag(wxTB_VERTICAL);
 
+    bool doRemap, doRemapBg, doTransparent;
+    if (wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 2)
+    {
+        doRemapBg = doRemap = false;
+        doTransparent = true;       
+    }
+    else
+    {   doRemap = !wxSystemOptions::HasOption(wxT("msw.remap"))
+            || wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 1;
+        doRemapBg = !doRemap;
+        doTransparent = false;
+    }
+
     // delete all old buttons, if any
     for ( size_t pos = 0; pos < m_nButtons; pos++ )
     {
@@ -518,6 +533,9 @@ bool wxToolBar::Realize()
         wxMemoryDC dcAllButtons;
         wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight);
         dcAllButtons.SelectObject(bitmap);
+        if (doTransparent)
+            dcAllButtons.SetBackground(*wxTRANSPARENT_BRUSH);
+        else
         dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH);
         dcAllButtons.Clear();
 
@@ -542,7 +560,7 @@ 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 (doRemapBg)
         {
 #if USE_BITMAP_MASKS
             dcAllButtons.SelectObject(wxNullBitmap);
@@ -608,7 +626,7 @@ bool wxToolBar::Realize()
         bitmap.SetHBITMAP(0);
 #endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS
 
-        if (!wxSystemOptions::HasOption(wxT("msw.remap")) || wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 1)
+        if (doRemap)
         {
             // Map to system colours
             hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
@@ -922,6 +940,7 @@ bool wxToolBar::Realize()
         }
     }
 
+    InvalidateBestSize();
     return TRUE;
 }