]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for creating radio items in a toolbar with non zero margin
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Sep 2002 18:28:58 +0000 (18:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Sep 2002 18:28:58 +0000 (18:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/tbargtk.cpp
src/gtk1/tbargtk.cpp

index 26f7d2f6a6b6e3f4bc7744d49f1b0801bf5a497f..235319eb1690e9e219569849c917759d363595fd 100644 (file)
@@ -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;
index 26f7d2f6a6b6e3f4bc7744d49f1b0801bf5a497f..235319eb1690e9e219569849c917759d363595fd 100644 (file)
@@ -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;