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