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