// 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
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
#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 <commctrl.h>
#else
#include "wx/msw/gnuwin32/extra.h"
#endif
-#endif // __TWIN32__
+#include "wx/msw/missing.h"
-#include "wx/msw/dib.h"
#include "wx/app.h" // for GetComCtl32Version
#if defined(__MWERKS__) && defined(__WXMSW__)
return FALSE;
// MSW-specific initialisation
- if ( !MSWCreateToolbar(pos, size, style) )
+ if ( !MSWCreateToolbar(pos, size) )
return FALSE;
// set up the colors and fonts
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
UnsubclassWin();
- if ( !MSWCreateToolbar(pos, size, GetWindowStyle()) )
+ if ( !MSWCreateToolbar(pos, size) )
{
// what can we do?
wxFAIL_MSG( _T("recreating the toolbar failed") );
}
// 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() )
{
// 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();
{
msStyle |= TBSTYLE_FLAT | TBSTYLE_TRANSPARENT;
}
+
+ if ( s_verComCtl >= 470 && style & wxTB_HORZ_LAYOUT )
+ {
+ msStyle |= TBSTYLE_LIST;
+ }
}
if ( style & wxTB_NODIVIDER )
if ( style & wxTB_NOALIGN )
msStyle |= CCS_NOPARENTALIGN;
+ if ( style & wxTB_VERTICAL )
+ msStyle |= CCS_VERT;
+
return msStyle;
}
// 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();
// First, add the bitmap: we use one bitmap for all toolbar buttons
// ----------------------------------------------------------------
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
int bitmapId = 0;
wxSize sizeBmp;
{
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];
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() )
{
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) )
h = r.bottom - r.top;
if ( m_maxRows )
{
- // FIXME: 6 is hardcoded separator line height...
- //h += 6;
- if (HasFlag(wxTB_NODIVIDER))
- h += 3;
- else
- h += 6;
+ // FIXME: hardcoded separator line height...
+ h += HasFlag(wxTB_NODIVIDER) ? 4 : 6;
h *= m_maxRows;
}
}
// 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() )