]>
Commit | Line | Data |
---|---|---|
1c4293cb VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: property.h | |
3 | // Purpose: interface of wxPGProperty | |
4 | // Author: wxWidgets team | |
de003797 | 5 | // RCS-ID: $Id$ |
1c4293cb VZ |
6 | // Licence: wxWindows license |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
10 | #define wxNullProperty ((wxPGProperty*)NULL) | |
11 | ||
12 | ||
0ad10f30 FM |
13 | /** |
14 | @section propgrid_property_attributes wxPropertyGrid Property Attribute Identifiers | |
1c4293cb | 15 | |
0ad10f30 FM |
16 | wxPGProperty::SetAttribute() and wxPropertyGridInterface::SetPropertyAttribute() |
17 | accept one of these as attribute name argument. | |
1c4293cb | 18 | |
0ad10f30 FM |
19 | You can use strings instead of constants. |
20 | However, some of these constants are redefined to use cached strings which | |
21 | may reduce your binary size by some amount. | |
1c4293cb VZ |
22 | |
23 | @{ | |
24 | */ | |
25 | ||
26 | /** Set default value for property. | |
27 | */ | |
28 | #define wxPG_ATTR_DEFAULT_VALUE wxS("DefaultValue") | |
29 | ||
30 | /** Universal, int or double. Minimum value for numeric properties. | |
31 | */ | |
32 | #define wxPG_ATTR_MIN wxS("Min") | |
33 | ||
34 | /** Universal, int or double. Maximum value for numeric properties. | |
35 | */ | |
36 | #define wxPG_ATTR_MAX wxS("Max") | |
37 | ||
38 | /** Universal, string. When set, will be shown as text after the displayed | |
39 | text value. Alternatively, if third column is enabled, text will be shown | |
40 | there (for any type of property). | |
41 | */ | |
42 | #define wxPG_ATTR_UNITS wxS("Units") | |
43 | ||
44 | /** Universal, string. When set, will be shown in property's value cell | |
45 | when displayed value string is empty, or value is unspecified. | |
46 | */ | |
47 | #define wxPG_ATTR_INLINE_HELP wxS("InlineHelp") | |
48 | ||
49 | /** wxBoolProperty specific, int, default 0. When 1 sets bool property to | |
50 | use checkbox instead of choice. | |
51 | */ | |
52 | #define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox") | |
53 | ||
54 | /** wxBoolProperty specific, int, default 0. When 1 sets bool property value | |
55 | to cycle on double click (instead of showing the popup listbox). | |
56 | */ | |
57 | #define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling") | |
58 | ||
59 | /** wxFloatProperty (and similar) specific, int, default -1. Sets the (max) precision | |
60 | used when floating point value is rendered as text. The default -1 means infinite | |
61 | precision. | |
62 | */ | |
63 | #define wxPG_FLOAT_PRECISION wxS("Precision") | |
64 | ||
65 | /** The text will be echoed as asterisks (wxTE_PASSWORD will be passed to textctrl etc). | |
66 | */ | |
67 | #define wxPG_STRING_PASSWORD wxS("Password") | |
68 | ||
69 | /** Define base used by a wxUIntProperty. Valid constants are | |
70 | wxPG_BASE_OCT, wxPG_BASE_DEC, wxPG_BASE_HEX and wxPG_BASE_HEXL | |
71 | (lowercase characters). | |
72 | */ | |
73 | #define wxPG_UINT_BASE wxS("Base") | |
74 | ||
75 | /** Define prefix rendered to wxUIntProperty. Accepted constants | |
76 | wxPG_PREFIX_NONE, wxPG_PREFIX_0x, and wxPG_PREFIX_DOLLAR_SIGN. | |
77 | <b>Note:</b> Only wxPG_PREFIX_NONE works with Decimal and Octal | |
78 | numbers. | |
79 | */ | |
80 | #define wxPG_UINT_PREFIX wxS("Prefix") | |
81 | ||
82 | /** wxFileProperty/wxImageFileProperty specific, wxChar*, default is detected/varies. | |
83 | Sets the wildcard used in the triggered wxFileDialog. Format is the | |
84 | same. | |
85 | */ | |
86 | #define wxPG_FILE_WILDCARD wxS("Wildcard") | |
87 | ||
88 | /** wxFileProperty/wxImageFileProperty specific, int, default 1. | |
89 | When 0, only the file name is shown (i.e. drive and directory are hidden). | |
90 | */ | |
91 | #define wxPG_FILE_SHOW_FULL_PATH wxS("ShowFullPath") | |
92 | ||
93 | /** Specific to wxFileProperty and derived properties, wxString, default empty. | |
94 | If set, then the filename is shown relative to the given path string. | |
95 | */ | |
96 | #define wxPG_FILE_SHOW_RELATIVE_PATH wxS("ShowRelativePath") | |
97 | ||
98 | /** Specific to wxFileProperty and derived properties, wxString, default is empty. | |
99 | Sets the initial path of where to look for files. | |
100 | */ | |
101 | #define wxPG_FILE_INITIAL_PATH wxS("InitialPath") | |
102 | ||
103 | /** Specific to wxFileProperty and derivatives, wxString, default is empty. | |
104 | Sets a specific title for the dir dialog. | |
105 | */ | |
106 | #define wxPG_FILE_DIALOG_TITLE wxS("DialogTitle") | |
107 | ||
108 | /** Specific to wxDirProperty, wxString, default is empty. | |
109 | Sets a specific message for the dir dialog. | |
110 | */ | |
111 | #define wxPG_DIR_DIALOG_MESSAGE wxS("DialogMessage") | |
112 | ||
113 | /** Sets displayed date format for wxDateProperty. | |
114 | */ | |
115 | #define wxPG_DATE_FORMAT wxS("DateFormat") | |
116 | ||
117 | /** Sets wxDatePickerCtrl window style used with wxDateProperty. Default | |
b6fd0b42 JS |
118 | is wxDP_DEFAULT | wxDP_SHOWCENTURY. Using wxDP_ALLOWNONE will enable |
119 | better unspecified value support in the editor. | |
1c4293cb VZ |
120 | */ |
121 | #define wxPG_DATE_PICKER_STYLE wxS("PickerStyle") | |
122 | ||
123 | /** SpinCtrl editor, int or double. How much number changes when button is | |
124 | pressed (or up/down on keybard). | |
125 | */ | |
126 | #define wxPG_ATTR_SPINCTRL_STEP wxS("Step") | |
127 | ||
0ad10f30 | 128 | /** SpinCtrl editor, bool. If @true, value wraps at Min/Max. |
1c4293cb VZ |
129 | */ |
130 | #define wxPG_ATTR_SPINCTRL_WRAP wxS("Wrap") | |
131 | ||
18e046a7 JS |
132 | /** SpinCtrl editor, bool. If @true, value can also by changed by moving |
133 | mouse when left mouse button is being pressed. | |
134 | */ | |
135 | #define wxPG_ATTR_SPINCTRL_MOTIONSPIN wxS("MotionSpin") | |
136 | ||
1c4293cb VZ |
137 | /** wxMultiChoiceProperty, int. If 0, no user strings allowed. If 1, user strings |
138 | appear before list strings. If 2, user strings appear after list string. | |
139 | */ | |
140 | #define wxPG_ATTR_MULTICHOICE_USERSTRINGMODE wxS("UserStringMode") | |
141 | ||
142 | /** wxColourProperty and its kind, int, default 1. Setting this attribute to 0 hides custom | |
143 | colour from property's list of choices. | |
144 | */ | |
145 | #define wxPG_COLOUR_ALLOW_CUSTOM wxS("AllowCustom") | |
146 | ||
1c4293cb VZ |
147 | /** @} |
148 | */ | |
149 | ||
1c4293cb | 150 | |
0ad10f30 FM |
151 | |
152 | /** | |
153 | @class wxPGProperty | |
1c4293cb VZ |
154 | |
155 | wxPGProperty is base class for all wxPropertyGrid properties. In | |
156 | sections below we cover few related topics. | |
157 | ||
158 | @li @ref pgproperty_properties | |
159 | @li @ref pgproperty_creating | |
160 | ||
161 | @section pgproperty_properties Supplied Ready-to-use Property Classes | |
162 | ||
163 | Here is a list and short description of supplied fully-functional | |
164 | property classes. They are located in either props.h or advprops.h. | |
165 | ||
166 | @li @ref wxArrayStringProperty | |
167 | @li @ref wxBoolProperty | |
168 | @li @ref wxColourProperty | |
169 | @li @ref wxCursorProperty | |
170 | @li @ref wxDateProperty | |
171 | @li @ref wxDirProperty | |
172 | @li @ref wxEditEnumProperty | |
173 | @li @ref wxEnumProperty | |
174 | @li @ref wxFileProperty | |
175 | @li @ref wxFlagsProperty | |
176 | @li @ref wxFloatProperty | |
177 | @li @ref wxFontProperty | |
178 | @li @ref wxImageFileProperty | |
179 | @li @ref wxIntProperty | |
180 | @li @ref wxLongStringProperty | |
181 | @li @ref wxMultiChoiceProperty | |
182 | @li @ref wxPropertyCategory | |
183 | @li @ref wxStringProperty | |
184 | @li @ref wxSystemColourProperty | |
185 | @li @ref wxUIntProperty | |
186 | ||
187 | @subsection wxPropertyCategory | |
188 | ||
189 | Not an actual property per se, but a header for a group of properties. | |
190 | Regardless inherits from wxPGProperty. | |
191 | ||
192 | @subsection wxStringProperty | |
193 | ||
194 | Simple string property. wxPG_STRING_PASSWORD attribute may be used | |
195 | to echo value as asterisks and use wxTE_PASSWORD for wxTextCtrl. | |
196 | ||
bb6720bb JS |
197 | @remarks wxStringProperty has a special trait: if it has value of |
198 | "<composed>", and also has child properties, then its displayed | |
199 | value becomes composition of child property values, similar as | |
200 | with wxFontProperty, for instance. | |
1c4293cb VZ |
201 | |
202 | @subsection wxIntProperty | |
203 | ||
204 | Like wxStringProperty, but converts text to a signed long integer. | |
205 | wxIntProperty seamlessly supports 64-bit integers (ie. wxLongLong). | |
a6162a3e JS |
206 | To safely convert variant to integer, use code like this: |
207 | ||
208 | @code | |
209 | wxLongLong ll; | |
210 | ll << property->GetValue(); | |
211 | ||
212 | // or | |
213 | wxLongLong ll = propertyGrid->GetPropertyValueAsLong(property); | |
214 | @endcode | |
1c4293cb VZ |
215 | |
216 | @subsection wxUIntProperty | |
217 | ||
218 | Like wxIntProperty, but displays value as unsigned int. To set | |
219 | the prefix used globally, manipulate wxPG_UINT_PREFIX string attribute. | |
220 | To set the globally used base, manipulate wxPG_UINT_BASE int | |
221 | attribute. Regardless of current prefix, understands (hex) values starting | |
222 | with both "0x" and "$". | |
a6162a3e JS |
223 | Like wxIntProperty, wxUIntProperty seamlessly supports 64-bit unsigned |
224 | integers (ie. wxULongLong). Same wxVariant safety rules apply. | |
1c4293cb VZ |
225 | |
226 | @subsection wxFloatProperty | |
227 | ||
228 | Like wxStringProperty, but converts text to a double-precision floating point. | |
229 | Default float-to-text precision is 6 decimals, but this can be changed | |
230 | by modifying wxPG_FLOAT_PRECISION attribute. | |
231 | ||
232 | @subsection wxBoolProperty | |
233 | ||
234 | Represents a boolean value. wxChoice is used as editor control, by the | |
235 | default. wxPG_BOOL_USE_CHECKBOX attribute can be set to true inorder to use | |
236 | check box instead. | |
237 | ||
238 | @subsection wxLongStringProperty | |
239 | ||
240 | Like wxStringProperty, but has a button that triggers a small text editor | |
241 | dialog. Note that in long string values, tabs are represented by "\t" and | |
242 | line break by "\n". | |
243 | ||
3a89adc1 JS |
244 | To display custom dialog on button press, you can subclass |
245 | wxLongStringProperty and implement OnButtonClick, like this: | |
246 | ||
247 | @code | |
248 | virtual bool OnButtonClick( wxPropertyGrid* propGrid, wxString& value ) | |
249 | { | |
3a89adc1 JS |
250 | wxSize dialogSize(...size of your dialog...); |
251 | ||
252 | wxPoint dlgPos = propGrid->GetGoodEditorDialogPosition(this, | |
253 | dialogSize) | |
254 | ||
255 | // Create dialog dlg at dlgPos. Use value as initial string | |
256 | // value. | |
257 | ... | |
258 | ||
259 | if ( dlg.ShowModal() == wxID_OK ) | |
260 | { | |
261 | value = dlg.GetStringValue); | |
262 | return true; | |
263 | } | |
264 | return false; | |
265 | } | |
266 | @endcode | |
267 | ||
268 | Also, if you wish not to have line breaks and tabs translated to | |
269 | escape sequences, then do following in constructor of your subclass: | |
270 | ||
271 | @code | |
272 | m_flags |= wxPG_PROP_NO_ESCAPE; | |
273 | @endcode | |
274 | ||
1c4293cb VZ |
275 | @subsection wxDirProperty |
276 | ||
277 | Like wxLongStringProperty, but the button triggers dir selector instead. | |
278 | Supported properties (all with string value): wxPG_DIR_DIALOG_MESSAGE. | |
279 | ||
280 | @subsection wxFileProperty | |
281 | ||
282 | Like wxLongStringProperty, but the button triggers file selector instead. | |
283 | Default wildcard is "All files..." but this can be changed by setting | |
284 | wxPG_FILE_WILDCARD attribute (see wxFileDialog for format details). | |
0ad10f30 | 285 | Attribute wxPG_FILE_SHOW_FULL_PATH can be set to @false inorder to show |
1c4293cb VZ |
286 | only the filename, not the entire path. |
287 | ||
288 | @subsection wxEnumProperty | |
289 | ||
290 | Represents a single selection from a list of choices - | |
291 | wxOwnerDrawnComboBox is used to edit the value. | |
292 | ||
293 | @subsection wxFlagsProperty | |
294 | ||
295 | Represents a bit set that fits in a long integer. wxBoolProperty sub-properties | |
296 | are created for editing individual bits. Textctrl is created to manually edit | |
297 | the flags as a text; a continous sequence of spaces, commas and semicolons | |
298 | is considered as a flag id separator. | |
299 | <b>Note: </b> When changing "choices" (ie. flag labels) of wxFlagsProperty, you | |
939d9364 JS |
300 | will need to use wxPGProperty::SetChoices() - otherwise they will not get updated |
301 | properly. | |
1c4293cb VZ |
302 | |
303 | @subsection wxArrayStringProperty | |
304 | ||
305 | Allows editing of a list of strings in wxTextCtrl and in a separate dialog. | |
306 | ||
307 | @subsection wxDateProperty | |
308 | ||
309 | wxDateTime property. Default editor is DatePickerCtrl, altough TextCtrl | |
310 | should work as well. wxPG_DATE_FORMAT attribute can be used to change | |
311 | string wxDateTime::Format uses (altough default is recommended as it is | |
312 | locale-dependant), and wxPG_DATE_PICKER_STYLE allows changing window | |
313 | style given to DatePickerCtrl (default is wxDP_DEFAULT|wxDP_SHOWCENTURY). | |
b6fd0b42 | 314 | Using wxDP_ALLOWNONE will enable better unspecified value support. |
1c4293cb VZ |
315 | |
316 | @subsection wxEditEnumProperty | |
317 | ||
318 | Represents a string that can be freely edited or selected from list of choices - | |
319 | custom combobox control is used to edit the value. | |
320 | ||
321 | @subsection wxMultiChoiceProperty | |
322 | ||
323 | Allows editing a multiple selection from a list of strings. This is | |
324 | property is pretty much built around concept of wxMultiChoiceDialog. | |
325 | It uses wxArrayString value. | |
326 | ||
327 | @subsection wxImageFileProperty | |
328 | ||
329 | Like wxFileProperty, but has thumbnail of the image in front of | |
330 | the filename and autogenerates wildcard from available image handlers. | |
331 | ||
332 | @subsection wxColourProperty | |
333 | ||
334 | <b>Useful alternate editor:</b> Choice. | |
335 | ||
336 | Represents wxColour. wxButton is used to trigger a colour picker dialog. | |
d61d8cff JS |
337 | There are various sub-classing opportunities with this class. See |
338 | below in wxSystemColourProperty section for details. | |
1c4293cb VZ |
339 | |
340 | @subsection wxFontProperty | |
341 | ||
342 | Represents wxFont. Various sub-properties are used to edit individual | |
343 | subvalues. | |
344 | ||
345 | @subsection wxSystemColourProperty | |
346 | ||
347 | Represents wxColour and a system colour index. wxChoice is used to edit | |
348 | the value. Drop-down list has color images. Note that value type | |
d61d8cff JS |
349 | is wxColourPropertyValue instead of wxColour (which wxColourProperty |
350 | uses). | |
351 | ||
1c4293cb VZ |
352 | @code |
353 | class wxColourPropertyValue : public wxObject | |
354 | { | |
355 | public: | |
356 | // An integer value relating to the colour, and which exact | |
357 | // meaning depends on the property with which it is used. | |
358 | // | |
359 | // For wxSystemColourProperty: | |
360 | // Any of wxSYS_COLOUR_XXX, or any web-colour ( use wxPG_TO_WEB_COLOUR | |
361 | // macro - (currently unsupported) ), or wxPG_COLOUR_CUSTOM. | |
362 | wxUint32 m_type; | |
363 | ||
364 | // Resulting colour. Should be correct regardless of type. | |
365 | wxColour m_colour; | |
366 | }; | |
367 | @endcode | |
0ad10f30 | 368 | |
d61d8cff JS |
369 | in wxSystemColourProperty, and its derived class wxColourProperty, there |
370 | are various sub-classing features. To set basic list list of colour | |
371 | names, call wxPGProperty::SetChoices(). | |
372 | ||
373 | @code | |
374 | // Override in derived class to customize how colours are translated | |
375 | // to strings. | |
376 | virtual wxString ColourToString( const wxColour& col, int index ) const; | |
377 | ||
378 | // Returns index of entry that triggers colour picker dialog | |
379 | // (default is last). | |
380 | virtual int GetCustomColourIndex() const; | |
381 | ||
382 | // Helper function to show the colour dialog | |
383 | bool QueryColourFromUser( wxVariant& variant ) const; | |
384 | ||
385 | // Returns colour for given choice. | |
386 | // Default function returns wxSystemSettings::GetColour(index). | |
387 | virtual wxColour GetColour( int index ) const; | |
388 | @endcode | |
1c4293cb VZ |
389 | |
390 | @subsection wxCursorProperty | |
391 | ||
392 | Represents a wxCursor. wxChoice is used to edit the value. | |
393 | Drop-down list has cursor images under some (wxMSW) platforms. | |
394 | ||
395 | ||
396 | @section pgproperty_creating Creating Custom Properties | |
397 | ||
398 | New properties can be created by subclassing wxPGProperty or one | |
399 | of the provided property classes, and (re)implementing necessary | |
400 | member functions. Below, each virtual member function has ample | |
401 | documentation about its purpose and any odd details which to keep | |
402 | in mind. | |
403 | ||
404 | Here is a very simple 'template' code: | |
405 | ||
406 | @code | |
407 | class MyProperty : public wxPGProperty | |
408 | { | |
409 | public: | |
410 | // All arguments of ctor must have a default value - | |
411 | // use wxPG_LABEL for label and name | |
412 | MyProperty( const wxString& label = wxPG_LABEL, | |
413 | const wxString& name = wxPG_LABEL, | |
414 | const wxString& value = wxEmptyString ) | |
415 | { | |
416 | // m_value is wxVariant | |
417 | m_value = value; | |
418 | } | |
419 | ||
420 | virtual ~MyProperty() { } | |
421 | ||
422 | const wxPGEditor* DoGetEditorClass() const | |
423 | { | |
424 | // Determines editor used by property. | |
425 | // You can replace 'TextCtrl' below with any of these | |
426 | // builtin-in property editor identifiers: Choice, ComboBox, | |
427 | // TextCtrlAndButton, ChoiceAndButton, CheckBox, SpinCtrl, | |
428 | // DatePickerCtrl. | |
429 | return wxPGEditor_TextCtrl; | |
430 | } | |
431 | ||
1425eca5 JS |
432 | virtual wxString ValueToString( wxVariant& value, |
433 | int argFlags ) const | |
1c4293cb | 434 | { |
1425eca5 | 435 | // TODO: Convert given property value to a string |
1c4293cb VZ |
436 | } |
437 | ||
438 | virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags ) | |
439 | { | |
440 | // TODO: Adapt string to property value. | |
441 | } | |
442 | ||
443 | protected: | |
444 | }; | |
445 | @endcode | |
446 | ||
447 | Since wxPGProperty derives from wxObject, you can use standard | |
448 | DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS macros. From the | |
449 | above example they were omitted for sake of simplicity, and besides, | |
450 | they are only really needed if you need to use wxRTTI with your | |
451 | property class. | |
452 | ||
0372d42e JS |
453 | You can change the 'value type' of a property by simply assigning different |
454 | type of variant with SetValue. <b>It is mandatory to implement | |
455 | wxVariantData class for all data types used as property values.</b> | |
456 | You can use macros declared in wxPropertyGrid headers. For instance: | |
1c4293cb VZ |
457 | |
458 | @code | |
459 | // In header file: | |
0372d42e JS |
460 | // (If you need to have export declaration, use version of macros |
461 | // with _EXPORTED postfix) | |
462 | WX_PG_DECLARE_VARIANT_DATA(MyDataClass) | |
1c4293cb VZ |
463 | |
464 | // In sources file: | |
0372d42e JS |
465 | WX_PG_IMPLEMENT_VARIANT_DATA(MyDataClass) |
466 | ||
467 | // Or, if you don't have valid == operator: | |
468 | WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(MyDataClass) | |
1c4293cb VZ |
469 | @endcode |
470 | ||
471 | @library{wxpropgrid} | |
472 | @category{propgrid} | |
473 | */ | |
474 | class wxPGProperty : public wxObject | |
475 | { | |
476 | public: | |
477 | typedef wxUint32 FlagType; | |
478 | ||
bb6720bb JS |
479 | /** |
480 | Default constructor. | |
1c4293cb VZ |
481 | */ |
482 | wxPGProperty(); | |
483 | ||
bb6720bb JS |
484 | /** |
485 | Constructor. | |
1c4293cb VZ |
486 | Non-abstract property classes should have constructor of this style: |
487 | ||
488 | @code | |
489 | ||
bb6720bb | 490 | MyProperty( const wxString& label, const wxString& name, const T& value ) |
1c4293cb VZ |
491 | : wxPGProperty() |
492 | { | |
493 | // Generally recommended way to set the initial value | |
494 | // (as it should work in pretty much 100% of cases). | |
495 | wxVariant variant; | |
496 | variant << value; | |
497 | SetValue(variant); | |
498 | ||
499 | // If has private child properties then create them here. For example: | |
500 | // AddChild( new wxStringProperty( "Subprop 1", wxPG_LABEL, value.GetSubProp1() ) ); | |
501 | } | |
502 | ||
503 | @endcode | |
504 | */ | |
505 | wxPGProperty( const wxString& label, const wxString& name ); | |
506 | ||
bb6720bb JS |
507 | /** |
508 | Virtual destructor. It is customary for derived properties to implement this. | |
509 | */ | |
1c4293cb VZ |
510 | virtual ~wxPGProperty(); |
511 | ||
bb6720bb JS |
512 | /** |
513 | This virtual function is called after m_value has been set. | |
1c4293cb VZ |
514 | |
515 | @remarks | |
516 | - If m_value was set to Null variant (ie. unspecified value), OnSetValue() | |
517 | will not be called. | |
518 | - m_value may be of any variant type. Typically properties internally support only | |
519 | one variant type, and as such OnSetValue() provides a good opportunity to convert | |
520 | supported values into internal type. | |
521 | - Default implementation does nothing. | |
522 | */ | |
523 | virtual void OnSetValue(); | |
524 | ||
bb6720bb JS |
525 | /** |
526 | Override this to return something else than m_value as the value. | |
1c4293cb | 527 | */ |
0ad10f30 | 528 | virtual wxVariant DoGetValue() const; |
1c4293cb | 529 | |
bb6720bb JS |
530 | /** |
531 | Implement this function in derived class to check the value. | |
0ad10f30 | 532 | Return @true if it is ok. Returning @false prevents property change events |
1c4293cb VZ |
533 | from occurring. |
534 | ||
535 | @remarks | |
0ad10f30 | 536 | - Default implementation always returns @true. |
1c4293cb VZ |
537 | */ |
538 | virtual bool ValidateValue( wxVariant& value, wxPGValidationInfo& validationInfo ) const; | |
539 | ||
bb6720bb | 540 | /** |
9e6bebdc JS |
541 | Converts text into wxVariant value appropriate for this property. |
542 | ||
543 | @param variant | |
544 | On function entry this is the old value (should not be wxNullVariant | |
545 | in normal cases). Translated value must be assigned back to it. | |
546 | ||
547 | @param text | |
548 | Text to be translated into variant. | |
549 | ||
1c4293cb | 550 | @param argFlags |
9e6bebdc JS |
551 | If wxPG_FULL_VALUE is set, returns complete, storable value instead |
552 | of displayable one (they may be different). | |
553 | If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of | |
1425eca5 | 554 | composite property string value (as generated by ValueToString() |
9e6bebdc | 555 | called with this same flag). |
1c4293cb | 556 | |
9e6bebdc JS |
557 | @return Returns @true if resulting wxVariant value was different. |
558 | ||
559 | @remarks Default implementation converts semicolon delimited tokens into | |
560 | child values. Only works for properties with children. | |
561 | ||
562 | You might want to take into account that m_value is Null variant | |
563 | if property value is unspecified (which is usually only case if | |
564 | you explicitly enabled that sort behavior). | |
1c4293cb VZ |
565 | */ |
566 | virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const; | |
567 | ||
bb6720bb | 568 | /** |
9e6bebdc JS |
569 | Converts integer (possibly a choice selection) into wxVariant value |
570 | appropriate for this property. | |
571 | ||
572 | @param variant | |
573 | On function entry this is the old value (should not be wxNullVariant | |
574 | in normal cases). Translated value must be assigned back to it. | |
9e6bebdc JS |
575 | @param number |
576 | Integer to be translated into variant. | |
1c4293cb | 577 | @param argFlags |
9e6bebdc JS |
578 | If wxPG_FULL_VALUE is set, returns complete, storable value instead |
579 | of displayable one. | |
580 | ||
581 | @return Returns @true if resulting wxVariant value was different. | |
1c4293cb VZ |
582 | |
583 | @remarks | |
584 | - If property is not supposed to use choice or spinctrl or other editor | |
585 | with int-based value, it is not necessary to implement this method. | |
586 | - Default implementation simply assign given int to m_value. | |
9e6bebdc JS |
587 | - If property uses choice control, and displays a dialog on some choice |
588 | items, then it is preferred to display that dialog in IntToValue | |
589 | instead of OnEvent. | |
0ad10f30 | 590 | - You might want to take into account that m_value is Mull variant if |
9e6bebdc JS |
591 | property value is unspecified (which is usually only case if you |
592 | explicitly enabled that sort behavior). | |
1c4293cb | 593 | */ |
0ad10f30 | 594 | virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const; |
1c4293cb | 595 | |
bb6720bb | 596 | /** |
1425eca5 | 597 | Converts property value into a text representation. |
1c4293cb | 598 | |
1425eca5 JS |
599 | @param value |
600 | Value to be converted. | |
1425eca5 JS |
601 | @param argFlags |
602 | If 0 (default value), then displayed string is returned. | |
603 | If wxPG_FULL_VALUE is set, returns complete, storable string value | |
604 | instead of displayable. If wxPG_EDITABLE_VALUE is set, returns | |
0ad10f30 FM |
605 | string value that must be editable in textctrl. |
606 | If wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to | |
607 | display as a part of string property's composite text representation. | |
1425eca5 JS |
608 | |
609 | @remarks Default implementation calls GenerateComposedValue(). | |
1c4293cb | 610 | */ |
1425eca5 | 611 | virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; |
1c4293cb | 612 | |
bb6720bb JS |
613 | /** |
614 | Converts string to a value, and if successful, calls SetValue() on it. | |
1c4293cb | 615 | Default behavior is to do nothing. |
0ad10f30 | 616 | |
1c4293cb | 617 | @param text |
0ad10f30 FM |
618 | String to get the value from. |
619 | @param flags | |
620 | @todo docme | |
621 | ||
622 | @return @true if value was changed. | |
1c4293cb VZ |
623 | */ |
624 | bool SetValueFromString( const wxString& text, int flags = 0 ); | |
625 | ||
bb6720bb JS |
626 | /** |
627 | Converts integer to a value, and if succesful, calls SetValue() on it. | |
1c4293cb | 628 | Default behavior is to do nothing. |
0ad10f30 | 629 | |
1c4293cb | 630 | @param value |
0ad10f30 | 631 | Int to get the value from. |
1c4293cb | 632 | @param flags |
0ad10f30 FM |
633 | If has wxPG_FULL_VALUE, then the value given is a actual value and not an index. |
634 | ||
635 | @return @true if value was changed. | |
1c4293cb VZ |
636 | */ |
637 | bool SetValueFromInt( long value, int flags = 0 ); | |
638 | ||
bb6720bb JS |
639 | /** |
640 | Returns size of the custom painted image in front of property. This method | |
1c4293cb VZ |
641 | must be overridden to return non-default value if OnCustomPaint is to be |
642 | called. | |
0ad10f30 | 643 | |
1c4293cb | 644 | @param item |
0ad10f30 FM |
645 | Normally -1, but can be an index to the property's list of items. |
646 | ||
1c4293cb VZ |
647 | @remarks |
648 | - Default behavior is to return wxSize(0,0), which means no image. | |
649 | - Default image width or height is indicated with dimension -1. | |
650 | - You can also return wxPG_DEFAULT_IMAGE_SIZE which equals wxSize(-1, -1). | |
651 | */ | |
652 | virtual wxSize OnMeasureImage( int item = -1 ) const; | |
653 | ||
bb6720bb JS |
654 | /** |
655 | Events received by editor widgets are processed here. Note that editor class | |
1c4293cb VZ |
656 | usually processes most events. Some, such as button press events of |
657 | TextCtrlAndButton class, can be handled here. Also, if custom handling | |
658 | for regular events is desired, then that can also be done (for example, | |
659 | wxSystemColourProperty custom handles wxEVT_COMMAND_CHOICE_SELECTED | |
660 | to display colour picker dialog when 'custom' selection is made). | |
661 | ||
0ad10f30 FM |
662 | If the event causes value to be changed, SetValueInEvent() should be called |
663 | to set the new value. | |
664 | ||
665 | The parameter @a event is the associated wxEvent. | |
1c4293cb | 666 | |
1c4293cb | 667 | @retval |
0ad10f30 FM |
668 | Should return @true if any changes in value should be reported. |
669 | ||
1c4293cb VZ |
670 | @remarks |
671 | - If property uses choice control, and displays a dialog on some choice items, | |
672 | then it is preferred to display that dialog in IntToValue instead of OnEvent. | |
673 | */ | |
674 | virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* wnd_primary, wxEvent& event ); | |
675 | ||
bb6720bb JS |
676 | /** |
677 | Called after value of a child property has been altered. Note that this function is | |
1c4293cb VZ |
678 | usually called at the time that value of this property, or given child property, is |
679 | still pending for change. | |
680 | ||
681 | Sample pseudo-code implementation: | |
682 | ||
683 | @code | |
684 | void MyProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const | |
685 | { | |
686 | // Acquire reference to actual type of data stored in variant | |
687 | // (TFromVariant only exists if wxPropertyGrid's wxVariant-macros were used to create | |
688 | // the variant class). | |
689 | T& data = TFromVariant(thisValue); | |
690 | ||
691 | // Copy childValue into data. | |
692 | switch ( childIndex ) | |
693 | { | |
694 | case 0: | |
695 | data.SetSubProp1( childvalue.GetLong() ); | |
696 | break; | |
697 | case 1: | |
698 | data.SetSubProp2( childvalue.GetString() ); | |
699 | break; | |
700 | ... | |
701 | } | |
702 | } | |
703 | @endcode | |
704 | ||
705 | @param thisValue | |
0ad10f30 | 706 | Value of this property, that should be altered. |
1c4293cb | 707 | @param childIndex |
0ad10f30 | 708 | Index of child changed (you can use Item(childIndex) to get). |
1c4293cb | 709 | @param childValue |
0ad10f30 | 710 | Value of the child property. |
1c4293cb VZ |
711 | */ |
712 | virtual void ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const; | |
713 | ||
bb6720bb JS |
714 | /** |
715 | Returns pointer to an instance of used editor. | |
1c4293cb VZ |
716 | */ |
717 | virtual const wxPGEditor* DoGetEditorClass() const; | |
718 | ||
bb6720bb JS |
719 | /** |
720 | Returns pointer to the wxValidator that should be used | |
0ad10f30 | 721 | with the editor of this property (@NULL for no validator). |
1c4293cb VZ |
722 | Setting validator explicitly via SetPropertyValidator |
723 | will override this. | |
724 | ||
725 | In most situations, code like this should work well | |
726 | (macros are used to maintain one actual validator instance, | |
727 | so on the second call the function exits within the first | |
728 | macro): | |
729 | ||
730 | @code | |
731 | ||
732 | wxValidator* wxMyPropertyClass::DoGetValidator () const | |
733 | { | |
734 | WX_PG_DOGETVALIDATOR_ENTRY() | |
735 | ||
736 | wxMyValidator* validator = new wxMyValidator(...); | |
737 | ||
738 | ... prepare validator... | |
739 | ||
740 | WX_PG_DOGETVALIDATOR_EXIT(validator) | |
741 | } | |
742 | ||
743 | @endcode | |
744 | ||
745 | @remarks | |
746 | You can get common filename validator by returning | |
747 | wxFileProperty::GetClassValidator(). wxDirProperty, | |
748 | for example, uses it. | |
749 | */ | |
750 | virtual wxValidator* DoGetValidator () const; | |
751 | ||
bb6720bb JS |
752 | /** |
753 | Override to paint an image in front of the property value text or drop-down | |
1c4293cb VZ |
754 | list item (but only if wxPGProperty::OnMeasureImage is overridden as well). |
755 | ||
756 | If property's OnMeasureImage() returns size that has height != 0 but less than | |
757 | row height ( < 0 has special meanings), wxPropertyGrid calls this method to | |
758 | draw a custom image in a limited area in front of the editor control or | |
759 | value text/graphics, and if control has drop-down list, then the image is | |
760 | drawn there as well (even in the case OnMeasureImage() returned higher height | |
761 | than row height). | |
762 | ||
763 | NOTE: Following applies when OnMeasureImage() returns a "flexible" height ( | |
764 | using wxPG_FLEXIBLE_SIZE(W,H) macro), which implies variable height items: | |
765 | If rect.x is < 0, then this is a measure item call, which means that | |
766 | dc is invalid and only thing that should be done is to set paintdata.m_drawnHeight | |
767 | to the height of the image of item at index paintdata.m_choiceItem. This call | |
768 | may be done even as often as once every drop-down popup show. | |
769 | ||
770 | @param dc | |
771 | wxDC to paint on. | |
772 | @param rect | |
773 | Box reserved for custom graphics. Includes surrounding rectangle, if any. | |
774 | If x is < 0, then this is a measure item call (see above). | |
775 | @param paintdata | |
e342075f JS |
776 | wxPGPaintData structure with much useful data about painted item. |
777 | @code | |
778 | struct wxPGPaintData | |
779 | { | |
780 | // wxPropertyGrid. | |
781 | const wxPropertyGrid* m_parent; | |
782 | ||
783 | // Normally -1, otherwise index to drop-down list item that has to be drawn. | |
784 | int m_choiceItem; | |
785 | ||
786 | // Set to drawn width in OnCustomPaint (optional). | |
787 | int m_drawnWidth; | |
788 | ||
789 | // In a measure item call, set this to the height of item at m_choiceItem index | |
939d9364 | 790 | int m_drawnHeight; |
e342075f JS |
791 | }; |
792 | @endcode | |
1c4293cb VZ |
793 | |
794 | @remarks | |
795 | - You can actually exceed rect width, but if you do so then paintdata.m_drawnWidth | |
796 | must be set to the full width drawn in pixels. | |
797 | - Due to technical reasons, rect's height will be default even if custom height | |
798 | was reported during measure call. | |
799 | - Brush is guaranteed to be default background colour. It has been already used to | |
800 | clear the background of area being painted. It can be modified. | |
801 | - Pen is guaranteed to be 1-wide 'black' (or whatever is the proper colour) pen for | |
802 | drawing framing rectangle. It can be changed as well. | |
803 | ||
1425eca5 | 804 | @see ValueToString() |
1c4293cb VZ |
805 | */ |
806 | virtual void OnCustomPaint( wxDC& dc, const wxRect& rect, wxPGPaintData& paintdata ); | |
807 | ||
bb6720bb JS |
808 | /** |
809 | Returns used wxPGCellRenderer instance for given property column (label=0, value=1). | |
1c4293cb VZ |
810 | |
811 | Default implementation returns editor's renderer for all columns. | |
812 | */ | |
813 | virtual wxPGCellRenderer* GetCellRenderer( int column ) const; | |
814 | ||
bb6720bb JS |
815 | /** |
816 | Returns which choice is currently selected. Only applies to properties | |
939d9364 JS |
817 | which have choices. |
818 | ||
819 | Needs to reimplemented in derived class if property value does not | |
820 | map directly to a choice. Integer as index, bool, and string usually do. | |
821 | */ | |
822 | virtual int GetChoiceSelection() const; | |
823 | ||
bb6720bb JS |
824 | /** |
825 | Refresh values of child properties. Automatically called after value is set. | |
1c4293cb VZ |
826 | */ |
827 | virtual void RefreshChildren(); | |
828 | ||
bb6720bb JS |
829 | /** |
830 | Special handling for attributes of this property. | |
1c4293cb | 831 | |
0ad10f30 | 832 | If returns @false, then the attribute will be automatically stored in |
1c4293cb VZ |
833 | m_attributes. |
834 | ||
0ad10f30 | 835 | Default implementation simply returns @false. |
1c4293cb VZ |
836 | */ |
837 | virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); | |
838 | ||
bb6720bb JS |
839 | /** |
840 | Returns value of an attribute. | |
1c4293cb VZ |
841 | |
842 | Override if custom handling of attributes is needed. | |
843 | ||
0ad10f30 | 844 | Default implementation simply return @NULL variant. |
1c4293cb VZ |
845 | */ |
846 | virtual wxVariant DoGetAttribute( const wxString& name ) const; | |
847 | ||
bb6720bb JS |
848 | /** |
849 | Returns instance of a new wxPGEditorDialogAdapter instance, which is | |
1c4293cb VZ |
850 | used when user presses the (optional) button next to the editor control; |
851 | ||
0ad10f30 | 852 | Default implementation returns @NULL (ie. no action is generated when |
1c4293cb VZ |
853 | button is pressed). |
854 | */ | |
855 | virtual wxPGEditorDialogAdapter* GetEditorDialog() const; | |
856 | ||
d8812c6e JS |
857 | /** |
858 | Called whenever validation has failed with given pending value. | |
859 | ||
860 | @remarks If you implement this in your custom property class, please | |
861 | remember to call the baser implementation as well, since they | |
862 | may use it to revert property into pre-change state. | |
863 | */ | |
864 | virtual void OnValidationFailure( wxVariant& pendingValue ); | |
865 | ||
bb6720bb JS |
866 | /** |
867 | Append a new choice to property's list of choices. | |
939d9364 JS |
868 | |
869 | @param label | |
870 | Label for added choice. | |
871 | ||
872 | @param value | |
873 | Value for new choice. Do not specify if you wish this | |
874 | to equal choice index. | |
875 | ||
876 | @return | |
877 | Index to added choice. | |
878 | */ | |
879 | int AddChoice( const wxString& label, int value = wxPG_INVALID_VALUE ); | |
880 | ||
bb6720bb | 881 | /** |
2fd4a524 JS |
882 | Adds a child property. If you use this instead of |
883 | wxPropertyGridInterface::Insert() or | |
884 | wxPropertyGridInterface::AppendIn(), then you must set up | |
885 | property's parental type before making the call. To do this, | |
886 | call property's SetParentalType() function with either | |
887 | wxPG_PROP_MISC_PARENT (normal, public children) or with | |
888 | wxPG_PROP_AGGREGATE (private children for subclassed property). | |
889 | For instance: | |
890 | ||
891 | @code | |
892 | wxPGProperty* prop = new wxStringProperty(wxS("Property")); | |
893 | prop->SetParentalType(wxPG_PROP_MISC_PARENT); | |
894 | wxPGProperty* prop2 = new wxStringProperty(wxS("Property2")); | |
895 | prop->AddChild(prop2); | |
896 | @endcode | |
bb6720bb JS |
897 | */ |
898 | void AddChild( wxPGProperty* property ); | |
899 | ||
900 | /** | |
901 | Adapts list variant into proper value using consecutive | |
902 | ChildChanged() calls. | |
903 | */ | |
904 | void AdaptListToValue( wxVariant& list, wxVariant* value ) const; | |
905 | ||
906 | /** | |
907 | Determines, recursively, if all children are not unspecified. | |
908 | ||
909 | @param pendingList | |
910 | Assumes members in this wxVariant list as pending | |
911 | replacement values. | |
912 | */ | |
913 | bool AreAllChildrenSpecified( wxVariant* pendingList = NULL ) const; | |
914 | ||
915 | /** | |
0ad10f30 | 916 | Returns @true if children of this property are component values (for instance, |
1c4293cb VZ |
917 | points size, face name, and is_underlined are component values of a font). |
918 | */ | |
0ad10f30 | 919 | bool AreChildrenComponents() const; |
1c4293cb | 920 | |
91c818f8 JS |
921 | /** |
922 | Deletes children of the property. | |
923 | */ | |
924 | void DeleteChildren(); | |
925 | ||
bb6720bb JS |
926 | /** |
927 | Removes entry from property's wxPGChoices and editor control (if it is active). | |
1c4293cb VZ |
928 | |
929 | If selected item is deleted, then the value is set to unspecified. | |
930 | */ | |
931 | void DeleteChoice( int index ); | |
932 | ||
bb6720bb JS |
933 | /** Deletes all child properties. */ |
934 | void Empty(); | |
935 | ||
1425eca5 | 936 | /** |
c82a80e8 | 937 | Composes text from values of child properties. |
1425eca5 | 938 | */ |
c82a80e8 | 939 | wxString GenerateComposedValue() const; |
1c4293cb | 940 | |
bb6720bb JS |
941 | /** |
942 | Returns property attribute value, null variant if not found. | |
943 | */ | |
944 | wxVariant GetAttribute( const wxString& name ) const; | |
1c4293cb | 945 | |
bb6720bb JS |
946 | /** Returns named attribute, as string, if found. Otherwise defVal is returned. |
947 | */ | |
948 | wxString GetAttribute( const wxString& name, const wxString& defVal ) const; | |
1c4293cb | 949 | |
bb6720bb | 950 | /** Returns named attribute, as long, if found. Otherwise defVal is returned. |
939d9364 | 951 | */ |
bb6720bb | 952 | long GetAttributeAsLong( const wxString& name, long defVal ) const; |
1c4293cb | 953 | |
bb6720bb | 954 | /** Returns named attribute, as double, if found. Otherwise defVal is returned. |
1c4293cb | 955 | */ |
bb6720bb | 956 | double GetAttributeAsDouble( const wxString& name, double defVal ) const; |
1c4293cb | 957 | |
bb6720bb JS |
958 | /** |
959 | Returns attributes as list wxVariant. | |
960 | */ | |
961 | wxVariant GetAttributesAsList() const; | |
1c4293cb | 962 | |
bb6720bb | 963 | /** |
0ad10f30 | 964 | Returns editor used for given column. @NULL for no editor. |
1c4293cb | 965 | */ |
0ad10f30 | 966 | const wxPGEditor* GetColumnEditor( int column ) const; |
1c4293cb | 967 | |
bb6720bb | 968 | /** Returns property's base name (ie. parent's name is not added in any case) */ |
0ad10f30 | 969 | const wxString& GetBaseName() const; |
1c4293cb | 970 | |
bb6720bb | 971 | /** |
d7e2b522 | 972 | Returns wxPGCell of given column. |
1c4293cb | 973 | */ |
d7e2b522 | 974 | const wxPGCell& GetCell( unsigned int column ) const; |
1c4293cb | 975 | |
bb6720bb JS |
976 | /** |
977 | Returns number of child properties. | |
978 | */ | |
979 | unsigned int GetChildCount() const; | |
980 | ||
981 | /** | |
982 | Returns height of children, recursively, and | |
983 | by taking expanded/collapsed status into account. | |
984 | ||
985 | @param lh | |
986 | Line height. Pass result of GetGrid()->GetRowHeight() here. | |
987 | ||
988 | @param iMax | |
989 | Only used (internally) when finding property y-positions. | |
990 | */ | |
991 | int GetChildrenHeight( int lh, int iMax = -1 ) const; | |
992 | ||
993 | /** | |
994 | Returns read-only reference to property's list of choices. | |
995 | */ | |
996 | const wxPGChoices& GetChoices() const; | |
997 | ||
998 | /** | |
999 | Returns client data (void*) of a property. | |
1000 | */ | |
1001 | void* GetClientData() const; | |
1002 | ||
1003 | /** Sets managed client object of a property. | |
1004 | */ | |
1005 | wxClientData *GetClientObject() const; | |
1006 | ||
1007 | /** | |
1008 | Returns property's default value. If property's value type is not | |
1009 | a built-in one, and "DefaultValue" attribute is not defined, then | |
1010 | this function usually returns Null variant. | |
1011 | */ | |
1012 | wxVariant GetDefaultValue() const; | |
1013 | ||
40924780 | 1014 | /** Returns property's displayed text. |
bb6720bb | 1015 | */ |
0ad10f30 | 1016 | wxString GetDisplayedString() const; |
1c4293cb | 1017 | |
bb6720bb JS |
1018 | /** |
1019 | Returns wxPGEditor that will be used and created when | |
1020 | property becomes selected. Returns more accurate value | |
1021 | than DoGetEditorClass(). | |
1022 | */ | |
1023 | const wxPGEditor* GetEditorClass() const; | |
1024 | ||
1c4293cb VZ |
1025 | /** Returns property grid where property lies. */ |
1026 | wxPropertyGrid* GetGrid() const; | |
1027 | ||
bb6720bb JS |
1028 | /** |
1029 | Returns owner wxPropertyGrid, but only if one is currently on a page | |
1030 | displaying this property. | |
1031 | */ | |
1c4293cb VZ |
1032 | wxPropertyGrid* GetGridIfDisplayed() const; |
1033 | ||
bb6720bb JS |
1034 | /** |
1035 | Returns property's help or description text. | |
1036 | ||
1037 | @see SetHelpString() | |
1c4293cb | 1038 | */ |
bb6720bb | 1039 | const wxString& GetHelpString() const; |
1c4293cb | 1040 | |
bb6720bb JS |
1041 | /** |
1042 | Returns position in parent's array. | |
1043 | */ | |
1044 | unsigned int GetIndexInParent() const; | |
1c4293cb | 1045 | |
bb6720bb | 1046 | /** Returns property's label. */ |
0ad10f30 | 1047 | const wxString& GetLabel() const; |
1c4293cb | 1048 | |
bb6720bb JS |
1049 | /** |
1050 | Returns last visible child property, recursively. | |
1c4293cb | 1051 | */ |
bb6720bb | 1052 | const wxPGProperty* GetLastVisibleSubItem() const; |
1c4293cb | 1053 | |
bb6720bb JS |
1054 | /** |
1055 | Returns highest level non-category, non-root parent. Useful when you | |
17e3ad2a | 1056 | have nested properties with children. |
1c4293cb | 1057 | |
bb6720bb JS |
1058 | @remarks If immediate parent is root or category, this will return the |
1059 | property itself. | |
1060 | */ | |
1061 | wxPGProperty* GetMainParent() const; | |
1c4293cb | 1062 | |
bb6720bb | 1063 | /** Returns maximum allowed length of property's text value. |
1c4293cb | 1064 | */ |
0ad10f30 | 1065 | int GetMaxLength() const; |
1c4293cb | 1066 | |
bb6720bb JS |
1067 | /** Returns property's name with all (non-category, non-root) parents. */ |
1068 | wxString GetName() const; | |
1069 | ||
1070 | /** Return parent of property */ | |
0ad10f30 | 1071 | wxPGProperty* GetParent() const; |
bb6720bb JS |
1072 | |
1073 | /** | |
0ad10f30 | 1074 | Returns (direct) child property with given name (or @NULL if not found). |
1c4293cb | 1075 | */ |
bb6720bb JS |
1076 | wxPGProperty* GetPropertyByName( const wxString& name ) const; |
1077 | ||
1078 | /** Gets assignable version of property's validator. */ | |
1079 | wxValidator* GetValidator() const; | |
1c4293cb | 1080 | |
bb6720bb JS |
1081 | /** |
1082 | Returns property's value. | |
1083 | */ | |
0ad10f30 | 1084 | wxVariant GetValue() const; |
1c4293cb | 1085 | |
bb6720bb | 1086 | /** |
0ad10f30 | 1087 | Returns bitmap that appears next to value text. Only returns non-@NULL |
bb6720bb JS |
1088 | bitmap if one was set with SetValueImage(). |
1089 | */ | |
1090 | wxBitmap* GetValueImage() const; | |
1c4293cb | 1091 | |
1425eca5 JS |
1092 | /** Returns text representation of property's value. |
1093 | ||
1094 | @param argFlags | |
1095 | If 0 (default value), then displayed string is returned. | |
1096 | If wxPG_FULL_VALUE is set, returns complete, storable string value | |
1097 | instead of displayable. If wxPG_EDITABLE_VALUE is set, returns | |
1098 | string value that must be editable in textctrl. If | |
1099 | wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to | |
1100 | display as a part of string property's composite text | |
1101 | representation. | |
1102 | ||
1103 | @remarks In older versions, this function used to be overridden to convert | |
1104 | property's value into a string representation. This function is | |
1105 | now handled by ValueToString(), and overriding this function now | |
1106 | will result in run-time assertion failure. | |
1107 | */ | |
1108 | virtual wxString GetValueAsString( int argFlags = 0 ) const; | |
1109 | ||
1110 | /** Synonymous to GetValueAsString(). | |
1111 | ||
1112 | @deprecated Use GetValueAsString() instead. | |
bb6720bb JS |
1113 | |
1114 | @see GetValueAsString() | |
1115 | */ | |
1425eca5 | 1116 | wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const ); |
bb6720bb JS |
1117 | |
1118 | /** | |
1119 | Returns value type used by this property. | |
1120 | */ | |
0ad10f30 | 1121 | wxString GetValueType() const; |
1c4293cb | 1122 | |
bb6720bb JS |
1123 | /** |
1124 | Returns coordinate to the top y of the property. Note that the | |
1125 | position of scrollbars is not taken into account. | |
1c4293cb | 1126 | */ |
bb6720bb | 1127 | int GetY() const; |
1c4293cb | 1128 | |
bb6720bb | 1129 | /** |
0ad10f30 | 1130 | Returns @true if property has even one visible child. |
1c4293cb VZ |
1131 | */ |
1132 | bool HasVisibleChildren() const; | |
1133 | ||
bb6720bb JS |
1134 | /** |
1135 | Hides or reveals the property. | |
1136 | ||
1137 | @param hide | |
1138 | @true for hide, @false for reveal. | |
1139 | ||
1140 | @param flags | |
1141 | By default changes are applied recursively. Set this parameter wxPG_DONT_RECURSE to prevent this. | |
1142 | */ | |
1143 | bool Hide( bool hide, int flags = wxPG_RECURSE ); | |
1144 | ||
1145 | /** | |
1146 | Returns index of given child property. wxNOT_FOUND if | |
1147 | given property is not child of this. | |
1148 | */ | |
1149 | int Index( const wxPGProperty* p ) const; | |
1150 | ||
1151 | /** | |
1152 | Inserts a new choice to property's list of choices. | |
939d9364 JS |
1153 | |
1154 | @param label | |
1155 | Text for new choice | |
1156 | ||
1157 | @param index | |
1158 | Insertion position. Use wxNOT_FOUND to append. | |
1159 | ||
1160 | @param value | |
1161 | Value for new choice. Do not specify if you wish this | |
1162 | to equal choice index. | |
1c4293cb VZ |
1163 | */ |
1164 | int InsertChoice( const wxString& label, int index, int value = wxPG_INVALID_VALUE ); | |
1165 | ||
bb6720bb JS |
1166 | /** |
1167 | Returns @true if this property is actually a wxPropertyCategory. | |
1c4293cb | 1168 | */ |
bb6720bb | 1169 | bool IsCategory() const; |
1c4293cb | 1170 | |
bb6720bb JS |
1171 | /** |
1172 | Returns @true if property is enabled. | |
1c4293cb | 1173 | */ |
bb6720bb | 1174 | bool IsEnabled() const; |
1c4293cb | 1175 | |
bb6720bb JS |
1176 | /** |
1177 | Returns @true if property has visible children. | |
1c4293cb | 1178 | */ |
bb6720bb | 1179 | bool IsExpanded() const; |
1c4293cb | 1180 | |
bb6720bb JS |
1181 | /** |
1182 | Returns @true if this property is actually a wxRootProperty. | |
1c4293cb | 1183 | */ |
0ad10f30 | 1184 | bool IsRoot() const; |
1c4293cb | 1185 | |
bb6720bb JS |
1186 | /** |
1187 | Returns @true if candidateParent is some parent of this property. | |
1c4293cb | 1188 | */ |
bb6720bb | 1189 | bool IsSomeParent( wxPGProperty* candidateParent ) const; |
1c4293cb | 1190 | |
bb6720bb JS |
1191 | /** |
1192 | Returns true if property has editable wxTextCtrl when selected. | |
1c4293cb | 1193 | |
bb6720bb JS |
1194 | @remarks Altough disabled properties do not displayed editor, they still |
1195 | return @true here as being disabled is considered a temporary | |
1196 | condition (unlike being read-only or having limited editing enabled). | |
1c4293cb | 1197 | */ |
bb6720bb | 1198 | bool IsTextEditable() const; |
1c4293cb | 1199 | |
bb6720bb JS |
1200 | /** |
1201 | Returns @true if property's value is considered unspecified. This | |
1202 | usually means that value is Null variant. | |
1c4293cb | 1203 | */ |
bb6720bb | 1204 | bool IsValueUnspecified() const; |
1c4293cb | 1205 | |
bb6720bb JS |
1206 | /** |
1207 | Returns true if all parents expanded. | |
1c4293cb | 1208 | */ |
bb6720bb | 1209 | bool IsVisible() const; |
1c4293cb | 1210 | |
bb6720bb JS |
1211 | /** |
1212 | Returns child property at index i. | |
1c4293cb | 1213 | */ |
68bcfd2c | 1214 | wxPGProperty* Item( unsigned int i ) const; |
1c4293cb | 1215 | |
bb6720bb JS |
1216 | /** |
1217 | If property's editor is active, then update it's value. | |
1c4293cb VZ |
1218 | */ |
1219 | void RefreshEditor(); | |
1220 | ||
bb6720bb JS |
1221 | /** |
1222 | Sets an attribute for this property. | |
1223 | ||
1c4293cb | 1224 | @param name |
bb6720bb JS |
1225 | Text identifier of attribute. See @ref propgrid_property_attributes. |
1226 | ||
1c4293cb | 1227 | @param value |
bb6720bb | 1228 | Value of attribute. |
1802a91d JS |
1229 | |
1230 | @remarks Setting attribute's value to Null variant will simply remove it | |
1231 | from property's set of attributes. | |
1c4293cb VZ |
1232 | */ |
1233 | void SetAttribute( const wxString& name, wxVariant value ); | |
1234 | ||
d7e2b522 JS |
1235 | /** |
1236 | Sets property's background colour. | |
1237 | ||
1238 | @param colour | |
1239 | Background colour to use. | |
1240 | ||
1241 | @param recursively | |
1242 | If @true, children are affected recursively, and any categories | |
1243 | are not. | |
1244 | */ | |
1245 | void SetBackgroundColour( const wxColour& colour, | |
1246 | bool recursively = false ); | |
1247 | ||
bb6720bb JS |
1248 | /** |
1249 | Sets editor for a property. | |
1c4293cb VZ |
1250 | |
1251 | @param editor | |
bb6720bb JS |
1252 | For builtin editors, use wxPGEditor_X, where X is builtin editor's |
1253 | name (TextCtrl, Choice, etc. see wxPGEditor documentation for full list). | |
1c4293cb VZ |
1254 | |
1255 | For custom editors, use pointer you received from wxPropertyGrid::RegisterEditorClass(). | |
1256 | */ | |
bb6720bb | 1257 | void SetEditor( const wxPGEditor* editor ); |
1c4293cb | 1258 | |
bb6720bb JS |
1259 | /** |
1260 | Sets editor for a property, by editor name. | |
1c4293cb | 1261 | */ |
bb6720bb | 1262 | void SetEditor( const wxString& editorName ); |
1c4293cb | 1263 | |
bb6720bb JS |
1264 | /** |
1265 | Sets cell information for given column. | |
1c4293cb | 1266 | */ |
d7e2b522 | 1267 | void SetCell( int column, const wxPGCell& cell ); |
1c4293cb | 1268 | |
bb6720bb JS |
1269 | /** |
1270 | Sets new set of choices for property. | |
1c4293cb | 1271 | |
bb6720bb | 1272 | @remarks This operation clears the property value. |
1c4293cb | 1273 | */ |
bb6720bb | 1274 | bool SetChoices( wxPGChoices& choices ); |
1c4293cb | 1275 | |
bb6720bb JS |
1276 | /** |
1277 | If property has choices and they are not yet exclusive, new such copy | |
1278 | of them will be created. | |
1c4293cb | 1279 | */ |
bb6720bb | 1280 | void SetChoicesExclusive(); |
1c4293cb | 1281 | |
bb6720bb JS |
1282 | /** |
1283 | Sets client data (void*) of a property. | |
1c4293cb | 1284 | |
bb6720bb | 1285 | @remarks This untyped client data has to be deleted manually. |
1c4293cb | 1286 | */ |
bb6720bb | 1287 | void SetClientData( void* clientData ); |
1c4293cb | 1288 | |
bb6720bb JS |
1289 | /** Returns client object of a property. |
1290 | */ | |
1291 | void SetClientObject(wxClientData* clientObject); | |
1c4293cb | 1292 | |
bb6720bb JS |
1293 | /** |
1294 | Sets selected choice and changes property value. | |
1c4293cb | 1295 | |
bb6720bb JS |
1296 | Tries to retain value type, although currently if it is not string, |
1297 | then it is forced to integer. | |
1c4293cb | 1298 | */ |
bb6720bb | 1299 | void SetChoiceSelection( int newValue ); |
1c4293cb | 1300 | |
bb6720bb JS |
1301 | /** |
1302 | Sets property's help string, which is shown, for example, in | |
1303 | wxPropertyGridManager's description text box. | |
1c4293cb | 1304 | */ |
bb6720bb | 1305 | void SetHelpString( const wxString& helpString ); |
1c4293cb | 1306 | |
bb6720bb JS |
1307 | /** |
1308 | Sets property's label. | |
1c4293cb | 1309 | |
bb6720bb JS |
1310 | @remarks Properties under same parent may have same labels. However, |
1311 | property names must still remain unique. | |
258ccb95 | 1312 | */ |
0ad10f30 | 1313 | void SetLabel( const wxString& label ); |
1c4293cb | 1314 | |
bb6720bb JS |
1315 | /** |
1316 | Set max length of text in text editor. | |
1c4293cb | 1317 | */ |
bb6720bb | 1318 | bool SetMaxLength( int maxLen ); |
1c4293cb | 1319 | |
bb6720bb JS |
1320 | /** |
1321 | Sets property's "is it modified?" flag. Affects children recursively. | |
1c4293cb | 1322 | */ |
bb6720bb | 1323 | void SetModifiedStatus( bool modified ); |
1c4293cb | 1324 | |
bb6720bb JS |
1325 | /** |
1326 | Sets new (base) name for property. | |
1c4293cb | 1327 | */ |
bb6720bb | 1328 | void SetName( const wxString& newName ); |
1c4293cb | 1329 | |
2fd4a524 JS |
1330 | /** |
1331 | Changes what sort of parent this property is for its children. | |
1332 | ||
1333 | @param flag | |
1334 | Use one of the following values: wxPG_PROP_MISC_PARENT (for generic | |
1335 | parents), wxPG_PROP_CATEGORY (for categories), or | |
1336 | wxPG_PROP_AGGREGATE (for derived property classes with private | |
1337 | children). | |
1338 | ||
1339 | @remarks You only need to call this if you use AddChild() to add | |
1340 | child properties. Adding properties with | |
1341 | wxPropertyGridInterface::Insert() or | |
1342 | wxPropertyGridInterface::AppendIn() will automatically set | |
1343 | property to use wxPG_PROP_MISC_PARENT style. | |
1344 | */ | |
1345 | void SetParentalType( int flag ); | |
1346 | ||
d7e2b522 JS |
1347 | /** |
1348 | Sets property's text colour. | |
1349 | ||
1350 | @param colour | |
1351 | Text colour to use. | |
1352 | ||
1353 | @param recursively | |
1354 | If @true, children are affected recursively, and any categories | |
1355 | are not. | |
1356 | */ | |
1357 | void SetTextColour( const wxColour& colour, | |
1358 | bool recursively = false ); | |
1359 | ||
bb6720bb JS |
1360 | /** Sets wxValidator for a property */ |
1361 | void SetValidator( const wxValidator& validator ); | |
1c4293cb | 1362 | |
bb6720bb JS |
1363 | /** |
1364 | Call this to set value of the property. Unlike methods in wxPropertyGrid, | |
1365 | this does not automatically update the display. | |
1c4293cb VZ |
1366 | |
1367 | @remarks | |
bb6720bb JS |
1368 | Use wxPropertyGrid::ChangePropertyValue() instead if you need to run through |
1369 | validation process and send property change event. | |
1c4293cb | 1370 | |
bb6720bb JS |
1371 | If you need to change property value in event, based on user input, use |
1372 | SetValueInEvent() instead. | |
1c4293cb | 1373 | |
0ad10f30 FM |
1374 | @param value |
1375 | The value to set. | |
bb6720bb JS |
1376 | @param pList |
1377 | Pointer to list variant that contains child values. Used to indicate | |
0ad10f30 | 1378 | which children should be marked as modified. Usually you just use @NULL. |
bb6720bb JS |
1379 | @param flags |
1380 | Use wxPG_SETVAL_REFRESH_EDITOR to update editor control, if it | |
1381 | was selected. | |
1c4293cb | 1382 | */ |
bb6720bb | 1383 | void SetValue( wxVariant value, wxVariant* pList = NULL, int flags = 0 ); |
1c4293cb | 1384 | |
bb6720bb JS |
1385 | /** |
1386 | Set wxBitmap in front of the value. This bitmap may be ignored | |
1387 | by custom cell renderers. | |
1c4293cb | 1388 | */ |
bb6720bb | 1389 | void SetValueImage( wxBitmap& bmp ); |
1c4293cb | 1390 | |
bb6720bb JS |
1391 | /** |
1392 | Call this function in OnEvent(), OnButtonClick() etc. to change the | |
1393 | property value based on user input. | |
939d9364 | 1394 | |
bb6720bb JS |
1395 | @remarks This method is const since it doesn't actually modify value, but posts |
1396 | given variant as pending value, stored in wxPropertyGrid. | |
1c4293cb | 1397 | */ |
bb6720bb | 1398 | void SetValueInEvent( wxVariant value ) const; |
1c4293cb | 1399 | |
bb6720bb JS |
1400 | /** |
1401 | Sets property's value to unspecified (ie. Null variant). | |
1c4293cb | 1402 | */ |
bb6720bb | 1403 | void SetValueToUnspecified(); |
1c4293cb | 1404 | |
bb6720bb JS |
1405 | /** |
1406 | Call with @false in OnSetValue() to cancel value changes after all | |
1407 | (ie. cancel @true returned by StringToValue() or IntToValue()). | |
1408 | */ | |
1409 | void SetWasModified( bool set = true ); | |
1c4293cb | 1410 | |
bb6720bb JS |
1411 | /** |
1412 | Updates composed values of parent non-category properties, recursively. | |
1413 | Returns topmost property updated. | |
1414 | */ | |
1415 | wxPGProperty* UpdateParentValues(); | |
1c4293cb | 1416 | |
bb6720bb | 1417 | /** |
0ad10f30 | 1418 | Returns @true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES. |
1c4293cb | 1419 | */ |
bb6720bb | 1420 | bool UsesAutoUnspecified() const; |
1c4293cb VZ |
1421 | }; |
1422 | ||
1423 | ||
0ad10f30 FM |
1424 | /** |
1425 | @class wxPGChoices | |
1c4293cb VZ |
1426 | |
1427 | Helper class for managing choices of wxPropertyGrid properties. | |
1428 | Each entry can have label, value, bitmap, text colour, and background colour. | |
1429 | ||
1430 | @library{wxpropgrid} | |
1431 | @category{propgrid} | |
1432 | */ | |
1433 | class WXDLLIMPEXP_PROPGRID wxPGChoices | |
1434 | { | |
1435 | public: | |
1436 | typedef long ValArrItem; | |
1437 | ||
bb6720bb JS |
1438 | /** |
1439 | Default constructor. | |
1440 | */ | |
1441 | wxPGChoices(); | |
1c4293cb VZ |
1442 | |
1443 | /** Copy constructor. */ | |
bb6720bb | 1444 | wxPGChoices( const wxPGChoices& a ); |
1c4293cb VZ |
1445 | |
1446 | /** Constructor. */ | |
bb6720bb | 1447 | wxPGChoices( const wxChar** labels, const long* values = NULL ); |
1c4293cb VZ |
1448 | |
1449 | /** Constructor. */ | |
bb6720bb | 1450 | wxPGChoices( const wxArrayString& labels, const wxArrayInt& values = wxArrayInt() ); |
1c4293cb | 1451 | |
bb6720bb JS |
1452 | /** Constructor. */ |
1453 | wxPGChoices( wxPGChoicesData* data ); | |
1c4293cb VZ |
1454 | |
1455 | /** Destructor. */ | |
bb6720bb | 1456 | ~wxPGChoices(); |
1c4293cb | 1457 | |
bb6720bb JS |
1458 | /** |
1459 | Adds to current. If did not have own copies, creates them now. If was empty, | |
1c4293cb VZ |
1460 | identical to set except that creates copies. |
1461 | */ | |
1462 | void Add( const wxChar** labels, const ValArrItem* values = NULL ); | |
1463 | ||
1464 | /** Version that works with wxArrayString. */ | |
1465 | void Add( const wxArrayString& arr, const ValArrItem* values = NULL ); | |
1466 | ||
1467 | /** Version that works with wxArrayString and wxArrayInt. */ | |
1468 | void Add( const wxArrayString& arr, const wxArrayInt& arrint ); | |
1469 | ||
1470 | /** Adds single item. */ | |
1471 | wxPGChoiceEntry& Add( const wxString& label, int value = wxPG_INVALID_VALUE ); | |
1472 | ||
1473 | /** Adds a single item, with bitmap. */ | |
bb6720bb JS |
1474 | wxPGChoiceEntry& Add( const wxString& label, const wxBitmap& bitmap, |
1475 | int value = wxPG_INVALID_VALUE ); | |
1c4293cb VZ |
1476 | |
1477 | /** Adds a single item with full entry information. */ | |
0ad10f30 | 1478 | wxPGChoiceEntry& Add( const wxPGChoiceEntry& entry ); |
1c4293cb | 1479 | |
bb6720bb | 1480 | /** Adds single item, sorted. */ |
1c4293cb VZ |
1481 | wxPGChoiceEntry& AddAsSorted( const wxString& label, int value = wxPG_INVALID_VALUE ); |
1482 | ||
bb6720bb JS |
1483 | /** |
1484 | Assigns data from another set of choices. | |
1485 | */ | |
0ad10f30 | 1486 | void Assign( const wxPGChoices& a ); |
1c4293cb | 1487 | |
bb6720bb JS |
1488 | /** |
1489 | Assigns data from another set of choices. | |
1490 | */ | |
1c4293cb VZ |
1491 | void AssignData( wxPGChoicesData* data ); |
1492 | ||
bb6720bb JS |
1493 | /** |
1494 | Deletes all items. | |
1495 | */ | |
0ad10f30 | 1496 | void Clear(); |
1c4293cb | 1497 | |
bb6720bb JS |
1498 | /** |
1499 | Returns labe of item. | |
1500 | */ | |
68bcfd2c | 1501 | const wxString& GetLabel( unsigned int ind ) const; |
1c4293cb | 1502 | |
bb6720bb JS |
1503 | /** |
1504 | Returns number of items. | |
1505 | */ | |
68bcfd2c | 1506 | unsigned int GetCount() const; |
1c4293cb | 1507 | |
bb6720bb JS |
1508 | /** |
1509 | Returns value of item; | |
1510 | */ | |
68bcfd2c | 1511 | int GetValue( unsigned int ind ) const; |
1c4293cb | 1512 | |
bb6720bb JS |
1513 | /** |
1514 | Returns array of values matching the given strings. Unmatching strings | |
1c4293cb VZ |
1515 | result in wxPG_INVALID_VALUE entry in array. |
1516 | */ | |
1517 | wxArrayInt GetValuesForStrings( const wxArrayString& strings ) const; | |
1518 | ||
bb6720bb JS |
1519 | /** |
1520 | Returns array of indices matching given strings. Unmatching strings | |
0ad10f30 | 1521 | are added to 'unmatched', if not @NULL. |
1c4293cb | 1522 | */ |
bb6720bb JS |
1523 | wxArrayInt GetIndicesForStrings( const wxArrayString& strings, |
1524 | wxArrayString* unmatched = NULL ) const; | |
1c4293cb | 1525 | |
bb6720bb JS |
1526 | /** |
1527 | Returns @true if item at given index has a valid value; | |
1c4293cb | 1528 | */ |
bb6720bb | 1529 | bool HasValue( unsigned int i ) const; |
1c4293cb | 1530 | |
bb6720bb JS |
1531 | /** |
1532 | Returns index of item with given label. | |
1533 | */ | |
1534 | int Index( const wxString& label ) const; | |
1c4293cb | 1535 | |
bb6720bb JS |
1536 | /** |
1537 | Returns index of item with given value. | |
1538 | */ | |
1c4293cb VZ |
1539 | int Index( int val ) const; |
1540 | ||
bb6720bb JS |
1541 | /** |
1542 | Inserts single item. | |
1543 | */ | |
1c4293cb VZ |
1544 | wxPGChoiceEntry& Insert( const wxString& label, int index, int value = wxPG_INVALID_VALUE ); |
1545 | ||
bb6720bb JS |
1546 | /** |
1547 | Inserts a single item with full entry information. | |
1548 | */ | |
1c4293cb VZ |
1549 | wxPGChoiceEntry& Insert( const wxPGChoiceEntry& entry, int index ); |
1550 | ||
bb6720bb | 1551 | /** |
0ad10f30 | 1552 | Returns @false if this is a constant empty set of choices, |
1c4293cb VZ |
1553 | which should not be modified. |
1554 | */ | |
0ad10f30 | 1555 | bool IsOk() const; |
1c4293cb | 1556 | |
bb6720bb JS |
1557 | /** |
1558 | Returns item at given index. | |
1559 | */ | |
0ad10f30 | 1560 | const wxPGChoiceEntry& Item( unsigned int i ) const; |
1c4293cb | 1561 | |
bb6720bb JS |
1562 | /** |
1563 | Returns item at given index. | |
1564 | */ | |
0ad10f30 | 1565 | wxPGChoiceEntry& Item( unsigned int i ); |
1c4293cb | 1566 | |
bb6720bb JS |
1567 | /** |
1568 | Removes count items starting at position nIndex. | |
1569 | */ | |
1c4293cb VZ |
1570 | void RemoveAt(size_t nIndex, size_t count = 1); |
1571 | ||
bb6720bb JS |
1572 | /** |
1573 | Sets contents from lists of strings and values. | |
1c4293cb | 1574 | */ |
bb6720bb | 1575 | void Set( const wxChar** labels, const long* values = NULL ); |
1c4293cb | 1576 | |
bb6720bb JS |
1577 | /** |
1578 | Sets contents from lists of strings and values. | |
1579 | */ | |
1580 | void Set( const wxArrayString& labels, const wxArrayInt& values = wxArrayInt() ); | |
1c4293cb | 1581 | |
bb6720bb JS |
1582 | /** |
1583 | Creates exclusive copy of current choices. | |
1584 | */ | |
1585 | void SetExclusive(); | |
1c4293cb | 1586 | |
bb6720bb JS |
1587 | /** |
1588 | Returns array of choice labels. | |
1589 | */ | |
1c4293cb VZ |
1590 | wxArrayString GetLabels() const; |
1591 | ||
0ad10f30 | 1592 | void operator= (const wxPGChoices& a); |
1c4293cb | 1593 | |
0ad10f30 FM |
1594 | wxPGChoiceEntry& operator[](unsigned int i); |
1595 | const wxPGChoiceEntry& operator[](unsigned int i) const; | |
1c4293cb VZ |
1596 | }; |
1597 | ||
1598 | // ----------------------------------------------------------------------- |