]> git.saurik.com Git - wxWidgets.git/commitdiff
Added no-remap system option so colourful toolbar buttons
authorJulian Smart <julian@anthemion.co.uk>
Mon, 9 Feb 2004 16:02:28 +0000 (16:02 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 9 Feb 2004 16:02:28 +0000 (16:02 +0000)
aren't mangled
Toolbar buttons are now centred if the bitmap size is smaller
than the specified default size

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/tbar95.cpp

index df860b7234b4a2b90e8c84f1999c5ffe3e8051c2..b58f442fc035aa9b07e90d24a3a13f1f0f2ca8d1 100644 (file)
@@ -157,6 +157,10 @@ wxMSW:
 - background colour of a wxComboBox may now be set
 - fixed wxListCtrl::GetItemText/BackgroundColour()
 - Esc can now be used to close menus in the dialogs (Hartmut Honisch)
+- Added no-remap system option so colourful toolbar buttons
+  aren't mangled
+- Toolbar buttons are now centred if the bitmap size is smaller
+  than the specified default size
 
 wxGTK:
 
index 44bd62f13b195467955f341b84dba7da0fca46e6..172db4547d6e84b9c0be789da7fbabf3f981526e 100644 (file)
@@ -42,6 +42,7 @@
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
 
 #include "wx/toolbar.h"
+#include "wx/sysopt.h"
 
 #include "wx/msw/private.h"
 
@@ -539,6 +540,22 @@ bool wxToolBar::Realize()
         MemoryHDC memoryDC2;
 #endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS
 
+        if (wxSystemOptions::GetOptionInt(wxT("no-remap")) == 1)
+        {
+#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 +570,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 +606,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("no-remap")) || wxSystemOptions::GetOptionInt(wxT("no-remap")) == 0)
+        {
+            // Map to system colours
+            hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
+                totalBitmapWidth, totalBitmapHeight);
+        }
 
         bool addBitmap = TRUE;