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