X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12ed316d02733e7111a6967f6ae41e2c0ceaa57a..74d0b78c365fecd7437672dac3efe6ac371823c7:/src/msw/tbarmsw.cpp diff --git a/src/msw/tbarmsw.cpp b/src/msw/tbarmsw.cpp index e51c302c1c..d166b81736 100644 --- a/src/msw/tbarmsw.cpp +++ b/src/msw/tbarmsw.cpp @@ -5,8 +5,8 @@ // Modified by: 13.12.99 by VZ during toolbar classes reorganization // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -34,10 +34,6 @@ #if wxUSE_TOOLBAR && defined(__WIN16__) -#if !defined(__WIN32__) && !wxUSE_IMAGE_LOADING_IN_MSW - #error wxToolBar needs wxUSE_IMAGE_LOADING_IN_MSW under Win16 -#endif - #if !defined(__GNUWIN32__) && !defined(__SALFORDC__) #include "malloc.h" #endif @@ -83,14 +79,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) { } @@ -136,15 +132,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,7 +487,7 @@ 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; + wxBitmap bmpDisabled; if (tool->CanBeToggled()) { HBITMAP hbmp = CreateMappedBitmap((WXHINSTANCE)wxGetInstance(), @@ -784,7 +781,7 @@ void wxToolBar::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, 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()) @@ -1102,20 +1099,16 @@ WXHBITMAP wxToolBar::CreateMappedBitmap(WXHINSTANCE WXUNUSED(hInstance), void *i WXHBITMAP wxToolBar::CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap) { - HANDLE hDIB = wxBitmapToDIB((HBITMAP) hBitmap, 0); - if (hDIB) - { -#ifdef __WINDOWS_386__ - LPBITMAPINFOHEADER lpbmInfoHdr = (LPBITMAPINFOHEADER)MK_FP32(GlobalLock(hDIB)); -#else - LPBITMAPINFOHEADER lpbmInfoHdr = (LPBITMAPINFOHEADER)GlobalLock(hDIB); -#endif - HBITMAP newBitmap = (HBITMAP) CreateMappedBitmap((WXHINSTANCE) wxGetInstance(), lpbmInfoHdr); - GlobalUnlock(hDIB); + HANDLE hDIB = wxDIB::ConvertFromBitmap((HBITMAP) hBitmap); + if ( !hDIB ) + return 0; + + WXHBITMAP newBitmap = CreateMappedBitmap(hInstance, GlobalPtr(hDIB)); + GlobalFree(hDIB); - return (WXHBITMAP) newBitmap; - } - return 0; + + return newBitmap; } -#endif +#endif // wxUSE_TOOLBAR +