// Purpose: wxInfoBar implementation for GTK
// Author: Vadim Zeitlin
// Created: 2009-09-27
-// RCS-ID: $Id: wxhead.cpp,v 1.10 2009-06-29 10:23:04 zeitlin Exp $
+// RCS-ID: $Id$
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#endif // WX_PRECOMP
#include "wx/vector.h"
+#include "wx/stockitem.h"
#include "wx/gtk/private.h"
#include "wx/gtk/private/messagetype.h"
inline bool UseNative()
{
+#ifdef __WXGTK3__
+ return true;
+#else
// native GtkInfoBar widget is only available in GTK+ 2.18 and later
return gtk_check_version(2, 18, 0) == 0;
+#endif
}
} // anonymous namespace
GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response));
GTKConnectWidget("close", G_CALLBACK(wxgtk_infobar_close));
- return false;
+ return true;
}
wxInfoBar::~wxInfoBar()
GtkWidget *button = gtk_info_bar_add_button
(
GTK_INFO_BAR(m_widget),
- label.empty()
+ (label.empty()
? GTKConvertMnemonics(wxGetStockGtkID(btnid))
- : label,
+ : label).utf8_str(),
btnid
);
i != buttons.rend();
++i )
{
- gtk_widget_destroy(i->button);
- buttons.erase(i.base());
+ if (i->id == btnid)
+ {
+ gtk_widget_destroy(i->button);
+ buttons.erase(i.base());
- // see comment in GTKAddButton()
- InvalidateBestSize();
+ // see comment in GTKAddButton()
+ InvalidateBestSize();
- return;
+ 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);
+}
+
#endif // wxUSE_INFOBAR