X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/86b65467096ed1cd7c8b914bc64db6680fddafc9..34a0dc614e3011fd0e88fb3c57a1f6d107596cfc:/src/gtk/tbargtk.cpp diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 3ce3d74f7d..86fda2bd50 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -91,8 +91,8 @@ public: Init(); } - wxToolBarTool(wxToolBar *tbar, wxControl *control) - : wxToolBarToolBase(tbar, control) + wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label) + : wxToolBarToolBase(tbar, control, label) { Init(); } @@ -223,7 +223,7 @@ void gtktoolwidget_size_callback( GtkWidget *widget, { // this shouldn't happen... if (win->GetParent()->m_wxwindow) return; - + wxSize size = win->GetEffectiveMinSize(); if (size.y != alloc->height) { @@ -269,9 +269,10 @@ wxToolBarToolBase *wxToolBar::CreateTool(int id, clientData, shortHelpString, longHelpString); } -wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control) +wxToolBarToolBase * +wxToolBar::CreateTool(wxControl *control, const wxString& label) { - return new wxToolBarTool(this, control); + return new wxToolBarTool(this, control, label); } //----------------------------------------------------------------------------- @@ -474,11 +475,11 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) (const char *) NULL, posGtk ); - + // connect after in order to correct size_allocate events g_signal_connect_after (tool->GetControl()->m_widget, "size_allocate", G_CALLBACK (gtktoolwidget_size_callback), tool->GetControl()); - + break; } @@ -597,6 +598,30 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString ) } } +void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) +{ + wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); + if ( tool ) + { + wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); + + tool->SetNormalBitmap(bitmap); + tool->SetImage(tool->GetBitmap()); + } +} + +void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) +{ + wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); + if ( tool ) + { + wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); + + tool->SetDisabledBitmap(bitmap); + tool->SetImage(tool->GetBitmap()); + } +} + // ---------------------------------------------------------------------------- // wxToolBar idle handling // ---------------------------------------------------------------------------- @@ -605,7 +630,7 @@ void wxToolBar::OnInternalIdle() { // Check if we have to show window now if (GtkShowFromOnIdle()) return; - + wxCursor cursor = m_cursor; if (g_globalCursor.Ok()) cursor = g_globalCursor;