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