- gtk_info_bar_add_button
- (
- GTK_INFO_BAR(m_widget),
- label.empty() ? GTKConvertMnemonics(wxGetStockGtkID(btnid)) : label,
- btnid
- );
+ // if we had created the default close button before, remove it now that we
+ // have some user-defined button
+ if ( m_impl->m_close )
+ {
+ gtk_widget_destroy(m_impl->m_close);
+ m_impl->m_close = NULL;
+ }
+
+ GtkWidget * const button = GTKAddButton(btnid, label);
+ if ( button )
+ m_impl->m_buttons.push_back(wxInfoBarGTKImpl::Button(button, btnid));
+}
+
+void wxInfoBar::RemoveButton(wxWindowID btnid)
+{
+ if ( !UseNative() )
+ {
+ wxInfoBarGeneric::RemoveButton(btnid);
+ return;
+ }
+
+ // as in the generic version, look for the button starting from the end
+ wxInfoBarGTKImpl::Buttons& buttons = m_impl->m_buttons;
+ for ( wxInfoBarGTKImpl::Buttons::reverse_iterator i = buttons.rbegin();
+ i != buttons.rend();
+ ++i )
+ {
+ if (i->id == btnid)
+ {
+ gtk_widget_destroy(i->button);
+ buttons.erase(i.base());
+
+ // see comment in GTKAddButton()
+ InvalidateBestSize();
+
+ return;
+ }
+ }
+
+ wxFAIL_MSG( wxString::Format("button with id %d not found", btnid) );
+}
+
+void wxInfoBar::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+ wxInfoBarGeneric::DoApplyWidgetStyle(style);
+
+ if ( UseNative() )
+ GTKApplyStyle(m_impl->m_label, style);