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