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