infobar.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/infobar.h
  3. // Purpose: declaration of wxInfoBarBase defining common API of wxInfoBar
  4. // Author: Vadim Zeitlin
  5. // Created: 2009-07-28
  6. // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_INFOBAR_H_
  10. #define _WX_INFOBAR_H_
  11. #include "wx/defs.h"
  12. #if wxUSE_INFOBAR
  13. #include "wx/control.h"
  14. // ----------------------------------------------------------------------------
  15. // wxInfoBar shows non-critical but important information to the user
  16. // ----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxInfoBarBase : public wxControl
  18. {
  19. public:
  20. // real ctors are provided by the derived classes, just notice that unlike
  21. // most of the other windows, info bar is created hidden and must be
  22. // explicitly shown when it is needed (this is done because it is supposed
  23. // to be shown only intermittently and hiding it after creating it from the
  24. // user code would result in flicker)
  25. wxInfoBarBase() { }
  26. // show the info bar with the given message and optionally an icon
  27. virtual void ShowMessage(const wxString& msg,
  28. int flags = wxICON_INFORMATION) = 0;
  29. // hide the info bar
  30. virtual void Dismiss() = 0;
  31. // add an extra button to the bar, near the message (replacing the default
  32. // close button which is only shown if no extra buttons are used)
  33. virtual void AddButton(wxWindowID btnid,
  34. const wxString& label = wxString()) = 0;
  35. // remove a button previously added by AddButton()
  36. virtual void RemoveButton(wxWindowID btnid) = 0;
  37. private:
  38. wxDECLARE_NO_COPY_CLASS(wxInfoBarBase);
  39. };
  40. // currently only GTK+ has a native implementation
  41. #if defined(__WXGTK218__) && !defined(__WXUNIVERSAL__)
  42. #include "wx/gtk/infobar.h"
  43. #define wxHAS_NATIVE_INFOBAR
  44. #endif // wxGTK2
  45. // if the generic version is the only one we have, use it
  46. #ifndef wxHAS_NATIVE_INFOBAR
  47. #include "wx/generic/infobar.h"
  48. #define wxInfoBar wxInfoBarGeneric
  49. #endif
  50. #endif // wxUSE_INFOBAR
  51. #endif // _WX_INFOBAR_H_