infobar.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/infobar.h
  3. // Purpose: native implementation of wxInfoBar for GTK+ 2.18 and later
  4. // Author: Vadim Zeitlin
  5. // Created: 2009-09-26
  6. // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_GTK_INFOBAR_H_
  10. #define _WX_GTK_INFOBAR_H_
  11. #include "wx/generic/infobar.h"
  12. // ----------------------------------------------------------------------------
  13. // wxInfoBar for GTK+
  14. // ----------------------------------------------------------------------------
  15. // notice that the native GTK+ implementation is only available since
  16. // (relatively recent) 2.18 so we inherit from the generic one to be able to
  17. // fall back to it if GTK+ version is determined to be too old during run-time
  18. class WXDLLIMPEXP_CORE wxInfoBar : public wxInfoBarGeneric
  19. {
  20. public:
  21. wxInfoBar() { Init(); }
  22. wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY)
  23. {
  24. Init();
  25. Create(parent, winid);
  26. }
  27. bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
  28. virtual ~wxInfoBar();
  29. // implement base class methods
  30. // ----------------------------
  31. virtual void ShowMessage(const wxString& msg,
  32. int flags = wxICON_INFORMATION);
  33. virtual void Dismiss();
  34. virtual void AddButton(wxWindowID btnid,
  35. const wxString& label = wxString());
  36. virtual void RemoveButton(wxWindowID btnid);
  37. // implementation only
  38. // -------------------
  39. void GTKResponse(int btnid);
  40. protected:
  41. virtual void DoApplyWidgetStyle(GtkRcStyle *style);
  42. private:
  43. void Init() { m_impl = NULL; }
  44. // add a button with the given id/label and return its widget
  45. GtkWidget *GTKAddButton(wxWindowID btnid,
  46. const wxString& label = wxString());
  47. // only used when the native implementation is really being used
  48. class wxInfoBarGTKImpl *m_impl;
  49. wxDECLARE_NO_COPY_CLASS(wxInfoBar);
  50. };
  51. #endif // _WX_GTK_INFOBAR_H_