ensure that wxToolBar has one of wxTB_TOP/LEFT/RIGHT/BOTTOM styles set, otherwise the latest toolbar positioning code breaks down
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42840 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -564,6 +564,13 @@ protected:
|
||||
// helper functions
|
||||
// ----------------
|
||||
|
||||
// call this from derived class ctor/Create() to ensure that we have either
|
||||
// wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code
|
||||
// which randomly checks either one or the other of them and gets confused
|
||||
// if neither is set (and making one of them 0 is not an option neither as
|
||||
// then the existing tests would break down)
|
||||
void FixupStyle();
|
||||
|
||||
// un-toggle all buttons in the same radio group
|
||||
void UnToggleRadioGroup(wxToolBarToolBase *tool);
|
||||
|
||||
|
@@ -186,7 +186,13 @@ bool wxToolBar::Create( wxWindow *parent,
|
||||
const wxString& name )
|
||||
{
|
||||
// Call wxControl::Create so we get a wxNonControlNSControl
|
||||
return wxToolBarBase::Create(parent,winid,pos,size,style,wxDefaultValidator,name);
|
||||
if ( !wxToolBarBase::Create(parent, winid, pos, size, style,
|
||||
wxDefaultValidator, name) )
|
||||
return false;
|
||||
|
||||
FixupStyle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxToolBarToolBase *wxToolBar::CreateTool(int toolid,
|
||||
|
@@ -123,6 +123,15 @@ wxToolBarBase::wxToolBarBase()
|
||||
m_defaultHeight = 15;
|
||||
}
|
||||
|
||||
void wxToolBarBase::FixupStyle()
|
||||
{
|
||||
if ( !HasFlag(wxTB_TOP | wxTB_LEFT | wxTB_RIGHT | wxTB_BOTTOM) )
|
||||
{
|
||||
// this is the default
|
||||
m_windowStyle |= wxTB_TOP;
|
||||
}
|
||||
}
|
||||
|
||||
wxToolBarToolBase *wxToolBarBase::DoAddTool(int id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
|
@@ -287,6 +287,8 @@ bool wxToolBar::Create( wxWindow *parent,
|
||||
return false;
|
||||
}
|
||||
|
||||
FixupStyle();
|
||||
|
||||
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
|
||||
GtkSetStyle();
|
||||
|
||||
|
@@ -285,6 +285,8 @@ bool wxToolBar::Create( wxWindow *parent,
|
||||
return false;
|
||||
}
|
||||
|
||||
FixupStyle();
|
||||
|
||||
GtkOrientation orient;
|
||||
GtkToolbarStyle gtkStyle;
|
||||
GetGtkStyle(style, &orient, >kStyle);
|
||||
|
@@ -792,6 +792,8 @@ bool wxToolBar::Create(
|
||||
if ( !wxToolBarBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||
return false;
|
||||
|
||||
FixupStyle();
|
||||
|
||||
OSStatus err = noErr;
|
||||
|
||||
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||
|
@@ -204,6 +204,8 @@ bool wxToolBar::Create(wxWindow *parent,
|
||||
wxDefaultValidator, name ) )
|
||||
return false;
|
||||
|
||||
FixupStyle();
|
||||
|
||||
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||
|
@@ -234,6 +234,8 @@ bool wxToolBar::Create(wxWindow *parent,
|
||||
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||
return false;
|
||||
|
||||
FixupStyle();
|
||||
|
||||
// MSW-specific initialisation
|
||||
if ( !MSWCreateToolbar(pos, size) )
|
||||
return false;
|
||||
|
@@ -190,6 +190,8 @@ bool wxToolBar::Create(wxWindow *parent,
|
||||
return false;
|
||||
}
|
||||
|
||||
FixupStyle();
|
||||
|
||||
CreateInputHandler(wxINP_HANDLER_TOOLBAR);
|
||||
|
||||
SetInitialSize(size);
|
||||
|
Reference in New Issue
Block a user