X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/81d66cf39f810503baed79213bc3122fda0ccc7b..7b9da2077d0975db6c965a85c91d5aca671ab5e3:/src/msw/tbarmsw.cpp diff --git a/src/msw/tbarmsw.cpp b/src/msw/tbarmsw.cpp index e891c5e436..7f23bf7f63 100644 --- a/src/msw/tbarmsw.cpp +++ b/src/msw/tbarmsw.cpp @@ -21,20 +21,25 @@ #endif #ifndef WX_PRECOMP -#include "wx.h" +#include "wx/wx.h" #endif -#if USE_BUTTONBAR && USE_TOOLBAR +#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR -#ifndef __GNUWIN32__ +#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) #include "malloc.h" #endif +#if !defined(__MWERKS__) && !defined(__SALFORDC__) #include +#endif + #include #include "wx/tbarmsw.h" +#include "wx/event.h" #include "wx/app.h" +#include "wx/bitmap.h" #include "wx/msw/private.h" #include "wx/msw/dib.h" @@ -46,12 +51,12 @@ /////// Non-Windows 95 implementation -#if !USE_IMAGE_LOADING_IN_MSW -#error If USE_IMAGE_LOADING_IN_MSW is set to 0, then USE_BUTTONBAR must be set to 0 too. +#if !wxUSE_IMAGE_LOADING_IN_MSW +#error If wxUSE_IMAGE_LOADING_IN_MSW is set to 0, then wxUSE_BUTTONBAR must be set to 0 too. #endif #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase) +IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) EVT_SIZE(wxToolBarMSW::OnSize) @@ -188,7 +193,7 @@ void wxToolBarMSW::OnMouseEvent(wxMouseEvent& event) } long x, y; - event.Position(&x, &y); + event.GetPosition(&x, &y); wxToolBarTool *tool = FindToolForPosition(x, y); if (!tool) @@ -339,16 +344,15 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx // TODO: use the mapping code from wxToolBar95 to get it right in this class #if !defined(__WIN32__) && !defined(__WIN386__) - wxBitmap *bitmap2 = NULL; + wxBitmap bitmap2; if (toggle) { - bitmap2 = new wxBitmap; - bitmap2->SetHBITMAP( (WXHBITMAP) CreateMappedBitmap(wxGetInstance(), (HBITMAP) ((wxBitmap& )bitmap).GetHBITMAP())); + bitmap2.SetHBITMAP( (WXHBITMAP) CreateMappedBitmap((WXHINSTANCE)wxGetInstance(), (WXHBITMAP) ((wxBitmap& )bitmap).GetHBITMAP())); } - wxToolBarTool *tool = new wxToolBarTool(index, bitmap, *bitmap2, toggle, xPos, yPos, helpString1, helpString2); + wxToolBarTool *tool = new wxToolBarTool(index, bitmap, bitmap2, toggle, xPos, yPos, helpString1, helpString2); #else - wxToolBarTool *tool = new wxToolBarTool(index, bitmap, (wxBitmap *)NULL, toggle, xPos, yPos, helpString1, helpString2); + wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap, toggle, xPos, yPos, helpString1, helpString2); #endif tool->m_clientData = clientData; @@ -377,7 +381,7 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx return tool; } -void wxToolBarMSW::Layout(void) +void wxToolBarMSW::LayoutTools() { m_currentRowsOrColumns = 0; m_lastX = m_xMargin; @@ -461,12 +465,20 @@ void wxToolBarMSW::Layout(void) node = node->Next(); } if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) + { m_maxWidth += maxToolWidth; + m_maxHeight += maxToolHeight; + } else + { + m_maxWidth += maxToolWidth; m_maxHeight += maxToolHeight; + } m_maxWidth += m_xMargin; m_maxHeight += m_yMargin; + + SetSize(m_maxWidth, m_maxHeight); } @@ -932,7 +944,7 @@ WXHBITMAP wxToolBarMSW::CreateMappedBitmap(WXHINSTANCE WXUNUSED(hInstance), void WXHBITMAP wxToolBarMSW::CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap) { - HANDLE hDIB = BitmapToDIB((HBITMAP) hBitmap, 0); + HANDLE hDIB = wxBitmapToDIB((HBITMAP) hBitmap, 0); if (hDIB) { #ifdef __WINDOWS_386__