git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42840
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// helper functions
// ----------------
// 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);
// un-toggle all buttons in the same radio group
void UnToggleRadioGroup(wxToolBarToolBase *tool);
const wxString& name )
{
// Call wxControl::Create so we get a wxNonControlNSControl
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,
}
wxToolBarToolBase *wxToolBar::CreateTool(int toolid,
+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,
wxToolBarToolBase *wxToolBarBase::DoAddTool(int id,
const wxString& label,
const wxBitmap& bitmap,
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
GtkSetStyle();
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
GtkSetStyle();
GtkOrientation orient;
GtkToolbarStyle gtkStyle;
GetGtkStyle(style, &orient, >kStyle);
GtkOrientation orient;
GtkToolbarStyle gtkStyle;
GetGtkStyle(style, &orient, >kStyle);
if ( !wxToolBarBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
return false;
if ( !wxToolBarBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
return false;
OSStatus err = noErr;
#if wxMAC_USE_NATIVE_TOOLBAR
OSStatus err = noErr;
#if wxMAC_USE_NATIVE_TOOLBAR
wxDefaultValidator, name ) )
return false;
wxDefaultValidator, name ) )
return false;
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
Widget parentWidget = (Widget) parent->GetClientWidget();
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
Widget parentWidget = (Widget) parent->GetClientWidget();
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
return false;
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
return false;
// MSW-specific initialisation
if ( !MSWCreateToolbar(pos, size) )
return false;
// MSW-specific initialisation
if ( !MSWCreateToolbar(pos, size) )
return false;
CreateInputHandler(wxINP_HANDLER_TOOLBAR);
SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_TOOLBAR);
SetInitialSize(size);