]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/propgrid/propgrid.h
fix few doxygen warnings
[wxWidgets.git] / interface / wx / propgrid / propgrid.h
CommitLineData
1c4293cb
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: propgrid.h
3// Purpose: interface of wxPropertyGrid
4// Author: wxWidgets team
de003797 5// RCS-ID: $Id$
1c4293cb
VZ
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9
6b03a638
JS
10/**
11 @section propgrid_window_styles wxPropertyGrid Window Styles
1c4293cb
VZ
12
13 SetWindowStyleFlag method can be used to modify some of these at run-time.
14 @{
15*/
16enum wxPG_WINDOW_STYLES
17{
18
6b03a638
JS
19/**
20 This will cause Sort() automatically after an item is added.
1c4293cb
VZ
21 When inserting a lot of items in this mode, it may make sense to
22 use Freeze() before operations and Thaw() afterwards to increase
23 performance.
24*/
25wxPG_AUTO_SORT = 0x00000010,
26
6b03a638
JS
27/**
28 Categories are not initially shown (even if added).
1c4293cb
VZ
29 IMPORTANT NOTE: If you do not plan to use categories, then this
30 style will waste resources.
31 This flag can also be changed using wxPropertyGrid::EnableCategories method.
32*/
33wxPG_HIDE_CATEGORIES = 0x00000020,
34
0ad10f30 35/**
6b03a638 36 This style combines non-categoric mode and automatic sorting.
1c4293cb
VZ
37*/
38wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT),
39
6b03a638
JS
40/**
41 Modified values are shown in bold font. Changing this requires Refresh()
1c4293cb
VZ
42 to show changes.
43*/
44wxPG_BOLD_MODIFIED = 0x00000040,
45
6b03a638
JS
46/**
47 When wxPropertyGrid is resized, splitter moves to the center. This
1c4293cb
VZ
48 behavior stops once the user manually moves the splitter.
49*/
50wxPG_SPLITTER_AUTO_CENTER = 0x00000080,
51
6b03a638
JS
52/**
53 Display tool tips for cell text that cannot be shown completely. If
1c4293cb
VZ
54 wxUSE_TOOLTIPS is 0, then this doesn't have any effect.
55*/
56wxPG_TOOLTIPS = 0x00000100,
57
6b03a638
JS
58/**
59 Disables margin and hides all expand/collapse buttons that would appear
1c4293cb
VZ
60 outside the margin (for sub-properties). Toggling this style automatically
61 expands all collapsed items.
62*/
63wxPG_HIDE_MARGIN = 0x00000200,
64
6b03a638
JS
65/**
66 This style prevents user from moving the splitter.
1c4293cb
VZ
67*/
68wxPG_STATIC_SPLITTER = 0x00000400,
69
6b03a638
JS
70/**
71 Combination of other styles that make it impossible for user to modify
1c4293cb
VZ
72 the layout.
73*/
74wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER),
75
6b03a638
JS
76/**
77 Disables wxTextCtrl based editors for properties which
78 can be edited in another way. Equals calling
79 wxPropertyGrid::LimitPropertyEditing() for all added properties.
1c4293cb
VZ
80*/
81wxPG_LIMITED_EDITING = 0x00000800,
82
6b03a638
JS
83/**
84 wxPropertyGridManager only: Show tool bar for mode and page selection.
85*/
1c4293cb
VZ
86wxPG_TOOLBAR = 0x00001000,
87
6b03a638
JS
88/**
89 wxPropertyGridManager only: Show adjustable text box showing description
1c4293cb
VZ
90 or help text, if available, for currently selected property.
91*/
92wxPG_DESCRIPTION = 0x00002000
93
94};
95
96enum wxPG_EX_WINDOW_STYLES
97{
98
99/**
100 NOTE: wxPG_EX_xxx are extra window styles and must be set using SetExtraStyle()
101 member function.
102
6b03a638
JS
103 Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if
104 wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is not
105 activated, and switching the mode first time becomes somewhat slower.
106 wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away.
1c4293cb 107
6b03a638
JS
108 NOTE: If you do plan not switching to non-categoric mode, or if
109 you don't plan to use categories at all, then using this style will result
110 in waste of resources.
1c4293cb
VZ
111*/
112wxPG_EX_INIT_NOCAT = 0x00001000,
113
6b03a638
JS
114/**
115 Extended window style that sets wxPropertyGridManager tool bar to not
1c4293cb
VZ
116 use flat style.
117*/
118wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000,
119
6b03a638
JS
120/**
121 Shows alphabetic/categoric mode buttons from tool bar.
1c4293cb
VZ
122*/
123wxPG_EX_MODE_BUTTONS = 0x00008000,
124
6b03a638
JS
125/**
126 Show property help strings as tool tips instead as text on the status bar.
1c4293cb
VZ
127 You can set the help strings using SetPropertyHelpString member function.
128*/
129wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000,
130
6b03a638
JS
131/**
132 Allows relying on native double-buffering.
1c4293cb
VZ
133*/
134wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
135
6b03a638
JS
136/**
137 Set this style to let user have ability to set values of properties to
1c4293cb
VZ
138 unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
139 all properties.
140*/
141wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
142
6b03a638
JS
143/**
144 If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION and
145 wxPG_STRING_PASSWORD) are not stored into property's attribute storage (thus
146 they are not readable).
1c4293cb
VZ
147
148 Note that this option is global, and applies to all wxPG property containers.
149*/
150wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000,
151
6b03a638
JS
152/**
153 Hides page selection buttons from tool bar.
1c4293cb
VZ
154*/
155wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000
156
157};
158
159/** Combines various styles.
160*/
161#define wxPG_DEFAULT_STYLE (0)
162
163/** Combines various styles.
164*/
165#define wxPGMAN_DEFAULT_STYLE (0)
166
167/** @}
168*/
169
170// -----------------------------------------------------------------------
171
6b03a638
JS
172/**
173 @section propgrid_vfbflags wxPropertyGrid Validation Failure Behavior Flags
1c4293cb
VZ
174 @{
175*/
176
177enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
178{
179
6b03a638
JS
180/**
181 Prevents user from leaving property unless value is valid. If this
1c4293cb
VZ
182 behavior flag is not used, then value change is instead cancelled.
183*/
184wxPG_VFB_STAY_IN_PROPERTY = 0x01,
185
6b03a638
JS
186/**
187 Calls wxBell() on validation failure.
1c4293cb
VZ
188*/
189wxPG_VFB_BEEP = 0x02,
190
6b03a638
JS
191/**
192 Cell with invalid value will be marked (with red colour).
1c4293cb
VZ
193*/
194wxPG_VFB_MARK_CELL = 0x04,
195
6b03a638
JS
196/**
197 Display customizable text message explaining the situation.
1c4293cb
VZ
198*/
199wxPG_VFB_SHOW_MESSAGE = 0x08,
200
6b03a638
JS
201/**
202 Defaults.
203*/
1c4293cb 204wxPG_VFB_DEFAULT = wxPG_VFB_STAY_IN_PROPERTY|wxPG_VFB_BEEP,
1c4293cb
VZ
205};
206
207/** @}
208*/
209
210typedef wxByte wxPGVFBFlags;
211
2a8312bc
JS
212/**
213 wxPGValidationInfo
214
215 Used to convey validation information to and from functions that
0ad10f30 216 actually perform validation. Mostly used in custom property classes.
2a8312bc
JS
217*/
218class wxPGValidationInfo
219{
220public:
221 /**
222 @return Returns failure behavior which is a combination of
0ad10f30 223 @ref propgrid_vfbflags.
2a8312bc
JS
224 */
225 wxPGVFBFlags GetFailureBehavior();
226
227 /**
228 Returns current failure message.
229 */
230 const wxString& GetFailureMessage() const;
231
232 /**
233 Returns reference to pending value.
234 */
235 const wxVariant& GetValue() const;
236
237 /** Set validation failure behavior
238
239 @param failureBehavior
240 Mixture of @ref propgrid_vfbflags.
241 */
242 void SetFailureBehavior(wxPGVFBFlags failureBehavior);
243
244 /**
245 Set current failure message.
246 */
247 void SetFailureMessage(const wxString& message);
248};
249
1c4293cb
VZ
250// -----------------------------------------------------------------------
251
6b03a638
JS
252/**
253 @section propgrid_keyboard_actions wxPropertyGrid Action Identifiers
0ad10f30 254
6b03a638
JS
255 These are used with wxPropertyGrid::AddActionTrigger() and
256 wxPropertyGrid::ClearActionTriggers().
1c4293cb
VZ
257 @{
258*/
259
260enum wxPG_KEYBOARD_ACTIONS
261{
262 wxPG_ACTION_INVALID = 0,
263 wxPG_ACTION_NEXT_PROPERTY,
264 wxPG_ACTION_PREV_PROPERTY,
265 wxPG_ACTION_EXPAND_PROPERTY,
266 wxPG_ACTION_COLLAPSE_PROPERTY,
267 wxPG_ACTION_CANCEL_EDIT,
1c4293cb
VZ
268 wxPG_ACTION_MAX
269};
270
271/** @}
272*/
273
43396981
JS
274/** This callback function is used for sorting properties.
275
276 Call wxPropertyGrid::SetSortFunction() to set it.
277
278 Sort function should return a value greater than 0 if position of p1 is
279 after p2. So, for instance, when comparing property names, you can use
280 following implementation:
281
282 @code
283 int MyPropertySortFunction(wxPropertyGrid* propGrid,
284 wxPGProperty* p1,
285 wxPGProperty* p2)
286 {
287 return p1->GetBaseName().compare( p2->GetBaseName() );
288 }
289 @endcode
290*/
291typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid,
292 wxPGProperty* p1,
293 wxPGProperty* p2);
294
1c4293cb
VZ
295// -----------------------------------------------------------------------
296
0ad10f30
FM
297/**
298 @class wxPropertyGrid
1c4293cb 299
0ad10f30 300 wxPropertyGrid is a specialized grid for editing properties - in other
bba3f9b5 301 words name = value pairs. List of ready-to-use property classes include
6b03a638 302 strings, numbers, flag sets, fonts, colours and many others. It is possible,
bba3f9b5
JS
303 for example, to categorize properties, set up a complete tree-hierarchy,
304 add more than two columns, and set arbitrary per-property attributes.
1c4293cb 305
6b03a638
JS
306 Please note that most member functions are inherited and as such not
307 documented on this page. This means you will probably also want to read
308 wxPropertyGridInterface class reference.
1c4293cb
VZ
309
310 See also @ref overview_propgrid.
311
312 @section propgrid_window_styles_ Window Styles
313
314 See @ref propgrid_window_styles.
315
316 @section propgrid_event_handling Event Handling
317
6b03a638
JS
318 To process input from a property grid control, use these event handler macros
319 to direct input to member functions that take a wxPropertyGridEvent argument.
1c4293cb
VZ
320
321 @beginEventTable{wxPropertyGridEvent}
322 @event{EVT_PG_SELECTED (id, func)}
323 Respond to wxEVT_PG_SELECTED event, generated when property value
324 has been changed by user.
325 @event{EVT_PG_CHANGING(id, func)}
326 Respond to wxEVT_PG_CHANGING event, generated when property value
327 is about to be changed by user. Use wxPropertyGridEvent::GetValue()
328 to take a peek at the pending value, and wxPropertyGridEvent::Veto()
329 to prevent change from taking place, if necessary.
330 @event{EVT_PG_HIGHLIGHTED(id, func)}
331 Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse
332 moves over a property. Event's property is NULL if hovered area does
333 not belong to any property.
334 @event{EVT_PG_RIGHT_CLICK(id, func)}
335 Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is
336 clicked on with right mouse button.
337 @event{EVT_PG_DOUBLE_CLICK(id, func)}
338 Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is
6b03a638 339 double-clicked on with left mouse button.
1c4293cb
VZ
340 @event{EVT_PG_ITEM_COLLAPSED(id, func)}
341 Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses
6b03a638 342 a property or category.
1c4293cb
VZ
343 @event{EVT_PG_ITEM_EXPANDED(id, func)}
344 Respond to wxEVT_PG_ITEM_EXPANDED event, generated when user expands
6b03a638 345 a property or category.
1c4293cb
VZ
346 @endEventTable
347
348 @remarks
0ad10f30
FM
349 Use Freeze() and Thaw() respectively to disable and enable drawing.
350 This will also delay sorting etc. miscellaneous calculations to the last
351 possible moment.
1c4293cb
VZ
352
353 @library{wxpropgrid}
354 @category{propgrid}
e4821c39 355 @appearance{propertygrid.png}
1c4293cb
VZ
356*/
357class wxPropertyGrid : public wxScrolledWindow, public wxPropertyGridInterface
358{
359public:
0ad10f30
FM
360 /**
361 Two step constructor.
362 Call Create() when this constructor is called to build up the wxPropertyGrid
363 */
1c4293cb
VZ
364 wxPropertyGrid();
365
6b03a638 366 /**
0ad10f30
FM
367 Constructor.
368 The styles to be used are styles valid for the wxWindow and wxScrolledWindow.
6b03a638
JS
369
370 @see @ref propgrid_window_styles.
1c4293cb
VZ
371 */
372 wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY,
0ad10f30
FM
373 const wxPoint& pos = wxDefaultPosition,
374 const wxSize& size = wxDefaultSize,
375 long style = wxPG_DEFAULT_STYLE,
376 const wxChar* name = wxPropertyGridNameStr );
1c4293cb
VZ
377
378 /** Destructor */
379 virtual ~wxPropertyGrid();
380
6b03a638
JS
381 /**
382 Adds given key combination to trigger given action.
383
1c4293cb 384 @param action
6b03a638 385 Which action to trigger. See @ref propgrid_keyboard_actions.
6b03a638
JS
386 @param keycode
387 Which keycode triggers the action.
6b03a638
JS
388 @param modifiers
389 Which key event modifiers, in addition to keycode, are needed to
390 trigger the action.
1c4293cb
VZ
391 */
392 void AddActionTrigger( int action, int keycode, int modifiers = 0 );
393
6b03a638
JS
394 /**
395 This static function enables or disables automatic use of
396 wxGetTranslation() for following strings: wxEnumProperty list labels,
397 wxFlagsProperty child property labels.
398
1c4293cb
VZ
399 Default is false.
400 */
401 static void AutoGetTranslation( bool enable );
402
6b03a638
JS
403 /**
404 Changes value of a property, as if from an editor. Use this instead of
405 SetPropertyValue() if you need the value to run through validation
406 process, and also send the property change event.
1c4293cb 407
6b03a638 408 @return Returns true if value was successfully changed.
1c4293cb
VZ
409 */
410 bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
411
6b03a638
JS
412 /**
413 Centers the splitter. If argument is true, automatic splitter centering
414 is enabled (only applicable if style wxPG_SPLITTER_AUTO_CENTER was
415 defined).
1c4293cb
VZ
416 */
417 void CenterSplitter( bool enable_auto_centering = false );
418
6b03a638
JS
419 /**
420 Deletes all properties.
1c4293cb
VZ
421 */
422 virtual void Clear();
423
6b03a638
JS
424 /**
425 Clears action triggers for given action.
426
1c4293cb 427 @param action
6b03a638 428 Which action to trigger. @ref propgrid_keyboard_actions.
1c4293cb
VZ
429 */
430 void ClearActionTriggers( int action );
431
6b03a638
JS
432 /**
433 Forces updating the value of property from the editor control.
434 Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
435 ProcessEvent, meaning your event handlers will be called immediately.
1c4293cb 436
6b03a638 437 @return Returns @true if anything was changed.
1c4293cb
VZ
438 */
439 virtual bool CommitChangesFromEditor( wxUint32 flags = 0 );
440
6b03a638
JS
441 /**
442 Two step creation. Whenever the control is created without any
443 parameters, use Create to actually create it. Don't access the control's
444 public methods before this is called
445
446 @see @ref propgrid_window_styles.
1c4293cb
VZ
447 */
448 bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
0ad10f30
FM
449 const wxPoint& pos = wxDefaultPosition,
450 const wxSize& size = wxDefaultSize,
451 long style = wxPG_DEFAULT_STYLE,
452 const wxChar* name = wxPropertyGridNameStr );
1c4293cb 453
6b03a638
JS
454 /**
455 Call when editor widget's contents is modified. For example, this is
456 called when changes text in wxTextCtrl (used in wxStringProperty and
457 wxIntProperty).
1c4293cb 458
6b03a638 459 @remarks This function should only be called by custom properties.
1c4293cb
VZ
460
461 @see wxPGProperty::OnEvent()
462 */
0ad10f30 463 void EditorsValueWasModified();
1c4293cb 464
6b03a638
JS
465 /**
466 Reverse of EditorsValueWasModified().
1c4293cb 467
6b03a638 468 @remarks This function should only be called by custom properties.
1c4293cb 469 */
0ad10f30 470 void EditorsValueWasNotModified();
1c4293cb 471
6b03a638
JS
472 /**
473 Enables or disables (shows/hides) categories according to parameter
474 enable.
1621f192
JS
475
476 @remarks This functions deselects selected property, if any. Validation
477 failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
478 selection is cleared even if editor had invalid value.
6b03a638 479 */
1c4293cb
VZ
480 bool EnableCategories( bool enable );
481
6b03a638
JS
482 /**
483 Scrolls and/or expands items to ensure that the given item is visible.
484
485 @return Returns @true if something was actually done.
1c4293cb
VZ
486 */
487 bool EnsureVisible( wxPGPropArg id );
488
6b03a638
JS
489 /**
490 Reduces column sizes to minimum possible, while still retaining
491 fully visible grid contents (labels, images).
1c4293cb 492
6b03a638 493 @return Minimum size for the grid to still display everything.
1c4293cb 494
6b03a638 495 @remarks Does not work well with wxPG_SPLITTER_AUTO_CENTER window style.
1c4293cb 496
6b03a638
JS
497 This function only works properly if grid size prior to call was
498 already fairly large.
1c4293cb 499
6b03a638
JS
500 Note that you can also get calculated column widths by calling
501 GetState->GetColumnWidth() immediately after this function
502 returns.
1c4293cb 503 */
6b03a638 504 wxSize FitColumns();
1c4293cb 505
6b03a638
JS
506 /**
507 Returns wxWindow that the properties are painted on, and which should be
508 used as the parent for editor controls.
1c4293cb 509 */
6b03a638 510 wxPanel* GetPanel() const;
1c4293cb 511
6b03a638
JS
512 /**
513 Returns current category caption background colour.
514 */
515 wxColour GetCaptionBackgroundColour() const;
1c4293cb 516
6b03a638
JS
517 /**
518 Returns current category caption font.
519 */
520 wxFont& GetCaptionFont();
1c4293cb 521
6b03a638
JS
522 /**
523 Returns current category caption text colour.
524 */
525 wxColour GetCaptionForegroundColour() const;
1c4293cb 526
6b03a638
JS
527 /**
528 Returns current cell background colour.
529 */
530 wxColour GetCellBackgroundColour() const;
1c4293cb 531
6b03a638
JS
532 /**
533 Returns current cell text colour when disabled.
534 */
535 wxColour GetCellDisabledTextColour() const;
1c4293cb 536
6b03a638
JS
537 /**
538 Returns current cell text colour.
539 */
540 wxColour GetCellTextColour() const;
1c4293cb 541
6b03a638
JS
542 /**
543 Returns number of columns currently on grid.
544 */
68bcfd2c 545 unsigned int GetColumnCount() const;
1c4293cb 546
6b03a638
JS
547 /**
548 Returns colour of empty space below properties.
549 */
550 wxColour GetEmptySpaceColour() const;
1c4293cb 551
6b03a638
JS
552 /**
553 Returns height of highest characters of used font.
554 */
555 int GetFontHeight() const;
1c4293cb 556
6b03a638
JS
557 /**
558 Returns pointer to itself. Dummy function that enables same kind
1c4293cb
VZ
559 of code to use wxPropertyGrid and wxPropertyGridManager.
560 */
6b03a638
JS
561 wxPropertyGrid* GetGrid();
562
563 /**
564 Returns rectangle of custom paint image.
1c4293cb 565
6b03a638
JS
566 @param property
567 Return image rectangle for this property.
568
569 @param item
570 Which choice of property to use (each choice may have
571 different image).
1c4293cb 572 */
6b03a638
JS
573 wxRect GetImageRect( wxPGProperty* property, int item ) const;
574
575 /**
576 Returns size of the custom paint image in front of property.
1c4293cb 577
6b03a638
JS
578 @param property
579 Return image rectangle for this property.
580 If this argument is NULL, then preferred size is returned.
581
582 @param item
583 Which choice of property to use (each choice may have
584 different image).
1c4293cb 585 */
6b03a638
JS
586 wxSize GetImageSize( wxPGProperty* property = NULL, int item = -1 ) const;
587
588 /**
589 Returns last item which could be iterated using given flags.
1c4293cb 590
1c4293cb 591 @param flags
6b03a638 592 See @ref propgrid_iterator_flags.
1c4293cb 593 */
6b03a638 594 wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT );
1c4293cb 595
6b03a638
JS
596 /**
597 Returns colour of lines between cells.
598 */
599 wxColour GetLineColour() const;
1c4293cb 600
6b03a638
JS
601 /**
602 Returns background colour of margin.
603 */
604 wxColour GetMarginColour() const;
1c4293cb 605
9b5bafcf
JS
606 /**
607 Returns most up-to-date value of selected property. This will return
608 value different from GetSelectedProperty()->GetValue() only when text
609 editor is activate and string edited by user represents valid,
610 uncommitted property value.
611 */
703ee9f5 612 wxVariant GetUncommittedPropertyValue();
9b5bafcf 613
6b03a638
JS
614 /**
615 Returns "root property". It does not have name, etc. and it is not
1c4293cb
VZ
616 visible. It is only useful for accessing its children.
617 */
6b03a638 618 wxPGProperty* GetRoot() const;
1c4293cb 619
6b03a638
JS
620 /**
621 Returns height of a single grid row (in pixels).
622 */
623 int GetRowHeight() const;
1c4293cb 624
6b03a638
JS
625 /**
626 Returns currently selected property.
627 */
628 wxPGProperty* GetSelectedProperty() const;
1c4293cb 629
6b03a638
JS
630 /**
631 Returns currently selected property.
632 */
633 wxPGProperty* GetSelection() const;
1c4293cb 634
6b03a638
JS
635 /**
636 Returns current selection background colour.
637 */
638 wxColour GetSelectionBackgroundColour() const;
1c4293cb 639
6b03a638
JS
640 /**
641 Returns current selection text colour.
642 */
643 wxColour GetSelectionForegroundColour() const;
1c4293cb 644
43396981
JS
645 /**
646 Returns the property sort function (default is @NULL).
647
648 @see SetSortFunction
649 */
650 wxPGSortCallback GetSortFunction() const;
651
6b03a638
JS
652 /**
653 Returns current splitter x position.
654 */
655 int GetSplitterPosition() const;
1c4293cb 656
6b03a638
JS
657 /**
658 Returns wxTextCtrl active in currently selected property, if any. Takes
659 wxOwnerDrawnComboBox into account.
1c4293cb
VZ
660 */
661 wxTextCtrl* GetEditorTextCtrl() const;
662
6b03a638
JS
663 /**
664 Returns current vertical spacing.
665 */
0ad10f30 666 int GetVerticalSpacing() const;
1c4293cb 667
6b03a638
JS
668 /**
669 Returns true if editor's value was marked modified.
1c4293cb 670 */
6b03a638 671 bool IsEditorsValueModified() const;
1c4293cb 672
6b03a638
JS
673 /**
674 Returns information about arbitrary position in the grid.
1c4293cb
VZ
675 */
676 wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
677
6b03a638
JS
678 /**
679 Returns true if any property has been modified by the user.
680 */
681 bool IsAnyModified() const;
1c4293cb 682
6b03a638
JS
683 /**
684 Returns true if updating is frozen (ie. Freeze() called but not
685 yet Thaw() ).
686 */
687 bool IsFrozen() const;
1c4293cb 688
f521bae6
JS
689 /**
690 Refreshes any active editor control.
691 */
692 void RefreshEditor();
693
6b03a638
JS
694 /**
695 Redraws given property.
1c4293cb
VZ
696 */
697 virtual void RefreshProperty( wxPGProperty* p );
698
6b03a638
JS
699 /**
700 Registers a new editor class.
701
702 @return Returns pointer to the editor class instance that should be used.
1c4293cb 703 */
6b03a638
JS
704 static wxPGEditor* RegisterEditorClass( wxPGEditor* editor,
705 const wxString& name,
1c4293cb
VZ
706 bool noDefCheck = false );
707
6b03a638
JS
708 /**
709 Resets all colours to the original system values.
1c4293cb
VZ
710 */
711 void ResetColours();
712
6b03a638
JS
713 /**
714 Selects a property. Editor widget is automatically created, but
715 not focused unless focus is true. This will generate wxEVT_PG_SELECT
716 event.
717
1c4293cb 718 @param id
6b03a638
JS
719 Property to select (name or pointer).
720
721 @param focus
722 If @true, move keyboard focus to the created editor right away.
723
724 @return returns @true if selection finished successfully. Usually only
725 fails if current value in editor is not valid.
726
727 @see wxPropertyGrid::ClearSelection()
1c4293cb 728 */
6b03a638
JS
729 bool SelectProperty( wxPGPropArg id, bool focus = false );
730
731 /**
732 Changes keyboard shortcut to push the editor button.
1c4293cb 733
6b03a638
JS
734 @remarks You can set default with keycode 0. Good value for the platform
735 is guessed, but don't expect it to be very accurate.
1c4293cb
VZ
736 */
737 void SetButtonShortcut( int keycode, bool ctrlDown = false, bool altDown = false );
738
6b03a638
JS
739 /**
740 Sets category caption background colour.
741 */
1c4293cb
VZ
742 void SetCaptionBackgroundColour(const wxColour& col);
743
6b03a638
JS
744 /**
745 Sets category caption text colour.
746 */
1c4293cb
VZ
747 void SetCaptionTextColour(const wxColour& col);
748
6b03a638
JS
749 /**
750 Sets default cell background colour - applies to property cells.
1c4293cb
VZ
751 Note that appearance of editor widgets may not be affected.
752 */
753 void SetCellBackgroundColour(const wxColour& col);
754
6b03a638
JS
755 /**
756 Sets cell text colour for disabled properties.
1c4293cb
VZ
757 */
758 void SetCellDisabledTextColour(const wxColour& col);
759
6b03a638
JS
760 /**
761 Sets default cell text colour - applies to property name and value text.
1c4293cb
VZ
762 Note that appearance of editor widgets may not be affected.
763 */
764 void SetCellTextColour(const wxColour& col);
765
6b03a638
JS
766 /**
767 Set number of columns (2 or more).
1c4293cb 768 */
6b03a638 769 void SetColumnCount( int colCount );
1c4293cb 770
6b03a638
JS
771 /**
772 Sets the 'current' category - Append will add non-category properties
773 under it.
1c4293cb
VZ
774 */
775 void SetCurrentCategory( wxPGPropArg id );
776
6b03a638
JS
777 /**
778 Sets colour of empty space below properties.
779 */
1c4293cb
VZ
780 void SetEmptySpaceColour(const wxColour& col);
781
6b03a638
JS
782 /**
783 Sets colour of lines between cells.
784 */
1c4293cb
VZ
785 void SetLineColour(const wxColour& col);
786
6b03a638
JS
787 /**
788 Sets background colour of margin.
789 */
1c4293cb
VZ
790 void SetMarginColour(const wxColour& col);
791
0ad10f30
FM
792 /**
793 Sets selection background colour - applies to selected property name
794 background.
795 */
1c4293cb
VZ
796 void SetSelectionBackgroundColour(const wxColour& col);
797
0ad10f30
FM
798 /**
799 Sets selection foreground colour - applies to selected property name text.
800 */
1c4293cb
VZ
801 void SetSelectionTextColour(const wxColour& col);
802
43396981
JS
803
804 /**
805 Sets the property sorting function.
806
807 @param sortFunction
808 The sorting function to be used. It should return a value greater
809 than 0 if position of p1 is after p2. So, for instance, when
810 comparing property names, you can use following implementation:
811
812 @code
813 int MyPropertySortFunction(wxPropertyGrid* propGrid,
814 wxPGProperty* p1,
815 wxPGProperty* p2)
816 {
817 return p1->GetBaseName().compare( p2->GetBaseName() );
818 }
819 @endcode
820
821 @remarks
822 Default property sort function sorts properties by their labels
823 (case-insensitively).
824
825 @see GetSortFunction, wxPropertyGridInterface::Sort,
826 wxPropertyGridInterface::SortChildren
827 */
828 void SetSortFunction( wxPGSortCallback sortFunction );
829
0ad10f30
FM
830 /**
831 Sets x coordinate of the splitter.
6b03a638
JS
832
833 @remarks Splitter position cannot exceed grid size, and therefore setting
834 it during form creation may fail as initial grid size is often
835 smaller than desired splitter position, especially when sizers
836 are being used.
1c4293cb 837 */
6b03a638 838 void SetSplitterPosition( int newxpos, int col = 0 );
1c4293cb 839
6b03a638
JS
840 /**
841 Moves splitter as left as possible, while still allowing all
1c4293cb 842 labels to be shown in full.
6b03a638
JS
843
844 @param privateChildrenToo
845 If @false, will still allow private children to be cropped.
1c4293cb 846 */
0ad10f30 847 void SetSplitterLeft( bool privateChildrenToo = false );
1c4293cb 848
6b03a638
JS
849 /**
850 Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font
1c4293cb 851 height. Value of 2 should be default on most platforms.
1c4293cb 852 */
6b03a638 853 void SetVerticalSpacing( int vspacing );
1c4293cb 854
6b03a638
JS
855 /**
856 Shows an brief error message that is related to a property.
857 */
858 void ShowPropertyError( wxPGPropArg id, const wxString& msg );
1c4293cb
VZ
859};
860
861
6b03a638
JS
862/**
863 @class wxPropertyGridEvent
1c4293cb 864
6b03a638 865 A property grid event holds information about events associated with
1c4293cb
VZ
866 wxPropertyGrid objects.
867
868 @library{wxpropgrid}
869 @category{propgrid}
870*/
871class wxPropertyGridEvent : public wxCommandEvent
872{
873public:
874
875 /** Constructor. */
876 wxPropertyGridEvent(wxEventType commandType=0, int id=0);
877
878 /** Copy constructor. */
879 wxPropertyGridEvent(const wxPropertyGridEvent& event);
880
881 /** Destructor. */
882 ~wxPropertyGridEvent();
883
6b03a638
JS
884 /**
885 Returns true if you can veto the action that the event is signaling.
886 */
0ad10f30 887 bool CanVeto() const;
6b03a638 888
6b03a638
JS
889 /**
890 Returns highest level non-category, non-root parent of property for
891 which event occurred. Useful when you have nested properties with
892 children.
1c4293cb 893
6b03a638
JS
894 @remarks If immediate parent is root or category, this will return the
895 property itself.
896 */
897 wxPGProperty* GetMainParent() const;
1c4293cb 898
6b03a638
JS
899 /**
900 Returns property associated with this event.
901 */
902 wxPGProperty* GetProperty() const;
1c4293cb 903
6b03a638
JS
904 /**
905 Returns current validation failure flags.
1c4293cb 906 */
6b03a638 907 wxPGVFBFlags GetValidationFailureBehavior() const;
1c4293cb 908
6b03a638
JS
909 /**
910 Returns value that is about to be set for wxEVT_PG_CHANGING.
1c4293cb 911 */
6b03a638 912 const wxVariant& GetValue() const;
1c4293cb 913
6b03a638
JS
914 /**
915 Set if event can be vetoed.
1c4293cb 916 */
6b03a638 917 void SetCanVeto( bool canVeto );
0ad10f30 918
6b03a638
JS
919 /** Changes the property associated with this event. */
920 void SetProperty( wxPGProperty* p );
1c4293cb 921
6b03a638
JS
922 /**
923 Set override validation failure behavior. Only effective if Veto() was
924 also called, and only allowed if event type is wxEVT_PG_CHANGING.
1c4293cb 925 */
2a8312bc 926 void SetValidationFailureBehavior( wxPGVFBFlags flags );
1c4293cb 927
6b03a638
JS
928 /**
929 Sets custom failure message for this time only. Only applies if
1c4293cb
VZ
930 wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
931 */
6b03a638 932 void SetValidationFailureMessage( const wxString& message );
1c4293cb 933
6b03a638
JS
934 /**
935 Call this from your event handler to veto action that the event is
936 signaling. You can only veto a shutdown if wxPropertyGridEvent::CanVeto()
937 returns true.
1c4293cb 938
6b03a638
JS
939 @remarks Currently only wxEVT_PG_CHANGING supports vetoing.
940 */
941 void Veto( bool veto = true );
1c4293cb 942
6b03a638
JS
943 /**
944 Returns @true if event was vetoed.
945 */
946 bool WasVetoed() const;
1c4293cb 947};