]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/statusbr.h
allow reading GIFs with incorrectly specified animation size (closes #9465)
[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);
26
27 /**
28 Returns the pane width; it maybe negative, indicating a variable-width field.
29 */
30 int GetWidth() const;
31
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.
7c913512 55
23324ae1 56 @beginStyleTable
8c6791e4 57 @style{wxST_SIZEGRIP}
bb69632a 58 Displays a gripper at the right-hand side of the status bar.
23324ae1 59 @endStyleTable
7c913512 60
4701dc09
FM
61 @remarks
62 It is possible to create controls and other windows on the status bar.
bb69632a 63 Position these windows from an OnSize() event handler.
4701dc09 64
23324ae1
FM
65 @library{wxcore}
66 @category{miscwnd}
7c913512 67
b31eaa5c 68 @see wxStatusBarPane, wxFrame, @ref page_samples_statbar
23324ae1
FM
69*/
70class wxStatusBar : public wxWindow
71{
72public:
4701dc09
FM
73 /**
74 Default ctor.
75 */
76 wxStatusBar();
77
23324ae1
FM
78 /**
79 Constructor, creating the window.
3c4f71cc 80
7c913512 81 @param parent
4cc4bfaf 82 The window parent, usually a frame.
7c913512 83 @param id
4701dc09
FM
84 The window identifier.
85 It may take a value of -1 to indicate a default value.
7c913512 86 @param style
4cc4bfaf 87 The window style. See wxStatusBar.
7c913512 88 @param name
4cc4bfaf 89 The name of the window. This parameter is used to associate a name with the
4701dc09 90 item, allowing the application user to set Motif resource values for
4cc4bfaf 91 individual windows.
3c4f71cc 92
4cc4bfaf 93 @see Create()
23324ae1 94 */
7c913512
FM
95 wxStatusBar(wxWindow* parent, wxWindowID id = wxID_ANY,
96 long style = wxST_SIZEGRIP,
11e3af6e 97 const wxString& name = wxStatusBarNameStr);
23324ae1
FM
98
99 /**
100 Destructor.
101 */
adaaa686 102 virtual ~wxStatusBar();
23324ae1
FM
103
104 /**
105 Creates the window, for two-step construction.
23324ae1
FM
106 See wxStatusBar() for details.
107 */
108 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
109 long style = wxST_SIZEGRIP,
43c48e1e 110 const wxString& name = wxStatusBarNameStr);
23324ae1
FM
111
112 /**
113 Returns the size and position of a field's internal bounding rectangle.
3c4f71cc 114
7c913512 115 @param i
4cc4bfaf 116 The field in question.
7c913512 117 @param rect
4cc4bfaf 118 The rectangle values are placed in this variable.
3c4f71cc 119
d29a9a8a 120 @return @true if the field index is valid, @false otherwise.
3c4f71cc 121
4cc4bfaf 122 @see wxRect
23324ae1 123 */
328f5751 124 virtual bool GetFieldRect(int i, wxRect& rect) const;
4df02e42
FM
125
126 /**
127 Returns the number of fields in the status bar.
128 */
129 int GetFieldsCount() const;
130
23324ae1 131 /**
b31eaa5c 132 Returns the wxStatusBarPane representing the @a n-th field.
23324ae1 133 */
f18e1cf1 134 const wxStatusBarPane& GetField(int n) const;
b31eaa5c 135
23324ae1
FM
136 /**
137 Returns the string associated with a status bar field.
3c4f71cc 138
7c913512 139 @param i
4cc4bfaf 140 The number of the status field to retrieve, starting from zero.
3c4f71cc 141
d29a9a8a 142 @return The status field string if the field is valid, otherwise the
4701dc09 143 empty string.
3c4f71cc 144
4cc4bfaf 145 @see SetStatusText()
23324ae1 146 */
328f5751 147 virtual wxString GetStatusText(int i = 0) const;
23324ae1 148
b31eaa5c
FM
149 /**
150 Returns the stack of strings pushed (see PushStatusText()) on the
151 @a n-th field.
152
153 See wxStatusBarPane::GetStack() for more info.
154 */
f18e1cf1 155 const wxArrayString& GetStatusStack(int n) const;
b31eaa5c
FM
156
157 /**
158 Returns the width of the @a n-th field.
159
160 See wxStatusBarPane::GetWidth() for more info.
161 */
f18e1cf1 162 int GetStatusWidth(int n) const;
b31eaa5c
FM
163
164 /**
165 Returns the style of the @a n-th field.
166
167 See wxStatusBarPane::GetStyle() for more info.
168 */
f18e1cf1 169 int GetStatusStyle(int n) const;
b31eaa5c 170
23324ae1
FM
171 /**
172 Sets the field text to the top of the stack, and pops the stack of saved
173 strings.
3c4f71cc 174
4cc4bfaf 175 @see PushStatusText()
23324ae1
FM
176 */
177 void PopStatusText(int field = 0);
178
179 /**
180 Saves the current field text in a per field stack, and sets the field text
181 to the string passed as argument.
fd3ece57
FM
182
183 @see PopStatusText()
23324ae1
FM
184 */
185 void PushStatusText(const wxString& string, int field = 0);
186
187 /**
188 Sets the number of fields, and optionally the field widths.
3c4f71cc 189
7c913512 190 @param number
0cd15959
FM
191 The number of fields. If this is greater than the previous number,
192 then new fields with empty strings will be added to the status bar.
7c913512 193 @param widths
4cc4bfaf 194 An array of n integers interpreted in the same way as
4701dc09 195 in SetStatusWidths().
23324ae1 196 */
43c48e1e 197 virtual void SetFieldsCount(int number = 1, const int* widths = NULL);
23324ae1
FM
198
199 /**
4701dc09
FM
200 Sets the minimal possible height for the status bar.
201
202 The real height may be bigger than the height specified here depending
203 on the size of the font used by the status bar.
23324ae1 204 */
adaaa686 205 virtual void SetMinHeight(int height);
23324ae1
FM
206
207 /**
208 Sets the styles of the fields in the status line which can make fields appear
4701dc09 209 flat or raised instead of the standard sunken 3D border.
3c4f71cc 210
7c913512 211 @param n
4cc4bfaf 212 The number of fields in the status bar. Must be equal to the
4701dc09 213 number passed to SetFieldsCount() the last time it was called.
7c913512 214 @param styles
4cc4bfaf
FM
215 Contains an array of n integers with the styles for each field. There
216 are three possible styles:
4701dc09
FM
217 - wxSB_NORMAL (default): The field appears sunken with a standard 3D border.
218 - wxSB_FLAT: No border is painted around the field so that it appears flat.
219 - wxSB_RAISED: A raised 3D border is painted around the field.
23324ae1 220 */
43c48e1e 221 virtual void SetStatusStyles(int n, const int* styles);
23324ae1
FM
222
223 /**
224 Sets the text for one field.
3c4f71cc 225
7c913512 226 @param text
4cc4bfaf 227 The text to be set. Use an empty string ("") to clear the field.
7c913512 228 @param i
4cc4bfaf 229 The field to set, starting from zero.
3c4f71cc 230
4cc4bfaf 231 @see GetStatusText(), wxFrame::SetStatusText
23324ae1
FM
232 */
233 virtual void SetStatusText(const wxString& text, int i = 0);
234
235 /**
236 Sets the widths of the fields in the status line. There are two types of
54e18afc 237 fields: @b fixed widths and @b variable width fields. For the fixed width fields
23324ae1
FM
238 you should specify their (constant) width in pixels. For the variable width
239 fields, specify a negative number which indicates how the field should expand:
240 the space left for all variable width fields is divided between them according
241 to the absolute value of this number. A variable width field with width of -2
242 gets twice as much of it as a field with width -1 and so on.
4701dc09 243
23324ae1
FM
244 For example, to create one fixed width field of width 100 in the right part of
245 the status bar and two more fields which get 66% and 33% of the remaining
246 space correspondingly, you should use an array containing -2, -1 and 100.
3c4f71cc 247
7c913512 248 @param n
4cc4bfaf 249 The number of fields in the status bar. Must be equal to the
4701dc09 250 number passed to SetFieldsCount() the last time it was called.
f21dd16b 251 @param widths_field
4701dc09
FM
252 Contains an array of n integers, each of which is either an
253 absolute status field width in pixels if positive or indicates a
4cc4bfaf 254 variable width field if negative.
fd3ece57 255 The special value @NULL means that all fields should get the same width.
3c4f71cc 256
23324ae1 257 @remarks The widths of the variable fields are calculated from the total
4cc4bfaf 258 width of all fields, minus the sum of widths of the
4701dc09 259 non-variable fields, divided by the number of variable fields.
3c4f71cc 260
4701dc09 261 @see SetFieldsCount(), wxFrame::SetStatusWidths()
23324ae1 262 */
43c48e1e 263 virtual void SetStatusWidths(int n, const int* widths_field);
23324ae1 264};
e54c96f1 265