]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/statusbr.h
don't readd items in SetImageList() after changing the control mode, they are suppose...
[wxWidgets.git] / interface / wx / statusbr.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: statusbr.h
e54c96f1 3// Purpose: interface of wxStatusBar
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
b31eaa5c
FM
9/**
10 @class wxStatusBarPane
11
12 A status bar pane data container used by wxStatusBar.
7235c54d
FM
13
14 @library{wxcore}
50b75fe3 15 @category{data}
7235c54d
FM
16
17 @see wxStatusBar
b31eaa5c
FM
18*/
19class wxStatusBarPane
20{
21public:
22 /**
23 Constructs the pane with the given @a style and @a width.
24 */
25 wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0);
c94bdf2a 26
b31eaa5c
FM
27 /**
28 Returns the pane width; it maybe negative, indicating a variable-width field.
29 */
30 int GetWidth() const;
c94bdf2a 31
b31eaa5c
FM
32 /**
33 Returns the pane style.
34 */
35 int GetStyle() const;
36
37 /**
38 Returns the stack of strings pushed on this pane.
39
40 Note that this stack does include also the string currently displayed in this pane
41 as the version stored in the native status bar control is possibly ellipsized.
42
43 Also note that GetStack().Last() is the top of the stack (i.e. the string shown
44 in the status bar).
45 */
f18e1cf1 46 const wxArrayString& GetStack() const;
b31eaa5c
FM
47};
48
23324ae1
FM
49/**
50 @class wxStatusBar
7c913512 51
23324ae1 52 A status bar is a narrow window that can be placed along the bottom of a frame
4701dc09
FM
53 to give small amounts of status information. It can contain one or more fields,
54 one or more of which can be variable length according to the size of the window.
c94bdf2a
FM
55
56 Note that in wxStatusBar context, the terms @e pane and @e field are synonyms.
7c913512 57
23324ae1 58 @beginStyleTable
8c6791e4 59 @style{wxST_SIZEGRIP}
c94bdf2a
FM
60 Displays a gripper at the right-hand side of the status bar which can be used
61 to resize the parent window.
62 @style{wxST_SHOW_TIPS}
63 Displays tooltips for those panes whose status text has been ellipsized because
64 the status text doesn't fit the pane width.
65 Note that this style has effect only on wxGTK (with GTK+ >= 2.12) currently.
66 @style{wxST_DEFAULT_STYLE}
67 The default style: includes @c wxST_SIZEGRIP|wxST_SHOW_TIPS|wxFULL_REPAINT_ON_RESIZE.
23324ae1 68 @endStyleTable
7c913512 69
4701dc09
FM
70 @remarks
71 It is possible to create controls and other windows on the status bar.
bb69632a 72 Position these windows from an OnSize() event handler.
4701dc09 73
23324ae1
FM
74 @library{wxcore}
75 @category{miscwnd}
7c913512 76
b31eaa5c 77 @see wxStatusBarPane, wxFrame, @ref page_samples_statbar
23324ae1
FM
78*/
79class wxStatusBar : public wxWindow
80{
81public:
4701dc09
FM
82 /**
83 Default ctor.
84 */
85 wxStatusBar();
86
23324ae1
FM
87 /**
88 Constructor, creating the window.
3c4f71cc 89
7c913512 90 @param parent
4cc4bfaf 91 The window parent, usually a frame.
7c913512 92 @param id
4701dc09
FM
93 The window identifier.
94 It may take a value of -1 to indicate a default value.
7c913512 95 @param style
4cc4bfaf 96 The window style. See wxStatusBar.
7c913512 97 @param name
4cc4bfaf 98 The name of the window. This parameter is used to associate a name with the
4701dc09 99 item, allowing the application user to set Motif resource values for
4cc4bfaf 100 individual windows.
3c4f71cc 101
4cc4bfaf 102 @see Create()
23324ae1 103 */
7c913512 104 wxStatusBar(wxWindow* parent, wxWindowID id = wxID_ANY,
c94bdf2a 105 long style = wxST_DEFAULT_STYLE,
11e3af6e 106 const wxString& name = wxStatusBarNameStr);
23324ae1
FM
107
108 /**
109 Destructor.
110 */
adaaa686 111 virtual ~wxStatusBar();
23324ae1
FM
112
113 /**
114 Creates the window, for two-step construction.
23324ae1
FM
115 See wxStatusBar() for details.
116 */
117 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
c94bdf2a 118 long style = wxST_DEFAULT_STYLE,
43c48e1e 119 const wxString& name = wxStatusBarNameStr);
23324ae1
FM
120
121 /**
122 Returns the size and position of a field's internal bounding rectangle.
3c4f71cc 123
7c913512 124 @param i
4cc4bfaf 125 The field in question.
7c913512 126 @param rect
4cc4bfaf 127 The rectangle values are placed in this variable.
3c4f71cc 128
d29a9a8a 129 @return @true if the field index is valid, @false otherwise.
3c4f71cc 130
4cc4bfaf 131 @see wxRect
23324ae1 132 */
328f5751 133 virtual bool GetFieldRect(int i, wxRect& rect) const;
4df02e42
FM
134
135 /**
136 Returns the number of fields in the status bar.
137 */
138 int GetFieldsCount() const;
139
23324ae1 140 /**
b31eaa5c 141 Returns the wxStatusBarPane representing the @a n-th field.
23324ae1 142 */
f18e1cf1 143 const wxStatusBarPane& GetField(int n) const;
b31eaa5c 144
c94bdf2a
FM
145 /**
146 Returns the horizontal and vertical borders used when rendering the field
147 text inside the field area.
148
149 Note that the rect returned by GetFieldRect() already accounts for the
150 presence of horizontal and vertical border returned by this function.
151 */
152 wxSize GetBorders() const;
153
23324ae1
FM
154 /**
155 Returns the string associated with a status bar field.
3c4f71cc 156
7c913512 157 @param i
4cc4bfaf 158 The number of the status field to retrieve, starting from zero.
3c4f71cc 159
d29a9a8a 160 @return The status field string if the field is valid, otherwise the
4701dc09 161 empty string.
3c4f71cc 162
4cc4bfaf 163 @see SetStatusText()
23324ae1 164 */
328f5751 165 virtual wxString GetStatusText(int i = 0) const;
23324ae1 166
b31eaa5c
FM
167 /**
168 Returns the stack of strings pushed (see PushStatusText()) on the
169 @a n-th field.
170
171 See wxStatusBarPane::GetStack() for more info.
172 */
f18e1cf1 173 const wxArrayString& GetStatusStack(int n) const;
b31eaa5c
FM
174
175 /**
176 Returns the width of the @a n-th field.
177
178 See wxStatusBarPane::GetWidth() for more info.
179 */
f18e1cf1 180 int GetStatusWidth(int n) const;
b31eaa5c
FM
181
182 /**
183 Returns the style of the @a n-th field.
184
185 See wxStatusBarPane::GetStyle() for more info.
186 */
f18e1cf1 187 int GetStatusStyle(int n) const;
b31eaa5c 188
23324ae1
FM
189 /**
190 Sets the field text to the top of the stack, and pops the stack of saved
191 strings.
3c4f71cc 192
4cc4bfaf 193 @see PushStatusText()
23324ae1
FM
194 */
195 void PopStatusText(int field = 0);
196
197 /**
198 Saves the current field text in a per field stack, and sets the field text
199 to the string passed as argument.
fd3ece57
FM
200
201 @see PopStatusText()
23324ae1
FM
202 */
203 void PushStatusText(const wxString& string, int field = 0);
204
205 /**
206 Sets the number of fields, and optionally the field widths.
3c4f71cc 207
7c913512 208 @param number
0cd15959
FM
209 The number of fields. If this is greater than the previous number,
210 then new fields with empty strings will be added to the status bar.
7c913512 211 @param widths
4cc4bfaf 212 An array of n integers interpreted in the same way as
4701dc09 213 in SetStatusWidths().
23324ae1 214 */
43c48e1e 215 virtual void SetFieldsCount(int number = 1, const int* widths = NULL);
23324ae1
FM
216
217 /**
4701dc09
FM
218 Sets the minimal possible height for the status bar.
219
220 The real height may be bigger than the height specified here depending
221 on the size of the font used by the status bar.
23324ae1 222 */
adaaa686 223 virtual void SetMinHeight(int height);
23324ae1
FM
224
225 /**
226 Sets the styles of the fields in the status line which can make fields appear
4701dc09 227 flat or raised instead of the standard sunken 3D border.
3c4f71cc 228
7c913512 229 @param n
4cc4bfaf 230 The number of fields in the status bar. Must be equal to the
4701dc09 231 number passed to SetFieldsCount() the last time it was called.
7c913512 232 @param styles
4cc4bfaf
FM
233 Contains an array of n integers with the styles for each field. There
234 are three possible styles:
4701dc09
FM
235 - wxSB_NORMAL (default): The field appears sunken with a standard 3D border.
236 - wxSB_FLAT: No border is painted around the field so that it appears flat.
237 - wxSB_RAISED: A raised 3D border is painted around the field.
23324ae1 238 */
43c48e1e 239 virtual void SetStatusStyles(int n, const int* styles);
23324ae1
FM
240
241 /**
242 Sets the text for one field.
3c4f71cc 243
7c913512 244 @param text
4cc4bfaf 245 The text to be set. Use an empty string ("") to clear the field.
7c913512 246 @param i
4cc4bfaf 247 The field to set, starting from zero.
3c4f71cc 248
4cc4bfaf 249 @see GetStatusText(), wxFrame::SetStatusText
23324ae1
FM
250 */
251 virtual void SetStatusText(const wxString& text, int i = 0);
252
253 /**
254 Sets the widths of the fields in the status line. There are two types of
54e18afc 255 fields: @b fixed widths and @b variable width fields. For the fixed width fields
23324ae1
FM
256 you should specify their (constant) width in pixels. For the variable width
257 fields, specify a negative number which indicates how the field should expand:
258 the space left for all variable width fields is divided between them according
259 to the absolute value of this number. A variable width field with width of -2
260 gets twice as much of it as a field with width -1 and so on.
4701dc09 261
23324ae1
FM
262 For example, to create one fixed width field of width 100 in the right part of
263 the status bar and two more fields which get 66% and 33% of the remaining
264 space correspondingly, you should use an array containing -2, -1 and 100.
3c4f71cc 265
7c913512 266 @param n
4cc4bfaf 267 The number of fields in the status bar. Must be equal to the
4701dc09 268 number passed to SetFieldsCount() the last time it was called.
f21dd16b 269 @param widths_field
4701dc09
FM
270 Contains an array of n integers, each of which is either an
271 absolute status field width in pixels if positive or indicates a
4cc4bfaf 272 variable width field if negative.
fd3ece57 273 The special value @NULL means that all fields should get the same width.
3c4f71cc 274
23324ae1 275 @remarks The widths of the variable fields are calculated from the total
4cc4bfaf 276 width of all fields, minus the sum of widths of the
4701dc09 277 non-variable fields, divided by the number of variable fields.
3c4f71cc 278
4701dc09 279 @see SetFieldsCount(), wxFrame::SetStatusWidths()
23324ae1 280 */
43c48e1e 281 virtual void SetStatusWidths(int n, const int* widths_field);
23324ae1 282};
e54c96f1 283