]>
Commit | Line | Data |
---|---|---|
e3a43801 JS |
1 | \chapter{Alphabetical class reference}\label{classref} |
2 | \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% | |
3 | \setfooter{\thepage}{}{}{}{}{\thepage}% | |
4 | ||
5 | \overview{Property classes overview}{propertyoverview} | |
6 | ||
e3a43801 JS |
7 | \section{\class{wxBoolFormValidator}: wxPropertyFormValidator}\label{wxboolformvalidator} |
8 | ||
9 | \overview{Validator classes}{validatorclasses} | |
10 | ||
11 | This class validates a boolean value for a form view. The associated panel item must be a wxCheckBox. | |
12 | ||
13 | \membersection{wxBoolFormValidator::wxBoolFormValidator} | |
14 | ||
15 | \func{void}{wxBoolFormValidator}{\param{long }{flags=0}} | |
16 | ||
17 | Constructor. | |
18 | ||
19 | \section{\class{wxBoolListValidator}: wxPropertyListValidator}\label{wxboollistvalidator} | |
20 | ||
21 | \overview{Validator classes}{validatorclasses} | |
22 | ||
23 | This class validates a boolean value for a list view. | |
24 | ||
25 | \membersection{wxBoolListValidator::wxBoolListValidator} | |
26 | ||
27 | \func{void}{wxBoolListValidator}{\param{long }{flags=0}} | |
28 | ||
29 | Constructor. | |
30 | ||
31 | \section{\class{wxIntegerFormValidator}: wxPropertyFormValidator}\label{wxintegerformvalidator} | |
32 | ||
33 | \overview{Validator classes}{validatorclasses} | |
34 | ||
35 | This class validates a range of integer values for a form view. The associated panel item must be a wxText | |
36 | or wxSlider. | |
37 | ||
38 | \membersection{wxIntegerFormValidator::wxIntegerFormValidator} | |
39 | ||
40 | \func{void}{wxIntegerFormValidator}{\param{long }{min=0}, \param{long }{max=0}, | |
41 | \param{long}{ flags=0}} | |
42 | ||
43 | Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. | |
44 | ||
45 | ||
46 | \section{\class{wxIntegerListValidator}: wxPropertyListValidator}\label{wxintegerlistvalidator} | |
47 | ||
48 | \overview{Validator classes}{validatorclasses} | |
49 | ||
50 | This class validates a range of integer values for a list view. | |
51 | ||
52 | \membersection{wxIntegerListValidator::wxIntegerListValidator} | |
53 | ||
54 | \func{void}{wxIntegerListValidator}{\param{long }{min=0}, \param{long }{max=0}, | |
55 | \param{long}{ flags=wxPROP\_ALLOW\_TEXT\_EDITING}} | |
56 | ||
57 | Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. | |
58 | ||
59 | \section{\class{wxFilenameListValidator}: wxPropertyListValidator}\label{wxfilenamelistvalidator} | |
60 | ||
61 | \overview{Validator classes}{validatorclasses} | |
62 | ||
63 | This class validates a filename for a list view, allowing the user to edit it textually and also popping up | |
64 | a file selector in ``detailed editing" mode. | |
65 | ||
66 | \membersection{wxFilenameListValidator::wxFilenameListValidator} | |
67 | ||
68 | \func{void}{wxFilenameListValidator}{\param{wxString }{message = ``Select a file"}, \param{wxString }{wildcard = ``*.*"}, | |
69 | \param{long}{ flags=0}} | |
70 | ||
71 | Constructor. Supply an optional message and wildcard. | |
72 | ||
73 | \section{\class{wxListOfStringsListValidator}: wxPropertyListValidator}\label{wxlistofstringslistvalidator} | |
74 | ||
75 | \overview{Validator classes}{validatorclasses} | |
76 | ||
77 | This class validates a list of strings for a list view. When editing the property, | |
78 | a dialog box is presented for adding, deleting or editing entries in the list. | |
79 | At present no constraints may be supplied. | |
80 | ||
81 | You can construct a string list property value by constructing a wxStringList object. | |
82 | ||
83 | For example: | |
84 | ||
85 | \begin{verbatim} | |
86 | myListValidatorRegistry.RegisterValidator((wxString)"stringlist", | |
87 | new wxListOfStringsListValidator); | |
88 | ||
89 | wxStringList *strings = new wxStringList("earth", "fire", "wind", "water", NULL); | |
90 | ||
91 | sheet->AddProperty(new wxProperty("fred", strings, "stringlist")); | |
92 | \end{verbatim} | |
93 | ||
94 | \membersection{wxListOfStringsListValidator::wxListofStringsListValidator} | |
95 | ||
96 | \func{void}{wxListOfStringsListValidator}{\param{long}{ flags=0}} | |
97 | ||
98 | Constructor. | |
99 | ||
100 | \section{\class{wxProperty}: wxObject}\label{wxproperty} | |
101 | ||
102 | The {\bf wxProperty} class represents a property, with a \helpref{wxPropertyValue}{wxpropertyvalue}\rtfsp | |
103 | containing the actual value, a name a role, an optional validator, and | |
104 | an optional associated window. | |
105 | ||
106 | A property might correspond to an actual C++ data member, or it | |
107 | might correspond to a conceptual property, such as the width of a window. | |
108 | There is no explicit data member {\it wxWindow::width}, but it may be convenient | |
109 | to invent such a property for the purposes of editing attributes of the window. | |
110 | The properties in the property sheet can be mapped to ``reality" by | |
111 | whatever means (in this case by calling wxWindow::SetSize when the user has | |
112 | finished editing the property sheet). | |
113 | ||
114 | A validator may be associated with the property in order to ensure that this and | |
115 | only this validator will be used for editing and validating the property. | |
116 | An alternative method is to use the {\it role} parameter to specify what kind | |
117 | of validator would be appropriate; for example, specifying ``filename" for the role | |
118 | would allow the property view to find an appropriate validator at edit time. | |
119 | ||
120 | ||
121 | \membersection{wxProperty::wxProperty} | |
122 | ||
123 | \func{void}{wxProperty}{\void} | |
124 | ||
125 | \func{void}{wxProperty}{\param{wxProperty\& }{prop}} | |
126 | ||
127 | \func{void}{wxProperty}{\param{wxString}{ name}, \param{wxString}{ role}, \param{wxPropertyValidator *}{validator=NULL}} | |
128 | ||
129 | \func{void}{wxProperty}{\param{wxString}{ name}, \param{const wxPropertyValue\&}{ val}, \param{wxString}{ role}, \param{wxPropertyValidator *}{validator=NULL}} | |
130 | ||
131 | Constructors. | |
132 | ||
133 | \membersection{wxProperty::\destruct{wxProperty}} | |
134 | ||
135 | \func{void}{\destruct{wxProperty}}{\void} | |
136 | ||
137 | Destructor. Destroys the wxPropertyValue, and the property validator if there is one. However, if the | |
138 | actual C++ value in the wxPropertyValue is a pointer, the data in that variable is not destroyed. | |
139 | ||
140 | \membersection{wxProperty::GetValue} | |
141 | ||
142 | \func{wxPropertyValue\&}{GetValue}{\void} | |
143 | ||
144 | Returns a reference to the property value. | |
145 | ||
146 | \membersection{wxProperty::GetValidator} | |
147 | ||
148 | \func{wxPropertyValidator *}{GetValidator}{\void} | |
149 | ||
150 | Returns a pointer to the associated property validator (if any). | |
151 | ||
152 | \membersection{wxProperty::GetName} | |
153 | ||
154 | \func{wxString\&}{GetName}{\void} | |
155 | ||
156 | Returns the name of the property. | |
157 | ||
158 | \membersection{wxProperty::GetRole} | |
159 | ||
160 | \func{wxRole\&}{GetRole}{\void} | |
161 | ||
162 | Returns the role of the property, to be used when choosing an appropriate validator. | |
163 | ||
164 | \membersection{wxProperty::GetWindow} | |
165 | ||
166 | \func{wxWindow *}{GetWindow}{\void} | |
167 | ||
168 | Returns the window associated with the property (if any). | |
169 | ||
170 | \membersection{wxProperty::SetValue} | |
171 | ||
172 | \func{void}{SetValue}{\param{wxPropertyValue\&}{ val}} | |
173 | ||
174 | Sets the value of the property. | |
175 | ||
176 | \membersection{wxProperty::SetName} | |
177 | ||
178 | \func{void}{SetName}{\param{wxString\&}{ name}} | |
179 | ||
180 | Sets the name of the property. | |
181 | ||
182 | \membersection{wxProperty::SetRole} | |
183 | ||
184 | \func{void}{SetRole}{\param{wxString\&}{ role}} | |
185 | ||
186 | Sets the role of the property. | |
187 | ||
188 | \membersection{wxProperty::SetValidator} | |
189 | ||
190 | \func{void}{SetValidator}{\param{wxPropertyValidator *}{validator}} | |
191 | ||
192 | Sets the validator: this will be deleted when the property is deleted. | |
193 | ||
194 | \membersection{wxProperty::SetWindow} | |
195 | ||
196 | \func{void}{SetWindow}{\param{wxWindow *}{win}} | |
197 | ||
198 | Sets the window associated with the property. | |
199 | ||
200 | \membersection{wxProperty::operator $=$} | |
201 | ||
202 | \func{void}{operator $=$}{\param{const wxPropertyValue\&}{ val}} | |
203 | ||
204 | Assignment operator. | |
205 | ||
206 | \section{\class{wxPropertyFormValidator}: wxPropertyValidator}\label{wxpropertyformvalidator} | |
207 | ||
208 | The {\bf wxPropertyFormValidator} abstract class is the root of classes that define validation | |
209 | for a wxPropertyFormView. | |
210 | ||
211 | ||
212 | \section{\class{wxPropertyFormDialog}: wxDialogBox}\label{wxpropertyformdialog} | |
213 | ||
214 | The {\bf wxPropertyFormDialog} class is a prepackaged dialog which can | |
215 | be used for viewing a form property sheet. Pass a property form view object, and the dialog | |
216 | will pass OnClose and OnDefaultAction listbox messages to the view class for | |
217 | processing. | |
218 | ||
219 | \membersection{wxPropertyFormDialog::wxPropertyFormDialog} | |
220 | ||
221 | \func{void}{wxPropertyFormDialog}{\param{wxPropertyFormView *}{view}, \param{wxWindow *}{parent}, \param{char *}{title}, | |
222 | \param{Bool}{ modal=FALSE}, \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, | |
223 | \param{long}{ style=wxDEFAULT\_DIALOG\_STYLE}, \param{char *}{name=``dialogBox"}} | |
224 | ||
225 | Constructor. | |
226 | ||
227 | \membersection{wxPropertyFormDialog::\destruct{wxPropertyFormDialog}} | |
228 | ||
229 | \func{void}{\destruct{wxPropertyFormDialog}}{\void} | |
230 | ||
231 | Destructor. | |
232 | ||
233 | ||
234 | \section{\class{wxPropertyFormFrame}: wxFrame}\label{wxpropertyformframe} | |
235 | ||
236 | The {\bf wxPropertyFormFrame} class is a prepackaged frame which can | |
237 | be used for viewing a property form. Pass a property form view object, and the frame | |
238 | will pass OnClose messages to the view class for processing. | |
239 | ||
240 | Call Initialize to create the panel and associate the view; override OnCreatePanel | |
241 | if you wish to use a panel class other than the default wxPropertyFormPanel. | |
242 | ||
243 | \membersection{wxPropertyFormFrame::wxPropertyFormFrame} | |
244 | ||
245 | \func{void}{wxPropertyFormFrame}{\param{wxPropertyFormView *}{view}, \param{wxFrame *}{parent}, \param{char *}{title}, | |
246 | \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, | |
247 | \param{long}{ style=wxSDI $\|$ wxDEFAULT\_FRAME}, \param{char *}{name=``frame"}} | |
248 | ||
249 | Constructor. | |
250 | ||
251 | \membersection{wxPropertyFormFrame::\destruct{wxPropertyFormFrame}} | |
252 | ||
253 | \func{void}{\destruct{wxPropertyFormFrame}}{\void} | |
254 | ||
255 | Destructor. | |
256 | ||
257 | \membersection{wxPropertyFormFrame::GetPropertyPanel} | |
258 | ||
259 | \func{wxPanel *}{GetPropertyPanel}{\void} | |
260 | ||
261 | Returns the panel associated with the frame. | |
262 | ||
263 | \membersection{wxPropertyFormFrame::Initialize} | |
264 | ||
265 | \func{Bool}{Initialize}{\void} | |
266 | ||
267 | Must be called to create the panel and associate the view with the panel and frame. | |
268 | ||
269 | \membersection{wxPropertyFormFrame::OnCreatePanel} | |
270 | ||
271 | \func{wxPanel *}{OnCreatePanel}{\param{wxFrame *}{parent}, \param{wxPropertyFormView *}{view}} | |
272 | ||
273 | Creates a panel. Override this to create a panel type other than wxPropertyFormPanel. | |
274 | ||
275 | ||
276 | \section{\class{wxPropertyFormPanel}: wxPanel}\label{wxpropertyformpanel} | |
277 | ||
278 | The {\bf wxPropertyFormPanel} class is a prepackaged panel which can | |
279 | be used for viewing a property form. Pass a property form view object, and the panel | |
280 | will pass OnDefaultAction listbox messages to the view class for | |
281 | processing. | |
282 | ||
283 | \membersection{wxPropertyFormPanel::wxPropertyFormPanel} | |
284 | ||
285 | \func{void}{wxPropertyFormPanel}{\param{wxPropertyFormView *}{view}, \param{wxWindow *}{parent}, | |
286 | \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, | |
287 | \param{long}{ style=0}, \param{char *}{name=``panel"}} | |
288 | ||
289 | Constructor. | |
290 | ||
291 | \membersection{wxPropertyFormPanel::\destruct{wxPropertyFormPanel}} | |
292 | ||
293 | \func{void}{\destruct{wxPropertyFormPanel}}{\void} | |
294 | ||
295 | Destructor. | |
296 | ||
297 | ||
298 | ||
299 | \section{\class{wxPropertyFormValidator}: wxPropertyValidator}\label{wxpropertyformvalidatir} | |
300 | ||
301 | \overview{wxPropertyFormValidator overview}{wxpropertyformvalidatoroverview} | |
302 | ||
303 | The {\bf wxPropertyFormValidator} class defines a base class for form validators. By overriding virtual functions, | |
304 | the programmer can create custom behaviour for kinds of property. | |
305 | ||
306 | \membersection{wxPropertyFormValidator::wxPropertyFormValidator} | |
307 | ||
308 | \func{void}{wxPropertyFormValidator}{\param{long}{ flags = 0}} | |
309 | ||
310 | Constructor. | |
311 | ||
312 | \membersection{wxPropertyFormValidator::\destruct{wxPropertyFormValidator}} | |
313 | ||
314 | \func{void}{\destruct{wxPropertyFormValidator}}{\void} | |
315 | ||
316 | Destructor. | |
317 | ||
318 | \membersection{wxPropertyFormValidator::OnCommand} | |
319 | ||
320 | \func{Bool}{OnCommand}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, | |
321 | \param{wxWindow *}{parentWindow}, \param{wxCommandEvent\& }{event}} | |
322 | ||
323 | Called when the control corresponding to the property receives a command (if not intercepted | |
324 | by a callback associated with the actual control). | |
325 | ||
326 | \membersection{wxPropertyFormValidator::OnCheckValue} | |
327 | ||
328 | \func{Bool}{OnCheckValue}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, | |
329 | \param{wxWindow *}{parentWindow}} | |
330 | ||
331 | Called when the view checks the property value. The value checked by this validator should be taken from the | |
332 | panel item corresponding to the property. | |
333 | ||
334 | \membersection{wxPropertyFormValidator::OnDisplayValue} | |
335 | ||
336 | \func{Bool}{OnDisplayValue}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, | |
337 | \param{wxWindow *}{parentWindow}} | |
338 | ||
339 | Should display the property value in the appropriate control. | |
340 | ||
341 | \membersection{wxPropertyFormValidator::OnDoubleClick} | |
342 | ||
343 | \func{Bool}{OnDoubleClick}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, | |
344 | \param{wxWindow *}{parentWindow}} | |
345 | ||
346 | Called when the control corresponding to the property is double clicked (listboxes only). | |
347 | ||
348 | \membersection{wxPropertyFormValidator::OnRetrieveValue} | |
349 | ||
350 | \func{Bool}{OnRetrieveValue}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, | |
351 | \param{wxWindow *}{parentWindow}} | |
352 | ||
353 | Should do the transfer from the property editing area to the property itself. | |
354 | ||
355 | ||
356 | \section{\class{wxPropertyFormView}: wxPropertyView}\label{wxpropertyformview} | |
357 | ||
358 | \overview{wxPropertyFormView overview}{wxpropertyformviewoverview} | |
359 | ||
360 | The {\bf wxPropertyFormView} class shows a wxPropertySheet as a view onto a panel or dialog | |
361 | box which has already been created. | |
362 | ||
363 | \membersection{wxPropertyFormView::wxPropertyFormView} | |
364 | ||
365 | \func{void}{wxPropertyFormView}{\param{long}{ flags = 0}} | |
366 | ||
367 | Constructor. | |
368 | ||
369 | \membersection{wxPropertyFormView::\destruct{wxPropertyFormView}} | |
370 | ||
371 | \func{void}{\destruct{wxPropertyFormView}}{\void} | |
372 | ||
373 | Destructor. | |
374 | ||
375 | \membersection{wxPropertyFormView::AssociateNames}\label{wxpropertyformviewassociatenames} | |
376 | ||
377 | \func{void}{AssociateNames}{\void} | |
378 | ||
379 | Associates the properties with the controls on the panel. For each panel item, if the | |
380 | panel item name is the same as a property name, the two objects will be associated. | |
381 | This function should be called manually since the programmer may wish to do the | |
382 | association manually. | |
383 | ||
384 | \membersection{wxPropertyFormView::Check}\label{wxpropertyformviewcheck} | |
385 | ||
386 | \func{Bool}{Check}{\void} | |
387 | ||
388 | Checks all properties by calling the appropriate validators; returns FALSE if a validation failed. | |
389 | ||
390 | \membersection{wxPropertyFormView::GetPanel}\label{wxpropertyformviewgetpanel} | |
391 | ||
392 | \func{wxPanel *}{GetPanel}{\void} | |
393 | ||
394 | Returns the panel associated with the view. | |
395 | ||
396 | \membersection{wxPropertyFormView::GetManagedWindow}\label{wxpropertyformviewgetmanagedwindow} | |
397 | ||
398 | \func{wxWindow *}{GetManagedWindow}{\void} | |
399 | ||
400 | Returns the managed window (a frame or dialog) associated with the view. | |
401 | ||
402 | \membersection{wxPropertyFormView::OnOk}\label{wxpropertyformviewonok} | |
403 | ||
404 | \func{void}{OnOk}{\void} | |
405 | ||
406 | Virtual function that will be called when the OK button on the physical window is pressed. | |
407 | By default, checks and updates the form values, closes and deletes the frame or dialog, then deletes the view. | |
408 | ||
409 | \membersection{wxPropertyFormView::OnCancel}\label{wxpropertyformviewoncancel} | |
410 | ||
411 | \func{void}{OnCancel}{\void} | |
412 | ||
413 | Virtual function that will be called when the Cancel button on the physical window is pressed. | |
414 | By default, closes and deletes the frame or dialog, then deletes the view. | |
415 | ||
416 | \membersection{wxPropertyFormView::OnHelp}\label{wxpropertyformviewonhelp} | |
417 | ||
418 | \func{void}{OnHelp}{\void} | |
419 | ||
420 | Virtual function that will be called when the Help button on the physical window is pressed. | |
421 | This needs to be overridden by the application for anything interesting to happen. | |
422 | ||
423 | \membersection{wxPropertyFormView::OnRevert}\label{wxpropertyformviewonrevert} | |
424 | ||
425 | \func{void}{OnRevert}{\void} | |
426 | ||
427 | Virtual function that will be called when the Revert button on the physical window is pressed. | |
428 | By default transfers the wxProperty values to the panel items (in effect | |
429 | undoing any unsaved changes in the items). | |
430 | ||
431 | \membersection{wxPropertyFormView::OnUpdate}\label{wxpropertyformviewonupdate} | |
432 | ||
433 | \func{void}{OnUpdate}{\void} | |
434 | ||
435 | Virtual function that will be called when the Update button on the physical window is pressed. | |
436 | By defaults transfers the displayed values to the wxProperty objects. | |
437 | ||
438 | \membersection{wxPropertyFormView::SetManagedWindow}\label{wxpropertyformviewsetmanagedwindow} | |
439 | ||
440 | \func{void}{SetManagedWindow}{\param{wxWindow *}{win}} | |
441 | ||
442 | Sets the managed window (a frame or dialog) associated with the view. | |
443 | ||
444 | \membersection{wxPropertyFormView::TransferToDialog}\label{wxpropertyformviewtransfertodialog} | |
445 | ||
446 | \func{Bool}{TransferToDialog}{\void} | |
447 | ||
448 | Transfers property values to the controls in the dialog. | |
449 | ||
450 | \membersection{wxPropertyFormView::TransferToPropertySheet}\label{wxpropertyformviewtransfertopropertysheet} | |
451 | ||
452 | \func{Bool}{TransferToPropertySheet}{\void} | |
453 | ||
454 | Transfers property values from the controls in the dialog to the property sheet. | |
455 | ||
456 | ||
457 | \section{\class{wxPropertyListDialog}: wxDialogBox}\label{wxpropertylistdialog} | |
458 | ||
459 | The {\bf wxPropertyListDialog} class is a prepackaged dialog which can | |
460 | be used for viewing a property list. Pass a property list view object, and the dialog | |
461 | will pass OnClose and OnDefaultAction listbox messages to the view class for | |
462 | processing. | |
463 | ||
464 | \membersection{wxPropertyListDialog::wxPropertyListDialog} | |
465 | ||
466 | \func{void}{wxPropertyListDialog}{\param{wxPropertyListView *}{view}, \param{wxWindow *}{parent}, \param{char *}{title}, | |
467 | \param{Bool}{ modal=FALSE}, \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, | |
468 | \param{long}{ style=wxDEFAULT\_DIALOG\_STYLE}, \param{char *}{name=``dialogBox"}} | |
469 | ||
470 | Constructor. | |
471 | ||
472 | \membersection{wxPropertyListDialog::\destruct{wxPropertyListDialog}} | |
473 | ||
474 | \func{void}{\destruct{wxPropertyListDialog}}{\void} | |
475 | ||
476 | Destructor. | |
477 | ||
478 | ||
479 | \section{\class{wxPropertyListFrame}: wxFrame}\label{wxpropertylistframe} | |
480 | ||
481 | The {\bf wxPropertyListFrame} class is a prepackaged frame which can | |
482 | be used for viewing a property list. Pass a property list view object, and the frame | |
483 | will pass OnClose messages to the view class for processing. | |
484 | ||
485 | Call Initialize to create the panel and associate the view; override OnCreatePanel | |
486 | if you wish to use a panel class other than the default wxPropertyListPanel. | |
487 | ||
488 | \membersection{wxPropertyListFrame::wxPropertyListFrame} | |
489 | ||
490 | \func{void}{wxPropertyListFrame}{\param{wxPropertyListView *}{view}, \param{wxFrame *}{parent}, \param{char *}{title}, | |
491 | \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, | |
492 | \param{long}{ style=wxSDI $\|$ wxDEFAULT\_FRAME}, \param{char *}{name=``frame"}} | |
493 | ||
494 | Constructor. | |
495 | ||
496 | \membersection{wxPropertyListFrame::\destruct{wxPropertyListFrame}} | |
497 | ||
498 | \func{void}{\destruct{wxPropertyListFrame}}{\void} | |
499 | ||
500 | Destructor. | |
501 | ||
502 | \membersection{wxPropertyListFrame::GetPropertyPanel} | |
503 | ||
504 | \func{wxPanel *}{GetPropertyPanel}{\void} | |
505 | ||
506 | Returns the panel associated with the frame. | |
507 | ||
508 | \membersection{wxPropertyListFrame::Initialize} | |
509 | ||
510 | \func{Bool}{Initialize}{\void} | |
511 | ||
512 | Must be called to create the panel and associate the view with the panel and frame. | |
513 | ||
514 | \membersection{wxPropertyListFrame::OnCreatePanel} | |
515 | ||
516 | \func{wxPanel *}{OnCreatePanel}{\param{wxFrame *}{parent}, \param{wxPropertyListView *}{view}} | |
517 | ||
518 | Creates a panel. Override this to create a panel type other than wxPropertyListPanel. | |
519 | ||
520 | ||
521 | \section{\class{wxPropertyListPanel}: wxPanel}\label{wxpropertylistpanel} | |
522 | ||
523 | The {\bf wxPropertyListPanel} class is a prepackaged panel which can | |
524 | be used for viewing a property list. Pass a property list view object, and the panel | |
525 | will pass OnDefaultAction listbox messages to the view class for | |
526 | processing. | |
527 | ||
528 | \membersection{wxPropertyListPanel::wxPropertyListPanel} | |
529 | ||
530 | \func{void}{wxPropertyListPanel}{\param{wxPropertyListView *}{view}, \param{wxWindow *}{parent}, | |
531 | \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, | |
532 | \param{long}{ style=0}, \param{char *}{name=``panel"}} | |
533 | ||
534 | Constructor. | |
535 | ||
536 | \membersection{wxPropertyListPanel::\destruct{wxPropertyListPanel}} | |
537 | ||
538 | \func{void}{\destruct{wxPropertyListPanel}}{\void} | |
539 | ||
540 | Destructor. | |
541 | ||
542 | ||
543 | ||
544 | ||
545 | \section{\class{wxPropertyListValidator}: wxPropertyValidator}\label{wxpropertylistvalidator} | |
546 | ||
547 | \overview{wxPropertyListValidator overview}{wxpropertylistvalidatoroverview} | |
548 | ||
549 | The {\bf wxPropertyListValidator} abstract class is the base class for | |
550 | deriving validators for property lists. | |
551 | ||
552 | \membersection{wxPropertyListValidator::wxPropertyListValidator} | |
553 | ||
554 | \func{void}{wxPropertyListValidator}{\param{long}{ flags = wxPROP\_ALLOW\_TEXT\_EDITING}} | |
555 | ||
556 | Constructor. | |
557 | ||
558 | \membersection{wxPropertyListValidator::\destruct{wxPropertyListValidator}} | |
559 | ||
560 | \func{void}{\destruct{wxPropertyListValidator}}{\void} | |
561 | ||
562 | Destructor. | |
563 | ||
564 | \membersection{wxPropertyListValidator::OnCheckValue} | |
565 | ||
566 | \func{Bool}{OnCheckValue}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
567 | \param{wxWindow *}{parentWindow}} | |
568 | ||
569 | Called when the Tick (Confirm) button is pressed or focus is list. Return FALSE if the value | |
570 | was invalid, which is a signal restores the old value. Return TRUE if the value was valid. | |
571 | ||
572 | \membersection{wxPropertyListValidator::OnClearControls} | |
573 | ||
574 | \func{Bool}{OnClearControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
575 | \param{wxWindow *}{parentWindow}} | |
576 | ||
577 | Allows the clearing (enabling, disabling) of property list controls, when the focus leaves the current property. | |
578 | ||
579 | \membersection{wxPropertyListValidator::OnClearDetailControls} | |
580 | ||
581 | \func{Bool}{OnClearDetailControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
582 | \param{wxWindow *}{parentWindow}} | |
583 | ||
584 | Called when the focus is lost, if the validator is in detailed editing mode. | |
585 | ||
586 | \membersection{wxPropertyListValidator::OnDisplayValue} | |
587 | ||
588 | \func{Bool}{OnDisplayValue}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
589 | \param{wxWindow *}{parentWindow}} | |
590 | ||
591 | Should display the value in the appropriate controls. The default implementation gets the | |
592 | textual value from the property and inserts it into the text edit control. | |
593 | ||
594 | \membersection{wxPropertyListValidator::OnDoubleClick} | |
595 | ||
596 | \func{Bool}{OnDoubleClick}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
597 | \param{wxWindow *}{parentWindow}} | |
598 | ||
599 | Called when the property is double clicked. Extra functionality can be provided, | |
600 | such as cycling through possible values. | |
601 | ||
602 | \membersection{wxPropertyListValidator::OnEdit} | |
603 | ||
604 | \func{Bool}{OnEdit}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
605 | \param{wxWindow *}{parentWindow}} | |
606 | ||
607 | Called when the Edit (detailed editing) button is pressed. The default implementation | |
608 | calls wxPropertyListView::BeginDetailedEditing; a filename validator (for example) overrides | |
609 | this function to show the file selector. | |
610 | ||
611 | \membersection{wxPropertyListValidator::OnPrepareControls} | |
612 | ||
613 | \func{Bool}{OnPrepareControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
614 | \param{wxWindow *}{parentWindow}} | |
615 | ||
616 | Called to allow the validator to setup the display, such enabling or disabling buttons, and | |
617 | setting the values and selection in the standard listbox control (the one optionally used for displaying | |
618 | value options). | |
619 | ||
620 | \membersection{wxPropertyListValidator::OnPrepareDetailControls} | |
621 | ||
622 | \func{Bool}{OnPrepareDetailControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
623 | \param{wxWindow *}{parentWindow}} | |
624 | ||
625 | Called when the property is edited `in detail', i.e. when the Edit button is pressed. | |
626 | ||
627 | \membersection{wxPropertyListValidator::OnRetrieveValue} | |
628 | ||
629 | \func{Bool}{OnRetrieveValue}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
630 | \param{wxWindow *}{parentWindow}} | |
631 | ||
632 | Called when Tick (Confirm) is pressed or focus is lost or view wants to update | |
633 | the property list. Should do the transfer from the property editing area to the property itself | |
634 | ||
635 | \membersection{wxPropertyListValidator::OnSelect} | |
636 | ||
637 | \func{Bool}{OnSelect}{\param{Bool}{ select}, \param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
638 | \param{wxWindow *}{parentWindow}} | |
639 | ||
640 | Called when the property is selected or deselected: typically displays the value | |
641 | in the edit control (having chosen a suitable control to display: (non)editable text or listbox). | |
642 | ||
643 | \membersection{wxPropertyListValidator::OnValueListSelect} | |
644 | ||
645 | \func{Bool}{OnValueListSelect}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, | |
646 | \param{wxWindow *}{parentWindow}} | |
647 | ||
648 | Called when the value listbox is selected. The default behaviour is to copy | |
649 | string to text control, and retrieve the value into the property. | |
650 | ||
651 | ||
652 | ||
653 | \section{\class{wxPropertyListView}: wxPropertyView}\label{wxpropertylistview} | |
654 | ||
655 | \overview{wxPropertyListView overview}{wxpropertylistviewoverview} | |
656 | ||
657 | The {\bf wxPropertyListView} class shows a wxPropertySheet as a Visual Basic-style property list. | |
658 | ||
659 | \membersection{wxPropertyListView::wxPropertyListView} | |
660 | ||
661 | \func{void}{wxPropertyListView}{\param{long}{ flags = wxPROP\_BUTTON\_DEFAULT}} | |
662 | ||
663 | Constructor. | |
664 | ||
665 | The {\it flags} argument can be a bit list of the following: | |
666 | ||
667 | \begin{itemize}\itemsep=0pt | |
668 | \item wxPROP\_BUTTON\_CLOSE | |
669 | \item wxPROP\_BUTTON\_OK | |
670 | \item wxPROP\_BUTTON\_CANCEL | |
671 | \item wxPROP\_BUTTON\_CHECK\_CROSS | |
672 | \item wxPROP\_BUTTON\_HELP | |
673 | \item wxPROP\_DYNAMIC\_VALUE\_FIELD | |
674 | \item wxPROP\_PULLDOWN | |
675 | \end{itemize} | |
676 | ||
677 | \membersection{wxPropertyListView::\destruct{wxPropertyListView}} | |
678 | ||
679 | \func{void}{\destruct{wxPropertyListView}}{\void} | |
680 | ||
681 | Destructor. | |
682 | ||
683 | \membersection{wxPropertyListView::AssociatePanel}\label{wxpropertylistviewassociatepanel} | |
684 | ||
685 | \func{void}{AssociatePanel}{\param{wxPanel *}{panel}} | |
686 | ||
687 | Associates the window on which the controls will be displayed, with the view (sets an internal pointer to the window). | |
688 | ||
689 | \membersection{wxPropertyListView::BeginShowingProperty}\label{wxpropertylistviewbeginshowingproperty} | |
690 | ||
691 | \func{Bool}{BeginShowingProperty}{\param{wxProperty *}{property}} | |
692 | ||
693 | Finds the appropriate validator and loads the property into the controls, by calling | |
694 | wxPropertyValidator::OnPrepareControls and then wxPropertyListView::DisplayProperty. | |
695 | ||
696 | \membersection{wxPropertyListView::DisplayProperty}\label{wxpropertylistviewdisplayproperty} | |
697 | ||
698 | \func{Bool}{DisplayProperty}{\param{wxProperty *}{property}} | |
699 | ||
700 | Calls wxPropertyValidator::OnDisplayValue for the current property's validator. This function | |
701 | gets called by wxPropertyListView::BeginShowingProperty, which is in turn called | |
702 | from ShowProperty, called by OnPropertySelect, called by the listbox callback when selected. | |
703 | ||
704 | \membersection{wxPropertyListView::EndShowingProperty}\label{wxpropertylistviewendshowingproperty} | |
705 | ||
706 | \func{Bool}{EndShowingProperty}{\param{wxProperty *}{property}} | |
707 | ||
708 | Finds the appropriate validator and unloads the property from the controls, by calling | |
709 | wxPropertyListView::RetrieveProperty, wxPropertyValidator::OnClearControls and (if we're in | |
710 | detailed editing mdoe) wxPropertyValidator::OnClearDetailControls. | |
711 | ||
712 | \membersection{wxPropertyListView::GetPanel}\label{wxpropertylistviewgetpanel} | |
713 | ||
714 | \func{wxPanel *}{GetPanel}{\void} | |
715 | ||
716 | Returns the panel associated with the view. | |
717 | ||
718 | \membersection{wxPropertyListView::GetManagedWindow}\label{wxpropertylistviewgetmanagedwindow} | |
719 | ||
720 | \func{wxWindow *}{GetManagedWindow}{\void} | |
721 | ||
722 | Returns the managed window (a frame or dialog) associated with the view. | |
723 | ||
724 | \membersection{wxPropertyListView::GetWindowCancelButton}\label{wxpropertylistviewgetwindowcancelbutton} | |
725 | ||
726 | \func{wxButton *}{GetWindowCancelButton}{\void} | |
727 | ||
728 | Returns the window cancel button, if any. | |
729 | ||
730 | \membersection{wxPropertyListView::GetWindowCloseButton}\label{wxpropertylistviewgetwindowclosebutton} | |
731 | ||
732 | \func{wxButton *}{GetWindowCloseButton}{\void} | |
733 | ||
734 | Returns the window close or OK button, if any. | |
735 | ||
736 | \membersection{wxPropertyListView::GetWindowHelpButton}\label{wxpropertylistviewgetwindowhelpbutton} | |
737 | ||
738 | \func{wxButton *}{GetWindowHelpButton}{\void} | |
739 | ||
740 | Returns the window help button, if any. | |
741 | ||
742 | \membersection{wxPropertyListView::SetManagedWindow}\label{wxpropertylistviewsetmanagedwindow} | |
743 | ||
744 | \func{void}{SetManagedWindow}{\param{wxWindow *}{win}} | |
745 | ||
746 | Sets the managed window (a frame or dialog) associated with the view. | |
747 | ||
748 | \membersection{wxPropertyListView::UpdatePropertyDisplayInList}\label{wxpropertylistviewupdatepropdisplay} | |
749 | ||
750 | \func{Bool}{UpdatePropertyDisplayInList}{\param{wxProperty *}{property}} | |
751 | ||
752 | Updates the display for the given changed property. | |
753 | ||
754 | \membersection{wxPropertyListView::UpdatePropertyList}\label{wxpropertylistviewupdateproplist} | |
755 | ||
756 | \func{Bool}{UpdatePropertyList}{\param{Bool }{clearEditArea = TRUE}} | |
757 | ||
758 | Updates the whole property list display. | |
759 | ||
760 | ||
761 | \section{\class{wxPropertySheet}: wxObject}\label{wxpropertysheet} | |
762 | ||
763 | \overview{wxPropertySheet overview}{wxpropertysheetoverview} | |
764 | ||
765 | The {\bf wxPropertySheet} class is used for storing a number of | |
766 | wxProperty objects (essentially names and values). | |
767 | ||
768 | \membersection{wxPropertySheet::wxPropertySheet} | |
769 | ||
f3a65071 | 770 | \func{void}{wxPropertySheet}{\param{const wxString}{ name = ""}} |
e3a43801 | 771 | |
f3a65071 | 772 | Constructor. Sets property sheet's name to name if present. |
e3a43801 JS |
773 | |
774 | \membersection{wxPropertySheet::\destruct{wxPropertySheet}} | |
775 | ||
776 | \func{void}{\destruct{wxPropertySheet}}{\void} | |
777 | ||
778 | Destructor. Destroys all contained properties. | |
779 | ||
780 | \membersection{wxPropertySheet::AddProperty}\label{wxpropertysheetaddproperty} | |
781 | ||
782 | \func{void}{AddProperty}{\param{wxProperty *}{property}} | |
783 | ||
784 | Adds a property to the sheet. | |
785 | ||
786 | \membersection{wxPropertySheet::Clear}\label{wxpropertysheetclear} | |
787 | ||
788 | \func{void}{Clear}{\void} | |
789 | ||
790 | Clears all the properties from the sheet (deleting them). | |
791 | ||
f3a65071 JS |
792 | \membersection{wxPropertySheet::GetName}\label{wxpropertysheetgetname} |
793 | ||
794 | \func{wxString}{GetName}{\void} | |
795 | ||
796 | Gets the sheet's name. | |
797 | ||
798 | \membersection{wxPropertySheet::GetProperty}\label{wxpropertysheetgetproperty} | |
799 | ||
800 | \func{wxProperty *}{GetProperty}{\param{wxString}{ name}} | |
801 | ||
802 | Gets a property by name. | |
803 | ||
e3a43801 JS |
804 | \membersection{wxPropertySheet::GetProperties}\label{wxpropertysheetgetproperties} |
805 | ||
806 | \func{wxList\&}{GetProperties}{\void} | |
807 | ||
808 | Returns a reference to the internal list of properties. | |
809 | ||
f3a65071 | 810 | \membersection{wxPropertySheet::HasProperty}\label{wxpropertysheethasproperty} |
e3a43801 | 811 | |
f3a65071 | 812 | \func{bool}{HasProperty}{\param{wxString}{ propname}} |
e3a43801 | 813 | |
f3a65071 JS |
814 | Returns true if sheet contains property propname. |
815 | ||
816 | \membersection{wxPropertySheet::RemoveProperty}\label{wxpropertysheetremoveproperty} | |
817 | ||
818 | \func{void}{RemoveProperty}{\param{wxString}{ propname}} | |
819 | ||
820 | Removes property propname from sheet, deleting it. | |
821 | ||
822 | \membersection{wxPropertySheet::SetName}\label{wxpropertysheetsetname} | |
823 | ||
824 | \func{void}{SetName}{\param{wxString}{ sheetname}} | |
825 | ||
826 | Set the sheet's name to sheetname | |
827 | ||
828 | \membersection{wxPropertySheet::SetProperty}\label{wxpropertysheetsetproperty} | |
829 | ||
830 | \func{bool}{SetProperty}{\param{wxString}{ propname}, \param{wxPropertyValue}{ value}} | |
831 | ||
832 | Sets property propname to value. Returns false if property is not a member of sheet. | |
e3a43801 JS |
833 | |
834 | \membersection{wxPropertySheet::SetAllModified} | |
835 | ||
836 | \func{void}{SetAllModified}{\param{Bool}{ flag}} | |
837 | ||
838 | Sets the `modified' flag of each property value. | |
839 | ||
840 | ||
841 | ||
842 | \section{\class{wxPropertyValidator}: wxEvtHandler}\label{wxpropertyvalidator} | |
843 | ||
844 | \overview{wxPropertyValidator overview}{wxpropertyvalidatoroverview} | |
845 | ||
846 | The {\bf wxPropertyValidator} abstract class is the base class for deriving | |
847 | validators for properties. | |
848 | ||
849 | \membersection{wxPropertyValidator::wxPropertyValidator} | |
850 | ||
851 | \func{void}{wxPropertyValidator}{\param{long}{ flags = 0}} | |
852 | ||
853 | Constructor. | |
854 | ||
855 | \membersection{wxPropertyValidator::\destruct{wxPropertyValidator}} | |
856 | ||
857 | \func{void}{\destruct{wxPropertyValidator}}{\void} | |
858 | ||
859 | Destructor. | |
860 | ||
861 | \membersection{wxPropertyValidator::GetFlags} | |
862 | ||
863 | \func{long}{GetFlags}{\void} | |
864 | ||
865 | Returns the flags for the validator. | |
866 | ||
867 | \membersection{wxPropertyValidator::GetValidatorProperty} | |
868 | ||
869 | \func{wxProperty *}{GetValidatorProperty}{\void} | |
870 | ||
871 | Gets the property for the validator. | |
872 | ||
873 | \membersection{wxPropertyValidator::SetValidatorProperty} | |
874 | ||
875 | \func{void}{SetValidatorProperty}{\param{wxProperty *}{property}} | |
876 | ||
877 | Sets the property for the validator. | |
878 | ||
879 | ||
880 | \section{\class{wxPropertyValidatorRegistry}: wxHashTable}\label{wxpropertyvalidatorregistry} | |
881 | ||
882 | The {\bf wxPropertyValidatorRegistry} class is used for storing validators, | |
883 | indexed by the `role name' of the property, by which groups of property | |
884 | can be identified for the purpose of validation and editing. | |
885 | ||
886 | \membersection{wxPropertyValidatorRegistry::wxPropertyValidatorRegistry} | |
887 | ||
888 | \func{void}{wxPropertyValidatorRegistry}{\void} | |
889 | ||
890 | Constructor. | |
891 | ||
892 | \membersection{wxPropertyValidatorRegistry::\destruct{wxPropertyValidatorRegistry}} | |
893 | ||
894 | \func{void}{\destruct{wxPropertyValidatorRegistry}}{\void} | |
895 | ||
896 | Destructor. | |
897 | ||
898 | \membersection{wxPropertyValidatorRegistry::Clear} | |
899 | ||
900 | \func{void}{ClearRegistry}{\void} | |
901 | ||
902 | Clears the registry, deleting the validators. | |
903 | ||
904 | \membersection{wxPropertyValidatorRegistry::GetValidator} | |
905 | ||
906 | \func{wxPropertyValidator *}{GetValidator}{\param{wxString\& }{roleName}} | |
907 | ||
908 | Retrieve a validator by the property role name. | |
909 | ||
910 | \membersection{wxPropertyValidatorRegistry::RegisterValidator}\label{wxpropertyvalidatorregistervalidator} | |
911 | ||
912 | \func{void}{RegisterValidator}{\param{wxString\& }{roleName}, \param{wxPropertyValidator *}{validator}} | |
913 | ||
914 | Register a validator with the registry. {\it roleName} is a name indicating the | |
915 | role of the property, such as ``filename''. Later, when a validator is chosen for | |
916 | editing a property, this role name is matched against the class names of the property, | |
917 | if the property does not already have a validator explicitly associated with it. | |
918 | ||
919 | ||
920 | \section{\class{wxPropertyValue}: wxObject}\label{wxpropertyvalue} | |
921 | ||
922 | The {\bf wxPropertyValue} class represents the value of a property, | |
923 | and is normally associated with a wxProperty object. | |
924 | ||
925 | A wxPropertyValue has one of the following types: | |
926 | ||
927 | \begin{itemize}\itemsep=0pt | |
928 | \item wxPropertyValueNull | |
929 | \item wxPropertyValueInteger | |
930 | \item wxPropertyValueReal | |
931 | \item wxPropertyValueBool | |
932 | \item wxPropertyValueString | |
933 | \item wxPropertyValueList | |
934 | \item wxPropertyValueIntegerPtr | |
935 | \item wxPropertyValueRealPtr | |
936 | \item wxPropertyValueBoolPtr | |
937 | \item wxPropertyValueStringPtr | |
938 | \end{itemize} | |
939 | ||
940 | \membersection{wxPropertyValue::wxPropertyValue} | |
941 | ||
942 | \func{void}{wxPropertyValue}{\void} | |
943 | ||
944 | Default constructor. | |
945 | ||
946 | \func{void}{wxPropertyValue}{\param{const wxPropertyValue\& }{copyFrom}} | |
947 | ||
948 | Copy constructor. | |
949 | ||
950 | \func{void}{wxPropertyValue}{\param{char *}{val}} | |
951 | ||
952 | Construction from a string value. | |
953 | ||
954 | \func{void}{wxPropertyValue}{\param{long}{ val}} | |
955 | ||
956 | Construction from an integer value. You may need to cast to (long) to | |
957 | avoid confusion with other constructors (such as the Bool constructor). | |
958 | ||
959 | \func{void}{wxPropertyValue}{\param{Bool}{ val}} | |
960 | ||
961 | Construction from a boolean value. | |
962 | ||
963 | \func{void}{wxPropertyValue}{\param{float}{ val}} | |
964 | ||
965 | Construction from a floating point value. | |
966 | ||
967 | \func{void}{wxPropertyValue}{\param{double}{ val}} | |
968 | ||
969 | Construction from a floating point value. | |
970 | ||
971 | \func{void}{wxPropertyValue}{\param{wxList *}{ val}} | |
972 | ||
973 | Construction from a list of wxPropertyValue objects. The | |
974 | list, but not each contained wxPropertyValue, will be deleted | |
975 | by the constructor. The wxPropertyValues will be assigned to | |
976 | this wxPropertyValue list. In other words, so do not delete wxList or | |
977 | its data after calling this constructor. | |
978 | ||
979 | \func{void}{wxPropertyValue}{\param{wxStringList *}{ val}} | |
980 | ||
981 | Construction from a list of strings. The list (including the strings | |
982 | contained in it) will be deleted by the constructor, so do not | |
983 | destroy {\it val} explicitly. | |
984 | ||
985 | \func{void}{wxPropertyValue}{\param{char **}{val}} | |
986 | ||
987 | Construction from a string pointer. | |
988 | ||
989 | \func{void}{wxPropertyValue}{\param{long *}{val}} | |
990 | ||
991 | Construction from an integer pointer. | |
992 | ||
993 | \func{void}{wxPropertyValue}{\param{Bool *}{val}} | |
994 | ||
995 | Construction from an boolean pointer. | |
996 | ||
997 | \func{void}{wxPropertyValue}{\param{float *}{val}} | |
998 | ||
999 | Construction from a floating point pointer. | |
1000 | ||
1001 | The last four constructors use pointers to various C++ types, and do not | |
1002 | store the types themselves; this allows the values to stand in for actual | |
1003 | data values defined elsewhere. | |
1004 | ||
1005 | \membersection{wxPropertyValue::\destruct{wxPropertyValue}} | |
1006 | ||
1007 | \func{void}{\destruct{wxPropertyValue}}{\void} | |
1008 | ||
1009 | Destructor. | |
1010 | ||
1011 | \membersection{wxPropertyValue::Append} | |
1012 | ||
1013 | \func{void}{Append}{\param{wxPropertyValue *}{expr}} | |
1014 | ||
1015 | Appends a property value to the list. | |
1016 | ||
1017 | \membersection{wxPropertyValue::BoolValue} | |
1018 | ||
1019 | \func{Bool}{BoolValue}{\void} | |
1020 | ||
1021 | Returns the boolean value. | |
1022 | ||
1023 | \membersection{wxPropertyValue::BoolValuePtr} | |
1024 | ||
1025 | \func{Bool *}{BoolValuePtr}{\void} | |
1026 | ||
1027 | Returns the pointer to the boolean value. | |
1028 | ||
1029 | \membersection{wxPropertyValue::ClearList} | |
1030 | ||
1031 | \func{void}{ClearList}{\void} | |
1032 | ||
1033 | Deletes the contents of the list. | |
1034 | ||
1035 | \membersection{wxPropertyValue::Delete} | |
1036 | ||
1037 | \func{void}{Delete}{\param{wxPropertyValue *}{expr}} | |
1038 | ||
1039 | Deletes {\it expr} from this list. | |
1040 | ||
1041 | \membersection{wxPropertyValue::GetFirst} | |
1042 | ||
1043 | \func{wxPropertyValue *}{GetFirst}{\void} | |
1044 | ||
1045 | Gets the first value in the list. | |
1046 | ||
1047 | \membersection{wxPropertyValue::GetLast} | |
1048 | ||
1049 | \func{wxPropertyValue *}{GetFirst}{\void} | |
1050 | ||
1051 | Gets the last value in the list. | |
1052 | ||
1053 | \membersection{wxPropertyValue::GetModified} | |
1054 | ||
1055 | \func{Bool}{GetModified}{\void} | |
1056 | ||
1057 | Returns TRUE if the value was modified since being created | |
1058 | (or since SetModified was called). | |
1059 | ||
1060 | \membersection{wxPropertyValue::GetNext} | |
1061 | ||
1062 | \func{wxPropertyValue *}{GetNext}{\void} | |
1063 | ||
1064 | Gets the next value in the list (the one after `this'). | |
1065 | ||
1066 | \membersection{wxPropertyValue::GetStringRepresentation} | |
1067 | ||
1068 | \func{wxString}{GetStringRepresentation}{\void} | |
1069 | ||
1070 | Gets a string representation of the value. | |
1071 | ||
1072 | \membersection{wxPropertyValue::IntegerValue} | |
1073 | ||
1074 | \func{long}{IntegerValue}{\void} | |
1075 | ||
1076 | Returns the integer value. | |
1077 | ||
1078 | \membersection{wxPropertyValue::Insert} | |
1079 | ||
1080 | \func{void}{Insert}{\param{wxPropertyValue *}{expr}} | |
1081 | ||
1082 | Inserts a property value at the front of a list. | |
1083 | ||
1084 | \membersection{wxPropertyValue::IntegerValuePtr} | |
1085 | ||
1086 | \func{long *}{IntegerValuePtr}{\void} | |
1087 | ||
1088 | Returns the pointer to the integer value. | |
1089 | ||
1090 | \membersection{wxPropertyValue::Nth} | |
1091 | ||
1092 | \func{wxPropertyValue *}{Nth}{\param{int}{ n}} | |
1093 | ||
1094 | Returns the nth value of a list expression (starting from zero). | |
1095 | ||
1096 | \membersection{wxPropertyValue::Number} | |
1097 | ||
1098 | \func{int}{Number}{\void} | |
1099 | ||
1100 | Returns the number of elements in a list expression. | |
1101 | ||
1102 | \membersection{wxPropertyValue::RealValue} | |
1103 | ||
1104 | \func{float}{RealValue}{\void} | |
1105 | ||
1106 | Returns the floating point value. | |
1107 | ||
1108 | \membersection{wxPropertyValue::RealValuePtr} | |
1109 | ||
1110 | \func{float *}{RealValuePtr}{\void} | |
1111 | ||
1112 | Returns the pointer to the floating point value. | |
1113 | ||
1114 | \membersection{wxPropertyValue::SetModified} | |
1115 | ||
1116 | \func{void}{SetModified}{\param{Bool}{ flag}} | |
1117 | ||
1118 | Sets the `modified' flag. | |
1119 | ||
1120 | \membersection{wxPropertyValue::StringValue} | |
1121 | ||
1122 | \func{char *}{StringValue}{\void} | |
1123 | ||
1124 | Returns the string value. | |
1125 | ||
1126 | \membersection{wxPropertyValue::StringValuePtr} | |
1127 | ||
1128 | \func{char **}{StringValuePtr}{\void} | |
1129 | ||
1130 | Returns the pointer to the string value. | |
1131 | ||
1132 | \membersection{wxPropertyValue::Type} | |
1133 | ||
1134 | \func{wxPropertyValueType}{Type}{\void} | |
1135 | ||
1136 | Returns the value type. | |
1137 | ||
1138 | \membersection{wxPropertyValue::operator $=$} | |
1139 | ||
1140 | \func{void}{operator $=$}{\param{const wxPropertyValue\& }{val}} | |
1141 | ||
1142 | \func{void}{operator $=$}{\param{const char *}{val}} | |
1143 | ||
1144 | \func{void}{operator $=$}{\param{const long }{val}} | |
1145 | ||
1146 | \func{void}{operator $=$}{\param{const Bool }{val}} | |
1147 | ||
1148 | \func{void}{operator $=$}{\param{const float }{val}} | |
1149 | ||
1150 | \func{void}{operator $=$}{\param{const char **}{val}} | |
1151 | ||
1152 | \func{void}{operator $=$}{\param{const long *}{val}} | |
1153 | ||
1154 | \func{void}{operator $=$}{\param{const Bool *}{val}} | |
1155 | ||
1156 | \func{void}{operator $=$}{\param{const float *}{val}} | |
1157 | ||
1158 | Assignment operators. | |
1159 | ||
1160 | ||
1161 | ||
1162 | \section{\class{wxPropertyView}: wxEvtHandler}\label{wxpropertyview} | |
1163 | ||
1164 | \overview{wxPropertyView overview}{wxpropertyviewoverview} | |
1165 | ||
1166 | The {\bf wxPropertyView} abstract class is the base class for views | |
1167 | of property sheets, acting as intermediaries between properties and | |
1168 | actual windows. | |
1169 | ||
1170 | \membersection{wxPropertyView::wxPropertyView} | |
1171 | ||
1172 | \func{void}{wxPropertyView}{\param{long}{ flags = wxPROP\_BUTTON\_DEFAULT}} | |
1173 | ||
1174 | Constructor. | |
1175 | ||
1176 | The {\it flags} argument can be a bit list of the following: | |
1177 | ||
1178 | \begin{itemize}\itemsep=0pt | |
1179 | \item wxPROP\_BUTTON\_CLOSE | |
1180 | \item wxPROP\_BUTTON\_OK | |
1181 | \item wxPROP\_BUTTON\_CANCEL | |
1182 | \item wxPROP\_BUTTON\_CHECK\_CROSS | |
1183 | \item wxPROP\_BUTTON\_HELP | |
1184 | \item wxPROP\_DYNAMIC\_VALUE\_FIELD | |
1185 | \item wxPROP\_PULLDOWN | |
1186 | \end{itemize} | |
1187 | ||
1188 | \membersection{wxPropertyView::\destruct{wxPropertyView}} | |
1189 | ||
1190 | \func{void}{\destruct{wxPropertyView}}{\void} | |
1191 | ||
1192 | Destructor. | |
1193 | ||
1194 | \membersection{wxPropertyView::AddRegistry}\label{wxpropertyviewaddregistry} | |
1195 | ||
1196 | \func{void}{AddRegistry}{\param{wxPropertyValidatorRegistry *}{registry}} | |
1197 | ||
1198 | Adds a registry (list of property validators) the view's list of registries, which is initially empty. | |
1199 | ||
1200 | \membersection{wxPropertyView::FindPropertyValidator}\label{wxpropertyviewfindpropertyvalidator} | |
1201 | ||
1202 | \func{wxPropertyValidator *}{FindPropertyValidator}{\param{wxProperty *}{property}} | |
1203 | ||
1204 | Finds the property validator that is most appropriate to this property. | |
1205 | ||
1206 | \membersection{wxPropertyView::GetPropertySheet}\label{wxpropertyviewgetpropertysheet} | |
1207 | ||
1208 | \func{wxPropertySheet *}{GetPropertySheet}{\void} | |
1209 | ||
1210 | Gets the property sheet for this view. | |
1211 | ||
1212 | \membersection{wxPropertyView::GetRegistryList}\label{wxpropertyviewgetregistrylist} | |
1213 | ||
1214 | \func{wxList\&}{GetRegistryList}{\void} | |
1215 | ||
1216 | Returns a reference to the list of property validator registries. | |
1217 | ||
1218 | \membersection{wxPropertyView::OnOk}\label{wxpropertyviewonok} | |
1219 | ||
1220 | \func{void}{OnOk}{\void} | |
1221 | ||
1222 | Virtual function that will be called when the OK button on the physical window is pressed (if it exists). | |
1223 | ||
1224 | \membersection{wxPropertyView::OnCancel}\label{wxpropertyviewoncancel} | |
1225 | ||
1226 | \func{void}{OnCancel}{\void} | |
1227 | ||
1228 | Virtual function that will be called when the Cancel button on the physical window is pressed (if it exists). | |
1229 | ||
1230 | \membersection{wxPropertyView::OnClose}\label{wxpropertyviewonclose} | |
1231 | ||
1232 | \func{Bool}{OnClose}{\void} | |
1233 | ||
1234 | Virtual function that will be called when the physical window is closed. The default implementation returns FALSE. | |
1235 | ||
1236 | \membersection{wxPropertyView::OnHelp}\label{wxpropertyviewonhelp} | |
1237 | ||
1238 | \func{void}{OnHelp}{\void} | |
1239 | ||
1240 | Virtual function that will be called when the Help button on the physical window is pressed (if it exists). | |
1241 | ||
1242 | \membersection{wxPropertyView::OnPropertyChanged}\label{wxpropertyviewonpropertychanged} | |
1243 | ||
1244 | \func{void}{OnPropertyChanged}{\param{wxProperty *}{property}} | |
1245 | ||
1246 | Virtual function called by a view or validator when a property's value changed. Validators | |
1247 | must be written correctly for this to be called. You can override this function | |
1248 | to respond immediately to property value changes. | |
1249 | ||
1250 | \membersection{wxPropertyView::OnUpdateView}\label{wxpropertyviewonupdateview} | |
1251 | ||
1252 | \func{Bool}{OnUpdateView}{\void} | |
1253 | ||
1254 | Called by the viewed object to update the view. The default implementation just returns | |
1255 | FALSE. | |
1256 | ||
1257 | \membersection{wxPropertyView::SetPropertySheet}\label{wxpropertyviewsetpropertysheet} | |
1258 | ||
1259 | \func{void}{SetPropertySheet}{\param{wxPropertySheet *}{sheet}} | |
1260 | ||
1261 | Sets the property sheet for this view. | |
1262 | ||
1263 | \membersection{wxPropertyView::ShowView}\label{wxpropertyviewshowview} | |
1264 | ||
1265 | \func{void}{ShowView}{\param{wxPropertySheet *}{sheet}, \param{wxPanel *}{panel}} | |
1266 | ||
1267 | Associates this view with the given panel, and shows the view. | |
1268 | ||
1269 | \section{\class{wxRealFormValidator}: wxPropertyFormValidator}\label{wxrealformvalidator} | |
1270 | ||
1271 | \overview{Validator classes}{validatorclasses} | |
1272 | ||
1273 | This class validates a range of real values for form views. The associated panel item must be a wxText. | |
1274 | ||
1275 | \membersection{wxRealFormValidator::wxRealFormValidator} | |
1276 | ||
1277 | \func{void}{wxRealFormValidator}{\param{float }{min=0.0}, \param{float }{max=0.0}, | |
1278 | \param{long}{ flags=0}} | |
1279 | ||
1280 | Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. | |
1281 | ||
1282 | ||
1283 | \section{\class{wxStringFormValidator}: wxPropertyFormValidator}\label{wxstringformvalidator} | |
1284 | ||
1285 | \overview{Validator classes}{validatorclasses} | |
1286 | ||
1287 | This class validates a string value for a form view, with an optional choice of possible values. | |
1288 | The associated panel item must be a wxText, wxListBox or wxChoice. For wxListBox and wxChoice items, | |
1289 | if the item is empty, the validator attempts to initialize the item from the strings in | |
1290 | the validator. Note that this does not happen for XView wxChoice items since XView cannot reinitialize a wxChoice. | |
1291 | ||
1292 | \membersection{wxStringFormValidator::wxStringFormValidator} | |
1293 | ||
1294 | \func{void}{wxStringFormValidator}{\param{wxStringList *}{list=NULL}, \param{long}{ flags=0}} | |
1295 | ||
1296 | Constructor. Supply a list of strings to indicate a choice, or no strings to allow the | |
1297 | user to freely edit the string. The string list will be deleted when the validator is deleted. | |
1298 | ||
1299 | ||
1300 | \section{\class{wxRealListValidator}: wxPropertyListValidator}\label{wxreallistvalidator} | |
1301 | ||
1302 | \overview{Validator classes}{validatorclasses} | |
1303 | ||
1304 | This class validates a range of real values for property lists. | |
1305 | ||
1306 | \membersection{wxRealListValidator::wxreallistvalidator} | |
1307 | ||
1308 | \func{void}{wxRealListValidator}{\param{float }{min=0.0}, \param{float }{max=0.0}, | |
1309 | \param{long}{ flags=wxPROP\_ALLOW\_TEXT\_EDITING}} | |
1310 | ||
1311 | Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. | |
1312 | ||
1313 | ||
1314 | \section{\class{wxStringListValidator}: wxPropertyListValidator}\label{wxstringlistvalidator} | |
1315 | ||
1316 | \overview{Validator classes}{validatorclasses} | |
1317 | ||
1318 | This class validates a string value, with an optional choice of possible values. | |
1319 | ||
1320 | \membersection{wxStringListValidator::wxStringListValidator} | |
1321 | ||
1322 | \func{void}{wxStringListValidator}{\param{wxStringList *}{list=NULL}, \param{long}{ flags=0}} | |
1323 | ||
1324 | Constructor. Supply a list of strings to indicate a choice, or no strings to allow the | |
1325 | user to freely edit the string. The string list will be deleted when the validator is deleted. | |
1326 | ||
1327 | ||
1328 | \chapter{Classes by category}\label{classesbycat} | |
1329 | ||
1330 | A classification of property sheet classes by category. | |
1331 | ||
1332 | \section{Data classes} | |
1333 | ||
1334 | \begin{itemize}\itemsep=0pt | |
1335 | \item \helpref{wxProperty}{wxproperty} | |
1336 | \item \helpref{wxPropertyValue}{wxpropertyvalue} | |
1337 | \item \helpref{wxPropertySheet}{wxpropertysheet} | |
1338 | \end{itemize} | |
1339 | ||
1340 | ||
1341 | \section{Validator classes}\label{validatorclasses} | |
1342 | ||
1343 | Validators check that the values the user has entered for a property are | |
1344 | valid. They can also define specific ways of entering data, such as a | |
1345 | file selector for a filename, and they are responsible for transferring | |
1346 | values between the wxProperty and the physical display. | |
1347 | ||
1348 | Base classes: | |
1349 | ||
1350 | \begin{itemize}\itemsep=0pt | |
1351 | \item \helpref{wxPropertyValidator}{wxproperty} | |
1352 | \item \helpref{wxPropertyListValidator}{wxpropertylistvalidator} | |
1353 | \item \helpref{wxPropertyFormValidator}{wxpropertyformvalidator} | |
1354 | \end{itemize} | |
1355 | ||
1356 | List view validators: | |
1357 | ||
1358 | \begin{itemize}\itemsep=0pt | |
1359 | \item \helpref{wxBoolListValidator}{wxboollistvalidator} | |
1360 | \item \helpref{wxFilenameListValidator}{wxfilenamelistvalidator} | |
1361 | \item \helpref{wxIntegerListValidator}{wxintegerlistvalidator} | |
1362 | \item \helpref{wxListOfStringsListValidator}{wxlistofstringslistvalidator} | |
1363 | \item \helpref{wxRealListValidator}{wxreallistvalidator} | |
1364 | \item \helpref{wxStringListValidator}{wxstringlistvalidator} | |
1365 | \end{itemize} | |
1366 | ||
1367 | Form view validators: | |
1368 | ||
1369 | \begin{itemize}\itemsep=0pt | |
1370 | \item \helpref{wxBoolFormValidator}{wxboolformvalidator} | |
1371 | \item \helpref{wxIntegerFormValidator}{wxintegerformvalidator} | |
1372 | \item \helpref{wxRealFormValidator}{wxrealformvalidator} | |
1373 | \item \helpref{wxStringFormValidator}{wxstringformvalidator} | |
1374 | \end{itemize} | |
1375 | ||
1376 | \section{View classes}\label{viewclasses} | |
1377 | ||
1378 | View classes mediate between a property sheet and a physical window. | |
1379 | ||
1380 | \begin{itemize}\itemsep=0pt | |
1381 | \item \helpref{wxPropertyView}{wxpropertyview} | |
1382 | \item \helpref{wxPropertyListView}{wxpropertylistview} | |
1383 | \item \helpref{wxPropertyFormView}{wxpropertyformview} | |
1384 | \end{itemize} | |
1385 | ||
1386 | \section{Window classes}\label{windowclasses} | |
1387 | ||
1388 | The class library defines some window classes that can be used as-is with a suitable | |
1389 | view class and property sheet. | |
1390 | ||
1391 | \begin{itemize}\itemsep=0pt | |
1392 | \item \helpref{wxPropertyFormFrame}{wxpropertyformframe} | |
1393 | \item \helpref{wxPropertyFormDialog}{wxpropertyformdialog} | |
1394 | \item \helpref{wxPropertyFormPanel}{wxpropertyformpanel} | |
1395 | \item \helpref{wxPropertyListFrame}{wxpropertylistframe} | |
1396 | \item \helpref{wxPropertyListDialog}{wxpropertylistdialog} | |
1397 | \item \helpref{wxPropertyListPanel}{wxpropertylistpanel} | |
1398 | \end{itemize} | |
1399 | ||
1400 | \section{Registry classes} | |
1401 | ||
1402 | A validator registry is a list of validators that can be applied to properties in a property sheet. | |
1403 | There may be one or more registries per property view. | |
1404 | ||
1405 | \begin{itemize}\itemsep=0pt | |
1406 | \item \helpref{wxPropertyValidatorRegistry}{wxpropertyvalidatorregistry} | |
1407 | \end{itemize} | |
1408 | ||
1409 | ||
1410 | \chapter{Topic overviews}\label{overviews} | |
1411 | ||
1412 | This chapter contains a selection of topic overviews. | |
1413 | ||
1414 | \section{Property classes overview}\label{propertyoverview} | |
1415 | ||
1416 | The property classes help a programmer to express relationships between | |
1417 | data and physical windows, in particular: | |
1418 | ||
1419 | \begin{itemize}\itemsep=0pt | |
1420 | \item the transfer of data to and from the physical controls; | |
1421 | \item the behaviour of various controls and custom windows for particular | |
1422 | types of data; | |
1423 | \item the validation of data, notifying the user when incorrect data is entered, | |
1424 | or even better, constraining the input so only valid data can be entered. | |
1425 | \end{itemize} | |
1426 | ||
1427 | With a consistent framework, the programmer should be able to use existing | |
1428 | components and design new ones in a principled manner, to solve many data entry | |
1429 | requirements. | |
1430 | ||
1431 | Each datum is represented in a \helpref{wxProperty}{wxproperty}, which has a name and a value. | |
1432 | Various C++ types are permitted in the value of a property, and the property can store a pointer | |
1433 | to the data instead of a copy of the data. A \helpref{wxPropertySheet}{wxpropertysheet} represents a number of these properties. | |
1434 | ||
1435 | These two classes are independent from the way in which the data is visually manipulated. To | |
1436 | mediate between property sheets and windows, the abstract class \helpref{wxPropertyView}{wxpropertyview} is | |
1437 | available for programmers to derive new kinds of view. One kind of view that is available is the \helpref{wxPropertyListView}{wxpropertylistview}, | |
1438 | which displays the data in a Visual Basic-style list, with a small number of controls for editing | |
1439 | the currently selected property. Another is \helpref{wxPropertyFormView}{wxpropertyformview} which | |
1440 | mediates between an existing dialog or panel and the property sheet. | |
1441 | ||
1442 | The hard work of mediation is actually performed by validators, which are instances of classes | |
1443 | derived from \helpref{wxPropertyValidator}{wxpropertyvalidator}. A validator is associated with | |
1444 | a particular property and is responsible for | |
1445 | responding to user interface events, and displaying, updating and checking the property value. | |
1446 | Because a validator's behaviour depends largely on the kind of view being used, there has to be | |
1447 | a separate hierarchy of validators for each class of view. So for wxPropertyListView, there is | |
1448 | an abstract class \helpref{wxPropertyListValidator}{wxpropertylistvalidator} from which concrete | |
1449 | classes are derived, such as \helpref{wxRealListValidator}{wxreallistvalidator} and | |
1450 | \rtfsp\helpref{wxStringListValidator}{wxstringlistvalidator}. | |
1451 | ||
1452 | A validator can be explicitly set for a property, so there is no doubt which validator | |
1453 | should be used to edit that property. However, it is also possible to define a registry | |
1454 | of validators, and have the validator chosen on the basis of the {\it role} of the property. | |
1455 | So a property with a ``filename" role would match the ``filename" validator, which pops | |
1456 | up a file selector when the user double clicks on the property. | |
1457 | ||
1458 | You don't have to define your own frame or window classes: there are some predefined | |
1459 | that will work with the property list view. See \helpref{Window classes}{windowclasses} for | |
1460 | further details. | |
1461 | ||
1462 | \subsection{Example 1: Property list view} | |
1463 | ||
1464 | The following code fragment shows the essentials of creating a registry of | |
1465 | standard validators, a property sheet containing some properties, and | |
1466 | a property list view and dialog or frame. RegisterValidators will be | |
1467 | called on program start, and PropertySheetTest is called in response to a | |
1468 | menu command. | |
1469 | ||
1470 | Note how some properties are created with an explicit reference to | |
1471 | a validator, and others are provided with a ``role'' which can be matched | |
1472 | against a validator in the registry. | |
1473 | ||
1474 | The interface generated by this test program is shown in the section \helpref{Appearance and | |
1475 | behaviour of a property list view}{appearance}. | |
1476 | ||
1477 | \begin{verbatim} | |
1478 | void RegisterValidators(void) | |
1479 | { | |
1480 | myListValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator); | |
1481 | myListValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator); | |
1482 | myListValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator); | |
1483 | myListValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator); | |
1484 | } | |
1485 | ||
1486 | void PropertyListTest(Bool useDialog) | |
1487 | { | |
1488 | wxPropertySheet *sheet = new wxPropertySheet; | |
1489 | ||
1490 | sheet->AddProperty(new wxProperty("fred", 1.0, "real")); | |
1491 | sheet->AddProperty(new wxProperty("tough choice", (Bool)TRUE, "bool")); | |
1492 | sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50))); | |
1493 | sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); | |
1494 | sheet->AddProperty(new wxProperty("julian", "one", "string")); | |
1495 | sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); | |
1496 | wxStringList *strings = new wxStringList("one", "two", "three", NULL); | |
1497 | sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); | |
1498 | ||
1499 | wxPropertyListView *view = | |
1500 | new wxPropertyListView(NULL, | |
1501 | wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN); | |
1502 | ||
1503 | wxDialogBox *propDialog = NULL; | |
1504 | wxPropertyListFrame *propFrame = NULL; | |
1505 | if (useDialog) | |
1506 | { | |
1507 | propDialog = new wxPropertyListDialog(view, NULL, "Property Sheet Test", TRUE, -1, -1, 400, 500); | |
1508 | } | |
1509 | else | |
1510 | { | |
1511 | propFrame = new wxPropertyListFrame(view, NULL, "Property Sheet Test", -1, -1, 400, 500); | |
1512 | } | |
1513 | ||
1514 | view->AddRegistry(&myListValidatorRegistry); | |
1515 | ||
1516 | if (useDialog) | |
1517 | { | |
1518 | view->ShowView(sheet, propDialog); | |
1519 | propDialog->Centre(wxBOTH); | |
1520 | propDialog->Show(TRUE); | |
1521 | } | |
1522 | else | |
1523 | { | |
1524 | propFrame->Initialize(); | |
1525 | view->ShowView(sheet, propFrame->GetPropertyPanel()); | |
1526 | propFrame->Centre(wxBOTH); | |
1527 | propFrame->Show(TRUE); | |
1528 | } | |
1529 | } | |
1530 | \end{verbatim} | |
1531 | ||
1532 | \subsection{Example 2: Property form view} | |
1533 | ||
1534 | This example is similar to Example 1, but uses a property form view to | |
1535 | edit a property sheet using a predefined dialog box. | |
1536 | ||
1537 | \begin{verbatim} | |
1538 | void RegisterValidators(void) | |
1539 | { | |
1540 | myFormValidatorRegistry.RegisterValidator((wxString)"real", new wxRealFormValidator); | |
1541 | myFormValidatorRegistry.RegisterValidator((wxString)"string", new wxStringFormValidator); | |
1542 | myFormValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerFormValidator); | |
1543 | myFormValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolFormValidator); | |
1544 | } | |
1545 | ||
1546 | void PropertyFormTest(Bool useDialog) | |
1547 | { | |
1548 | wxPropertySheet *sheet = new wxPropertySheet; | |
1549 | ||
1550 | sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0))); | |
1551 | sheet->AddProperty(new wxProperty("tough choice", (Bool)TRUE, "bool")); | |
1552 | sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); | |
1553 | sheet->AddProperty(new wxProperty("julian", "one", "string")); | |
1554 | wxStringList *strings = new wxStringList("one", "two", "three", NULL); | |
1555 | sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); | |
1556 | ||
1557 | wxPropertyFormView *view = new wxPropertyFormView(NULL); | |
1558 | ||
1559 | wxDialogBox *propDialog = NULL; | |
1560 | wxPropertyFormFrame *propFrame = NULL; | |
1561 | if (useDialog) | |
1562 | { | |
1563 | propDialog = new wxPropertyFormDialog(view, NULL, "Property Form Test", TRUE, -1, -1, 400, 300); | |
1564 | } | |
1565 | else | |
1566 | { | |
1567 | propFrame = new wxPropertyFormFrame(view, NULL, "Property Form Test", -1, -1, 400, 300); | |
1568 | propFrame->Initialize(); | |
1569 | } | |
1570 | ||
1571 | wxPanel *panel = propDialog ? propDialog : propFrame->GetPropertyPanel(); | |
1572 | panel->SetLabelPosition(wxVERTICAL); | |
1573 | ||
1574 | // Add items to the panel | |
1575 | ||
1576 | (void) new wxButton(panel, (wxFunction)NULL, "OK", -1, -1, -1, -1, 0, "ok"); | |
1577 | (void) new wxButton(panel, (wxFunction)NULL, "Cancel", -1, -1, 80, -1, 0, "cancel"); | |
1578 | (void) new wxButton(panel, (wxFunction)NULL, "Update", -1, -1, 80, -1, 0, "update"); | |
1579 | (void) new wxButton(panel, (wxFunction)NULL, "Revert", -1, -1, -1, -1, 0, "revert"); | |
1580 | panel->NewLine(); | |
1581 | ||
1582 | // The name of this text item matches the "fred" property | |
1583 | (void) new wxText(panel, (wxFunction)NULL, "Fred", "", -1, -1, 90, -1, 0, "fred"); | |
1584 | (void) new wxCheckBox(panel, (wxFunction)NULL, "Yes or no", -1, -1, -1, -1, 0, "tough choice"); | |
1585 | (void) new wxSlider(panel, (wxFunction)NULL, "Sliding scale", 0, -50, 50, 100, -1, -1, wxHORIZONTAL, "ian"); | |
1586 | panel->NewLine(); | |
1587 | (void) new wxListBox(panel, (wxFunction)NULL, "Constrained", wxSINGLE, -1, -1, 100, 90, 0, NULL, 0, "constrained"); | |
1588 | ||
1589 | view->AddRegistry(&myFormValidatorRegistry); | |
1590 | ||
1591 | if (useDialog) | |
1592 | { | |
1593 | view->ShowView(sheet, propDialog); | |
1594 | view->AssociateNames(); | |
1595 | view->TransferToDialog(); | |
1596 | propDialog->Centre(wxBOTH); | |
1597 | propDialog->Show(TRUE); | |
1598 | } | |
1599 | else | |
1600 | { | |
1601 | view->ShowView(sheet, propFrame->GetPropertyPanel()); | |
1602 | view->AssociateNames(); | |
1603 | view->TransferToDialog(); | |
1604 | propFrame->Centre(wxBOTH); | |
1605 | propFrame->Show(TRUE); | |
1606 | } | |
1607 | } | |
1608 | \end{verbatim} | |
1609 | ||
1610 | \section{Validator classes overview}\label{validatoroverview} | |
1611 | ||
1612 | Classes: \helpref{Validator classes}{validatorclasses} | |
1613 | ||
1614 | The validator classes provide functionality for mediating between a wxProperty and | |
1615 | the actual display. There is a separate family of validator classes for each | |
1616 | class of view, since the differences in user interface for these views implies | |
1617 | that little common functionality can be shared amongst validators. | |
1618 | ||
1619 | \subsection{wxPropertyValidator overview}\label{wxpropertyvalidatoroverview} | |
1620 | ||
1621 | Class: \helpref{wxPropertyValidator}{wxpropertyvalidator} | |
1622 | ||
1623 | This class is the root of all property validator classes. It contains a small | |
1624 | amount of common functionality, including functions to convert between | |
1625 | strings and C++ values. | |
1626 | ||
1627 | A validator is notionally an object which sits between a property and its displayed | |
1628 | value, and checks that the value the user enters is correct, giving an error message | |
1629 | if the validation fails. In fact, the validator does more than that, and is akin to | |
1630 | a view class but at a finer level of detail. It is also responsible for | |
1631 | loading the dialog box control with the value from the property, putting it back | |
1632 | into the property, preparing special controls for editing the value, and | |
1633 | may even invoke special dialogs for editing the value in a convenient way. | |
1634 | ||
1635 | In a property list dialog, there is quite a lot of scope for supplying custom dialogs, | |
1636 | such as file or colour selectors. For a form dialog, there is less scope because | |
1637 | there is no concept of `detailed editing' of a value: one control is associated with | |
1638 | one property, and there is no provision for invoking further dialogs. The reader | |
1639 | may like to work out how the form view could be extended to provide some of the | |
1640 | functionality of the property list! | |
1641 | ||
1642 | Validator objects may be associated explictly with a wxProperty, or they may be | |
1643 | indirectly associated by virtue of a property `kind' that matches validators having | |
1644 | that kind. In the latter case, such validators are stored in a validator registry | |
1645 | which is passed to the view before the dialog is shown. If the validator takes | |
1646 | arguments, such as minimum and maximum values in the case of a wxIntegerListValidator, | |
1647 | then the validator must be associated explicitly with the property. The validator | |
1648 | will be deleted when the property is deleted. | |
1649 | ||
1650 | \subsection{wxPropertyListValidator overview}\label{wxpropertylistvalidatoroverview} | |
1651 | ||
1652 | Class: \helpref{wxPropertyListValidator}{wxpropertylistvalidator} | |
1653 | ||
1654 | This class is the abstract base class for property list view validators. | |
1655 | The list view acts upon a user interface containing a list of properties, | |
1656 | a text item for direct property value editing, confirm/cancel buttons for the value, | |
1657 | a pulldown list for making a choice between values, and OK/Cancel/Help buttons | |
1658 | for the dialog (see \helpref{property list appearance}{appearance}). | |
1659 | ||
1660 | By overriding virtual functions, the programmer can create custom | |
1661 | behaviour for different kinds of property. Custom behaviour can use just the | |
1662 | available controls on the property list dialog, or the validator can | |
1663 | invoke custom editors with quite different controls, which pop up in | |
1664 | `detailed editing' mode. | |
1665 | ||
1666 | See the detailed class documentation for the members you should override | |
1667 | to give your validator appropriate behaviour. | |
1668 | ||
1669 | \subsection{wxPropertyFormValidator overview}\label{wxpropertyformvalidatoroverview} | |
1670 | ||
1671 | This class is the abstract base class for property form view validators. | |
1672 | The form view acts upon an existing dialog box or panel, where either the | |
1673 | panel item names correspond to property names, or the programmer has explicitly | |
1674 | associated the panel item with the property. | |
1675 | ||
1676 | By overriding virtual functions, the programmer determines how | |
1677 | values are displayed or retrieved, and the checking that the validator does. | |
1678 | ||
1679 | See the detailed class documentation for the members you should override | |
1680 | to give your validator appropriate behaviour. | |
1681 | ||
1682 | \section{View classes overview}\label{viewoverview} | |
1683 | ||
1684 | Classes: \helpref{View classes}{viewclasses} | |
1685 | ||
1686 | An instance of a view class relates a property sheet with an actual window. | |
1687 | Currently, there are two classes of view: wxPropertyListView and wxPropertyFormView. | |
1688 | ||
1689 | \subsection{wxPropertyView overview}\label{wxpropertyviewoverview} | |
1690 | ||
1691 | Class: \helpref{wxPropertyView}{wxpropertyview} | |
1692 | ||
1693 | This is the abstract base class for property views. | |
1694 | ||
1695 | \subsection{wxPropertyListView overview}\label{wxpropertylistviewoverview} | |
1696 | ||
1697 | Class: \helpref{wxPropertyListView}{wxpropertylistview} | |
1698 | ||
1699 | The property list view defines the relationship between a property sheet and | |
1700 | a property list dialog or panel. It manages user interface events such as | |
1701 | clicking on a property, pressing return in the text edit field, and clicking | |
1702 | on Confirm or Cancel. These events cause member functions of the | |
1703 | class to be called, and these in turn may call member functions of | |
1704 | the appropriate validator to be called, to prepare controls, check the property value, | |
1705 | invoke detailed editing, etc. | |
1706 | ||
1707 | \subsection{wxPropertyFormView overview}\label{wxpropertyformviewoverview} | |
1708 | ||
1709 | Class: \helpref{wxPropertyFormView}{wxpropertyformview} | |
1710 | ||
1711 | The property form view manages the relationship between a property sheet | |
1712 | and an existing dialog or panel. | |
1713 | ||
1714 | You must first create a panel or dialog box for the view to work on. | |
1715 | The panel should contain panel items with names that correspond to | |
1716 | properties in your property sheet; or you can explicitly set the | |
1717 | panel item for each property. | |
1718 | ||
1719 | Apart from any custom panel items that you wish to control independently | |
1720 | of the property-editing items, wxPropertyFormView takes over the | |
1721 | processing of item events. It can also control normal dialog behaviour such | |
1722 | as OK, Cancel, so you should also create some standard buttons that the property view | |
1723 | can recognise. Just create the buttons with standard names and the view | |
1724 | will do the rest. The following button names are recognised: | |
1725 | ||
1726 | \begin{itemize}\itemsep=0pt | |
1727 | \item {\bf ok}: indicates the OK button. Calls wxPropertyFormView::OnOk. By default, | |
1728 | checks and updates the form values, closes and deletes the frame or dialog, then deletes the view. | |
1729 | \item {\bf cancel}: indicates the Cancel button. Calls wxPropertyFormView::OnCancel. By default, | |
1730 | closes and deletes the frame or dialog, then deletes the view. | |
1731 | \item {\bf help}: indicates the Help button. Calls wxPropertyFormView::OnHelp. This needs | |
1732 | to be overridden by the application for anything interesting to happen. | |
1733 | \item {\bf revert}: indicates the Revert button. Calls wxPropertyFormView::OnRevert, | |
1734 | which by default transfers the wxProperty values to the panel items (in effect | |
1735 | undoing any unsaved changes in the items). | |
1736 | \item {\bf update}: indicates the Revert button. Calls wxPropertyFormView::OnUpdate, which | |
1737 | by defaults transfers the displayed values to the wxProperty objects. | |
1738 | \end{itemize} | |
1739 | ||
1740 | \section{wxPropertySheet overview}\label{wxpropertysheetoverview} | |
1741 | ||
1742 | Classes: \helpref{wxPropertySheet}{wxpropertysheet}, \helpref{wxProperty}{wxproperty}, \helpref{wxPropertyValue}{wxpropertyvalue} | |
1743 | ||
1744 | A property sheet defines zero or more properties. This is a bit like an explicit representation of | |
1745 | a C++ object. wxProperty objects can have values which are pointers to C++ values, or they | |
1746 | can allocate their own storage for values. | |
1747 | ||
1748 | Because the property sheet representation is explicit and can be manipulated by | |
1749 | a program, it is a convenient form to be used for a variety of | |
1750 | editing purposes. wxPropertyListView and wxPropertyFormView are two classes that | |
1751 | specify the relationship between a property sheet and a user interface. You could imagine | |
1752 | other uses for wxPropertySheet, for example to generate a form-like user interface without | |
1753 | the need for GUI programming. Or for storing the names and values of command-line switches, with the | |
1754 | option to subsequently edit these values using a wxPropertyListView. | |
1755 | ||
1756 | A typical use for a property sheet is to represent values of an object | |
1757 | which are only implicit in the current representation of it. For | |
1758 | example, in Visual Basic and similar programming environments, you can | |
1759 | `edit a button', or rather, edit the button's properties. One of the | |
1760 | properties you can edit is {\it width} - but there is no explicit | |
1761 | representation of width in a wxWindows button; instead, you call SetSize | |
1762 | and GetSize members. To translate this into a consisent, | |
1763 | property-oriented scheme, we could derive a new class | |
1764 | wxButtonWithProperties, which has two new functions: SetProperty and | |
1765 | GetProperty. SetProperty accepts a property name and a value, and calls | |
1766 | an appropriate function for the property that is being passed. | |
1767 | GetProperty accepts a property name, returning a property value. So | |
1768 | instead of having to use the usual arbitrary set of C++ member functions | |
1769 | to set or access attributes of a window, programmer deals merely with | |
1770 | SetValue/GetValue, and property names and values. | |
1771 | We now have a single point at which we can modify or query an object by specifying | |
1772 | names and values at run-time. (The implementation of SetProperty and GetProperty | |
1773 | is probably quite messy and involves a large if-then-else statement to | |
1774 | test the property name and act accordingly.) | |
1775 | ||
1776 | When the user invokes the property editor for a wxButtonWithProperties, the system | |
1777 | creates a wxPropertySheet with `imaginary' properties such as width, height, font size | |
1778 | and so on. For each property, wxButtonWithProperties::GetProperty is called, and the result is | |
1779 | passed to the corresponding wxProperty. The wxPropertySheet is passed to a wxPropertyListView | |
1780 | as described elsewhere, and the user edits away. When the user has finished editing, the system calls | |
1781 | wxButtonWithProperties::SetProperty to transfer the wxProperty value back into the button | |
1782 | by way of an appropriate call, wxWindow::SetSize in the case of width and height properties. | |
1783 | ||
1784 | ||
1785 |