wx/gtk/bmpcbox.h \
wx/gtk/calctrl.h \
wx/gtk/dataview.h \
- wx/gtk/hyperlink.h
+ wx/gtk/hyperlink.h \
+ wx/gtk/infobar.h
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ADVANCED_PLATFORM_NATIVE_HDR = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_ADVANCED_PLATFORM_NATIVE_HDR)
@COND_TOOLKIT_MSW@ADVANCED_PLATFORM_NATIVE_HDR = \
@COND_TOOLKIT_MSW@ wx/generic/animate.h wx/msw/bmpcbox.h wx/msw/calctrl.h \
monodll_gridsel.o \
monodll_helpext.o \
monodll_hyperlinkg.o \
- monodll_infobar.o \
+ monodll_generic_infobar.o \
monodll_laywin.o \
monodll_notifmsgg.o \
monodll_odcombo.o \
monodll_gridsel.o \
monodll_helpext.o \
monodll_hyperlinkg.o \
- monodll_infobar.o \
+ monodll_generic_infobar.o \
monodll_laywin.o \
monodll_notifmsgg.o \
monodll_odcombo.o \
monodll_gtk_bmpcbox.o \
monodll_gtk_calctrl.o \
monodll_gtk_dataview.o \
- monodll_hyperlink.o
+ monodll_hyperlink.o \
+ monodll_gtk_infobar.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS)
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS = \
monodll_animateg.o \
monolib_gridsel.o \
monolib_helpext.o \
monolib_hyperlinkg.o \
- monolib_infobar.o \
+ monolib_generic_infobar.o \
monolib_laywin.o \
monolib_notifmsgg.o \
monolib_odcombo.o \
monolib_gridsel.o \
monolib_helpext.o \
monolib_hyperlinkg.o \
- monolib_infobar.o \
+ monolib_generic_infobar.o \
monolib_laywin.o \
monolib_notifmsgg.o \
monolib_odcombo.o \
monolib_gtk_bmpcbox.o \
monolib_gtk_calctrl.o \
monolib_gtk_dataview.o \
- monolib_hyperlink.o
+ monolib_hyperlink.o \
+ monolib_gtk_infobar.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1)
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 = \
monolib_animateg.o \
advdll_gridsel.o \
advdll_helpext.o \
advdll_hyperlinkg.o \
- advdll_infobar.o \
+ advdll_generic_infobar.o \
advdll_laywin.o \
advdll_notifmsgg.o \
advdll_odcombo.o \
advdll_gridsel.o \
advdll_helpext.o \
advdll_hyperlinkg.o \
- advdll_infobar.o \
+ advdll_generic_infobar.o \
advdll_laywin.o \
advdll_notifmsgg.o \
advdll_odcombo.o \
advdll_gtk_bmpcbox.o \
advdll_gtk_calctrl.o \
advdll_gtk_dataview.o \
- advdll_hyperlink.o
+ advdll_hyperlink.o \
+ advdll_gtk_infobar.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2)
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 = \
advdll_animateg.o \
advlib_gridsel.o \
advlib_helpext.o \
advlib_hyperlinkg.o \
- advlib_infobar.o \
+ advlib_generic_infobar.o \
advlib_laywin.o \
advlib_notifmsgg.o \
advlib_odcombo.o \
advlib_gridsel.o \
advlib_helpext.o \
advlib_hyperlinkg.o \
- advlib_infobar.o \
+ advlib_generic_infobar.o \
advlib_laywin.o \
advlib_notifmsgg.o \
advlib_odcombo.o \
advlib_gtk_bmpcbox.o \
advlib_gtk_calctrl.o \
advlib_gtk_dataview.o \
- advlib_hyperlink.o
+ advlib_hyperlink.o \
+ advlib_gtk_infobar.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3)
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 = \
advlib_animateg.o \
monodll_hyperlink.o: $(srcdir)/src/gtk/hyperlink.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/hyperlink.cpp
+monodll_gtk_infobar.o: $(srcdir)/src/gtk/infobar.cpp $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/infobar.cpp
+
monodll_mediactrlcmn.o: $(srcdir)/src/common/mediactrlcmn.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/mediactrlcmn.cpp
@COND_USE_GUI_1@monodll_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp
-@COND_USE_GUI_1@monodll_infobar.o: $(srcdir)/src/generic/infobar.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@monodll_generic_infobar.o: $(srcdir)/src/generic/infobar.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp
@COND_USE_GUI_1@monodll_laywin.o: $(srcdir)/src/generic/laywin.cpp $(MONODLL_ODEP)
monolib_hyperlink.o: $(srcdir)/src/gtk/hyperlink.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/hyperlink.cpp
+monolib_gtk_infobar.o: $(srcdir)/src/gtk/infobar.cpp $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/infobar.cpp
+
monolib_mediactrlcmn.o: $(srcdir)/src/common/mediactrlcmn.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/mediactrlcmn.cpp
@COND_USE_GUI_1@monolib_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp
-@COND_USE_GUI_1@monolib_infobar.o: $(srcdir)/src/generic/infobar.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@monolib_generic_infobar.o: $(srcdir)/src/generic/infobar.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp
@COND_USE_GUI_1@monolib_laywin.o: $(srcdir)/src/generic/laywin.cpp $(MONOLIB_ODEP)
advdll_hyperlink.o: $(srcdir)/src/gtk/hyperlink.cpp $(ADVDLL_ODEP)
$(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/gtk/hyperlink.cpp
+advdll_gtk_infobar.o: $(srcdir)/src/gtk/infobar.cpp $(ADVDLL_ODEP)
+ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/gtk/infobar.cpp
+
advdll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(ADVDLL_ODEP)
$(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/unix/sound_sdl.cpp
advdll_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(ADVDLL_ODEP)
$(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp
-advdll_infobar.o: $(srcdir)/src/generic/infobar.cpp $(ADVDLL_ODEP)
+advdll_generic_infobar.o: $(srcdir)/src/generic/infobar.cpp $(ADVDLL_ODEP)
$(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp
advdll_laywin.o: $(srcdir)/src/generic/laywin.cpp $(ADVDLL_ODEP)
advlib_hyperlink.o: $(srcdir)/src/gtk/hyperlink.cpp $(ADVLIB_ODEP)
$(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/gtk/hyperlink.cpp
+advlib_gtk_infobar.o: $(srcdir)/src/gtk/infobar.cpp $(ADVLIB_ODEP)
+ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/gtk/infobar.cpp
+
advlib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(ADVLIB_ODEP)
$(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/unix/sound_sdl.cpp
advlib_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(ADVLIB_ODEP)
$(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp
-advlib_infobar.o: $(srcdir)/src/generic/infobar.cpp $(ADVLIB_ODEP)
+advlib_generic_infobar.o: $(srcdir)/src/generic/infobar.cpp $(ADVLIB_ODEP)
$(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp
advlib_laywin.o: $(srcdir)/src/generic/laywin.cpp $(ADVLIB_ODEP)
src/gtk/calctrl.cpp
src/gtk/dataview.cpp
src/gtk/hyperlink.cpp
+ src/gtk/infobar.cpp
</set>
<set var="ADVANCED_GTK_NATIVE_HDR" hints="files">
wx/gtk/animate.h
wx/gtk/calctrl.h
wx/gtk/dataview.h
wx/gtk/hyperlink.h
+ wx/gtk/infobar.h
</set>
<set var="ADVANCED_GTK1_SRC" hints="files">
// wxInfoBar
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_ADV wxInfoBar : public wxInfoBarBase
+class WXDLLIMPEXP_ADV wxInfoBarGeneric : public wxInfoBarBase
{
public:
// the usual ctors and Create() but remember that info bar is created
// hidden
- wxInfoBar() { Init(); }
+ wxInfoBarGeneric() { Init(); }
- wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY)
+ wxInfoBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY)
{
Init();
Create(parent, winid);
// implement base class methods
// ----------------------------
- virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE);
+ virtual void ShowMessage(const wxString& msg,
+ int flags = wxICON_INFORMATION);
virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
// (default font is a larger and bold version of the normal one)
virtual bool SetFont(const wxFont& font);
+protected:
+ // update the parent to take our new or changed size into account (notably
+ // should be called when we're shown or hidden)
+ void UpdateParent();
+
private:
// common part of all ctors
void Init();
// handler for the close button
void OnButton(wxCommandEvent& event);
- // update the parent after we're shown or hidden
- void UpdateParent();
-
// change the parent background colour to match that of our sibling
void ChangeParentBackground();
// the original parent background colour, before we changed it
wxColour m_origParentBgCol;
- wxDECLARE_NO_COPY_CLASS(wxInfoBar);
+ wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric);
};
#endif // _WX_GENERIC_INFOBAR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/infobar.h
+// Purpose: native implementation of wxInfoBar for GTK+ 2.18 and later
+// Author: Vadim Zeitlin
+// Created: 2009-09-26
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_INFOBAR_H_
+#define _WX_GTK_INFOBAR_H_
+
+#include "wx/generic/infobar.h"
+
+// ----------------------------------------------------------------------------
+// wxInfoBar for GTK+
+// ----------------------------------------------------------------------------
+
+// notice that the native GTK+ implementation is only available since
+// (relatively recent) 2.18 so we inherit from the generic one to be able to
+// fall back to it if GTK+ version is determined to be too old during run-time
+class WXDLLIMPEXP_ADV wxInfoBar : public wxInfoBarGeneric
+{
+public:
+ wxInfoBar() { Init(); }
+
+ wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY)
+ {
+ Init();
+ Create(parent, winid);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
+
+ virtual ~wxInfoBar();
+
+ // implement base class methods
+ // ----------------------------
+
+ virtual void ShowMessage(const wxString& msg,
+ int flags = wxICON_INFORMATION);
+
+ virtual void AddButton(wxWindowID btnid,
+ const wxString& label = wxString());
+
+ // implementation only
+ // -------------------
+
+ void GTKResponse(int btnid);
+
+protected:
+ virtual bool GTKShouldConnectSizeRequest() const { return false; }
+
+private:
+ void Init() { m_label = NULL; }
+
+ GtkWidget *m_label;
+
+ wxDECLARE_NO_COPY_CLASS(wxInfoBar);
+};
+
+#endif // _WX_GTK_INFOBAR_H_
+
// wxInfoBar shows non-critical but important information to the user
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_ADV wxInfoBarBase : public wxWindow
+class WXDLLIMPEXP_ADV wxInfoBarBase : public wxControl
{
public:
// real ctors are provided by the derived classes, just notice that unlike
// show the info bar with the given message and optionally an icon
- virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE) = 0;
+ virtual void ShowMessage(const wxString& msg,
+ int flags = wxICON_INFORMATION) = 0;
// add an extra button to the bar, near the message
virtual void AddButton(wxWindowID btnid,
wxDECLARE_NO_COPY_CLASS(wxInfoBarBase);
};
-// include platform-dependent implementation
-//
-// TODO-GTK: implement a native version using GtkInfoBar (GTK+ 2.18+)
-#include "wx/generic/infobar.h"
+// currently only GTK+ has a native implementation
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include <gtk/gtkversion.h>
+ #if GTK_CHECK_VERSION(2, 18, 0)
+ #include "wx/gtk/infobar.h"
+ #define wxHAS_NATIVE_INFOBAR
+ #endif
+#endif // wxGTK2
+
+// if the generic version is the only one we have, use it
+#ifndef wxHAS_NATIVE_INFOBAR
+ #include "wx/generic/infobar.h"
+ #define wxInfoBar wxInfoBarGeneric
+#endif
#endif // wxUSE_INFOBAR
See the dialogs sample for more sophisticated examples.
- Only generic implementation of this class exists currently but it is
- planned to provide a native GTK+-based version in future wxWidgets releases
- so avoid the use of the methods marked "generic only" for maximal
- portability.
+ Currently this class is implemented generically (i.e. in the same
+ platform-independent way for all ports) and also natively in wxGTK but the
+ native implementation requires a recent -- as of this writing -- GTK+ 2.18
+ version.
@library{wxadv}
@category{miscwnd}
@param msg
The text of the message.
@param flags
- One of wxICON_NONE (default), wxICON_INFORMATION, wxICON_QUESTION,
+ One of wxICON_NONE, wxICON_INFORMATION (default), wxICON_QUESTION,
wxICON_WARNING or wxICON_ERROR values. These flags have the same
- meaning as in wxMessageDialog, i.e. show the corresponding icon in
- the bar.
+ meaning as in wxMessageDialog for the generic version, i.e. show
+ (or not, in case of wxICON_NONE) the corresponding icon in the bar
+ but can be interpreted by the native versions. For example, the
+ GTK+ native implementation doesn't show icons at all but uses this
+ parameter to select the appropriate background colour for the
+ notification.
*/
void ShowMessage(const wxString& msg, int flags = wxICON_NONE);
All these methods exist in the generic version of the class only.
The generic version uses wxWindow::ShowWithEffect() function to
- progressively show it on the platforms which support it. The methods
- here allow to change the default effect used (or disable it entirely)
- and change its duration.
+ progressively show it on the platforms which support it (currently only
+ wxMSW). The methods here allow to change the default effect used (or
+ disable it entirely) and change its duration.
*/
//@{
#if wxUSE_INFOBAR
#ifndef WX_PRECOMP
- #include "wx/artprov.h"
#include "wx/bmpbuttn.h"
#include "wx/button.h"
#include "wx/settings.h"
#include "wx/infobar.h"
+#include "wx/artprov.h"
#include "wx/scopeguard.h"
#include "wx/sizer.h"
// implementation
// ============================================================================
-void wxInfoBar::Init()
+void wxInfoBarGeneric::Init()
{
m_icon = NULL;
m_text = NULL;
m_effectDuration = 0;
}
-bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid)
+bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid)
{
// calling Hide() before Create() ensures that we're created initially
// hidden
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED,
- wxCommandEventHandler(wxInfoBar::OnButton),
+ wxCommandEventHandler(wxInfoBarGeneric::OnButton),
NULL,
this
);
return true;
}
-bool wxInfoBar::SetFont(const wxFont& font)
+bool wxInfoBarGeneric::SetFont(const wxFont& font)
{
if ( !wxInfoBarBase::SetFont(font) )
return false;
return true;
}
-void wxInfoBar::UpdateParent()
+void wxInfoBarGeneric::UpdateParent()
{
wxWindow * const parent = wxGetTopLevelParent(GetParent());
parent->Layout();
}
-void wxInfoBar::ChangeParentBackground()
+void wxInfoBarGeneric::ChangeParentBackground()
{
wxWindow * const parent = GetParent();
m_origParentBgCol = parent->GetBackgroundColour();
parent->SetOwnBackgroundColour(sibling->GetBackgroundColour());
}
-void wxInfoBar::RestoreParentBackground()
+void wxInfoBarGeneric::RestoreParentBackground()
{
GetParent()->SetOwnBackgroundColour(m_origParentBgCol);
}
-void wxInfoBar::DoHide()
+void wxInfoBarGeneric::DoHide()
{
ChangeParentBackground();
- wxON_BLOCK_EXIT_THIS0( wxInfoBar::RestoreParentBackground );
+ wxON_BLOCK_EXIT_THIS0( wxInfoBarGeneric::RestoreParentBackground );
HideWithEffect(m_hideEffect, m_effectDuration);
UpdateParent();
}
-void wxInfoBar::DoShow()
+void wxInfoBarGeneric::DoShow()
{
// re-layout the parent first so that the window expands into an already
// unoccupied by the other controls area: for this we need to change our
// going to expand to look like part of this sibling for a better effect so
// temporarily change the background of our parent to the same colour
ChangeParentBackground();
- wxON_BLOCK_EXIT_THIS0( wxInfoBar::RestoreParentBackground );
+ wxON_BLOCK_EXIT_THIS0( wxInfoBarGeneric::RestoreParentBackground );
// adjust the parent layout to account for us
UpdateParent();
ShowWithEffect(m_showEffect, m_effectDuration);
}
-void wxInfoBar::ShowMessage(const wxString& msg, int flags)
+void wxInfoBarGeneric::ShowMessage(const wxString& msg, int flags)
{
// first update the controls
const int icon = flags & wxICON_MASK;
}
}
-void wxInfoBar::AddButton(wxWindowID btnid, const wxString& label)
+void wxInfoBarGeneric::AddButton(wxWindowID btnid, const wxString& label)
{
wxSizer * const sizer = GetSizer();
wxCHECK_RET( sizer, "must be created first" );
wxSizerFlags().Centre().DoubleBorder());
}
-void wxInfoBar::OnButton(wxCommandEvent& WXUNUSED(event))
+void wxInfoBarGeneric::OnButton(wxCommandEvent& WXUNUSED(event))
{
DoHide();
}
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/gtk/infobar.cpp
+// 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 $
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#include "wx/infobar.h"
+
+#if wxUSE_INFOBAR && defined(wxHAS_NATIVE_INFOBAR)
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/gtk/private.h"
+#include "wx/gtk/private/messagetype.h"
+
+// ----------------------------------------------------------------------------
+// local functions
+// ----------------------------------------------------------------------------
+
+namespace
+{
+
+inline bool UseNative()
+{
+ // native GtkInfoBar widget is only available in GTK+ 2.18 and later
+ return gtk_check_version(2, 18, 0) == 0;
+}
+
+} // anonymous namespace
+
+extern "C"
+{
+
+static void wxgtk_infobar_response(GtkInfoBar * WXUNUSED(infobar),
+ gint btnid,
+ wxInfoBar *win)
+{
+ win->GTKResponse(btnid);
+}
+
+static void wxgtk_infobar_close(GtkInfoBar * WXUNUSED(infobar),
+ wxInfoBar *win)
+{
+ win->GTKResponse(wxID_CANCEL);
+}
+
+} // extern "C" section with GTK+ callbacks
+
+// ============================================================================
+// wxInfoBar implementation
+// ============================================================================
+
+bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid)
+{
+ if ( !UseNative() )
+ return wxInfoBarGeneric::Create(parent, winid);
+
+ // this control is created initially hidden
+ Hide();
+ if ( !CreateBase(parent, winid) )
+ return false;
+
+ // create the info bar widget itself
+ m_widget = gtk_info_bar_new();
+ wxCHECK_MSG( m_widget, false, "failed to create GtkInfoBar" );
+ g_object_ref(m_widget);
+
+ // also create a label which will be used to show our message
+ m_label = gtk_label_new("");
+ gtk_widget_show(m_label);
+
+ GtkWidget * const
+ contentArea = gtk_info_bar_get_content_area(GTK_INFO_BAR(m_widget));
+ wxCHECK_MSG( contentArea, false, "failed to get GtkInfoBar content area" );
+ gtk_container_add(GTK_CONTAINER(contentArea), m_label);
+
+ // finish creation and connect to all the signals we're interested in
+ m_parent->DoAddChild(this);
+
+ PostCreation(wxDefaultSize);
+
+ GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response));
+ GTKConnectWidget("close", G_CALLBACK(wxgtk_infobar_close));
+
+ return false;
+}
+
+void wxInfoBar::ShowMessage(const wxString& msg, int flags)
+{
+ if ( !UseNative() )
+ {
+ wxInfoBarGeneric::ShowMessage(msg, flags);
+ return;
+ }
+
+ GtkMessageType type;
+ if ( wxGTKImpl::ConvertMessageTypeFromWX(flags, &type) )
+ gtk_info_bar_set_message_type(GTK_INFO_BAR(m_widget), type);
+ gtk_label_set_text(GTK_LABEL(m_label), wxGTK_CONV(msg));
+
+ if ( !IsShown() )
+ Show();
+
+ UpdateParent();
+}
+
+void wxInfoBar::GTKResponse(int WXUNUSED(btnid))
+{
+ Hide();
+
+ UpdateParent();
+}
+
+void wxInfoBar::AddButton(wxWindowID btnid, const wxString& label)
+{
+ if ( !UseNative() )
+ {
+ wxInfoBarGeneric::AddButton(btnid, label);
+ return;
+ }
+
+ gtk_info_bar_add_button
+ (
+ GTK_INFO_BAR(m_widget),
+ label.empty() ? GTKConvertMnemonics(wxGetStockGtkID(btnid)) : label,
+ btnid
+ );
+}
+
+#endif // wxUSE_INFOBAR