X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0b83552acf359689c43d641175f7292391f6a9e6..2efd54a41b12a5977713c837c585d89f35a13d14:/src/gtk/toolbar.cpp diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp index 701ec64a84..df4530d636 100644 --- a/src/gtk/toolbar.cpp +++ b/src/gtk/toolbar.cpp @@ -445,6 +445,32 @@ void wxToolBar::SetWindowStyleFlag( long style ) GtkSetStyle(); } +bool wxToolBar::Realize() +{ + if ( !wxToolBarBase::Realize() ) + return false; + + // bring the initial state of all the toolbar items in line with the + // internal state if the latter was changed by calling wxToolBarTool:: + // Enable(): this works under MSW, where the toolbar items are only created + // in Realize() which uses the internal state to determine the initial + // button state, so make it work under GTK too + for ( wxToolBarToolsList::const_iterator i = m_tools.begin(); + i != m_tools.end(); + ++i ) + { + // by default the toolbar items are enabled and not toggled, so we only + // have to do something if their internal state doesn't correspond to + // this + if ( !(*i)->IsEnabled() ) + DoEnableTool(*i, false); + if ( (*i)->IsToggled() ) + DoToggleTool(*i, true); + } + + return true; +} + bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool* tool = static_cast(toolBase); @@ -519,6 +545,15 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) case wxTOOL_STYLE_SEPARATOR: tool->m_item = gtk_separator_tool_item_new(); + if ( tool->IsStretchable() ) + { + gtk_separator_tool_item_set_draw + ( + GTK_SEPARATOR_TOOL_ITEM(tool->m_item), + FALSE + ); + gtk_tool_item_set_expand(tool->m_item, TRUE); + } gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos)); break;