]>
Commit | Line | Data |
---|---|---|
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 | ||
9 | /** | |
10 | @class wxStatusBar | |
7c913512 | 11 | |
23324ae1 | 12 | A status bar is a narrow window that can be placed along the bottom of a frame |
4701dc09 FM |
13 | to give small amounts of status information. It can contain one or more fields, |
14 | one or more of which can be variable length according to the size of the window. | |
7c913512 | 15 | |
23324ae1 | 16 | @beginStyleTable |
8c6791e4 | 17 | @style{wxST_SIZEGRIP} |
bb69632a | 18 | Displays a gripper at the right-hand side of the status bar. |
23324ae1 | 19 | @endStyleTable |
7c913512 | 20 | |
4701dc09 FM |
21 | @remarks |
22 | It is possible to create controls and other windows on the status bar. | |
bb69632a | 23 | Position these windows from an OnSize() event handler. |
4701dc09 | 24 | |
23324ae1 FM |
25 | @library{wxcore} |
26 | @category{miscwnd} | |
7c913512 | 27 | |
4701dc09 | 28 | @see wxFrame, @ref page_samples_statbar |
23324ae1 FM |
29 | */ |
30 | class wxStatusBar : public wxWindow | |
31 | { | |
32 | public: | |
4701dc09 FM |
33 | /** |
34 | Default ctor. | |
35 | */ | |
36 | wxStatusBar(); | |
37 | ||
23324ae1 FM |
38 | /** |
39 | Constructor, creating the window. | |
3c4f71cc | 40 | |
7c913512 | 41 | @param parent |
4cc4bfaf | 42 | The window parent, usually a frame. |
7c913512 | 43 | @param id |
4701dc09 FM |
44 | The window identifier. |
45 | It may take a value of -1 to indicate a default value. | |
7c913512 | 46 | @param style |
4cc4bfaf | 47 | The window style. See wxStatusBar. |
7c913512 | 48 | @param name |
4cc4bfaf | 49 | The name of the window. This parameter is used to associate a name with the |
4701dc09 | 50 | item, allowing the application user to set Motif resource values for |
4cc4bfaf | 51 | individual windows. |
3c4f71cc | 52 | |
4cc4bfaf | 53 | @see Create() |
23324ae1 | 54 | */ |
7c913512 FM |
55 | wxStatusBar(wxWindow* parent, wxWindowID id = wxID_ANY, |
56 | long style = wxST_SIZEGRIP, | |
11e3af6e | 57 | const wxString& name = wxStatusBarNameStr); |
23324ae1 FM |
58 | |
59 | /** | |
60 | Destructor. | |
61 | */ | |
adaaa686 | 62 | virtual ~wxStatusBar(); |
23324ae1 FM |
63 | |
64 | /** | |
65 | Creates the window, for two-step construction. | |
23324ae1 FM |
66 | See wxStatusBar() for details. |
67 | */ | |
68 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, | |
69 | long style = wxST_SIZEGRIP, | |
43c48e1e | 70 | const wxString& name = wxStatusBarNameStr); |
23324ae1 FM |
71 | |
72 | /** | |
73 | Returns the size and position of a field's internal bounding rectangle. | |
3c4f71cc | 74 | |
7c913512 | 75 | @param i |
4cc4bfaf | 76 | The field in question. |
7c913512 | 77 | @param rect |
4cc4bfaf | 78 | The rectangle values are placed in this variable. |
3c4f71cc | 79 | |
d29a9a8a | 80 | @return @true if the field index is valid, @false otherwise. |
3c4f71cc | 81 | |
4cc4bfaf | 82 | @see wxRect |
23324ae1 | 83 | */ |
328f5751 | 84 | virtual bool GetFieldRect(int i, wxRect& rect) const; |
23324ae1 FM |
85 | |
86 | /** | |
87 | Returns the number of fields in the status bar. | |
88 | */ | |
328f5751 | 89 | int GetFieldsCount() const; |
23324ae1 FM |
90 | |
91 | /** | |
92 | Returns the string associated with a status bar field. | |
3c4f71cc | 93 | |
7c913512 | 94 | @param i |
4cc4bfaf | 95 | The number of the status field to retrieve, starting from zero. |
3c4f71cc | 96 | |
d29a9a8a | 97 | @return The status field string if the field is valid, otherwise the |
4701dc09 | 98 | empty string. |
3c4f71cc | 99 | |
4cc4bfaf | 100 | @see SetStatusText() |
23324ae1 | 101 | */ |
328f5751 | 102 | virtual wxString GetStatusText(int i = 0) const; |
23324ae1 FM |
103 | |
104 | /** | |
105 | Sets the field text to the top of the stack, and pops the stack of saved | |
106 | strings. | |
3c4f71cc | 107 | |
4cc4bfaf | 108 | @see PushStatusText() |
23324ae1 FM |
109 | */ |
110 | void PopStatusText(int field = 0); | |
111 | ||
112 | /** | |
113 | Saves the current field text in a per field stack, and sets the field text | |
114 | to the string passed as argument. | |
fd3ece57 FM |
115 | |
116 | @see PopStatusText() | |
23324ae1 FM |
117 | */ |
118 | void PushStatusText(const wxString& string, int field = 0); | |
119 | ||
120 | /** | |
121 | Sets the number of fields, and optionally the field widths. | |
3c4f71cc | 122 | |
7c913512 | 123 | @param number |
0cd15959 FM |
124 | The number of fields. If this is greater than the previous number, |
125 | then new fields with empty strings will be added to the status bar. | |
7c913512 | 126 | @param widths |
4cc4bfaf | 127 | An array of n integers interpreted in the same way as |
4701dc09 | 128 | in SetStatusWidths(). |
23324ae1 | 129 | */ |
43c48e1e | 130 | virtual void SetFieldsCount(int number = 1, const int* widths = NULL); |
23324ae1 FM |
131 | |
132 | /** | |
4701dc09 FM |
133 | Sets the minimal possible height for the status bar. |
134 | ||
135 | The real height may be bigger than the height specified here depending | |
136 | on the size of the font used by the status bar. | |
23324ae1 | 137 | */ |
adaaa686 | 138 | virtual void SetMinHeight(int height); |
23324ae1 FM |
139 | |
140 | /** | |
141 | Sets the styles of the fields in the status line which can make fields appear | |
4701dc09 | 142 | flat or raised instead of the standard sunken 3D border. |
3c4f71cc | 143 | |
7c913512 | 144 | @param n |
4cc4bfaf | 145 | The number of fields in the status bar. Must be equal to the |
4701dc09 | 146 | number passed to SetFieldsCount() the last time it was called. |
7c913512 | 147 | @param styles |
4cc4bfaf FM |
148 | Contains an array of n integers with the styles for each field. There |
149 | are three possible styles: | |
4701dc09 FM |
150 | - wxSB_NORMAL (default): The field appears sunken with a standard 3D border. |
151 | - wxSB_FLAT: No border is painted around the field so that it appears flat. | |
152 | - wxSB_RAISED: A raised 3D border is painted around the field. | |
23324ae1 | 153 | */ |
43c48e1e | 154 | virtual void SetStatusStyles(int n, const int* styles); |
23324ae1 FM |
155 | |
156 | /** | |
157 | Sets the text for one field. | |
3c4f71cc | 158 | |
7c913512 | 159 | @param text |
4cc4bfaf | 160 | The text to be set. Use an empty string ("") to clear the field. |
7c913512 | 161 | @param i |
4cc4bfaf | 162 | The field to set, starting from zero. |
3c4f71cc | 163 | |
4cc4bfaf | 164 | @see GetStatusText(), wxFrame::SetStatusText |
23324ae1 FM |
165 | */ |
166 | virtual void SetStatusText(const wxString& text, int i = 0); | |
167 | ||
168 | /** | |
169 | Sets the widths of the fields in the status line. There are two types of | |
54e18afc | 170 | fields: @b fixed widths and @b variable width fields. For the fixed width fields |
23324ae1 FM |
171 | you should specify their (constant) width in pixels. For the variable width |
172 | fields, specify a negative number which indicates how the field should expand: | |
173 | the space left for all variable width fields is divided between them according | |
174 | to the absolute value of this number. A variable width field with width of -2 | |
175 | gets twice as much of it as a field with width -1 and so on. | |
4701dc09 | 176 | |
23324ae1 FM |
177 | For example, to create one fixed width field of width 100 in the right part of |
178 | the status bar and two more fields which get 66% and 33% of the remaining | |
179 | space correspondingly, you should use an array containing -2, -1 and 100. | |
3c4f71cc | 180 | |
7c913512 | 181 | @param n |
4cc4bfaf | 182 | The number of fields in the status bar. Must be equal to the |
4701dc09 | 183 | number passed to SetFieldsCount() the last time it was called. |
f21dd16b | 184 | @param widths_field |
4701dc09 FM |
185 | Contains an array of n integers, each of which is either an |
186 | absolute status field width in pixels if positive or indicates a | |
4cc4bfaf | 187 | variable width field if negative. |
fd3ece57 | 188 | The special value @NULL means that all fields should get the same width. |
3c4f71cc | 189 | |
23324ae1 | 190 | @remarks The widths of the variable fields are calculated from the total |
4cc4bfaf | 191 | width of all fields, minus the sum of widths of the |
4701dc09 | 192 | non-variable fields, divided by the number of variable fields. |
3c4f71cc | 193 | |
4701dc09 | 194 | @see SetFieldsCount(), wxFrame::SetStatusWidths() |
23324ae1 | 195 | */ |
43c48e1e | 196 | virtual void SetStatusWidths(int n, const int* widths_field); |
23324ae1 | 197 | }; |
e54c96f1 | 198 |