1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/infobar.h
3 // Purpose: generic wxInfoBar class declaration
4 // Author: Vadim Zeitlin
6 // RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GENERIC_INFOBAR_H_
12 #define _WX_GENERIC_INFOBAR_H_
14 class WXDLLIMPEXP_FWD_CORE wxBitmapButton
;
15 class WXDLLIMPEXP_FWD_CORE wxStaticBitmap
;
16 class WXDLLIMPEXP_FWD_CORE wxStaticText
;
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 class WXDLLIMPEXP_ADV wxInfoBarGeneric
: public wxInfoBarBase
25 // the usual ctors and Create() but remember that info bar is created
27 wxInfoBarGeneric() { Init(); }
29 wxInfoBarGeneric(wxWindow
*parent
, wxWindowID winid
= wxID_ANY
)
32 Create(parent
, winid
);
35 bool Create(wxWindow
*parent
, wxWindowID winid
= wxID_ANY
);
38 // implement base class methods
39 // ----------------------------
41 virtual void ShowMessage(const wxString
& msg
,
42 int flags
= wxICON_INFORMATION
);
44 virtual void Dismiss();
46 virtual void AddButton(wxWindowID btnid
, const wxString
& label
= wxString());
48 virtual void RemoveButton(wxWindowID btnid
);
50 // methods specific to this version
51 // --------------------------------
53 // set the effect(s) to use when showing/hiding the bar, may be
54 // wxSHOW_EFFECT_NONE to disable any effects entirely
56 // by default, slide to bottom/top is used when it's positioned on the top
57 // of the window for showing/hiding it and top/bottom when it's positioned
59 void SetShowHideEffects(wxShowEffect showEffect
, wxShowEffect hideEffect
)
61 m_showEffect
= showEffect
;
62 m_hideEffect
= hideEffect
;
65 // get effect used when showing/hiding the window
66 wxShowEffect
GetShowEffect() const { return m_showEffect
; }
67 wxShowEffect
GetHideEffect() const { return m_hideEffect
; }
69 // set the duration of animation used when showing/hiding the bar, in ms
70 void SetEffectDuration(int duration
) { m_effectDuration
= duration
; }
72 // get the currently used effect animation duration
73 int GetEffectDuration() const { return m_effectDuration
; }
76 // overridden base class methods
77 // -----------------------------
79 // setting the font of this window sets it for the text control inside it
80 // (default font is a larger and bold version of the normal one)
81 virtual bool SetFont(const wxFont
& font
);
84 // update the parent to take our new or changed size into account (notably
85 // should be called when we're shown or hidden)
89 // common part of all ctors
92 // handler for the close button
93 void OnButton(wxCommandEvent
& event
);
95 // change the parent background colour to match that of our sibling
96 void ChangeParentBackground();
98 // restore the parent background changed by the above function
99 void RestoreParentBackground();
106 // different controls making up the bar
107 wxStaticBitmap
*m_icon
;
108 wxStaticText
*m_text
;
109 wxBitmapButton
*m_button
;
111 // the effects to use when showing/hiding and duration for them
112 wxShowEffect m_showEffect
,
114 int m_effectDuration
;
116 // the original parent background colour, before we changed it
117 wxColour m_origParentBgCol
;
119 DECLARE_EVENT_TABLE()
120 wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric
);
123 #endif // _WX_GENERIC_INFOBAR_H_