1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/infobar.h
3 // Purpose: generic wxInfoBar class declaration
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GENERIC_INFOBAR_H_
11 #define _WX_GENERIC_INFOBAR_H_
13 class WXDLLIMPEXP_FWD_CORE wxBitmapButton
;
14 class WXDLLIMPEXP_FWD_CORE wxStaticBitmap
;
15 class WXDLLIMPEXP_FWD_CORE wxStaticText
;
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 class WXDLLIMPEXP_CORE wxInfoBarGeneric
: public wxInfoBarBase
24 // the usual ctors and Create() but remember that info bar is created
26 wxInfoBarGeneric() { Init(); }
28 wxInfoBarGeneric(wxWindow
*parent
, wxWindowID winid
= wxID_ANY
)
31 Create(parent
, winid
);
34 bool Create(wxWindow
*parent
, wxWindowID winid
= wxID_ANY
);
37 // implement base class methods
38 // ----------------------------
40 virtual void ShowMessage(const wxString
& msg
,
41 int flags
= wxICON_INFORMATION
);
43 virtual void Dismiss();
45 virtual void AddButton(wxWindowID btnid
, const wxString
& label
= wxString());
47 virtual void RemoveButton(wxWindowID btnid
);
49 // methods specific to this version
50 // --------------------------------
52 // set the effect(s) to use when showing/hiding the bar, may be
53 // wxSHOW_EFFECT_NONE to disable any effects entirely
55 // by default, slide to bottom/top is used when it's positioned on the top
56 // of the window for showing/hiding it and top/bottom when it's positioned
58 void SetShowHideEffects(wxShowEffect showEffect
, wxShowEffect hideEffect
)
60 m_showEffect
= showEffect
;
61 m_hideEffect
= hideEffect
;
64 // get effect used when showing/hiding the window
65 wxShowEffect
GetShowEffect() const;
66 wxShowEffect
GetHideEffect() const;
68 // set the duration of animation used when showing/hiding the bar, in ms
69 void SetEffectDuration(int duration
) { m_effectDuration
= duration
; }
71 // get the currently used effect animation duration
72 int GetEffectDuration() const { return m_effectDuration
; }
75 // overridden base class methods
76 // -----------------------------
78 // setting the font of this window sets it for the text control inside it
79 // (default font is a larger and bold version of the normal one)
80 virtual bool SetFont(const wxFont
& font
);
83 // info bar shouldn't have any border by default, the colour difference
84 // between it and the main window separates it well enough
85 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
88 // update the parent to take our new or changed size into account (notably
89 // should be called when we're shown or hidden)
93 // common part of all ctors
96 // handler for the close button
97 void OnButton(wxCommandEvent
& event
);
103 // determine the placement of the bar from its position in the containing
112 BarPlacement
GetBarPlacement() const;
115 // different controls making up the bar
116 wxStaticBitmap
*m_icon
;
117 wxStaticText
*m_text
;
118 wxBitmapButton
*m_button
;
120 // the effects to use when showing/hiding and duration for them: by default
121 // the effect is determined by the info bar automatically depending on its
122 // position and the default duration is used
123 wxShowEffect m_showEffect
,
125 int m_effectDuration
;
127 DECLARE_EVENT_TABLE()
128 wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric
);
131 #endif // _WX_GENERIC_INFOBAR_H_