X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a92b5dfe8ce92f1686df0bec0ccc61d75ed46100..ca77701441e39245dcbfce903049e76f166979e5:/include/wx/generic/infobar.h diff --git a/include/wx/generic/infobar.h b/include/wx/generic/infobar.h index 9b2109028f..7beb08ad04 100644 --- a/include/wx/generic/infobar.h +++ b/include/wx/generic/infobar.h @@ -3,7 +3,7 @@ // Purpose: generic wxInfoBar class declaration // Author: Vadim Zeitlin // Created: 2009-07-28 -// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $ +// RCS-ID: $Id$ // Copyright: (c) 2009 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -19,14 +19,14 @@ class WXDLLIMPEXP_FWD_CORE wxStaticText; // wxInfoBar // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_ADV wxInfoBar : public wxInfoBarBase +class WXDLLIMPEXP_CORE 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); @@ -38,8 +38,14 @@ public: // 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 Dismiss(); + + virtual void AddButton(wxWindowID btnid, const wxString& label = wxString()); + + virtual void RemoveButton(wxWindowID btnid); // methods specific to this version // -------------------------------- @@ -57,8 +63,8 @@ public: } // get effect used when showing/hiding the window - wxShowEffect GetShowEffect() const { return m_showEffect; } - wxShowEffect GetHideEffect() const { return m_hideEffect; } + wxShowEffect GetShowEffect() const; + wxShowEffect GetHideEffect() const; // set the duration of animation used when showing/hiding the bar, in ms void SetEffectDuration(int duration) { m_effectDuration = duration; } @@ -66,6 +72,24 @@ public: // get the currently used effect animation duration int GetEffectDuration() const { return m_effectDuration; } + + // overridden base class methods + // ----------------------------- + + // setting the font of this window sets it for the text control inside it + // (default font is a larger and bold version of the normal one) + virtual bool SetFont(const wxFont& font); + +protected: + // info bar shouldn't have any border by default, the colour difference + // between it and the main window separates it well enough + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + + // 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(); @@ -73,34 +97,36 @@ private: // 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(); - - // restore the parent background changed by the above function - void RestoreParentBackground(); - // show/hide the bar void DoShow(); void DoHide(); + // determine the placement of the bar from its position in the containing + // sizer + enum BarPlacement + { + BarPlacement_Top, + BarPlacement_Bottom, + BarPlacement_Unknown + }; + + BarPlacement GetBarPlacement() const; + // different controls making up the bar wxStaticBitmap *m_icon; wxStaticText *m_text; wxBitmapButton *m_button; - // the effects to use when showing/hiding and duration for them + // the effects to use when showing/hiding and duration for them: by default + // the effect is determined by the info bar automatically depending on its + // position and the default duration is used wxShowEffect m_showEffect, m_hideEffect; int m_effectDuration; - // the original parent background colour, before we changed it - wxColour m_origParentBgCol; - - wxDECLARE_NO_COPY_CLASS(wxInfoBar); + DECLARE_EVENT_TABLE() + wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric); }; #endif // _WX_GENERIC_INFOBAR_H_