X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8251c0d6ac01dd4f2b62413037b743052224851f..8531cc2589161b92c1d8b607b0c13e4d1c8b6844:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 5716e1a76f..4fa970dc54 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -49,17 +49,12 @@ #include "wx/msw/private.h" -#ifndef __TWIN32__ - -#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__)) +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__)) #include #else #include "wx/msw/gnuwin32/extra.h" #endif -#endif // __TWIN32__ - -#include "wx/msw/dib.h" #include "wx/app.h" // for GetComCtl32Version #if defined(__MWERKS__) && defined(__WXMSW__) @@ -238,7 +233,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 +243,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, wxEmptyString, pos, size) ) return FALSE; // toolbar-specific post initialisation @@ -276,7 +269,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") ); @@ -285,7 +278,7 @@ void wxToolBar::Recreate() } // reparent all our children under the new toolbar - for ( wxWindowList::Node *node = m_children.GetFirst(); + for ( wxWindowList::compatibility_iterator node = m_children.GetFirst(); node; node = node->GetNext() ) { @@ -347,7 +340,7 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const // do have tooltips wouldn't work msStyle |= TBSTYLE_TOOLTIPS; - if ( style & wxTB_FLAT ) + if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) ) { // static as it doesn't change during the program lifetime static int s_verComCtl = wxTheApp->GetComCtl32Version(); @@ -360,6 +353,11 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const { msStyle |= TBSTYLE_FLAT | TBSTYLE_TRANSPARENT; } + + if ( s_verComCtl >= 470 && style & wxTB_HORZ_LAYOUT ) + { + msStyle |= TBSTYLE_LIST; + } } if ( style & wxTB_NODIVIDER ) @@ -368,6 +366,9 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const if ( style & wxTB_NOALIGN ) msStyle |= CCS_NOPARENTALIGN; + if ( style & wxTB_VERTICAL ) + msStyle |= CCS_VERT; + return msStyle; } @@ -393,7 +394,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) // first determine the position of the first button to delete: it may be // different from pos if we use several separators to cover the space used // by a control - wxToolBarToolsList::Node *node; + wxToolBarToolsList::compatibility_iterator node; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool2 = node->GetData(); @@ -484,7 +485,7 @@ bool wxToolBar::Realize() // First, add the bitmap: we use one bitmap for all toolbar buttons // ---------------------------------------------------------------- - wxToolBarToolsList::Node *node; + wxToolBarToolsList::compatibility_iterator node; int bitmapId = 0; wxSize sizeBmp; @@ -658,9 +659,14 @@ bool wxToolBar::Realize() { wxToolBarToolBase *tool = node->GetData(); - // don't add separators to the vertical toolbar - looks ugly - if ( isVertical && tool->IsSeparator() ) + // don't add separators to the vertical toolbar with old comctl32.dll + // versions as they didn't handle this properly + if ( isVertical && tool->IsSeparator() && + wxTheApp->GetComCtl32Version() <= 472 ) + { continue; + } + TBBUTTON& button = buttons[i]; @@ -1015,7 +1021,7 @@ static wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools, size_t index ) { - wxToolBarToolsList::Node* current = tools.GetFirst(); + wxToolBarToolsList::compatibility_iterator current = tools.GetFirst(); for ( ; current != 0; current = current->GetNext() ) { @@ -1169,7 +1175,7 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event) bool wxToolBar::HandleSize(WXWPARAM wParam, WXLPARAM lParam) { - // calculate our minor dimenstion ourselves - we're confusing the standard + // calculate our minor dimension ourselves - we're confusing the standard // logic (TB_AUTOSIZE) with our horizontal toolbars and other hacks RECT r; if ( ::SendMessage(GetHwnd(), TB_GETITEMRECT, 0, (LPARAM)&r) ) @@ -1194,12 +1200,8 @@ bool wxToolBar::HandleSize(WXWPARAM wParam, WXLPARAM lParam) h = r.bottom - r.top; if ( m_maxRows ) { - // FIXME: 6 is hardcoded separator line height... - //h += 6; - if (HasFlag(wxTB_NODIVIDER)) - h += 4; - else - h += 6; + // FIXME: hardcoded separator line height... + h += HasFlag(wxTB_NODIVIDER) ? 4 : 6; h *= m_maxRows; } } @@ -1223,7 +1225,7 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam) // any here // first of all, do we have any controls at all? - wxToolBarToolsList::Node *node; + wxToolBarToolsList::compatibility_iterator node; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { if ( node->GetData()->IsControl() )