]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/infobar.h
db57ea31b11c605ee425775682cb04b81f357568
[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 wxInfoBarGeneric : public wxInfoBarBase
23 {
24 public:
25 // the usual ctors and Create() but remember that info bar is created
26 // hidden
27 wxInfoBarGeneric() { Init(); }
28
29 wxInfoBarGeneric(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,
42 int flags = wxICON_INFORMATION);
43
44 virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
45
46 virtual void RemoveButton(wxWindowID btnid);
47
48 // methods specific to this version
49 // --------------------------------
50
51 // set the effect(s) to use when showing/hiding the bar, may be
52 // wxSHOW_EFFECT_NONE to disable any effects entirely
53 //
54 // by default, slide to bottom/top is used when it's positioned on the top
55 // of the window for showing/hiding it and top/bottom when it's positioned
56 // at the bottom
57 void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
58 {
59 m_showEffect = showEffect;
60 m_hideEffect = hideEffect;
61 }
62
63 // get effect used when showing/hiding the window
64 wxShowEffect GetShowEffect() const { return m_showEffect; }
65 wxShowEffect GetHideEffect() const { return m_hideEffect; }
66
67 // set the duration of animation used when showing/hiding the bar, in ms
68 void SetEffectDuration(int duration) { m_effectDuration = duration; }
69
70 // get the currently used effect animation duration
71 int GetEffectDuration() const { return m_effectDuration; }
72
73
74 // overridden base class methods
75 // -----------------------------
76
77 // setting the font of this window sets it for the text control inside it
78 // (default font is a larger and bold version of the normal one)
79 virtual bool SetFont(const wxFont& font);
80
81 protected:
82 // update the parent to take our new or changed size into account (notably
83 // should be called when we're shown or hidden)
84 void UpdateParent();
85
86 private:
87 // common part of all ctors
88 void Init();
89
90 // handler for the close button
91 void OnButton(wxCommandEvent& event);
92
93 // change the parent background colour to match that of our sibling
94 void ChangeParentBackground();
95
96 // restore the parent background changed by the above function
97 void RestoreParentBackground();
98
99 // show/hide the bar
100 void DoShow();
101 void DoHide();
102
103
104 // different controls making up the bar
105 wxStaticBitmap *m_icon;
106 wxStaticText *m_text;
107 wxBitmapButton *m_button;
108
109 // the effects to use when showing/hiding and duration for them
110 wxShowEffect m_showEffect,
111 m_hideEffect;
112 int m_effectDuration;
113
114 // the original parent background colour, before we changed it
115 wxColour m_origParentBgCol;
116
117 DECLARE_EVENT_TABLE()
118 wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric);
119 };
120
121 #endif // _WX_GENERIC_INFOBAR_H_
122