]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbarmsw.cpp
added wxCheckListBox::HitTest() (modified patch 594524)
[wxWidgets.git] / src / msw / tbarmsw.cpp
index e7ab1de5c87d69df24b349dd1bf6164f9a55ef9f..92b60a0fa10efd1e52ac42aab0a81cc0b6845dbc 100644 (file)
@@ -32,7 +32,7 @@
     #include "wx/wx.h"
 #endif
 
-#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR && !wxUSE_TOOLBAR_SIMPLE
+#if wxUSE_TOOLBAR && defined(__WIN16__)
 
 #if !defined(__WIN32__) && !wxUSE_IMAGE_LOADING_IN_MSW
     #error wxToolBar needs wxUSE_IMAGE_LOADING_IN_MSW under Win16
@@ -48,7 +48,7 @@
 
 #include <stdlib.h>
 
-#include "wx/tbarmsw.h"
+#include "wx/msw/tbarmsw.h"
 #include "wx/event.h"
 #include "wx/app.h"
 #include "wx/bitmap.h"
@@ -83,14 +83,14 @@ class WXDLLEXPORT wxToolBarTool : public wxToolBarToolBase
 public:
     wxToolBarTool(wxToolBar *tbar,
                   int id,
-                  const wxBitmap& bitmap1,
-                  const wxBitmap& bitmap2,
+                  const wxBitmap& bmpNormal,
+                  const wxBitmap& bmpDisabled,
                   bool toggle,
                   wxObject *clientData,
-                  const wxString& shortHelpString,
-                  const wxString& longHelpString)
-        : wxToolBarToolBase(tbar, id, bitmap1, bitmap2, toggle,
-                            clientData, shortHelpString, longHelpString)
+                  const wxString& shortHelp,
+                  const wxString& longHelp)
+        : wxToolBarToolBase(tbar, id, bmpNormal, bmpDisabled, toggle,
+                            clientData, shortHelp, longHelp)
     {
     }
 
@@ -119,7 +119,7 @@ public:
 // ----------------------------------------------------------------------------
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
        EVT_PAINT(wxToolBar::OnPaint)
@@ -136,15 +136,16 @@ END_EVENT_TABLE()
 // ----------------------------------------------------------------------------
 
 wxToolBarToolBase *wxToolBar::CreateTool(int id,
-                                         const wxBitmap& bitmap1,
-                                         const wxBitmap& bitmap2,
-                                         bool toggle,
+                                         const wxString& label,
+                                         const wxBitmap& bmpNormal,
+                                         const wxBitmap& bmpDisabled,
+                                         wxItemKind kind,
                                          wxObject *clientData,
-                                         const wxString& shortHelpString,
-                                         const wxString& longHelpString)
+                                         const wxString& shortHelp,
+                                         const wxString& longHelp)
 {
-    return new wxToolBarTool(this, id, bitmap1, bitmap2, toggle,
-                             clientData, shortHelpString, longHelpString);
+    return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
+                             clientData, shortHelp, longHelp);
 }
 
 wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
@@ -490,8 +491,8 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
 
     // TODO: use the mapping code from wxToolBar95 to get it right in this class
 #if !defined(__WIN32__) && !defined(__WIN386__)
-    wxBitmap bitmap2;
-    if (toggle)
+    wxBitmap bmpDisabled;
+    if (tool->CanBeToggled())
     {
         HBITMAP hbmp = CreateMappedBitmap((WXHINSTANCE)wxGetInstance(),
                                           GetHbitmapOf(tool->GetBitmap1()));
@@ -747,8 +748,11 @@ void wxToolBar::DrawBlankButton(WXHDC hdc, int x, int y, int dx, int dy, int sta
     }
 }
 
-void wxToolBar::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBarTool *tool, int state)
+void wxToolBar::DrawButton(WXHDC hdc, int x, int y, int dx, int dy,
+                           wxToolBarToolBase *toolBase, int state)
 {
+    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
+
     int yOffset;
     HBRUSH hbrOld, hbr;
     BOOL bMaskCreated = FALSE;
@@ -781,7 +785,7 @@ void wxToolBar::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBarToo
     dxFace -= 3;               
     dyFace -= 3;
 
-    // Using bitmap2 can cause problems (don't know why!)
+    // Using bmpDisabled can cause problems (don't know why!)
 #if !defined(__WIN32__) && !defined(__WIN386__)
     HBITMAP bitmapOld;
     if (tool->GetBitmap2().Ok())