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 wxInfoBar
: public wxInfoBarBase
25 // the usual ctors and Create() but remember that info bar is created
27 wxInfoBar() { Init(); }
29 wxInfoBar(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
, int flags
= wxICON_NONE
);
43 virtual void AddButton(wxWindowID btnid
, const wxString
& label
= wxString());
46 // methods specific to this version
47 // --------------------------------
49 // set the effect(s) to use when showing/hiding the bar, may be
50 // wxSHOW_EFFECT_NONE to disable any effects entirely
52 // by default, slide to bottom/top is used when it's positioned on the top
53 // of the window for showing/hiding it and top/bottom when it's positioned
55 void SetShowHideEffects(wxShowEffect showEffect
, wxShowEffect hideEffect
)
57 m_showEffect
= showEffect
;
58 m_hideEffect
= hideEffect
;
61 // get effect used when showing/hiding the window
62 wxShowEffect
GetShowEffect() const { return m_showEffect
; }
63 wxShowEffect
GetHideEffect() const { return m_hideEffect
; }
65 // set the duration of animation used when showing/hiding the bar, in ms
66 void SetEffectDuration(int duration
) { m_effectDuration
= duration
; }
68 // get the currently used effect animation duration
69 int GetEffectDuration() const { return m_effectDuration
; }
72 // overridden base class methods
73 // -----------------------------
75 // setting the font of this window sets it for the text control inside it
76 // (default font is a larger and bold version of the normal one)
77 virtual bool SetFont(const wxFont
& font
);
80 // common part of all ctors
83 // handler for the close button
84 void OnButton(wxCommandEvent
& event
);
86 // update the parent after we're shown or hidden
89 // change the parent background colour to match that of our sibling
90 void ChangeParentBackground();
92 // restore the parent background changed by the above function
93 void RestoreParentBackground();
100 // different controls making up the bar
101 wxStaticBitmap
*m_icon
;
102 wxStaticText
*m_text
;
103 wxBitmapButton
*m_button
;
105 // the effects to use when showing/hiding and duration for them
106 wxShowEffect m_showEffect
,
108 int m_effectDuration
;
110 // the original parent background colour, before we changed it
111 wxColour m_origParentBgCol
;
113 wxDECLARE_NO_COPY_CLASS(wxInfoBar
);
116 #endif // _WX_GENERIC_INFOBAR_H_