]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/infobar.h
9b2109028f4ffedbfdcd9ea191aa7dc4d05b8079
[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
44 // methods specific to this version
45 // --------------------------------
46
47 // set the effect(s) to use when showing/hiding the bar, may be
48 // wxSHOW_EFFECT_NONE to disable any effects entirely
49 //
50 // by default, slide to bottom/top is used when it's positioned on the top
51 // of the window for showing/hiding it and top/bottom when it's positioned
52 // at the bottom
53 void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
54 {
55 m_showEffect = showEffect;
56 m_hideEffect = hideEffect;
57 }
58
59 // get effect used when showing/hiding the window
60 wxShowEffect GetShowEffect() const { return m_showEffect; }
61 wxShowEffect GetHideEffect() const { return m_hideEffect; }
62
63 // set the duration of animation used when showing/hiding the bar, in ms
64 void SetEffectDuration(int duration) { m_effectDuration = duration; }
65
66 // get the currently used effect animation duration
67 int GetEffectDuration() const { return m_effectDuration; }
68
69 private:
70 // common part of all ctors
71 void Init();
72
73 // handler for the close button
74 void OnButton(wxCommandEvent& event);
75
76 // update the parent after we're shown or hidden
77 void UpdateParent();
78
79 // change the parent background colour to match that of our sibling
80 void ChangeParentBackground();
81
82 // restore the parent background changed by the above function
83 void RestoreParentBackground();
84
85 // show/hide the bar
86 void DoShow();
87 void DoHide();
88
89
90 // different controls making up the bar
91 wxStaticBitmap *m_icon;
92 wxStaticText *m_text;
93 wxBitmapButton *m_button;
94
95 // the effects to use when showing/hiding and duration for them
96 wxShowEffect m_showEffect,
97 m_hideEffect;
98 int m_effectDuration;
99
100 // the original parent background colour, before we changed it
101 wxColour m_origParentBgCol;
102
103 wxDECLARE_NO_COPY_CLASS(wxInfoBar);
104 };
105
106 #endif // _WX_GENERIC_INFOBAR_H_
107