]>
Commit | Line | Data |
---|---|---|
a92b5dfe VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/infobar.h | |
3 | // Purpose: generic wxInfoBar class declaration | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2009-07-28 | |
65391c8f | 6 | // RCS-ID: $Id$ |
a92b5dfe VZ |
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 | ||
ed8efd46 | 22 | class WXDLLIMPEXP_ADV wxInfoBarGeneric : public wxInfoBarBase |
a92b5dfe VZ |
23 | { |
24 | public: | |
25 | // the usual ctors and Create() but remember that info bar is created | |
26 | // hidden | |
ed8efd46 | 27 | wxInfoBarGeneric() { Init(); } |
a92b5dfe | 28 | |
ed8efd46 | 29 | wxInfoBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY) |
a92b5dfe VZ |
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 | ||
ed8efd46 VZ |
41 | virtual void ShowMessage(const wxString& msg, |
42 | int flags = wxICON_INFORMATION); | |
a92b5dfe | 43 | |
0b1add25 VZ |
44 | virtual void Dismiss(); |
45 | ||
374ae80f VZ |
46 | virtual void AddButton(wxWindowID btnid, const wxString& label = wxString()); |
47 | ||
e6b2aae1 | 48 | virtual void RemoveButton(wxWindowID btnid); |
a92b5dfe VZ |
49 | |
50 | // methods specific to this version | |
51 | // -------------------------------- | |
52 | ||
53 | // set the effect(s) to use when showing/hiding the bar, may be | |
54 | // wxSHOW_EFFECT_NONE to disable any effects entirely | |
55 | // | |
56 | // by default, slide to bottom/top is used when it's positioned on the top | |
57 | // of the window for showing/hiding it and top/bottom when it's positioned | |
58 | // at the bottom | |
59 | void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect) | |
60 | { | |
61 | m_showEffect = showEffect; | |
62 | m_hideEffect = hideEffect; | |
63 | } | |
64 | ||
65 | // get effect used when showing/hiding the window | |
3996b21a VZ |
66 | wxShowEffect GetShowEffect() const; |
67 | wxShowEffect GetHideEffect() const; | |
a92b5dfe VZ |
68 | |
69 | // set the duration of animation used when showing/hiding the bar, in ms | |
70 | void SetEffectDuration(int duration) { m_effectDuration = duration; } | |
71 | ||
72 | // get the currently used effect animation duration | |
73 | int GetEffectDuration() const { return m_effectDuration; } | |
74 | ||
df8c364b VZ |
75 | |
76 | // overridden base class methods | |
77 | // ----------------------------- | |
78 | ||
79 | // setting the font of this window sets it for the text control inside it | |
80 | // (default font is a larger and bold version of the normal one) | |
81 | virtual bool SetFont(const wxFont& font); | |
82 | ||
ed8efd46 | 83 | protected: |
5cdd3805 VZ |
84 | // info bar shouldn't have any border by default, the colour difference |
85 | // between it and the main window separates it well enough | |
86 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } | |
87 | ||
88 | ||
ed8efd46 VZ |
89 | // update the parent to take our new or changed size into account (notably |
90 | // should be called when we're shown or hidden) | |
91 | void UpdateParent(); | |
92 | ||
a92b5dfe VZ |
93 | private: |
94 | // common part of all ctors | |
95 | void Init(); | |
96 | ||
97 | // handler for the close button | |
98 | void OnButton(wxCommandEvent& event); | |
99 | ||
a92b5dfe VZ |
100 | // show/hide the bar |
101 | void DoShow(); | |
102 | void DoHide(); | |
103 | ||
3996b21a VZ |
104 | // determine the placement of the bar from its position in the containing |
105 | // sizer | |
106 | enum BarPlacement | |
107 | { | |
108 | BarPlacement_Top, | |
109 | BarPlacement_Bottom, | |
110 | BarPlacement_Unknown | |
111 | }; | |
112 | ||
113 | BarPlacement GetBarPlacement() const; | |
114 | ||
a92b5dfe VZ |
115 | |
116 | // different controls making up the bar | |
117 | wxStaticBitmap *m_icon; | |
118 | wxStaticText *m_text; | |
119 | wxBitmapButton *m_button; | |
120 | ||
3996b21a VZ |
121 | // the effects to use when showing/hiding and duration for them: by default |
122 | // the effect is determined by the info bar automatically depending on its | |
123 | // position and the default duration is used | |
a92b5dfe VZ |
124 | wxShowEffect m_showEffect, |
125 | m_hideEffect; | |
126 | int m_effectDuration; | |
127 | ||
cc7033c2 | 128 | DECLARE_EVENT_TABLE() |
ed8efd46 | 129 | wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric); |
a92b5dfe VZ |
130 | }; |
131 | ||
132 | #endif // _WX_GENERIC_INFOBAR_H_ | |
133 |