X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2600776164cbac3a9db926e5c50847be44bee494..c0c05e79b20d6ca372ece6ac5995b0e3db18a29b:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 37f38fa169..f6bc3617dc 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -259,11 +259,29 @@ wxToolBarToolBase *wxToolBarBase::AddSeparator() wxToolBarToolBase *wxToolBarBase::InsertSeparator(size_t pos) { - return DoInsertNewTool(pos, CreateTool(wxID_SEPARATOR, - wxEmptyString, - wxNullBitmap, wxNullBitmap, - wxITEM_SEPARATOR, NULL, - wxEmptyString, wxEmptyString)); + return DoInsertNewTool(pos, CreateSeparator()); +} + +wxToolBarToolBase *wxToolBarBase::AddStretchableSpace() +{ + return InsertStretchableSpace(GetToolsCount()); +} + +wxToolBarToolBase *wxToolBarBase::InsertStretchableSpace(size_t pos) +{ + wxToolBarToolBase * const tool = CreateSeparator(); + if ( tool ) + { + // this is a hack but we know that all the current implementations + // don't really use the tool when it's created, they will do it + // InsertTool() at earliest and maybe even in Realize() much later + // + // so we can create the tool as a plain separator and mark it as being + // a stretchable space later + tool->MakeStretchable(); + } + + return DoInsertNewTool(pos, tool); } wxToolBarToolBase *wxToolBarBase::RemoveTool(int id) @@ -436,8 +454,7 @@ bool wxToolBarBase::Realize() if ( m_tools.empty() ) return false; - // make sure tool size is larger enough for all all bitmaps to fit in - // (this is consistent with what other ports do): + // make sure tool size is large enough for all bitmaps to fit in AdjustToolBitmapSize(); return true;