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