]>
Commit | Line | Data |
---|---|---|
ed791986 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/statusbr.h | |
3 | // Purpose: wxStatusBar class interface | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 05.02.00 | |
7 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) wxWidgets team |
65571936 | 9 | // Licence: wxWindows licence |
ed791986 VZ |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_STATUSBR_H_BASE_ |
13 | #define _WX_STATUSBR_H_BASE_ | |
c801d85f | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
71e03035 VZ |
16 | #pragma interface "statbar.h" |
17 | #endif | |
18 | ||
ed791986 VZ |
19 | #include "wx/window.h" |
20 | ||
1e6feb95 VZ |
21 | #if wxUSE_STATUSBAR |
22 | ||
1f361cdd | 23 | #include "wx/list.h" |
ed39ff57 | 24 | #include "wx/dynarray.h" |
1f361cdd MB |
25 | |
26 | WX_DECLARE_LIST(wxString, wxListString); | |
27 | ||
c2919ab3 VZ |
28 | // ---------------------------------------------------------------------------- |
29 | // wxStatusBar constants | |
30 | // ---------------------------------------------------------------------------- | |
31 | ||
32 | // style flags for fields | |
33 | #define wxSB_NORMAL 0x0000 | |
34 | #define wxSB_FLAT 0x0001 | |
35 | #define wxSB_RAISED 0x0002 | |
36 | ||
ed791986 VZ |
37 | // ---------------------------------------------------------------------------- |
38 | // wxStatusBar: a window near the bottom of the frame used for status info | |
39 | // ---------------------------------------------------------------------------- | |
40 | ||
41 | class WXDLLEXPORT wxStatusBarBase : public wxWindow | |
42 | { | |
43 | public: | |
71e03035 VZ |
44 | wxStatusBarBase(); |
45 | ||
46 | virtual ~wxStatusBarBase(); | |
47 | ||
48 | // field count | |
49 | // ----------- | |
ed791986 | 50 | |
71e03035 VZ |
51 | // set the number of fields and call SetStatusWidths(widths) if widths are |
52 | // given | |
53 | virtual void SetFieldsCount(int number = 1, const int *widths = NULL); | |
ed791986 VZ |
54 | int GetFieldsCount() const { return m_nFields; } |
55 | ||
71e03035 VZ |
56 | // field text |
57 | // ---------- | |
58 | ||
ed791986 VZ |
59 | virtual void SetStatusText(const wxString& text, int number = 0) = 0; |
60 | virtual wxString GetStatusText(int number = 0) const = 0; | |
61 | ||
1f361cdd MB |
62 | void PushStatusText(const wxString& text, int number = 0); |
63 | void PopStatusText(int number = 0); | |
64 | ||
71e03035 VZ |
65 | // fields widths |
66 | // ------------- | |
67 | ||
68 | // set status field widths as absolute numbers: positive widths mean that | |
69 | // the field has the specified absolute width, negative widths are | |
70 | // interpreted as the sizer options, i.e. the extra space (total space | |
71 | // minus the sum of fixed width fields) is divided between the fields with | |
72 | // negative width according to the abs value of the width (field with width | |
73 | // -2 grows twice as much as one with width -1 &c) | |
74 | virtual void SetStatusWidths(int n, const int widths[]); | |
75 | ||
c2919ab3 VZ |
76 | // field styles |
77 | // ------------ | |
78 | ||
d775fa82 WS |
79 | // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D |
80 | // border around a field, wxSB_FLAT for no border around a field, so that it | |
c2919ab3 VZ |
81 | // appears flat or wxSB_POPOUT to make the field appear raised. |
82 | // Setting field styles only works on wxMSW | |
83 | virtual void SetStatusStyles(int n, const int styles[]); | |
84 | ||
71e03035 VZ |
85 | // geometry |
86 | // -------- | |
ed791986 VZ |
87 | |
88 | // Get the position and size of the field's internal bounding rectangle | |
89 | virtual bool GetFieldRect(int i, wxRect& rect) const = 0; | |
90 | ||
91 | // sets the minimal vertical size of the status bar | |
92 | virtual void SetMinHeight(int height) = 0; | |
93 | ||
94 | // get the dimensions of the horizontal and vertical borders | |
95 | virtual int GetBorderX() const = 0; | |
96 | virtual int GetBorderY() const = 0; | |
97 | ||
1e6feb95 | 98 | // don't want status bars to accept the focus at all |
d775fa82 | 99 | virtual bool AcceptsFocus() const { return false; } |
1e6feb95 | 100 | |
ed791986 | 101 | protected: |
71e03035 VZ |
102 | // set the widths array to NULL |
103 | void InitWidths(); | |
104 | ||
105 | // free the status widths arrays | |
106 | void FreeWidths(); | |
107 | ||
108 | // reset the widths | |
109 | void ReinitWidths() { FreeWidths(); InitWidths(); } | |
110 | ||
c2919ab3 VZ |
111 | // same, for field styles |
112 | void InitStyles(); | |
113 | void FreeStyles(); | |
114 | void ReinitStyles() { FreeStyles(); InitStyles(); } | |
115 | ||
1f361cdd MB |
116 | // same, for text stacks |
117 | void InitStacks(); | |
118 | void FreeStacks(); | |
119 | void ReinitStacks() { FreeStacks(); InitStacks(); } | |
120 | ||
71e03035 VZ |
121 | // calculate the real field widths for the given total available size |
122 | wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; | |
123 | ||
1f361cdd MB |
124 | // use these functions to access the stacks of field strings |
125 | wxListString *GetStatusStack(int i) const; | |
126 | wxListString *GetOrCreateStatusStack(int i); | |
127 | ||
71e03035 VZ |
128 | // the current number of fields |
129 | int m_nFields; | |
130 | ||
131 | // the widths of the fields in pixels if !NULL, all fields have the same | |
132 | // width otherwise | |
133 | int *m_statusWidths; | |
1f361cdd | 134 | |
d775fa82 | 135 | // the styles of the fields |
c2919ab3 VZ |
136 | int *m_statusStyles; |
137 | ||
1f361cdd MB |
138 | // stacks of previous values for PushStatusText/PopStatusText |
139 | // this is created on demand, use GetStatusStack/GetOrCreateStatusStack | |
140 | wxListString **m_statusTextStacks; | |
22f3361e VZ |
141 | |
142 | DECLARE_NO_COPY_CLASS(wxStatusBarBase) | |
ed791986 VZ |
143 | }; |
144 | ||
71e03035 VZ |
145 | // ---------------------------------------------------------------------------- |
146 | // include the actual wxStatusBar class declaration | |
147 | // ---------------------------------------------------------------------------- | |
148 | ||
149 | #if defined(__WXUNIVERSAL__) | |
150 | #define wxStatusBarUniv wxStatusBar | |
ed791986 | 151 | |
71e03035 | 152 | #include "wx/univ/statusbr.h" |
4055ed82 | 153 | #elif defined(__WXPALMOS__) |
ffecfa5a JS |
154 | #define wxStatusBarPalm wxStatusBar |
155 | ||
771be77f | 156 | #include "wx/palmos/statusbr.h" |
71e03035 VZ |
157 | #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR |
158 | #define wxStatusBar95 wxStatusBar | |
71e03035 VZ |
159 | |
160 | #include "wx/msw/statbr95.h" | |
656fc51c | 161 | #elif defined(__WXMAC__) |
71e03035 | 162 | #define wxStatusBarMac wxStatusBar |
71e03035 | 163 | |
5fde6fcc | 164 | #include "wx/generic/statusbr.h" |
a02bb143 | 165 | #include "wx/mac/statusbr.h" |
ed791986 | 166 | #else |
71e03035 | 167 | #define wxStatusBarGeneric wxStatusBar |
ed791986 | 168 | |
71e03035 | 169 | #include "wx/generic/statusbr.h" |
ed791986 VZ |
170 | #endif |
171 | ||
71e03035 | 172 | #endif // wxUSE_STATUSBAR |
1e6feb95 | 173 | |
c801d85f | 174 | #endif |
34138703 | 175 | // _WX_STATUSBR_H_BASE_ |