X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf9e3e736771b247eb38ada221266733b6a601c7..b9517a0ae450f70439f88abcab474ad60035b52c:/src/gtk/tbargtk.cpp diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 9ee4df2deb..7df75acd3a 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -178,7 +178,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) ); - m_separation = 5; + m_separation = 7; gtk_toolbar_set_space_size( m_toolbar, m_separation ); m_hasToolAlready = FALSE; @@ -329,8 +329,8 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, GtkRequisition req; (* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req ); - m_width = req.width; - m_height = req.height; + m_width = req.width + m_xMargin; + m_height = req.height + 2*m_yMargin + 4; gtk_signal_connect( GTK_OBJECT(tool->m_item), "enter_notify_event", @@ -353,12 +353,13 @@ bool wxToolBar::AddControl(wxControl *control) wxToolBarTool *tool = new wxToolBarTool(control); + tool -> m_item = NULL; gtk_toolbar_append_widget( m_toolbar, control->m_widget, (const char *) NULL, (const char *) NULL ); GtkRequisition req; (* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req ); - m_width = req.width; - m_height = req.height; + m_width = req.width + m_xMargin; + m_height = req.height + 2*m_yMargin + 4; m_tools.Append( tool ); @@ -370,33 +371,35 @@ void wxToolBar::AddSeparator() gtk_toolbar_append_space( m_toolbar ); } -void wxToolBar::ClearTools() -{ - wxFAIL_MSG( wxT("wxToolBar::ClearTools not implemented") ); -} - -bool wxToolBar::Realize() +bool wxToolBar::DeleteTool(int toolIndex) { - m_x = 0; - m_y = 0; - m_width = 100; - m_height = 0; - wxNode *node = m_tools.First(); while (node) { wxToolBarTool *tool = (wxToolBarTool*)node->Data(); - if (tool->m_bitmap1.Ok()) + if (tool->m_index == toolIndex) { - int tool_height = tool->m_bitmap1.GetHeight(); - if (tool_height > m_height) m_height = tool_height; + if (tool->m_control) + tool->m_control->Destroy(); + else + gtk_widget_destroy( tool->m_item ); + m_tools.DeleteNode( node ); + + return TRUE; } - node = node->Next(); } - - m_height += 5 + 2*m_yMargin; - + + return FALSE; +} + +void wxToolBar::ClearTools() +{ + wxFAIL_MSG( wxT("wxToolBar::ClearTools not implemented") ); +} + +bool wxToolBar::Realize() +{ return TRUE; } @@ -512,7 +515,7 @@ void wxToolBar::SetMargins( int x, int y ) { wxCHECK_RET( !m_hasToolAlready, wxT("wxToolBar::SetMargins must be called before adding tool.") ); - if (x > 2) 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;