X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b39dbf34b887a73c525da903d8599f4f6b7eb8f9..b5435dccd098ae153c3b7b3b8fca8dd0d763986c:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 3af9bfe8e8..a1d6e9d484 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -55,6 +55,8 @@ #include "wx/msw/gnuwin32/extra.h" #endif +#include "wx/msw/missing.h" + #include "wx/app.h" // for GetComCtl32Version #if defined(__MWERKS__) && defined(__WXMSW__) @@ -245,7 +247,7 @@ bool wxToolBar::Create(wxWindow *parent, bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size) { - if ( !MSWCreateControl(TOOLBARCLASSNAME, _T(""), pos, size) ) + if ( !MSWCreateControl(TOOLBARCLASSNAME, wxEmptyString, pos, size) ) return FALSE; // toolbar-specific post initialisation @@ -278,7 +280,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() ) { @@ -340,7 +342,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(); @@ -353,6 +355,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 ) @@ -361,6 +368,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; } @@ -386,7 +396,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(); @@ -477,7 +487,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; @@ -651,9 +661,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]; @@ -1008,7 +1023,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() ) { @@ -1162,7 +1177,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) ) @@ -1187,12 +1202,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; } } @@ -1216,7 +1227,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() )