X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/24998710952312c2cc1a5bfee1b416783e17319a..cfcc39321282c5877cbb45248bb8004ced24516b:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 836a79ee2f..b0c059dd89 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -238,7 +238,7 @@ bool wxToolBar::Create(wxWindow *parent, return FALSE; // MSW-specific initialisation - if ( !MSWCreateToolbar(pos, size, style) ) + if ( !MSWCreateToolbar(pos, size) ) return FALSE; // set up the colors and fonts @@ -248,11 +248,9 @@ bool wxToolBar::Create(wxWindow *parent, return TRUE; } -bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, - const wxSize& size, - long style) +bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size) { - if ( !MSWCreateControl(TOOLBARCLASSNAME, _T(""), pos, size, style) ) + if ( !MSWCreateControl(TOOLBARCLASSNAME, _T(""), pos, size) ) return FALSE; // toolbar-specific post initialisation @@ -276,7 +274,7 @@ void wxToolBar::Recreate() UnsubclassWin(); - if ( !MSWCreateToolbar(pos, size, GetWindowStyle()) ) + if ( !MSWCreateToolbar(pos, size) ) { // what can we do? wxFAIL_MSG( _T("recreating the toolbar failed") ); @@ -472,9 +470,19 @@ bool wxToolBar::Realize() const bool isVertical = HasFlag(wxTB_VERTICAL); + // delete all old buttons, if any + for ( size_t pos = 0; pos < m_nButtons; pos++ ) + { + if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) + { + wxLogDebug(wxT("TB_DELETEBUTTON failed")); + } + } + // First, add the bitmap: we use one bitmap for all toolbar buttons // ---------------------------------------------------------------- + wxToolBarToolsList::Node *node; int bitmapId = 0; wxSize sizeBmp; @@ -531,9 +539,7 @@ bool wxToolBar::Realize() // the number of buttons (not separators) int nButtons = 0; - for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); - node; - node = node->GetNext() ) + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool = node->GetData(); if ( tool->IsButton() ) @@ -613,15 +619,6 @@ bool wxToolBar::Realize() bitmapId = m_nButtons; } - - // Now delete all the buttons - for ( size_t pos = 0; pos < m_nButtons; pos++ ) - { - if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) - { - wxLogDebug(wxT("TB_DELETEBUTTON failed")); - } - } } if ( addBitmap ) // no old bitmap or we can't replace it @@ -655,9 +652,7 @@ bool wxToolBar::Realize() bool lastWasRadio = FALSE; int i = 0; - for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); - node; - node = node->GetNext() ) + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool = node->GetData(); @@ -1200,7 +1195,7 @@ bool wxToolBar::HandleSize(WXWPARAM wParam, WXLPARAM lParam) // FIXME: 6 is hardcoded separator line height... //h += 6; if (HasFlag(wxTB_NODIVIDER)) - h += 3; + h += 4; else h += 6; h *= m_maxRows;