]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: property.h | |
3 | // Purpose: interface of wxPGProperty | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | // ----------------------------------------------------------------------- | |
10 | ||
11 | /** | |
12 | @class wxPropertyGridInterface | |
13 | ||
14 | Most of the shared property manipulation interface shared by wxPropertyGrid, | |
15 | wxPropertyGridPage, and wxPropertyGridManager is defined in this class. | |
16 | ||
17 | @remarks | |
18 | - In separate wxPropertyGrid component this class was known as | |
19 | wxPropertyContainerMethods. | |
20 | ||
21 | - wxPropertyGridInterface's property operation member functions all accept | |
22 | a special wxPGPropArg id argument, using which you can refer to properties | |
23 | either by their pointer (for performance) or by their name (for conveniency). | |
24 | ||
25 | @library{wxpropgrid} | |
26 | @category{propgrid} | |
27 | */ | |
28 | class WXDLLIMPEXP_PROPGRID wxPropertyGridInterface | |
29 | { | |
30 | public: | |
31 | ||
32 | /** Destructor */ | |
33 | virtual ~wxPropertyGridInterface() { } | |
34 | ||
35 | /** | |
36 | Appends property to the list. wxPropertyGrid assumes ownership of the | |
37 | object. Becomes child of most recently added category. | |
38 | ||
39 | @remarks | |
40 | - wxPropertyGrid takes the ownership of the property pointer. | |
41 | - If appending a category with name identical to a category already in | |
42 | the wxPropertyGrid, then newly created category is deleted, and most | |
43 | recently added category (under which properties are appended) is set | |
44 | to the one with same name. This allows easier adding of items to same | |
45 | categories in multiple passes. | |
46 | - Does not automatically redraw the control, so you may need to call | |
47 | Refresh() when calling this function after control has been shown for | |
48 | the first time. | |
49 | */ | |
50 | wxPGProperty* Append( wxPGProperty* property ); | |
51 | ||
52 | /** | |
53 | Same as Append(), but appends under given parent property. | |
54 | ||
55 | @param id | |
56 | Name or pointer to parent property. | |
57 | ||
58 | @param newProperty | |
59 | Property to be added. | |
60 | */ | |
61 | wxPGProperty* AppendIn( wxPGPropArg id, wxPGProperty* newProperty ); | |
62 | ||
63 | /** | |
64 | In order to add new items into a property with private children (for | |
65 | instance, wxFlagsProperty), you need to call this method. | |
66 | After populating has been finished, you need to call EndAddChildren(). | |
67 | ||
68 | @see EndAddChildren() | |
69 | */ | |
70 | void BeginAddChildren( wxPGPropArg id ); | |
71 | ||
72 | /** | |
73 | Deletes all properties. | |
74 | */ | |
75 | virtual void Clear() = 0; | |
76 | ||
77 | /** | |
78 | Deselect current selection, if any. | |
79 | ||
80 | @return Returns @true if success (ie. validator did not intercept). | |
81 | */ | |
82 | bool ClearSelection(); | |
83 | ||
84 | /** | |
85 | Resets modified status of all properties. | |
86 | */ | |
87 | void ClearModifiedStatus(); | |
88 | ||
89 | /** | |
90 | Collapses given category or property with children. | |
91 | ||
92 | @return Returns @true if actually collapsed. | |
93 | */ | |
94 | bool Collapse( wxPGPropArg id ); | |
95 | ||
96 | /** | |
97 | Collapses all items that can be collapsed. | |
98 | ||
99 | @return Returns @false if failed (may fail if value in active | |
100 | editor cannot be validated). | |
101 | */ | |
102 | bool CollapseAll(); | |
103 | ||
104 | /** | |
105 | Changes value of a property, as if by user. Use this instead of | |
106 | SetPropertyValue() if you need the value to run through validation | |
107 | process, and also send the property change event. | |
108 | ||
109 | @return Returns @true if value was successfully changed. | |
110 | */ | |
111 | bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue ); | |
112 | ||
113 | /** | |
114 | Deletes a property. | |
115 | */ | |
116 | void DeleteProperty( wxPGPropArg id ); | |
117 | ||
118 | /** | |
119 | Disables a property. | |
120 | */ | |
121 | bool DisableProperty( wxPGPropArg id ); | |
122 | ||
123 | /** | |
124 | Returns @true if all property grid data changes have been committed. Usually | |
125 | only returns @false if value in active editor has been invalidated by a | |
126 | wxValidator. | |
127 | */ | |
128 | bool EditorValidate(); | |
129 | ||
130 | /** | |
131 | Enables or disables property. | |
132 | ||
133 | @param id | |
134 | Name or pointer to a property. | |
135 | @param enable | |
136 | If @false, property is disabled instead. | |
137 | */ | |
138 | bool EnableProperty( wxPGPropArg id, bool enable = true ); | |
139 | ||
140 | /** | |
141 | Called after population of property with fixed children has finished. | |
142 | ||
143 | @see BeginAddChildren() | |
144 | */ | |
145 | void EndAddChildren( wxPGPropArg id ); | |
146 | ||
147 | /** | |
148 | Expands given category or property with children. | |
149 | ||
150 | @return Returns @true if actually expanded. | |
151 | */ | |
152 | bool Expand( wxPGPropArg id ); | |
153 | ||
154 | /** | |
155 | Expands all items that can be expanded. | |
156 | */ | |
157 | bool ExpandAll( bool expand = true ); | |
158 | ||
159 | /** | |
160 | Returns id of first child of given property. | |
161 | ||
162 | @remarks Does not return private children! | |
163 | */ | |
164 | wxPGProperty* GetFirstChild( wxPGPropArg id ); | |
165 | ||
166 | //@{ | |
167 | /** | |
168 | Returns iterator class instance. | |
169 | ||
170 | @param flags | |
171 | See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes | |
172 | iteration over everything except private child properties. | |
173 | @param firstProp | |
174 | Property to start iteration from. If @NULL, then first child of root | |
175 | is used. | |
176 | ||
177 | @beginWxPythonOnly | |
178 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and | |
179 | instead of * operator, use GetProperty() method. | |
180 | @endWxPythonOnly | |
181 | */ | |
182 | wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, | |
183 | wxPGProperty* firstProp = NULL ); | |
184 | wxPropertyGridConstIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, | |
185 | wxPGProperty* firstProp = NULL ) const; | |
186 | //@} | |
187 | ||
188 | //@{ | |
189 | /** | |
190 | Returns iterator class instance. | |
191 | ||
192 | @param flags | |
193 | See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes | |
194 | iteration over everything except private child properties. | |
195 | @param startPos | |
196 | Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start | |
197 | from the first property from the top, and wxBOTTOM means that the | |
198 | iteration will instead begin from bottommost valid item. | |
199 | ||
200 | @beginWxPythonOnly | |
201 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and | |
202 | instead of * operator, use GetProperty() method. | |
203 | @endWxPythonOnly | |
204 | */ | |
205 | wxPropertyGridIterator GetIterator( int flags, int startPos ); | |
206 | wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const; | |
207 | //@} | |
208 | ||
209 | /** | |
210 | Returns id of first item that matches given criteria. | |
211 | ||
212 | @param flags | |
213 | See @ref propgrid_iterator_flags. | |
214 | */ | |
215 | wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ); | |
216 | ||
217 | /** | |
218 | Returns id of property with given name (case-sensitive). | |
219 | */ | |
220 | wxPGProperty* GetProperty( const wxString& name ) const; | |
221 | ||
222 | /** | |
223 | Adds to 'targetArr' pointers to properties that have given flags 'flags' set. | |
224 | However, if @a 'inverse' is set to @true, then only properties without | |
225 | given flags are stored. | |
226 | ||
227 | @param targetArr | |
228 | @todo docme | |
229 | @param flags | |
230 | Property flags to use. | |
231 | @param inverse | |
232 | @todo docme | |
233 | @param iterFlags | |
234 | Iterator flags to use. Default is everything expect private children. | |
235 | See @ref propgrid_iterator_flags. | |
236 | */ | |
237 | void GetPropertiesWithFlag( wxArrayPGProperty* targetArr, | |
238 | wxPGProperty::FlagType flags, | |
239 | bool inverse = false, | |
240 | int iterFlags = (wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_HIDDEN|wxPG_ITERATE_CATEGORIES) ) const; | |
241 | ||
242 | /** | |
243 | Returns value of given attribute. If none found, returns wxNullVariant. | |
244 | */ | |
245 | wxVariant GetPropertyAttribute( wxPGPropArg id, const wxString& attrName ) const; | |
246 | ||
247 | /** | |
248 | Returns pointer of property's nearest parent category. If no category | |
249 | found, returns @NULL. | |
250 | */ | |
251 | wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const; | |
252 | ||
253 | /** Returns client data (void*) of a property. */ | |
254 | void* GetPropertyClientData( wxPGPropArg id ) const; | |
255 | ||
256 | /** | |
257 | Returns first property which label matches given string. @NULL if none | |
258 | found. Note that this operation is very slow when compared to | |
259 | GetPropertyByName(). | |
260 | */ | |
261 | wxPGProperty* GetPropertyByLabel( const wxString& label ) const; | |
262 | ||
263 | /** | |
264 | Returns property with given name. @NULL if none found. | |
265 | */ | |
266 | wxPGProperty* GetPropertyByName( const wxString& name ) const; | |
267 | ||
268 | /** | |
269 | Returns child property 'subname' of property 'name'. Same as | |
270 | calling GetPropertyByName("name.subname"), albeit slightly faster. | |
271 | */ | |
272 | wxPGProperty* GetPropertyByName( const wxString& name, | |
273 | const wxString& subname ) const; | |
274 | ||
275 | /** | |
276 | Returns property's editor. | |
277 | */ | |
278 | const wxPGEditor* GetPropertyEditor( wxPGPropArg id ) const; | |
279 | ||
280 | /** | |
281 | Returns help string associated with a property. | |
282 | */ | |
283 | wxString GetPropertyHelpString( wxPGPropArg id ) const; | |
284 | ||
285 | /** | |
286 | Returns property's custom value image (@NULL of none). | |
287 | */ | |
288 | wxBitmap* GetPropertyImage( wxPGPropArg id ) const; | |
289 | ||
290 | /** Returns label of a property. */ | |
291 | const wxString& GetPropertyLabel( wxPGPropArg id ); | |
292 | ||
293 | /** Returns property's name, by which it is globally accessible. */ | |
294 | wxString GetPropertyName( wxPGProperty* property ); | |
295 | ||
296 | /** | |
297 | Returns validator of a property as a reference, which you | |
298 | can pass to any number of SetPropertyValidator. | |
299 | */ | |
300 | wxValidator* GetPropertyValidator( wxPGPropArg id ); | |
301 | ||
302 | /** | |
303 | Returns property's value as wxVariant. | |
304 | ||
305 | If property value is unspecified, Null variant is returned. | |
306 | */ | |
307 | wxVariant GetPropertyValue( wxPGPropArg id ); | |
308 | ||
309 | /** Return's property's value as wxArrayInt. */ | |
310 | wxArrayInt GetPropertyValueAsArrayInt( wxPGPropArg id ) const; | |
311 | ||
312 | /** Returns property's value as wxArrayString. */ | |
313 | wxArrayString GetPropertyValueAsArrayString( wxPGPropArg id ) const; | |
314 | ||
315 | /** Returns property's value as bool */ | |
316 | bool GetPropertyValueAsBool( wxPGPropArg id ) const; | |
317 | ||
318 | /** Return's property's value as wxDateTime. */ | |
319 | wxDateTime GetPropertyValueAsDateTime( wxPGPropArg id ) const; | |
320 | ||
321 | /** Returns property's value as double-precision floating point number. */ | |
322 | double GetPropertyValueAsDouble( wxPGPropArg id ) const; | |
323 | ||
324 | /** Returns property's value as integer */ | |
325 | int GetPropertyValueAsInt( wxPGPropArg id ) const; | |
326 | ||
327 | /** Returns property's value as integer */ | |
328 | long GetPropertyValueAsLong( wxPGPropArg id ) const; | |
329 | ||
330 | /** Returns property's value as native signed 64-bit integer. */ | |
331 | wxLongLong_t GetPropertyValueAsLongLong( wxPGPropArg id ) const; | |
332 | ||
333 | /** | |
334 | Returns property's value as wxString. If property does not | |
335 | use string value type, then its value is converted using | |
336 | wxPGProperty::GetValueAsString(). | |
337 | */ | |
338 | wxString GetPropertyValueAsString( wxPGPropArg id ) const; | |
339 | ||
340 | /** Returns property's value as unsigned integer */ | |
341 | unsigned long GetPropertyValueAsULong( wxPGPropArg id ) const; | |
342 | ||
343 | /** Returns property's value as native unsigned 64-bit integer. */ | |
344 | wxULongLong_t GetPropertyValueAsULongLong( wxPGPropArg id ) const; | |
345 | ||
346 | /** | |
347 | Returns a wxVariant list containing wxVariant versions of all | |
348 | property values. Order is not guaranteed. | |
349 | ||
350 | @param listname | |
351 | @todo docme | |
352 | @param baseparent | |
353 | @todo docme | |
354 | @param flags | |
355 | Use wxPG_KEEP_STRUCTURE to retain category structure; each sub | |
356 | category will be its own wxVariantList of wxVariant. | |
357 | ||
358 | Use wxPG_INC_ATTRIBUTES to include property attributes as well. | |
359 | Each attribute will be stored as list variant named | |
360 | "@@<propname>@@attr." | |
361 | */ | |
362 | wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, | |
363 | wxPGProperty* baseparent = NULL, long flags = 0 ) const; | |
364 | ||
365 | /** Returns currently selected property. */ | |
366 | wxPGProperty* GetSelection() const; | |
367 | ||
368 | /** | |
369 | Similar to GetIterator(), but instead returns wxPGVIterator instance, | |
370 | which can be useful for forward-iterating through arbitrary property | |
371 | containers. | |
372 | ||
373 | @param flags | |
374 | See @ref propgrid_iterator_flags. | |
375 | ||
376 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and | |
377 | instead of * operator, use GetProperty() method. | |
378 | */ | |
379 | virtual wxPGVIterator GetVIterator( int flags ) const; | |
380 | ||
381 | /** | |
382 | Hides or reveals a property. | |
383 | ||
384 | @param id | |
385 | @todo docme | |
386 | @param hide | |
387 | If @true, hides property, otherwise reveals it. | |
388 | @param flags | |
389 | By default changes are applied recursively. Set this parameter | |
390 | wxPG_DONT_RECURSE to prevent this. | |
391 | */ | |
392 | bool HideProperty( wxPGPropArg id, bool hide = true, int flags = wxPG_RECURSE ); | |
393 | ||
394 | /** | |
395 | Initializes *all* property types. Causes references to most object | |
396 | files in the library, so calling this may cause significant increase | |
397 | in executable size when linking with static library. | |
398 | */ | |
399 | static void InitAllTypeHandlers(); | |
400 | ||
401 | /** | |
402 | Inserts property to the property container. | |
403 | ||
404 | @param priorThis | |
405 | New property is inserted just prior to this. Available only | |
406 | in the first variant. There are two versions of this function | |
407 | to allow this parameter to be either an id or name to | |
408 | a property. | |
409 | @param newProperty | |
410 | Pointer to the inserted property. wxPropertyGrid will take | |
411 | ownership of this object. | |
412 | ||
413 | @return Returns newProperty. | |
414 | ||
415 | @remarks | |
416 | ||
417 | - wxPropertyGrid takes the ownership of the property pointer. | |
418 | ||
419 | - While Append may be faster way to add items, make note that when | |
420 | both types of data storage (categoric and | |
421 | non-categoric) are active, Insert becomes even more slow. This is | |
422 | especially true if current mode is non-categoric. | |
423 | ||
424 | Example of use: | |
425 | ||
426 | @code | |
427 | ||
428 | // append category | |
429 | wxPGProperty* my_cat_id = propertygrid->Append( new wxPropertyCategory("My Category") ); | |
430 | ||
431 | ... | |
432 | ||
433 | // insert into category - using second variant | |
434 | wxPGProperty* my_item_id_1 = propertygrid->Insert( my_cat_id, 0, new wxStringProperty("My String 1") ); | |
435 | ||
436 | // insert before to first item - using first variant | |
437 | wxPGProperty* my_item_id_2 = propertygrid->Insert( my_item_id, new wxStringProperty("My String 2") ); | |
438 | ||
439 | @endcode | |
440 | */ | |
441 | wxPGProperty* Insert( wxPGPropArg priorThis, wxPGProperty* newProperty ); | |
442 | ||
443 | /** | |
444 | Inserts property to the property container. | |
445 | See the other overload for more details. | |
446 | ||
447 | @param parent | |
448 | New property is inserted under this category. Available only | |
449 | in the second variant. There are two versions of this function | |
450 | to allow this parameter to be either an id or name to | |
451 | a property. | |
452 | @param index | |
453 | Index under category. Available only in the second variant. | |
454 | If index is < 0, property is appended in category. | |
455 | @param newProperty | |
456 | Pointer to the inserted property. wxPropertyGrid will take | |
457 | ownership of this object. | |
458 | ||
459 | @return Returns newProperty. | |
460 | */ | |
461 | wxPGProperty* Insert( wxPGPropArg parent, int index, wxPGProperty* newProperty ); | |
462 | ||
463 | /** Returns @true if property is a category. */ | |
464 | bool IsPropertyCategory( wxPGPropArg id ) const; | |
465 | ||
466 | /** Returns @true if property is enabled. */ | |
467 | bool IsPropertyEnabled( wxPGPropArg id ) const; | |
468 | ||
469 | /** | |
470 | Returns @true if given property is expanded. Naturally, always returns | |
471 | @false for properties that cannot be expanded. | |
472 | */ | |
473 | bool IsPropertyExpanded( wxPGPropArg id ) const; | |
474 | ||
475 | /** | |
476 | Returns @true if property has been modified after value set or modify | |
477 | flag clear by software. | |
478 | */ | |
479 | bool IsPropertyModified( wxPGPropArg id ) const; | |
480 | ||
481 | /** | |
482 | Returns @true if property is shown (ie. HideProperty() with @true not | |
483 | called for it). | |
484 | */ | |
485 | bool IsPropertyShown( wxPGPropArg id ) const; | |
486 | ||
487 | /** | |
488 | Returns @true if property value is set to unspecified. | |
489 | */ | |
490 | bool IsPropertyValueUnspecified( wxPGPropArg id ) const; | |
491 | ||
492 | /** | |
493 | Disables (limit = @true) or enables (limit = @false) wxTextCtrl editor | |
494 | of a property, if it is not the sole mean to edit the value. | |
495 | */ | |
496 | void LimitPropertyEditing( wxPGPropArg id, bool limit = true ); | |
497 | ||
498 | /** | |
499 | Initializes additional property editors (SpinCtrl etc.). Causes | |
500 | references to most object files in the library, so calling this may | |
501 | cause significant increase in executable size when linking with static | |
502 | library. | |
503 | */ | |
504 | static void RegisterAdditionalEditors(); | |
505 | ||
506 | /** | |
507 | Replaces property with id with newly created one. For example, | |
508 | this code replaces existing property named "Flags" with one that | |
509 | will have different set of items: | |
510 | ||
511 | @code | |
512 | pg->ReplaceProperty("Flags", | |
513 | wxFlagsProperty("Flags", wxPG_LABEL, newItems)) | |
514 | @endcode | |
515 | ||
516 | @see Insert() | |
517 | */ | |
518 | wxPGProperty* ReplaceProperty( wxPGPropArg id, wxPGProperty* property ); | |
519 | ||
520 | /** | |
521 | @anchor propgridinterface_editablestate_flags | |
522 | ||
523 | Flags for wxPropertyGridInterface::SaveEditableState() and | |
524 | wxPropertyGridInterface::RestoreEditableState(). | |
525 | */ | |
526 | enum EditableStateFlags | |
527 | { | |
528 | /** Include selected property. */ | |
529 | SelectionState = 0x01, | |
530 | /** Include expanded/collapsed property information. */ | |
531 | ExpandedState = 0x02, | |
532 | /** Include scrolled position. */ | |
533 | ScrollPosState = 0x04, | |
534 | /** Include selected page information. Only applies to | |
535 | wxPropertyGridManager. */ | |
536 | PageState = 0x08, | |
537 | /** Include splitter position. Stored for each page. */ | |
538 | SplitterPosState = 0x10, | |
539 | /** Include description box size. | |
540 | Only applies to wxPropertyGridManager. */ | |
541 | DescBoxState = 0x20, | |
542 | ||
543 | /** | |
544 | Include all supported user editable state information. | |
545 | This is usually the default value. */ | |
546 | AllStates = SelectionState | | |
547 | ExpandedState | | |
548 | ScrollPosState | | |
549 | PageState | | |
550 | SplitterPosState | | |
551 | DescBoxState | |
552 | }; | |
553 | ||
554 | /** | |
555 | Restores user-editable state. See also wxPropertyGridInterface::SaveEditableState(). | |
556 | ||
557 | @param src | |
558 | String generated by SaveEditableState. | |
559 | ||
560 | @param restoreStates | |
561 | Which parts to restore from source string. See @ref propgridinterface_editablestate_flags | |
562 | "list of editable state flags". | |
563 | ||
564 | @return Returns @false if there was problem reading the string. | |
565 | ||
566 | @remarks If some parts of state (such as scrolled or splitter position) | |
567 | fail to restore correctly, please make sure that you call this | |
568 | function after wxPropertyGrid size has been set (this may | |
569 | sometimes be tricky when sizers are used). | |
570 | */ | |
571 | bool RestoreEditableState( const wxString& src, | |
572 | int restoreStates = AllStates ); | |
573 | ||
574 | /** | |
575 | Used to acquire user-editable state (selected property, expanded | |
576 | properties, scrolled position, splitter positions). | |
577 | ||
578 | @param includedStates | |
579 | Which parts of state to include. See @ref propgridinterface_editablestate_flags | |
580 | "list of editable state flags". | |
581 | */ | |
582 | wxString SaveEditableState( int includedStates = AllStates ) const; | |
583 | ||
584 | /** | |
585 | Sets strings listed in the choice dropdown of a wxBoolProperty. | |
586 | ||
587 | Defaults are "True" and "False", so changing them to, say, "Yes" and | |
588 | "No" may be useful in some less technical applications. | |
589 | */ | |
590 | static void SetBoolChoices( const wxString& trueChoice, | |
591 | const wxString& falseChoice ); | |
592 | ||
593 | /** | |
594 | Sets an attribute for this property. | |
595 | ||
596 | @param id | |
597 | @todo docme | |
598 | @param attrName | |
599 | Text identifier of attribute. See @ref propgrid_property_attributes. | |
600 | @param value | |
601 | Value of attribute. | |
602 | @param argFlags | |
603 | Optional. | |
604 | Use wxPG_RECURSE to set the attribute to child properties recursively. | |
605 | ||
606 | @remarks Setting attribute's value to Null variant will simply remove it | |
607 | from property's set of attributes. | |
608 | */ | |
609 | void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName, | |
610 | wxVariant value, long argFlags = 0 ); | |
611 | ||
612 | /** | |
613 | Sets property attribute for all applicapple properties. | |
614 | Be sure to use this method only after all properties have been | |
615 | added to the grid. | |
616 | */ | |
617 | void SetPropertyAttributeAll( const wxString& attrName, wxVariant value ); | |
618 | ||
619 | /** | |
620 | Sets text, bitmap, and colours for given column's cell. | |
621 | ||
622 | @remarks | |
623 | - You can set label cell by using column 0. | |
624 | - You can use wxPG_LABEL as text to use default text for column. | |
625 | */ | |
626 | void SetPropertyCell( wxPGPropArg id, | |
627 | int column, | |
628 | const wxString& text = wxEmptyString, | |
629 | const wxBitmap& bitmap = wxNullBitmap, | |
630 | const wxColour& fgCol = wxNullColour, | |
631 | const wxColour& bgCol = wxNullColour ); | |
632 | ||
633 | /** | |
634 | Sets client data (void*) of a property. | |
635 | ||
636 | @remarks | |
637 | This untyped client data has to be deleted manually. | |
638 | */ | |
639 | void SetPropertyClientData( wxPGPropArg id, void* clientData ); | |
640 | ||
641 | /** | |
642 | Sets editor for a property. | |
643 | ||
644 | @param id | |
645 | @todo docme | |
646 | @param editor | |
647 | For builtin editors, use wxPGEditor_X, where X is builtin editor's | |
648 | name (TextCtrl, Choice, etc. see wxPGEditor documentation for full | |
649 | list). | |
650 | ||
651 | For custom editors, use pointer you received from wxPropertyGrid::RegisterEditorClass(). | |
652 | */ | |
653 | void SetPropertyEditor( wxPGPropArg id, const wxPGEditor* editor ); | |
654 | ||
655 | /** | |
656 | Sets editor control of a property. As editor argument, use | |
657 | editor name string, such as "TextCtrl" or "Choice". | |
658 | */ | |
659 | void SetPropertyEditor( wxPGPropArg id, const wxString& editorName ); | |
660 | ||
661 | /** | |
662 | Sets label of a property. | |
663 | ||
664 | @remarks | |
665 | - Properties under same parent may have same labels. However, | |
666 | property names must still remain unique. | |
667 | */ | |
668 | void SetPropertyLabel( wxPGPropArg id, const wxString& newproplabel ); | |
669 | ||
670 | /** | |
671 | Sets name of a property. | |
672 | ||
673 | @param id | |
674 | Name or pointer of property which name to change. | |
675 | ||
676 | @param newName | |
677 | New name for property. | |
678 | */ | |
679 | void SetPropertyName( wxPGPropArg id, const wxString& newName ); | |
680 | ||
681 | /** | |
682 | Sets property (and, recursively, its children) to have read-only value. | |
683 | In other words, user cannot change the value in the editor, but they can | |
684 | still copy it. | |
685 | ||
686 | @remarks This is mainly for use with textctrl editor. Only some other | |
687 | editors fully support it. | |
688 | ||
689 | @param id | |
690 | Property name or pointer. | |
691 | ||
692 | @param set | |
693 | Use @true to enable read-only, @false to disable it. | |
694 | ||
695 | @param flags | |
696 | By default changes are applied recursively. Set this parameter | |
697 | wxPG_DONT_RECURSE to prevent this. | |
698 | */ | |
699 | void SetPropertyReadOnly( wxPGPropArg id, bool set = true, | |
700 | int flags = wxPG_RECURSE ); | |
701 | ||
702 | /** | |
703 | Sets property's value to unspecified. If it has children (it may be | |
704 | category), then the same thing is done to them. | |
705 | */ | |
706 | void SetPropertyValueUnspecified( wxPGPropArg id ); | |
707 | ||
708 | /** | |
709 | Sets various property values from a list of wxVariants. If property with | |
710 | name is missing from the grid, new property is created under given | |
711 | default category (or root if omitted). | |
712 | */ | |
713 | void SetPropertyValues( const wxVariantList& list, | |
714 | wxPGPropArg defaultCategory = wxNullProperty ); | |
715 | ||
716 | void SetPropertyValues( const wxVariant& list, | |
717 | wxPGPropArg defaultCategory = wxNullProperty ); | |
718 | ||
719 | /** | |
720 | Associates the help string with property. | |
721 | ||
722 | @remarks By default, text is shown either in the manager's "description" | |
723 | text box or in the status bar. If extra window style | |
724 | wxPG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as | |
725 | a tooltip. | |
726 | */ | |
727 | void SetPropertyHelpString( wxPGPropArg id, const wxString& helpString ); | |
728 | ||
729 | /** | |
730 | Set wxBitmap in front of the value. | |
731 | ||
732 | @remarks Bitmap will be scaled to a size returned by | |
733 | wxPropertyGrid::GetImageSize(); | |
734 | */ | |
735 | void SetPropertyImage( wxPGPropArg id, wxBitmap& bmp ); | |
736 | ||
737 | /** | |
738 | Sets max length of property's text. | |
739 | */ | |
740 | bool SetPropertyMaxLength( wxPGPropArg id, int maxLen ); | |
741 | ||
742 | /** | |
743 | Sets validator of a property. | |
744 | */ | |
745 | void SetPropertyValidator( wxPGPropArg id, const wxValidator& validator ); | |
746 | ||
747 | /** Sets value (integer) of a property. */ | |
748 | void SetPropertyValue( wxPGPropArg id, long value ); | |
749 | ||
750 | /** Sets value (integer) of a property. */ | |
751 | void SetPropertyValue( wxPGPropArg id, int value ); | |
752 | ||
753 | /** Sets value (floating point) of a property. */ | |
754 | void SetPropertyValue( wxPGPropArg id, double value ); | |
755 | ||
756 | /** Sets value (bool) of a property. */ | |
757 | void SetPropertyValue( wxPGPropArg id, bool value ); | |
758 | ||
759 | /** Sets value (string) of a property. */ | |
760 | void SetPropertyValue( wxPGPropArg id, const wxString& value ); | |
761 | ||
762 | /** Sets value (wxArrayString) of a property. */ | |
763 | void SetPropertyValue( wxPGPropArg id, const wxArrayString& value ); | |
764 | ||
765 | /** Sets value (wxDateTime) of a property. */ | |
766 | void SetPropertyValue( wxPGPropArg id, const wxDateTime& value ); | |
767 | ||
768 | /** Sets value (wxObject*) of a property. */ | |
769 | void SetPropertyValue( wxPGPropArg id, wxObject* value ); | |
770 | ||
771 | /** Sets value (wxObject&) of a property. */ | |
772 | void SetPropertyValue( wxPGPropArg id, wxObject& value ); | |
773 | ||
774 | /** Sets value (native 64-bit int) of a property. */ | |
775 | void SetPropertyValue( wxPGPropArg id, wxLongLong_t value ); | |
776 | ||
777 | /** Sets value (native 64-bit unsigned int) of a property. */ | |
778 | void SetPropertyValue( wxPGPropArg id, wxULongLong_t value ); | |
779 | ||
780 | /** Sets value (wxArrayInt&) of a property. */ | |
781 | void SetPropertyValue( wxPGPropArg id, const wxArrayInt& value ); | |
782 | ||
783 | /** | |
784 | Sets value (wxString) of a property. | |
785 | ||
786 | @remarks This method uses wxPGProperty::SetValueFromString(), which all | |
787 | properties should implement. This means that there should not be | |
788 | a type error, and instead the string is converted to property's | |
789 | actual value type. | |
790 | */ | |
791 | void SetPropertyValueString( wxPGPropArg id, const wxString& value ); | |
792 | ||
793 | /** | |
794 | Sets value (wxVariant&) of a property. | |
795 | ||
796 | @remarks Use wxPropertyGrid::ChangePropertyValue() instead if you need to | |
797 | run through validation process and send property change event. | |
798 | */ | |
799 | void SetPropertyValue( wxPGPropArg id, wxVariant value ); | |
800 | ||
801 | /** | |
802 | Adjusts how wxPropertyGrid behaves when invalid value is entered | |
803 | in a property. | |
804 | ||
805 | @param vfbFlags | |
806 | See @ref propgrid_vfbflags for possible values. | |
807 | */ | |
808 | void SetValidationFailureBehavior( int vfbFlags ); | |
809 | ||
810 | /** | |
811 | Returns editor pointer of editor with given name; | |
812 | */ | |
813 | static wxPGEditor* GetEditorByName( const wxString& editorName ); | |
814 | }; | |
815 |