]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/infobar.h
085bc40d50417a5aa839d7482610c5a98529fb02
[wxWidgets.git] / include / wx / generic / infobar.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/infobar.h
3 // Purpose: generic wxInfoBar class declaration
4 // Author: Vadim Zeitlin
5 // Created: 2009-07-28
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 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GENERIC_INFOBAR_H_
12 #define _WX_GENERIC_INFOBAR_H_
13
14 class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
15 class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
16 class WXDLLIMPEXP_FWD_CORE wxStaticText;
17
18 // ----------------------------------------------------------------------------
19 // wxInfoBar
20 // ----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_ADV wxInfoBar : public wxInfoBarBase
23 {
24 public:
25 // the usual ctors and Create() but remember that info bar is created
26 // hidden
27 wxInfoBar() { Init(); }
28
29 wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY)
30 {
31 Init();
32 Create(parent, winid);
33 }
34
35 bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
36
37
38 // implement base class methods
39 // ----------------------------
40
41 virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE);
42
43 virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
44
45
46 // methods specific to this version
47 // --------------------------------
48
49 // set the effect(s) to use when showing/hiding the bar, may be
50 // wxSHOW_EFFECT_NONE to disable any effects entirely
51 //
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
54 // at the bottom
55 void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
56 {
57 m_showEffect = showEffect;
58 m_hideEffect = hideEffect;
59 }
60
61 // get effect used when showing/hiding the window
62 wxShowEffect GetShowEffect() const { return m_showEffect; }
63 wxShowEffect GetHideEffect() const { return m_hideEffect; }
64
65 // set the duration of animation used when showing/hiding the bar, in ms
66 void SetEffectDuration(int duration) { m_effectDuration = duration; }
67
68 // get the currently used effect animation duration
69 int GetEffectDuration() const { return m_effectDuration; }
70
71
72 // overridden base class methods
73 // -----------------------------
74
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);
78
79 private:
80 // common part of all ctors
81 void Init();
82
83 // handler for the close button
84 void OnButton(wxCommandEvent& event);
85
86 // update the parent after we're shown or hidden
87 void UpdateParent();
88
89 // change the parent background colour to match that of our sibling
90 void ChangeParentBackground();
91
92 // restore the parent background changed by the above function
93 void RestoreParentBackground();
94
95 // show/hide the bar
96 void DoShow();
97 void DoHide();
98
99
100 // different controls making up the bar
101 wxStaticBitmap *m_icon;
102 wxStaticText *m_text;
103 wxBitmapButton *m_button;
104
105 // the effects to use when showing/hiding and duration for them
106 wxShowEffect m_showEffect,
107 m_hideEffect;
108 int m_effectDuration;
109
110 // the original parent background colour, before we changed it
111 wxColour m_origParentBgCol;
112
113 wxDECLARE_NO_COPY_CLASS(wxInfoBar);
114 };
115
116 #endif // _WX_GENERIC_INFOBAR_H_
117