]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/infobar.h
Made wxInfoBar::SetFont() change the text message font.
[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
70 // overridden base class methods
71 // -----------------------------
72
73 // setting the font of this window sets it for the text control inside it
74 // (default font is a larger and bold version of the normal one)
75 virtual bool SetFont(const wxFont& font);
76
77 private:
78 // common part of all ctors
79 void Init();
80
81 // handler for the close button
82 void OnButton(wxCommandEvent& event);
83
84 // update the parent after we're shown or hidden
85 void UpdateParent();
86
87 // change the parent background colour to match that of our sibling
88 void ChangeParentBackground();
89
90 // restore the parent background changed by the above function
91 void RestoreParentBackground();
92
93 // show/hide the bar
94 void DoShow();
95 void DoHide();
96
97
98 // different controls making up the bar
99 wxStaticBitmap *m_icon;
100 wxStaticText *m_text;
101 wxBitmapButton *m_button;
102
103 // the effects to use when showing/hiding and duration for them
104 wxShowEffect m_showEffect,
105 m_hideEffect;
106 int m_effectDuration;
107
108 // the original parent background colour, before we changed it
109 wxColour m_origParentBgCol;
110
111 wxDECLARE_NO_COPY_CLASS(wxInfoBar);
112 };
113
114 #endif // _WX_GENERIC_INFOBAR_H_
115