From 6a1359c0a5cc5dc5f762b1c126545425a2f84edd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 6 Sep 2002 18:28:58 +0000 Subject: [PATCH] fix for creating radio items in a toolbar with non zero margin git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/tbargtk.cpp | 14 ++++++++------ src/gtk1/tbargtk.cpp | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 26f7d2f6a6..235319eb16 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -374,8 +374,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool *tool = (wxToolBarTool *)toolBase; - // we have inserted a space before all the tools - if (m_xMargin > 1) pos++; + // if we have inserted a space before all the tools we must change the GTK + // index by 1 + size_t posGtk = m_xMargin > 1 ? pos + 1 : pos; if ( tool->IsButton() ) { @@ -454,7 +455,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) tool->m_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool, - pos + posGtk ); if ( !tool->m_item ) @@ -476,7 +477,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) break; case wxTOOL_STYLE_SEPARATOR: - gtk_toolbar_insert_space( m_toolbar, pos ); + gtk_toolbar_insert_space( m_toolbar, posGtk ); // skip the rest return TRUE; @@ -487,7 +488,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) tool->GetControl()->m_widget, (const char *) NULL, (const char *) NULL, - pos + posGtk ); break; } @@ -586,7 +587,8 @@ void wxToolBar::SetMargins( int x, int y ) wxCHECK_RET( GetToolsCount() == 0, wxT("wxToolBar::SetMargins must be called before adding tools.") ); - if (x > 1) gtk_toolbar_append_space( m_toolbar ); // oh well + if (x > 1) + gtk_toolbar_append_space( m_toolbar ); // oh well m_xMargin = x; m_yMargin = y; diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 26f7d2f6a6..235319eb16 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -374,8 +374,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool *tool = (wxToolBarTool *)toolBase; - // we have inserted a space before all the tools - if (m_xMargin > 1) pos++; + // if we have inserted a space before all the tools we must change the GTK + // index by 1 + size_t posGtk = m_xMargin > 1 ? pos + 1 : pos; if ( tool->IsButton() ) { @@ -454,7 +455,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) tool->m_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool, - pos + posGtk ); if ( !tool->m_item ) @@ -476,7 +477,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) break; case wxTOOL_STYLE_SEPARATOR: - gtk_toolbar_insert_space( m_toolbar, pos ); + gtk_toolbar_insert_space( m_toolbar, posGtk ); // skip the rest return TRUE; @@ -487,7 +488,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) tool->GetControl()->m_widget, (const char *) NULL, (const char *) NULL, - pos + posGtk ); break; } @@ -586,7 +587,8 @@ void wxToolBar::SetMargins( int x, int y ) wxCHECK_RET( GetToolsCount() == 0, wxT("wxToolBar::SetMargins must be called before adding tools.") ); - if (x > 1) gtk_toolbar_append_space( m_toolbar ); // oh well + if (x > 1) + gtk_toolbar_append_space( m_toolbar ); // oh well m_xMargin = x; m_yMargin = y; -- 2.45.2