]> git.saurik.com Git - wxWidgets.git/blob - include/wx/propgrid/propgrid.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / propgrid / propgrid.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/propgrid/propgrid.h
3 // Purpose: wxPropertyGrid
4 // Author: Jaakko Salli
5 // Modified by:
6 // Created: 2004-09-25
7 // Copyright: (c) Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_PROPGRID_PROPGRID_H_
12 #define _WX_PROPGRID_PROPGRID_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_PROPGRID
17
18 #include "wx/thread.h"
19 #include "wx/dcclient.h"
20 #include "wx/control.h"
21 #include "wx/scrolwin.h"
22 #include "wx/tooltip.h"
23 #include "wx/datetime.h"
24 #include "wx/recguard.h"
25
26 #include "wx/propgrid/property.h"
27 #include "wx/propgrid/propgridiface.h"
28
29
30 #ifndef SWIG
31 extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridNameStr[];
32 #endif
33
34 class wxPGComboBox;
35
36 #if wxUSE_STATUSBAR
37 class WXDLLIMPEXP_FWD_CORE wxStatusBar;
38 #endif
39
40 // -----------------------------------------------------------------------
41 // Global variables
42 // -----------------------------------------------------------------------
43
44 // This is required for sharing common global variables.
45 class WXDLLIMPEXP_PROPGRID wxPGGlobalVarsClass
46 {
47 public:
48
49 wxPGGlobalVarsClass();
50 ~wxPGGlobalVarsClass();
51
52 #if wxUSE_THREADS
53 // Critical section for handling the globals. Generally it is not needed
54 // since GUI code is supposed to be in single thread. However,
55 // we do want the user to be able to convey wxPropertyGridEvents to other
56 // threads.
57 wxCriticalSection m_critSect;
58 #endif
59
60 // Used by advprops, but here to make things easier.
61 wxString m_pDefaultImageWildcard;
62
63 // Map of editor class instances (keys are name string).
64 wxPGHashMapS2P m_mapEditorClasses;
65
66 #if wxUSE_VALIDATORS
67 wxVector<wxValidator*> m_arrValidators; // These wxValidators need to be freed
68 #endif
69
70 wxPGHashMapS2P m_dictPropertyClassInfo; // PropertyName -> ClassInfo
71
72 wxPGChoices* m_fontFamilyChoices;
73
74 // Replace with your own to affect all properties using default renderer.
75 wxPGCellRenderer* m_defaultRenderer;
76
77 wxPGChoices m_boolChoices;
78
79 wxVariant m_vEmptyString;
80 wxVariant m_vZero;
81 wxVariant m_vMinusOne;
82 wxVariant m_vTrue;
83 wxVariant m_vFalse;
84
85 // Cached constant strings
86 wxPGCachedString m_strstring;
87 wxPGCachedString m_strlong;
88 wxPGCachedString m_strbool;
89 wxPGCachedString m_strlist;
90
91 wxPGCachedString m_strDefaultValue;
92 wxPGCachedString m_strMin;
93 wxPGCachedString m_strMax;
94 wxPGCachedString m_strUnits;
95 wxPGCachedString m_strHint;
96 #if wxPG_COMPATIBILITY_1_4
97 wxPGCachedString m_strInlineHelp;
98 #endif
99
100 // If true then some things are automatically translated
101 bool m_autoGetTranslation;
102
103 // > 0 if errors cannot or should not be shown in statusbar etc.
104 int m_offline;
105
106 int m_extraStyle; // global extra style
107
108 int m_warnings;
109
110 int HasExtraStyle( int style ) const { return (m_extraStyle & style); }
111 };
112
113 extern WXDLLIMPEXP_DATA_PROPGRID(wxPGGlobalVarsClass*) wxPGGlobalVars;
114
115 #define wxPGVariant_EmptyString (wxPGGlobalVars->m_vEmptyString)
116 #define wxPGVariant_Zero (wxPGGlobalVars->m_vZero)
117 #define wxPGVariant_MinusOne (wxPGGlobalVars->m_vMinusOne)
118 #define wxPGVariant_True (wxPGGlobalVars->m_vTrue)
119 #define wxPGVariant_False (wxPGGlobalVars->m_vFalse)
120
121 #define wxPGVariant_Bool(A) (A?wxPGVariant_True:wxPGVariant_False)
122
123 // When wxPG is loaded dynamically after the application is already running
124 // then the built-in module system won't pick this one up. Add it manually.
125 WXDLLIMPEXP_PROPGRID void wxPGInitResourceModule();
126
127 // -----------------------------------------------------------------------
128
129 /** @section propgrid_window_styles wxPropertyGrid Window Styles
130
131 SetWindowStyleFlag method can be used to modify some of these at run-time.
132 @{
133 */
134 enum wxPG_WINDOW_STYLES
135 {
136
137 /** This will cause Sort() automatically after an item is added.
138 When inserting a lot of items in this mode, it may make sense to
139 use Freeze() before operations and Thaw() afterwards to increase
140 performance.
141 */
142 wxPG_AUTO_SORT = 0x00000010,
143
144 /** Categories are not initially shown (even if added).
145 IMPORTANT NOTE: If you do not plan to use categories, then this
146 style will waste resources.
147 This flag can also be changed using wxPropertyGrid::EnableCategories method.
148 */
149 wxPG_HIDE_CATEGORIES = 0x00000020,
150
151 /* This style combines non-categoric mode and automatic sorting.
152 */
153 wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT),
154
155 /** Modified values are shown in bold font. Changing this requires Refresh()
156 to show changes.
157 */
158 wxPG_BOLD_MODIFIED = 0x00000040,
159
160 /** Using this style, the column splitters move automatically based on column
161 proportions (default is equal proportion for every column). This behaviour
162 stops once the user manually moves a splitter, and returns when a
163 splitter is double-clicked.
164
165 @see wxPropertyGridInterface::SetColumnProportion().
166 */
167 wxPG_SPLITTER_AUTO_CENTER = 0x00000080,
168
169 /** Display tooltips for cell text that cannot be shown completely. If
170 wxUSE_TOOLTIPS is 0, then this doesn't have any effect.
171 */
172 wxPG_TOOLTIPS = 0x00000100,
173
174 /** Disables margin and hides all expand/collapse buttons that would appear
175 outside the margin (for sub-properties). Toggling this style automatically
176 expands all collapsed items.
177 */
178 wxPG_HIDE_MARGIN = 0x00000200,
179
180 /** This style prevents user from moving the splitter.
181 */
182 wxPG_STATIC_SPLITTER = 0x00000400,
183
184 /** Combination of other styles that make it impossible for user to modify
185 the layout.
186 */
187 wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER),
188
189 /** Disables wxTextCtrl based editors for properties which
190 can be edited in another way.
191
192 Equals calling wxPropertyGrid::LimitPropertyEditing for all added
193 properties.
194 */
195 wxPG_LIMITED_EDITING = 0x00000800,
196
197 /** wxPropertyGridManager only: Show toolbar for mode and page selection. */
198 wxPG_TOOLBAR = 0x00001000,
199
200 /** wxPropertyGridManager only: Show adjustable text box showing description
201 or help text, if available, for currently selected property.
202 */
203 wxPG_DESCRIPTION = 0x00002000,
204
205 /** wxPropertyGridManager only: don't show an internal border around the
206 property grid. Recommended if you use a header.
207 */
208 wxPG_NO_INTERNAL_BORDER = 0x00004000
209 };
210
211 #if wxPG_COMPATIBILITY_1_4
212 // In wxPG 1.4 this was used to enable now-default theme border support
213 // in wxPropertyGridManager.
214 #define wxPG_THEME_BORDER 0x00000000
215 #endif
216
217
218 enum wxPG_EX_WINDOW_STYLES
219 {
220
221 /**
222 NOTE: wxPG_EX_xxx are extra window styles and must be set using
223 SetExtraStyle() member function.
224
225 Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if
226 wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is
227 not activated, and switching the mode first time becomes somewhat slower.
228 wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away.
229 IMPORTANT NOTE: If you do plan not switching to non-categoric mode, or if
230 you don't plan to use categories at all, then using this style will result
231 in waste of resources.
232
233 */
234 wxPG_EX_INIT_NOCAT = 0x00001000,
235
236 /** Extended window style that sets wxPropertyGridManager toolbar to not
237 use flat style.
238 */
239 wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000,
240
241 /** Shows alphabetic/categoric mode buttons from toolbar.
242 */
243 wxPG_EX_MODE_BUTTONS = 0x00008000,
244
245 /** Show property help strings as tool tips instead as text on the status bar.
246 You can set the help strings using SetPropertyHelpString member function.
247 */
248 wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000,
249
250 /** Prevent TAB from focusing to wxButtons. This behaviour was default
251 in version 1.2.0 and earlier.
252 NOTE! Tabbing to button doesn't work yet. Problem seems to be that on wxMSW
253 atleast the button doesn't properly propagate key events (yes, I'm using
254 wxWANTS_CHARS).
255 */
256 //wxPG_EX_NO_TAB_TO_BUTTON = 0x00020000,
257
258 /** Allows relying on native double-buffering.
259 */
260 wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
261
262 /** Set this style to let user have ability to set values of properties to
263 unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
264 all properties.
265 */
266 wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
267
268 /**
269 If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION
270 and wxPG_STRING_PASSWORD) are not stored into property's attribute storage
271 (thus they are not readable).
272
273 Note that this option is global, and applies to all wxPG property
274 containers.
275 */
276 wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000,
277
278 /** Hides page selection buttons from toolbar.
279 */
280 wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
281
282 /** Allows multiple properties to be selected by user (by pressing SHIFT
283 when clicking on a property, or by dragging with left mouse button
284 down).
285
286 You can get array of selected properties with
287 wxPropertyGridInterface::GetSelectedProperties(). In multiple selection
288 mode wxPropertyGridInterface::GetSelection() returns
289 property which has editor active (usually the first one
290 selected). Other useful member functions are ClearSelection(),
291 AddToSelection() and RemoveFromSelection().
292 */
293 wxPG_EX_MULTIPLE_SELECTION = 0x02000000,
294
295 /**
296 This enables top-level window tracking which allows wxPropertyGrid to
297 notify the application of last-minute property value changes by user.
298
299 This style is not enabled by default because it may cause crashes when
300 wxPropertyGrid is used in with wxAUI or similar system.
301
302 @remarks If you are not in fact using any system that may change
303 wxPropertyGrid's top-level parent window on its own, then you
304 are recommended to enable this style.
305 */
306 wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000,
307
308 /** Don't show divider above toolbar, on Windows.
309 */
310 wxPG_EX_NO_TOOLBAR_DIVIDER = 0x08000000,
311
312 /** Show a separator below the toolbar.
313 */
314 wxPG_EX_TOOLBAR_SEPARATOR = 0x10000000
315
316 };
317
318 #if wxPG_COMPATIBILITY_1_4
319 #define wxPG_EX_DISABLE_TLP_TRACKING 0x00000000
320 #endif
321
322 /** Combines various styles.
323 */
324 #define wxPG_DEFAULT_STYLE (0)
325
326 /** Combines various styles.
327 */
328 #define wxPGMAN_DEFAULT_STYLE (0)
329
330 /** @}
331 */
332
333 // -----------------------------------------------------------------------
334
335 //
336 // Ids for sub-controls
337 // NB: It should not matter what these are.
338 #define wxPG_SUBID1 2
339 #define wxPG_SUBID2 3
340 #define wxPG_SUBID_TEMP1 4
341
342 // -----------------------------------------------------------------------
343
344 /** @class wxPGCommonValue
345
346 wxPropertyGrid stores information about common values in these
347 records.
348
349 NB: Common value feature is not complete, and thus not mentioned in
350 documentation.
351 */
352 class WXDLLIMPEXP_PROPGRID wxPGCommonValue
353 {
354 public:
355
356 wxPGCommonValue( const wxString& label, wxPGCellRenderer* renderer )
357 {
358 m_label = label;
359 m_renderer = renderer;
360 renderer->IncRef();
361 }
362 virtual ~wxPGCommonValue()
363 {
364 m_renderer->DecRef();
365 }
366
367 virtual wxString GetEditableText() const { return m_label; }
368 const wxString& GetLabel() const { return m_label; }
369 wxPGCellRenderer* GetRenderer() const { return m_renderer; }
370
371 protected:
372 wxString m_label;
373 wxPGCellRenderer* m_renderer;
374 };
375
376 // -----------------------------------------------------------------------
377
378 /** @section propgrid_vfbflags wxPropertyGrid Validation Failure behaviour Flags
379 @{
380 */
381
382 enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
383 {
384
385 /** Prevents user from leaving property unless value is valid. If this
386 behaviour flag is not used, then value change is instead cancelled.
387 */
388 wxPG_VFB_STAY_IN_PROPERTY = 0x01,
389
390 /** Calls wxBell() on validation failure.
391 */
392 wxPG_VFB_BEEP = 0x02,
393
394 /** Cell with invalid value will be marked (with red colour).
395 */
396 wxPG_VFB_MARK_CELL = 0x04,
397
398 /**
399 Display a text message explaining the situation.
400
401 To customize the way the message is displayed, you need to
402 reimplement wxPropertyGrid::DoShowPropertyError() in a
403 derived class. Default behaviour is to display the text on
404 the top-level frame's status bar, if present, and otherwise
405 using wxMessageBox.
406 */
407 wxPG_VFB_SHOW_MESSAGE = 0x08,
408
409 /**
410 Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
411 message using wxMessageBox.
412 */
413 wxPG_VFB_SHOW_MESSAGEBOX = 0x10,
414
415 /**
416 Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
417 message on the status bar (when present - you can reimplement
418 wxPropertyGrid::GetStatusBar() in a derived class to specify
419 this yourself).
420 */
421 wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20,
422
423 /** Defaults. */
424 wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL |
425 wxPG_VFB_SHOW_MESSAGEBOX,
426
427 /** Only used internally. */
428 wxPG_VFB_UNDEFINED = 0x80
429
430 };
431
432 /** @}
433 */
434
435 // Having this as define instead of wxByte typedef makes things easier for
436 // wxPython bindings (ignoring and redefining it in SWIG interface file
437 // seemed rather tricky)
438 #define wxPGVFBFlags unsigned char
439
440 /**
441 wxPGValidationInfo
442
443 Used to convey validation information to and from functions that
444 actually perform validation. Mostly used in custom property
445 classes.
446 */
447 class WXDLLIMPEXP_PROPGRID wxPGValidationInfo
448 {
449 friend class wxPropertyGrid;
450 public:
451 wxPGValidationInfo()
452 {
453 m_failureBehavior = 0;
454 m_isFailing = false;
455 }
456
457 ~wxPGValidationInfo()
458 {
459 }
460
461 /**
462 @return Returns failure behaviour which is a combination of
463 @ref propgrid_vfbflags.
464 */
465 wxPGVFBFlags GetFailureBehavior() const
466 { return m_failureBehavior; }
467
468 /**
469 Returns current failure message.
470 */
471 const wxString& GetFailureMessage() const
472 { return m_failureMessage; }
473
474 /**
475 Returns reference to pending value.
476 */
477 wxVariant& GetValue()
478 {
479 wxASSERT(m_pValue);
480 return *m_pValue;
481 }
482
483 /** Set validation failure behaviour
484
485 @param failureBehavior
486 Mixture of @ref propgrid_vfbflags.
487 */
488 void SetFailureBehavior(wxPGVFBFlags failureBehavior)
489 { m_failureBehavior = failureBehavior; }
490
491 /**
492 Set current failure message.
493 */
494 void SetFailureMessage(const wxString& message)
495 { m_failureMessage = message; }
496
497 private:
498 /** Value to be validated.
499 */
500 wxVariant* m_pValue;
501
502 /** Message displayed on validation failure.
503 */
504 wxString m_failureMessage;
505
506 /** Validation failure behaviour. Use wxPG_VFB_XXX flags.
507 */
508 wxPGVFBFlags m_failureBehavior;
509
510 // True when validation is currently failing.
511 bool m_isFailing;
512 };
513
514 // -----------------------------------------------------------------------
515
516 /** @section propgrid_pgactions wxPropertyGrid Action Identifiers
517
518 These are used with wxPropertyGrid::AddActionTrigger() and
519 wxPropertyGrid::ClearActionTriggers().
520 @{
521 */
522
523 enum wxPG_KEYBOARD_ACTIONS
524 {
525 wxPG_ACTION_INVALID = 0,
526
527 /** Select the next property. */
528 wxPG_ACTION_NEXT_PROPERTY,
529
530 /** Select the previous property. */
531 wxPG_ACTION_PREV_PROPERTY,
532
533 /** Expand the selected property, if it has child items. */
534 wxPG_ACTION_EXPAND_PROPERTY,
535
536 /** Collapse the selected property, if it has child items. */
537 wxPG_ACTION_COLLAPSE_PROPERTY,
538
539 /** Cancel and undo any editing done in the currently active property
540 editor.
541 */
542 wxPG_ACTION_CANCEL_EDIT,
543
544 /** Move focus to the editor control of the currently selected
545 property.
546 */
547 wxPG_ACTION_EDIT,
548
549 /** Causes editor's button (if any) to be pressed. */
550 wxPG_ACTION_PRESS_BUTTON,
551
552 wxPG_ACTION_MAX
553 };
554
555 /** @}
556 */
557
558 // -----------------------------------------------------------------------
559
560
561 // wxPropertyGrid::DoSelectProperty flags (selFlags)
562
563 // Focuses to created editor
564 #define wxPG_SEL_FOCUS 0x0001
565 // Forces deletion and recreation of editor
566 #define wxPG_SEL_FORCE 0x0002
567 // For example, doesn't cause EnsureVisible
568 #define wxPG_SEL_NONVISIBLE 0x0004
569 // Do not validate editor's value before selecting
570 #define wxPG_SEL_NOVALIDATE 0x0008
571 // Property being deselected is about to be deleted
572 #define wxPG_SEL_DELETING 0x0010
573 // Property's values was set to unspecified by the user
574 #define wxPG_SEL_SETUNSPEC 0x0020
575 // Property's event handler changed the value
576 #define wxPG_SEL_DIALOGVAL 0x0040
577 // Set to disable sending of wxEVT_PG_SELECTED event
578 #define wxPG_SEL_DONT_SEND_EVENT 0x0080
579 // Don't make any graphics updates
580 #define wxPG_SEL_NO_REFRESH 0x0100
581
582 // -----------------------------------------------------------------------
583
584 // DoSetSplitterPosition() flags
585
586 enum wxPG_SET_SPLITTER_POSITION_SPLITTER_FLAGS
587 {
588 wxPG_SPLITTER_REFRESH = 0x0001,
589 wxPG_SPLITTER_ALL_PAGES = 0x0002,
590 wxPG_SPLITTER_FROM_EVENT = 0x0004,
591 wxPG_SPLITTER_FROM_AUTO_CENTER = 0x0008
592 };
593
594
595 // -----------------------------------------------------------------------
596
597 // Internal flags
598 #define wxPG_FL_INITIALIZED 0x0001
599 // Set when creating editor controls if it was clicked on.
600 #define wxPG_FL_ACTIVATION_BY_CLICK 0x0002
601 #define wxPG_FL_DONT_CENTER_SPLITTER 0x0004
602 #define wxPG_FL_FOCUSED 0x0008
603 #define wxPG_FL_MOUSE_CAPTURED 0x0010
604 #define wxPG_FL_MOUSE_INSIDE 0x0020
605 #define wxPG_FL_VALUE_MODIFIED 0x0040
606 // don't clear background of m_wndEditor
607 #define wxPG_FL_PRIMARY_FILLS_ENTIRE 0x0080
608 // currently active editor uses custom image
609 #define wxPG_FL_CUR_USES_CUSTOM_IMAGE 0x0100
610 // cell colours override selection colours for selected cell
611 #define wxPG_FL_CELL_OVERRIDES_SEL 0x0200
612 #define wxPG_FL_SCROLLED 0x0400
613 // set when all added/inserted properties get hideable flag
614 #define wxPG_FL_ADDING_HIDEABLES 0x0800
615 // Disables showing help strings on statusbar.
616 #define wxPG_FL_NOSTATUSBARHELP 0x1000
617 // Marks that we created the state, so we have to destroy it too.
618 #define wxPG_FL_CREATEDSTATE 0x2000
619 // Set if scrollbar's existence was detected in last onresize.
620 #define wxPG_FL_SCROLLBAR_DETECTED 0x4000
621 // Set if wxPGMan requires redrawing of description text box.
622 #define wxPG_FL_DESC_REFRESH_REQUIRED 0x8000
623 // Set if contained in wxPropertyGridManager
624 #define wxPG_FL_IN_MANAGER 0x00020000
625 // Set after wxPropertyGrid is shown in its initial good size
626 #define wxPG_FL_GOOD_SIZE_SET 0x00040000
627 // Set when in SelectProperty.
628 #define wxPG_FL_IN_SELECT_PROPERTY 0x00100000
629 // Set when help string is shown in status bar
630 #define wxPG_FL_STRING_IN_STATUSBAR 0x00200000
631 // Auto sort is enabled (for categorized mode)
632 #define wxPG_FL_CATMODE_AUTO_SORT 0x01000000
633 // Set after page has been inserted to manager
634 #define wxPG_MAN_FL_PAGE_INSERTED 0x02000000
635 // Active editor control is abnormally large
636 #define wxPG_FL_ABNORMAL_EDITOR 0x04000000
637 // Recursion guard for HandleCustomEditorEvent
638 #define wxPG_FL_IN_HANDLECUSTOMEDITOREVENT 0x08000000
639 #define wxPG_FL_VALUE_CHANGE_IN_EVENT 0x10000000
640 // Editor control width should not change on resize
641 #define wxPG_FL_FIXED_WIDTH_EDITOR 0x20000000
642 // Width of panel can be different than width of grid
643 #define wxPG_FL_HAS_VIRTUAL_WIDTH 0x40000000
644 // Prevents RecalculateVirtualSize re-entrancy
645 #define wxPG_FL_RECALCULATING_VIRTUAL_SIZE 0x80000000
646
647 #if !defined(__wxPG_SOURCE_FILE__)
648 // Reduce compile time, but still include in user app
649 #include "wx/propgrid/props.h"
650 #endif
651
652 // -----------------------------------------------------------------------
653
654 /** @class wxPropertyGrid
655
656 wxPropertyGrid is a specialized grid for editing properties
657 such as strings, numbers, flagsets, fonts, and colours. wxPropertySheet
658 used to do the very same thing, but it hasn't been updated for a while
659 and it is currently deprecated.
660
661 Please note that most member functions are inherited and as such not
662 documented on this page. This means you will probably also want to read
663 wxPropertyGridInterface class reference.
664
665 See also @ref overview_propgrid.
666
667 @section propgrid_window_styles_ Window Styles
668
669 See @ref propgrid_window_styles.
670
671 @section propgrid_event_handling Event Handling
672
673 To process input from a propertygrid control, use these event handler
674 macros to direct input to member functions that take a wxPropertyGridEvent
675 argument.
676
677 @beginEventTable{wxPropertyGridEvent}
678 @event{EVT_PG_SELECTED (id, func)}
679 Respond to wxEVT_PG_SELECTED event, generated when a property selection
680 has been changed, either by user action or by indirect program
681 function. For instance, collapsing a parent property programmatically
682 causes any selected child property to become unselected, and may
683 therefore cause this event to be generated.
684 @event{EVT_PG_CHANGING(id, func)}
685 Respond to wxEVT_PG_CHANGING event, generated when property value
686 is about to be changed by user. Use wxPropertyGridEvent::GetValue()
687 to take a peek at the pending value, and wxPropertyGridEvent::Veto()
688 to prevent change from taking place, if necessary.
689 @event{EVT_PG_HIGHLIGHTED(id, func)}
690 Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse
691 moves over a property. Event's property is NULL if hovered area does
692 not belong to any property.
693 @event{EVT_PG_RIGHT_CLICK(id, func)}
694 Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is
695 clicked on with right mouse button.
696 @event{EVT_PG_DOUBLE_CLICK(id, func)}
697 Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is
698 double-clicked onwith left mouse button.
699 @event{EVT_PG_ITEM_COLLAPSED(id, func)}
700 Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses
701 a property or category..
702 @event{EVT_PG_ITEM_EXPANDED(id, func)}
703 Respond to wxEVT_PG_ITEM_EXPANDED event, generated when user expands
704 a property or category..
705 @event{EVT_PG_LABEL_EDIT_BEGIN(id, func)}
706 Respond to wxEVT_PG_LABEL_EDIT_BEGIN event, generated when is about to
707 begin editing a property label. You can veto this event to prevent the
708 action.
709 @event{EVT_PG_LABEL_EDIT_ENDING(id, func)}
710 Respond to wxEVT_PG_LABEL_EDIT_ENDING event, generated when is about to
711 end editing of a property label. You can veto this event to prevent the
712 action.
713 @event{EVT_PG_COL_BEGIN_DRAG(id, func)}
714 Respond to wxEVT_PG_COL_BEGIN_DRAG event, generated when user
715 starts resizing a column - can be vetoed.
716 @event{EVT_PG_COL_DRAGGING,(id, func)}
717 Respond to wxEVT_PG_COL_DRAGGING, event, generated when a
718 column resize by user is in progress. This event is also generated
719 when user double-clicks the splitter in order to recenter
720 it.
721 @event{EVT_PG_COL_END_DRAG(id, func)}
722 Respond to wxEVT_PG_COL_END_DRAG event, generated after column
723 resize by user has finished.
724 @endEventTable
725
726 @remarks
727
728 - Use Freeze() and Thaw() respectively to disable and enable drawing. This
729 will also delay sorting etc. miscellaneous calculations to the last
730 possible moment.
731
732 @library{wxpropgrid}
733 @category{propgrid}
734 */
735 class WXDLLIMPEXP_PROPGRID wxPropertyGrid : public wxControl,
736 public wxScrollHelper,
737 public wxPropertyGridInterface
738 {
739 friend class wxPropertyGridEvent;
740 friend class wxPropertyGridPageState;
741 friend class wxPropertyGridInterface;
742 friend class wxPropertyGridManager;
743 friend class wxPGHeaderCtrl;
744
745 DECLARE_DYNAMIC_CLASS(wxPropertyGrid)
746 public:
747
748 #ifndef SWIG
749 /**
750 Two step constructor.
751
752 Call Create when this constructor is called to build up the
753 wxPropertyGrid
754 */
755 wxPropertyGrid();
756 #endif
757
758 /** The default constructor. The styles to be used are styles valid for
759 the wxWindow.
760
761 @see @link wndflags Additional Window Styles @endlink
762 */
763 wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY,
764 const wxPoint& pos = wxDefaultPosition,
765 const wxSize& size = wxDefaultSize,
766 long style = wxPG_DEFAULT_STYLE,
767 const wxString& name = wxPropertyGridNameStr );
768
769 /** Destructor */
770 virtual ~wxPropertyGrid();
771
772 /** Adds given key combination to trigger given action.
773
774 Here is a sample code to make Enter key press move focus to
775 the next property.
776
777 @code
778 propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY,
779 WXK_RETURN);
780 propGrid->DedicateKey(WXK_RETURN);
781 @endcode
782
783 @param action
784 Which action to trigger. See @ref propgrid_keyboard_actions.
785 @param keycode
786 Which keycode triggers the action.
787 @param modifiers
788 Which key event modifiers, in addition to keycode, are needed to
789 trigger the action.
790 */
791 void AddActionTrigger( int action, int keycode, int modifiers = 0 );
792
793 /**
794 Dedicates a specific keycode to wxPropertyGrid. This means that such
795 key presses will not be redirected to editor controls.
796
797 Using this function allows, for example, navigation between
798 properties using arrow keys even when the focus is in the editor
799 control.
800 */
801 void DedicateKey( int keycode )
802 {
803 m_dedicatedKeys.push_back(keycode);
804 }
805
806 /**
807 This static function enables or disables automatic use of
808 wxGetTranslation for following strings: wxEnumProperty list labels,
809 wxFlagsProperty sub-property labels.
810
811 Default is false.
812 */
813 static void AutoGetTranslation( bool enable );
814
815 /**
816 Changes value of a property, as if from an editor.
817
818 Use this instead of SetPropertyValue() if you need the value to run
819 through validation process, and also send the property change event.
820
821 @return
822 Returns true if value was successfully changed.
823 */
824 bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
825
826 /**
827 Centers the splitter.
828
829 @param enableAutoResizing
830 If @true, automatic column resizing is enabled (only applicapple
831 if window style wxPG_SPLITTER_AUTO_CENTER is used).
832 */
833 void CenterSplitter( bool enableAutoResizing = false );
834
835 /** Deletes all properties.
836 */
837 virtual void Clear();
838
839 /** Clears action triggers for given action.
840 @param action
841 Which action to trigger. See @link pgactions List of list of
842 wxPropertyGrid actions@endlink.
843 */
844 void ClearActionTriggers( int action );
845
846 /** Forces updating the value of property from the editor control.
847
848 Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
849 ProcessEvent, meaning your event handlers will be called immediately.
850
851 @return
852 Returns true if anything was changed.
853 */
854 virtual bool CommitChangesFromEditor( wxUint32 flags = 0 );
855
856 /**
857 Two step creation.
858
859 Whenever the control is created without any parameters, use Create to
860 actually create it. Don't access the control's public methods before
861 this is called @see @link wndflags Additional Window Styles@endlink
862 */
863 bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
864 const wxPoint& pos = wxDefaultPosition,
865 const wxSize& size = wxDefaultSize,
866 long style = wxPG_DEFAULT_STYLE,
867 const wxString& name = wxPropertyGridNameStr );
868
869 /**
870 Call when editor widget's contents is modified.
871
872 For example, this is called when changes text in wxTextCtrl (used in
873 wxStringProperty and wxIntProperty).
874
875 @remarks
876 This function should only be called by custom properties.
877
878 @see wxPGProperty::OnEvent()
879 */
880 void EditorsValueWasModified() { m_iFlags |= wxPG_FL_VALUE_MODIFIED; }
881
882 /** Reverse of EditorsValueWasModified().
883
884 @remarks
885 This function should only be called by custom properties.
886 */
887 void EditorsValueWasNotModified()
888 {
889 m_iFlags &= ~(wxPG_FL_VALUE_MODIFIED);
890 }
891
892 /**
893 Enables or disables (shows/hides) categories according to parameter
894 enable.
895 */
896 bool EnableCategories( bool enable );
897
898 /** Scrolls and/or expands items to ensure that the given item is visible.
899 Returns true if something was actually done.
900 */
901 bool EnsureVisible( wxPGPropArg id );
902
903 /**
904 Reduces column sizes to minimum possible that contents are still
905 visibly (naturally some margin space will be applied as well).
906
907 @return
908 Minimum size for the grid to still display everything.
909
910 @remarks
911 Does not work well with wxPG_SPLITTER_AUTO_CENTER window style.
912
913 This function only works properly if grid size prior to call was already
914 fairly large.
915
916 Note that you can also get calculated column widths by calling
917 GetState->GetColumnWidth() immediately after this function returns.
918 */
919 wxSize FitColumns()
920 {
921 wxSize sz = m_pState->DoFitColumns();
922 return sz;
923 }
924
925 /**
926 Returns wxWindow that the properties are painted on, and which should
927 be used as the parent for editor controls.
928 */
929 wxWindow* GetPanel()
930 {
931 return this;
932 }
933
934 /** Returns current category caption background colour. */
935 wxColour GetCaptionBackgroundColour() const { return m_colCapBack; }
936
937 wxFont& GetCaptionFont() { return m_captionFont; }
938
939 const wxFont& GetCaptionFont() const { return m_captionFont; }
940
941 /** Returns current category caption text colour. */
942 wxColour GetCaptionForegroundColour() const { return m_colCapFore; }
943
944 /** Returns current cell background colour. */
945 wxColour GetCellBackgroundColour() const { return m_colPropBack; }
946
947 /** Returns current cell text colour when disabled. */
948 wxColour GetCellDisabledTextColour() const { return m_colDisPropFore; }
949
950 /** Returns current cell text colour. */
951 wxColour GetCellTextColour() const { return m_colPropFore; }
952
953 /**
954 Returns number of columns currently on grid.
955 */
956 unsigned int GetColumnCount() const
957 {
958 return (unsigned int) m_pState->m_colWidths.size();
959 }
960
961 /** Returns colour of empty space below properties. */
962 wxColour GetEmptySpaceColour() const { return m_colEmptySpace; }
963
964 /** Returns height of highest characters of used font. */
965 int GetFontHeight() const { return m_fontHeight; }
966
967 /** Returns pointer to itself. Dummy function that enables same kind
968 of code to use wxPropertyGrid and wxPropertyGridManager.
969 */
970 wxPropertyGrid* GetGrid() { return this; }
971
972 /** Returns rectangle of custom paint image.
973 */
974 wxRect GetImageRect( wxPGProperty* p, int item ) const;
975
976 /** Returns size of the custom paint image in front of property.
977 If no argument is given, returns preferred size.
978 */
979 wxSize GetImageSize( wxPGProperty* p = NULL, int item = -1 ) const;
980
981 //@{
982 /** Returns last item which could be iterated using given flags.
983 @param flags
984 See @ref propgrid_iterator_flags.
985 */
986 wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT )
987 {
988 return m_pState->GetLastItem(flags);
989 }
990
991 const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
992 {
993 return m_pState->GetLastItem(flags);
994 }
995 //@}
996
997 /** Returns colour of lines between cells. */
998 wxColour GetLineColour() const { return m_colLine; }
999
1000 /** Returns background colour of margin. */
1001 wxColour GetMarginColour() const { return m_colMargin; }
1002
1003 /** Returns margin width. */
1004 int GetMarginWidth() const { return m_marginWidth; }
1005
1006 /**
1007 Returns most up-to-date value of selected property. This will return
1008 value different from GetSelectedProperty()->GetValue() only when text
1009 editor is activate and string edited by user represents valid,
1010 uncommitted property value.
1011 */
1012 wxVariant GetUncommittedPropertyValue();
1013
1014 /** Returns "root property". It does not have name, etc. and it is not
1015 visible. It is only useful for accessing its children.
1016 */
1017 wxPGProperty* GetRoot() const { return m_pState->m_properties; }
1018
1019 /** Returns height of a single grid row (in pixels). */
1020 int GetRowHeight() const { return m_lineHeight; }
1021
1022 /** Returns currently selected property. */
1023 wxPGProperty* GetSelectedProperty() const { return GetSelection(); }
1024
1025 /** Returns current selection background colour. */
1026 wxColour GetSelectionBackgroundColour() const { return m_colSelBack; }
1027
1028 /** Returns current selection text colour. */
1029 wxColour GetSelectionForegroundColour() const { return m_colSelFore; }
1030
1031 /**
1032 Returns current splitter x position.
1033 */
1034 int GetSplitterPosition( unsigned int splitterIndex = 0 ) const
1035 {
1036 return m_pState->DoGetSplitterPosition(splitterIndex);
1037 }
1038
1039 /** Returns wxTextCtrl active in currently selected property, if any. Takes
1040 into account wxOwnerDrawnComboBox.
1041 */
1042 wxTextCtrl* GetEditorTextCtrl() const;
1043
1044 wxPGValidationInfo& GetValidationInfo()
1045 {
1046 return m_validationInfo;
1047 }
1048
1049 /** Returns current vertical spacing. */
1050 int GetVerticalSpacing() const { return (int)m_vspacing; }
1051
1052 /**
1053 Returns @true if a property editor control has focus.
1054 */
1055 bool IsEditorFocused() const;
1056
1057 /** Returns true if editor's value was marked modified.
1058 */
1059 bool IsEditorsValueModified() const
1060 { return ( m_iFlags & wxPG_FL_VALUE_MODIFIED ) ? true : false; }
1061
1062 /**
1063 Returns information about arbitrary position in the grid.
1064
1065 @param pt
1066 Coordinates in the virtual grid space. You may need to use
1067 wxScrolled<T>::CalcScrolledPosition() for translating
1068 wxPropertyGrid client coordinates into something this member
1069 function can use.
1070 */
1071 wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
1072
1073 /** Returns true if any property has been modified by the user. */
1074 bool IsAnyModified() const { return (m_pState->m_anyModified>0); }
1075
1076 /**
1077 Returns true if updating is frozen (ie Freeze() called but not yet
1078 Thaw() ).
1079 */
1080 bool IsFrozen() const { return (m_frozen>0)?true:false; }
1081
1082 /**
1083 It is recommended that you call this function any time your code causes
1084 wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle()
1085 handler should be able to detect most changes, but it is not perfect.
1086
1087 @param newTLP
1088 New top-level parent that is about to be set. Old top-level parent
1089 window should still exist as the current one.
1090
1091 @remarks This function is automatically called from wxPropertyGrid::
1092 Reparent() and wxPropertyGridManager::Reparent(). You only
1093 need to use it if you reparent wxPropertyGrid indirectly.
1094 */
1095 void OnTLPChanging( wxWindow* newTLP );
1096
1097 /** Redraws given property.
1098 */
1099 virtual void RefreshProperty( wxPGProperty* p );
1100
1101 /** Registers a new editor class.
1102 @return
1103 Pointer to the editor class instance that should be used.
1104 */
1105 static wxPGEditor* RegisterEditorClass( wxPGEditor* editor,
1106 bool noDefCheck = false )
1107 {
1108 return DoRegisterEditorClass(editor, wxEmptyString, noDefCheck);
1109 }
1110
1111 static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editorClass,
1112 const wxString& editorName,
1113 bool noDefCheck = false );
1114
1115 /** Resets all colours to the original system values.
1116 */
1117 void ResetColours();
1118
1119 /**
1120 Resets column sizes and splitter positions, based on proportions.
1121
1122 @param enableAutoResizing
1123 If @true, automatic column resizing is enabled (only applicapple
1124 if window style wxPG_SPLITTER_AUTO_CENTER is used).
1125
1126 @see wxPropertyGridInterface::SetColumnProportion()
1127 */
1128 void ResetColumnSizes( bool enableAutoResizing = false );
1129
1130 /**
1131 Selects a property.
1132 Editor widget is automatically created, but not focused unless focus is
1133 true.
1134
1135 @param id
1136 Property to select.
1137
1138 @return
1139 True if selection finished successfully. Usually only fails if
1140 current value in editor is not valid.
1141
1142 @remarks In wxPropertyGrid 1.4, this member function used to generate
1143 wxEVT_PG_SELECTED. In wxWidgets 2.9 and later, it no longer
1144 does that.
1145
1146 @remarks This clears any previous selection.
1147 */
1148 bool SelectProperty( wxPGPropArg id, bool focus = false );
1149
1150 /**
1151 Set entire new selection from given list of properties.
1152 */
1153 void SetSelection( const wxArrayPGProperty& newSelection )
1154 {
1155 DoSetSelection( newSelection, wxPG_SEL_DONT_SEND_EVENT );
1156 }
1157
1158 /**
1159 Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION
1160 extra style is not used, then this has same effect as
1161 calling SelectProperty().
1162
1163 @remarks Multiple selection is not supported for categories. This
1164 means that if you have properties selected, you cannot
1165 add category to selection, and also if you have category
1166 selected, you cannot add other properties to selection.
1167 This member function will fail silently in these cases,
1168 even returning true.
1169 */
1170 bool AddToSelection( wxPGPropArg id )
1171 {
1172 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
1173 return DoAddToSelection(p, wxPG_SEL_DONT_SEND_EVENT);
1174 }
1175
1176 /**
1177 Removes given property from selection. If property is not selected,
1178 an assertion failure will occur.
1179 */
1180 bool RemoveFromSelection( wxPGPropArg id )
1181 {
1182 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
1183 return DoRemoveFromSelection(p, wxPG_SEL_DONT_SEND_EVENT);
1184 }
1185
1186 /**
1187 Makes given column editable by user.
1188
1189 @param editable
1190 Using @false here will disable column from being editable.
1191 */
1192 void MakeColumnEditable( unsigned int column, bool editable = true );
1193
1194 /**
1195 Creates label editor wxTextCtrl for given column, for property
1196 that is currently selected. When multiple selection is
1197 enabled, this applies to whatever property GetSelection()
1198 returns.
1199
1200 @param colIndex
1201 Which column's label to edit. Note that you should not
1202 use value 1, which is reserved for property value
1203 column.
1204
1205 @see EndLabelEdit(), MakeColumnEditable()
1206 */
1207 void BeginLabelEdit( unsigned int column = 0 )
1208 {
1209 DoBeginLabelEdit(column, wxPG_SEL_DONT_SEND_EVENT);
1210 }
1211
1212 /**
1213 Destroys label editor wxTextCtrl, if any.
1214
1215 @param commit
1216 Use @true (default) to store edited label text in
1217 property cell data.
1218
1219 @see BeginLabelEdit(), MakeColumnEditable()
1220 */
1221 void EndLabelEdit( bool commit = true )
1222 {
1223 DoEndLabelEdit(commit, wxPG_SEL_DONT_SEND_EVENT);
1224 }
1225
1226 /**
1227 Returns currently active label editor, NULL if none.
1228 */
1229 wxTextCtrl* GetLabelEditor() const
1230 {
1231 return m_labelEditor;
1232 }
1233
1234 /** Sets category caption background colour. */
1235 void SetCaptionBackgroundColour(const wxColour& col);
1236
1237 /** Sets category caption text colour. */
1238 void SetCaptionTextColour(const wxColour& col);
1239
1240 /** Sets default cell background colour - applies to property cells.
1241 Note that appearance of editor widgets may not be affected.
1242 */
1243 void SetCellBackgroundColour(const wxColour& col);
1244
1245 /** Sets cell text colour for disabled properties.
1246 */
1247 void SetCellDisabledTextColour(const wxColour& col);
1248
1249 /** Sets default cell text colour - applies to property name and value text.
1250 Note that appearance of editor widgets may not be affected.
1251 */
1252 void SetCellTextColour(const wxColour& col);
1253
1254 /** Set number of columns (2 or more).
1255 */
1256 void SetColumnCount( int colCount )
1257 {
1258 m_pState->SetColumnCount(colCount);
1259 Refresh();
1260 }
1261
1262 /**
1263 Sets the 'current' category - Append will add non-category properties
1264 under it.
1265 */
1266 void SetCurrentCategory( wxPGPropArg id )
1267 {
1268 wxPG_PROP_ARG_CALL_PROLOG()
1269 wxPropertyCategory* pc = wxDynamicCast(p, wxPropertyCategory);
1270 wxASSERT(pc);
1271 m_pState->m_currentCategory = pc;
1272 }
1273
1274 /** Sets colour of empty space below properties. */
1275 void SetEmptySpaceColour(const wxColour& col);
1276
1277 /** Sets colour of lines between cells. */
1278 void SetLineColour(const wxColour& col);
1279
1280 /** Sets background colour of margin. */
1281 void SetMarginColour(const wxColour& col);
1282
1283 /**
1284 Sets selection background colour - applies to selected property name
1285 background.
1286 */
1287 void SetSelectionBackgroundColour(const wxColour& col);
1288
1289 /**
1290 Sets selection foreground colour - applies to selected property name
1291 text.
1292 */
1293 void SetSelectionTextColour(const wxColour& col);
1294
1295 /** Sets x coordinate of the splitter.
1296 @remarks
1297 Splitter position cannot exceed grid size, and therefore setting it
1298 during form creation may fail as initial grid size is often smaller
1299 than desired splitter position, especially when sizers are being used.
1300 */
1301 void SetSplitterPosition( int newXPos, int col = 0 )
1302 {
1303 DoSetSplitterPosition(newXPos, col, wxPG_SPLITTER_REFRESH);
1304 }
1305
1306 /**
1307 Sets the property sorting function.
1308
1309 @param sortFunction
1310 The sorting function to be used. It should return a value greater
1311 than 0 if position of p1 is after p2. So, for instance, when
1312 comparing property names, you can use following implementation:
1313
1314 @code
1315 int MyPropertySortFunction(wxPropertyGrid* propGrid,
1316 wxPGProperty* p1,
1317 wxPGProperty* p2)
1318 {
1319 return p1->GetBaseName().compare( p2->GetBaseName() );
1320 }
1321 @endcode
1322
1323 @remarks
1324 Default property sort function sorts properties by their labels
1325 (case-insensitively).
1326
1327 @see GetSortFunction, wxPropertyGridInterface::Sort,
1328 wxPropertyGridInterface::SortChildren
1329 */
1330 void SetSortFunction( wxPGSortCallback sortFunction )
1331 {
1332 m_sortFunction = sortFunction;
1333 }
1334
1335 /**
1336 Returns the property sort function (default is @NULL).
1337
1338 @see SetSortFunction
1339 */
1340 wxPGSortCallback GetSortFunction() const
1341 {
1342 return m_sortFunction;
1343 }
1344
1345 /**
1346 Sets appearance of value cells representing an unspecified property
1347 value. Default appearance is blank.
1348
1349 @remarks If you set the unspecified value to have any
1350 textual representation, then that will override
1351 "InlineHelp" attribute.
1352
1353 @see wxPGProperty::SetValueToUnspecified(),
1354 wxPGProperty::IsValueUnspecified()
1355 */
1356 void SetUnspecifiedValueAppearance( const wxPGCell& cell )
1357 {
1358 m_unspecifiedAppearance = m_propertyDefaultCell;
1359 m_unspecifiedAppearance.MergeFrom(cell);
1360 }
1361
1362 /**
1363 Returns current appearance of unspecified value cells.
1364
1365 @see SetUnspecifiedValueAppearance()
1366 */
1367 const wxPGCell& GetUnspecifiedValueAppearance() const
1368 {
1369 return m_unspecifiedAppearance;
1370 }
1371
1372 /**
1373 Returns (visual) text representation of the unspecified
1374 property value.
1375
1376 @param argFlags For internal use only.
1377 */
1378 wxString GetUnspecifiedValueText( int argFlags = 0 ) const;
1379
1380 /** Set virtual width for this particular page. Width -1 indicates that the
1381 virtual width should be disabled. */
1382 void SetVirtualWidth( int width );
1383
1384 /**
1385 Moves splitter as left as possible, while still allowing all
1386 labels to be shown in full.
1387
1388 @param privateChildrenToo
1389 If @false, will still allow private children to be cropped.
1390 */
1391 void SetSplitterLeft( bool privateChildrenToo = false )
1392 {
1393 m_pState->SetSplitterLeft(privateChildrenToo);
1394 }
1395
1396 /** Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font
1397 height. Value of 2 should be default on most platforms.
1398 */
1399 void SetVerticalSpacing( int vspacing )
1400 {
1401 m_vspacing = (unsigned char)vspacing;
1402 CalculateFontAndBitmapStuff( vspacing );
1403 if ( !m_pState->m_itemsAdded ) Refresh();
1404 }
1405
1406 /** Shows an brief error message that is related to a property. */
1407 void ShowPropertyError( wxPGPropArg id, const wxString& msg )
1408 {
1409 wxPG_PROP_ARG_CALL_PROLOG()
1410 DoShowPropertyError(p, msg);
1411 }
1412
1413 /////////////////////////////////////////////////////////////////
1414 //
1415 // Following methods do not need to be (currently) documented
1416 //
1417 /////////////////////////////////////////////////////////////////
1418
1419 bool HasVirtualWidth() const
1420 { return (m_iFlags & wxPG_FL_HAS_VIRTUAL_WIDTH) ? true : false; }
1421
1422 const wxPGCommonValue* GetCommonValue( unsigned int i ) const
1423 {
1424 return (wxPGCommonValue*) m_commonValues[i];
1425 }
1426
1427 /** Returns number of common values.
1428 */
1429 unsigned int GetCommonValueCount() const
1430 {
1431 return (unsigned int) m_commonValues.size();
1432 }
1433
1434 /** Returns label of given common value.
1435 */
1436 wxString GetCommonValueLabel( unsigned int i ) const
1437 {
1438 wxASSERT( GetCommonValue(i) );
1439 return GetCommonValue(i)->GetLabel();
1440 }
1441
1442 /**
1443 Returns index of common value that will truly change value to
1444 unspecified.
1445 */
1446 int GetUnspecifiedCommonValue() const { return m_cvUnspecified; }
1447
1448 /** Set index of common value that will truly change value to unspecified.
1449 Using -1 will set none to have such effect.
1450 Default is 0.
1451 */
1452 void SetUnspecifiedCommonValue( int index ) { m_cvUnspecified = index; }
1453
1454 /**
1455 Shortcut for creating dialog-caller button. Used, for example, by
1456 wxFontProperty.
1457 @remarks
1458 This should only be called by properties.
1459 */
1460 wxWindow* GenerateEditorButton( const wxPoint& pos, const wxSize& sz );
1461
1462 /** Fixes position of wxTextCtrl-like control (wxSpinCtrl usually
1463 fits as one). Call after control has been created (but before
1464 shown).
1465 */
1466 void FixPosForTextCtrl( wxWindow* ctrl,
1467 unsigned int forColumn = 1,
1468 const wxPoint& offset = wxPoint(0, 0) );
1469
1470 /** Shortcut for creating text editor widget.
1471 @param pos
1472 Same as pos given for CreateEditor.
1473 @param sz
1474 Same as sz given for CreateEditor.
1475 @param value
1476 Initial text for wxTextCtrl.
1477 @param secondary
1478 If right-side control, such as button, also created, then create it
1479 first and pass it as this parameter.
1480 @param extraStyle
1481 Extra style flags to pass for wxTextCtrl.
1482 @remarks
1483 Note that this should generally be called only by new classes derived
1484 from wxPGProperty.
1485 */
1486 wxWindow* GenerateEditorTextCtrl( const wxPoint& pos,
1487 const wxSize& sz,
1488 const wxString& value,
1489 wxWindow* secondary,
1490 int extraStyle = 0,
1491 int maxLen = 0,
1492 unsigned int forColumn = 1 );
1493
1494 /* Generates both textctrl and button.
1495 */
1496 wxWindow* GenerateEditorTextCtrlAndButton( const wxPoint& pos,
1497 const wxSize& sz, wxWindow** psecondary, int limited_editing,
1498 wxPGProperty* property );
1499
1500 /** Generates position for a widget editor dialog box.
1501 @param p
1502 Property for which dialog is positioned.
1503 @param sz
1504 Known or over-approximated size of the dialog.
1505 @return
1506 Position for dialog.
1507 */
1508 wxPoint GetGoodEditorDialogPosition( wxPGProperty* p,
1509 const wxSize& sz );
1510
1511 // Converts escape sequences in src_str to newlines,
1512 // tabs, etc. and copies result to dst_str.
1513 static wxString& ExpandEscapeSequences( wxString& dst_str,
1514 wxString& src_str );
1515
1516 // Converts newlines, tabs, etc. in src_str to escape
1517 // sequences, and copies result to dst_str.
1518 static wxString& CreateEscapeSequences( wxString& dst_str,
1519 wxString& src_str );
1520
1521 /**
1522 Returns rectangle that fully contains properties between and including
1523 p1 and p2. Rectangle is in virtual scrolled window coordinates.
1524 */
1525 wxRect GetPropertyRect( const wxPGProperty* p1,
1526 const wxPGProperty* p2 ) const;
1527
1528 /** Returns pointer to current active primary editor control (NULL if none).
1529 */
1530 wxWindow* GetEditorControl() const;
1531
1532 wxWindow* GetPrimaryEditor() const
1533 {
1534 return GetEditorControl();
1535 }
1536
1537 /**
1538 Returns pointer to current active secondary editor control (NULL if
1539 none).
1540 */
1541 wxWindow* GetEditorControlSecondary() const
1542 {
1543 return m_wndEditor2;
1544 }
1545
1546 /**
1547 Refreshes any active editor control.
1548 */
1549 void RefreshEditor();
1550
1551 // Events from editor controls are forward to this function
1552 bool HandleCustomEditorEvent( wxEvent &event );
1553
1554 // Mostly useful for page switching.
1555 void SwitchState( wxPropertyGridPageState* pNewState );
1556
1557 long GetInternalFlags() const { return m_iFlags; }
1558 bool HasInternalFlag( long flag ) const
1559 { return (m_iFlags & flag) ? true : false; }
1560 void SetInternalFlag( long flag ) { m_iFlags |= flag; }
1561 void ClearInternalFlag( long flag ) { m_iFlags &= ~(flag); }
1562 void IncFrozen() { m_frozen++; }
1563 void DecFrozen() { m_frozen--; }
1564
1565 void OnComboItemPaint( const wxPGComboBox* pCb,
1566 int item,
1567 wxDC* pDc,
1568 wxRect& rect,
1569 int flags );
1570
1571 /** Standardized double-to-string conversion.
1572 */
1573 static const wxString& DoubleToString( wxString& target,
1574 double value,
1575 int precision,
1576 bool removeZeroes,
1577 wxString* precTemplate = NULL );
1578
1579 /**
1580 Call this from wxPGProperty::OnEvent() to cause property value to be
1581 changed after the function returns (with true as return value).
1582 ValueChangeInEvent() must be used if you wish the application to be
1583 able to use wxEVT_PG_CHANGING to potentially veto the given value.
1584 */
1585 void ValueChangeInEvent( wxVariant variant )
1586 {
1587 m_changeInEventValue = variant;
1588 m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT;
1589 }
1590
1591 /**
1592 You can use this member function, for instance, to detect in
1593 wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was
1594 already called in wxPGEditor::OnEvent(). It really only detects
1595 if was value was changed using wxPGProperty::SetValueInEvent(), which
1596 is usually used when a 'picker' dialog is displayed. If value was
1597 written by "normal means" in wxPGProperty::StringToValue() or
1598 IntToValue(), then this function will return false (on the other hand,
1599 wxPGProperty::OnEvent() is not even called in those cases).
1600 */
1601 bool WasValueChangedInEvent() const
1602 {
1603 return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false;
1604 }
1605
1606 /** Returns true if given event is from first of an array of buttons
1607 (as can be in case when wxPGMultiButton is used).
1608 */
1609 bool IsMainButtonEvent( const wxEvent& event )
1610 {
1611 return (event.GetEventType() == wxEVT_BUTTON)
1612 && (m_wndSecId == event.GetId());
1613 }
1614
1615 /** Pending value is expected to be passed in PerformValidation().
1616 */
1617 virtual bool DoPropertyChanged( wxPGProperty* p,
1618 unsigned int selFlags = 0 );
1619
1620 /** Called when validation for given property fails.
1621 @param invalidValue
1622 Value which failed in validation.
1623 @return
1624 Return true if user is allowed to change to another property even
1625 if current has invalid value.
1626 @remarks
1627 To add your own validation failure behaviour, override
1628 wxPropertyGrid::DoOnValidationFailure().
1629 */
1630 bool OnValidationFailure( wxPGProperty* property,
1631 wxVariant& invalidValue );
1632
1633 /** Called to indicate property and editor has valid value now.
1634 */
1635 void OnValidationFailureReset( wxPGProperty* property )
1636 {
1637 if ( property && property->HasFlag(wxPG_PROP_INVALID_VALUE) )
1638 {
1639 DoOnValidationFailureReset(property);
1640 property->ClearFlag(wxPG_PROP_INVALID_VALUE);
1641 }
1642 m_validationInfo.m_failureMessage.clear();
1643 }
1644
1645 /**
1646 Override in derived class to display error messages in custom manner
1647 (these message usually only result from validation failure).
1648
1649 @remarks If you implement this, then you also need to implement
1650 DoHidePropertyError() - possibly to do nothing, if error
1651 does not need hiding (e.g. it was logged or shown in a
1652 message box).
1653
1654 @see DoHidePropertyError()
1655 */
1656 virtual void DoShowPropertyError( wxPGProperty* property,
1657 const wxString& msg );
1658
1659 /**
1660 Override in derived class to hide an error displayed by
1661 DoShowPropertyError().
1662
1663 @see DoShowPropertyError()
1664 */
1665 virtual void DoHidePropertyError( wxPGProperty* property );
1666
1667 #if wxUSE_STATUSBAR
1668 /**
1669 Return wxStatusBar that is used by this wxPropertyGrid. You can
1670 reimplement this member function in derived class to override
1671 the default behaviour of using the top-level wxFrame's status
1672 bar, if any.
1673 */
1674 virtual wxStatusBar* GetStatusBar();
1675 #endif
1676
1677 /** Override to customize property validation failure behaviour.
1678 @param invalidValue
1679 Value which failed in validation.
1680 @return
1681 Return true if user is allowed to change to another property even
1682 if current has invalid value.
1683 */
1684 virtual bool DoOnValidationFailure( wxPGProperty* property,
1685 wxVariant& invalidValue );
1686
1687 /** Override to customize resetting of property validation failure status.
1688 @remarks
1689 Property is guaranteed to have flag wxPG_PROP_INVALID_VALUE set.
1690 */
1691 virtual void DoOnValidationFailureReset( wxPGProperty* property );
1692
1693 int GetSpacingY() const { return m_spacingy; }
1694
1695 /**
1696 Must be called in wxPGEditor::CreateControls() if primary editor window
1697 is wxTextCtrl, just before textctrl is created.
1698 @param text
1699 Initial text value of created wxTextCtrl.
1700 */
1701 void SetupTextCtrlValue( const wxString text ) { m_prevTcValue = text; }
1702
1703 /**
1704 Unfocuses or closes editor if one was open, but does not deselect
1705 property.
1706 */
1707 bool UnfocusEditor();
1708
1709 virtual void SetWindowStyleFlag( long style );
1710
1711 void DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 );
1712
1713 void DrawItem( wxPGProperty* p )
1714 {
1715 DrawItems(p,p);
1716 }
1717
1718 virtual void DrawItemAndChildren( wxPGProperty* p );
1719
1720 /**
1721 Draws item, children, and consequtive parents as long as category is
1722 not met.
1723 */
1724 void DrawItemAndValueRelated( wxPGProperty* p );
1725
1726 protected:
1727
1728 /**
1729 wxPropertyGridPageState used by the grid is created here.
1730
1731 If grid is used in wxPropertyGridManager, there is no point overriding
1732 this - instead, set custom wxPropertyGridPage classes.
1733 */
1734 virtual wxPropertyGridPageState* CreateState() const;
1735
1736 enum PerformValidationFlags
1737 {
1738 SendEvtChanging = 0x0001,
1739 IsStandaloneValidation = 0x0002 // Not called in response to event
1740 };
1741
1742 /**
1743 Runs all validation functionality (includes sending wxEVT_PG_CHANGING).
1744 Returns true if all tests passed. Implement in derived class to
1745 add additional validation behaviour.
1746 */
1747 virtual bool PerformValidation( wxPGProperty* p,
1748 wxVariant& pendingValue,
1749 int flags = SendEvtChanging );
1750
1751 public:
1752
1753 // Control font changer helper.
1754 void SetCurControlBoldFont();
1755
1756 wxPGCell& GetPropertyDefaultCell()
1757 {
1758 return m_propertyDefaultCell;
1759 }
1760
1761 wxPGCell& GetCategoryDefaultCell()
1762 {
1763 return m_categoryDefaultCell;
1764 }
1765
1766 //
1767 // Public methods for semi-public use
1768 //
1769 bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 );
1770
1771 // Overridden functions.
1772 virtual bool Destroy();
1773 // Returns property at given y coordinate (relative to grid's top left).
1774 wxPGProperty* GetItemAtY( int y ) const { return DoGetItemAtY(y); }
1775
1776 virtual void Refresh( bool eraseBackground = true,
1777 const wxRect *rect = (const wxRect *) NULL );
1778 virtual bool SetFont( const wxFont& font );
1779 virtual void Freeze();
1780 virtual void SetExtraStyle( long exStyle );
1781 virtual void Thaw();
1782 virtual bool Reparent( wxWindowBase *newParent );
1783
1784 protected:
1785 virtual wxSize DoGetBestSize() const;
1786
1787 #ifndef wxPG_ICON_WIDTH
1788 wxBitmap *m_expandbmp, *m_collbmp;
1789 #endif
1790
1791 wxCursor *m_cursorSizeWE;
1792
1793 /** wxWindow pointers to editor control(s). */
1794 wxWindow *m_wndEditor;
1795 wxWindow *m_wndEditor2;
1796
1797 wxBitmap *m_doubleBuffer;
1798
1799 /** Local time ms when control was created. */
1800 wxLongLong m_timeCreated;
1801
1802 /** wxPGProperty::OnEvent can change value by setting this. */
1803 wxVariant m_changeInEventValue;
1804
1805 /** Id of m_wndEditor2, or its first child, if any. */
1806 int m_wndSecId;
1807
1808 /** Extra Y spacing between the items. */
1809 int m_spacingy;
1810
1811 /** Control client area width; updated on resize. */
1812 int m_width;
1813
1814 /** Control client area height; updated on resize. */
1815 int m_height;
1816
1817 /** Current non-client width (needed when auto-centering). */
1818 int m_ncWidth;
1819
1820 /** Non-client width (auto-centering helper). */
1821 //int m_fWidth;
1822
1823 /** Previously recorded scroll start position. */
1824 int m_prevVY;
1825
1826 /**
1827 The gutter spacing in front and back of the image.
1828 This determines the amount of spacing in front of each item
1829 */
1830 int m_gutterWidth;
1831
1832 /** Includes separator line. */
1833 int m_lineHeight;
1834
1835 /** Gutter*2 + image width. */
1836 int m_marginWidth;
1837
1838 // y spacing for expand/collapse button.
1839 int m_buttonSpacingY;
1840
1841 /** Extra margin for expanded sub-group items. */
1842 int m_subgroup_extramargin;
1843
1844 /**
1845 The image width of the [+] icon.
1846
1847 This is also calculated in the gutter
1848 */
1849 int m_iconWidth;
1850
1851 #ifndef wxPG_ICON_WIDTH
1852
1853 /**
1854 The image height of the [+] icon.
1855
1856 This is calculated as minimal size and to align
1857 */
1858 int m_iconHeight;
1859 #endif
1860
1861 /** Current cursor id. */
1862 int m_curcursor;
1863
1864 // Caption font. Same as normal font plus bold style.
1865 wxFont m_captionFont;
1866
1867 int m_fontHeight; // Height of the font.
1868
1869 /** m_splitterx when drag began. */
1870 int m_startingSplitterX;
1871
1872 /**
1873 Index to splitter currently being dragged (0=one after the first
1874 column).
1875 */
1876 int m_draggedSplitter;
1877
1878 /** Changed property, calculated in PerformValidation(). */
1879 wxPGProperty* m_chgInfo_changedProperty;
1880
1881 /**
1882 Lowest property for which editing happened, but which does not have
1883 aggregate parent
1884 */
1885 wxPGProperty* m_chgInfo_baseChangedProperty;
1886
1887 /** Changed property value, calculated in PerformValidation(). */
1888 wxVariant m_chgInfo_pendingValue;
1889
1890 /** Passed to SetValue. */
1891 wxVariant m_chgInfo_valueList;
1892
1893 /** Validation information. */
1894 wxPGValidationInfo m_validationInfo;
1895
1896 /** Actions and keys that trigger them. */
1897 wxPGHashMapI2I m_actionTriggers;
1898
1899 /** Appearance of currently active editor. */
1900 wxPGCell m_editorAppearance;
1901
1902 /** Appearance of a unspecified value cell. */
1903 wxPGCell m_unspecifiedAppearance;
1904
1905 /** List of properties to be deleted/removed in idle event handler. */
1906 wxArrayPGProperty m_deletedProperties;
1907 wxArrayPGProperty m_removedProperties;
1908
1909 /** List of key codes that will not be handed over to editor controls. */
1910 // FIXME: Make this a hash set once there is template-based wxHashSet.
1911 wxVector<int> m_dedicatedKeys;
1912
1913 //
1914 // Temporary values
1915 //
1916
1917 /** Bits are used to indicate which colours are customized. */
1918 unsigned short m_coloursCustomized;
1919
1920 /** x - m_splitterx. */
1921 signed char m_dragOffset;
1922
1923 /** 0 = not dragging, 1 = drag just started, 2 = drag in progress */
1924 unsigned char m_dragStatus;
1925
1926 /** 0 = margin, 1 = label, 2 = value. */
1927 unsigned char m_mouseSide;
1928
1929 /** True when editor control is focused. */
1930 unsigned char m_editorFocused;
1931
1932 /** 1 if m_latsCaption is also the bottommost caption. */
1933 //unsigned char m_lastCaptionBottomnest;
1934
1935 /** Set to 1 when graphics frozen. */
1936 unsigned char m_frozen;
1937
1938 unsigned char m_vspacing;
1939
1940 // Used to track when Alt/Ctrl+Key was consumed.
1941 unsigned char m_keyComboConsumed;
1942
1943 /** 1 if in DoPropertyChanged() */
1944 bool m_inDoPropertyChanged;
1945
1946 /** 1 if in CommitChangesFromEditor() */
1947 bool m_inCommitChangesFromEditor;
1948
1949 /** 1 if in DoSelectProperty() */
1950 bool m_inDoSelectProperty;
1951
1952 bool m_inOnValidationFailure;
1953
1954 wxPGVFBFlags m_permanentValidationFailureBehavior; // Set by app
1955
1956 // DoEditorValidate() recursion guard
1957 wxRecursionGuardFlag m_validatingEditor;
1958
1959 /** Internal flags - see wxPG_FL_XXX constants. */
1960 wxUint32 m_iFlags;
1961
1962 /** When drawing next time, clear this many item slots at the end. */
1963 int m_clearThisMany;
1964
1965 // Mouse is hovering over this column (index)
1966 unsigned int m_colHover;
1967
1968 // pointer to property that has mouse hovering
1969 wxPGProperty* m_propHover;
1970
1971 // Active label editor
1972 wxTextCtrl* m_labelEditor;
1973
1974 // For which property the label editor is active
1975 wxPGProperty* m_labelEditorProperty;
1976
1977 // EventObject for wxPropertyGridEvents
1978 wxWindow* m_eventObject;
1979
1980 // What (global) window is currently focused (needed to resolve event
1981 // handling mess).
1982 wxWindow* m_curFocused;
1983
1984 // Event currently being sent - NULL if none at the moment
1985 wxPropertyGridEvent* m_processedEvent;
1986
1987 // Last known top-level parent
1988 wxWindow* m_tlp;
1989
1990 // Last closed top-level parent
1991 wxWindow* m_tlpClosed;
1992
1993 // Local time ms when tlp was closed.
1994 wxLongLong m_tlpClosedTime;
1995
1996 // Sort function
1997 wxPGSortCallback m_sortFunction;
1998
1999 // y coordinate of property that mouse hovering
2000 int m_propHoverY;
2001
2002 // Which column's editor is selected (usually 1)?
2003 unsigned int m_selColumn;
2004
2005 // x relative to splitter (needed for resize).
2006 int m_ctrlXAdjust;
2007
2008 // lines between cells
2009 wxColour m_colLine;
2010 // property labels and values are written in this colour
2011 wxColour m_colPropFore;
2012 // or with this colour when disabled
2013 wxColour m_colDisPropFore;
2014 // background for m_colPropFore
2015 wxColour m_colPropBack;
2016 // text color for captions
2017 wxColour m_colCapFore;
2018 // background color for captions
2019 wxColour m_colCapBack;
2020 // foreground for selected property
2021 wxColour m_colSelFore;
2022 // background for selected property (actually use background color when
2023 // control out-of-focus)
2024 wxColour m_colSelBack;
2025 // background colour for margin
2026 wxColour m_colMargin;
2027 // background colour for empty space below the grid
2028 wxColour m_colEmptySpace;
2029
2030 // Default property colours
2031 wxPGCell m_propertyDefaultCell;
2032
2033 // Default property category
2034 wxPGCell m_categoryDefaultCell;
2035
2036 // Backup of selected property's cells
2037 wxVector<wxPGCell> m_propCellsBackup;
2038
2039 // NB: These *cannot* be moved to globals.
2040
2041 // labels when properties use common values
2042 wxVector<wxPGCommonValue*> m_commonValues;
2043
2044 // array of live events
2045 wxVector<wxPropertyGridEvent*> m_liveEvents;
2046
2047 // Which cv selection really sets value to unspecified?
2048 int m_cvUnspecified;
2049
2050 // Used to skip excess text editor events
2051 wxString m_prevTcValue;
2052
2053 protected:
2054
2055 // Sets some members to defaults (called constructors).
2056 void Init1();
2057
2058 // Initializes some members (called by Create and complex constructor).
2059 void Init2();
2060
2061 void OnPaint(wxPaintEvent &event );
2062
2063 // main event receivers
2064 void OnMouseMove( wxMouseEvent &event );
2065 void OnMouseClick( wxMouseEvent &event );
2066 void OnMouseRightClick( wxMouseEvent &event );
2067 void OnMouseDoubleClick( wxMouseEvent &event );
2068 void OnMouseUp( wxMouseEvent &event );
2069 void OnKey( wxKeyEvent &event );
2070 void OnResize( wxSizeEvent &event );
2071
2072 // event handlers
2073 bool HandleMouseMove( int x, unsigned int y, wxMouseEvent &event );
2074 bool HandleMouseClick( int x, unsigned int y, wxMouseEvent &event );
2075 bool HandleMouseRightClick( int x, unsigned int y, wxMouseEvent &event );
2076 bool HandleMouseDoubleClick( int x, unsigned int y, wxMouseEvent &event );
2077 bool HandleMouseUp( int x, unsigned int y, wxMouseEvent &event );
2078 void HandleKeyEvent( wxKeyEvent &event, bool fromChild );
2079
2080 void OnMouseEntry( wxMouseEvent &event );
2081
2082 void OnIdle( wxIdleEvent &event );
2083 void OnFocusEvent( wxFocusEvent &event );
2084 void OnChildFocusEvent( wxChildFocusEvent& event );
2085
2086 bool OnMouseCommon( wxMouseEvent &event, int* px, int *py );
2087 bool OnMouseChildCommon( wxMouseEvent &event, int* px, int *py );
2088
2089 // sub-control event handlers
2090 void OnMouseClickChild( wxMouseEvent &event );
2091 void OnMouseRightClickChild( wxMouseEvent &event );
2092 void OnMouseMoveChild( wxMouseEvent &event );
2093 void OnMouseUpChild( wxMouseEvent &event );
2094 void OnChildKeyDown( wxKeyEvent &event );
2095
2096 void OnCaptureChange( wxMouseCaptureChangedEvent &event );
2097
2098 void OnScrollEvent( wxScrollWinEvent &event );
2099
2100 void OnSysColourChanged( wxSysColourChangedEvent &event );
2101
2102 void OnTLPClose( wxCloseEvent& event );
2103
2104 protected:
2105
2106 bool AddToSelectionFromInputEvent( wxPGProperty* prop,
2107 unsigned int colIndex,
2108 wxMouseEvent* event = NULL,
2109 int selFlags = 0 );
2110
2111 /**
2112 Adjust the centering of the bitmap icons (collapse / expand) when the
2113 caption font changes.
2114
2115 They need to be centered in the middle of the font, so a bit of deltaY
2116 adjustment is needed. On entry, m_captionFont must be set to window
2117 font. It will be modified properly.
2118 */
2119 void CalculateFontAndBitmapStuff( int vspacing );
2120
2121 wxRect GetEditorWidgetRect( wxPGProperty* p, int column ) const;
2122
2123 void CorrectEditorWidgetSizeX();
2124
2125 /** Called in RecalculateVirtualSize() to reposition control
2126 on virtual height changes.
2127 */
2128 void CorrectEditorWidgetPosY();
2129
2130 int DoDrawItems( wxDC& dc,
2131 const wxRect* itemsRect,
2132 bool isBuffered ) const;
2133
2134 /** Draws an expand/collapse (ie. +/-) button.
2135 */
2136 virtual void DrawExpanderButton( wxDC& dc, const wxRect& rect,
2137 wxPGProperty* property ) const;
2138
2139 /** Draws items from topitemy to bottomitemy */
2140 void DrawItems( wxDC& dc,
2141 unsigned int topItemY,
2142 unsigned int bottomItemY,
2143 const wxRect* itemsRect = NULL );
2144
2145 // Translate wxKeyEvent to wxPG_ACTION_XXX
2146 int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;
2147
2148 int KeyEventToAction(wxKeyEvent &event) const
2149 {
2150 return KeyEventToActions(event, NULL);
2151 }
2152
2153 void ImprovedClientToScreen( int* px, int* py );
2154
2155 // Called by focus event handlers. newFocused is the window that becomes
2156 // focused.
2157 void HandleFocusChange( wxWindow* newFocused );
2158
2159 /** Reloads all non-customized colours from system settings. */
2160 void RegainColours();
2161
2162 virtual bool DoEditorValidate();
2163
2164 // Similar to DoSelectProperty() but also works on columns
2165 // other than 1. Does not active editor if column is not
2166 // editable.
2167 bool DoSelectAndEdit( wxPGProperty* prop,
2168 unsigned int colIndex,
2169 unsigned int selFlags );
2170
2171 void DoSetSelection( const wxArrayPGProperty& newSelection,
2172 int selFlags = 0 );
2173
2174 void DoSetSplitterPosition( int newxpos,
2175 int splitterIndex = 0,
2176 int flags = wxPG_SPLITTER_REFRESH );
2177
2178 bool DoAddToSelection( wxPGProperty* prop,
2179 int selFlags = 0 );
2180
2181 bool DoRemoveFromSelection( wxPGProperty* prop,
2182 int selFlags = 0 );
2183
2184 void DoBeginLabelEdit( unsigned int colIndex, int selFlags = 0 );
2185 void DoEndLabelEdit( bool commit, int selFlags = 0 );
2186 void OnLabelEditorEnterPress( wxCommandEvent& event );
2187 void OnLabelEditorKeyPress( wxKeyEvent& event );
2188
2189 wxPGProperty* DoGetItemAtY( int y ) const;
2190
2191 void DestroyEditorWnd( wxWindow* wnd );
2192 void FreeEditors();
2193
2194 virtual bool DoExpand( wxPGProperty* p, bool sendEvent = false );
2195
2196 virtual bool DoCollapse( wxPGProperty* p, bool sendEvent = false );
2197
2198 // Returns nearest paint visible property (such that will be painted unless
2199 // window is scrolled or resized). If given property is paint visible, then
2200 // it itself will be returned.
2201 wxPGProperty* GetNearestPaintVisible( wxPGProperty* p ) const;
2202
2203 static void RegisterDefaultEditors();
2204
2205 // Sets up basic event handling for child control
2206 void SetupChildEventHandling( wxWindow* wnd );
2207
2208 void CustomSetCursor( int type, bool override = false );
2209
2210 /**
2211 Repositions scrollbar and underlying panel according to changed virtual
2212 size.
2213 */
2214 void RecalculateVirtualSize( int forceXPos = -1 );
2215
2216 void SetEditorAppearance( const wxPGCell& cell,
2217 bool unspecified = false );
2218
2219 void ResetEditorAppearance()
2220 {
2221 wxPGCell cell;
2222 cell.SetEmptyData();
2223 SetEditorAppearance(cell, false);
2224 }
2225
2226 void PrepareAfterItemsAdded();
2227
2228 /**
2229 Send event from the property grid.
2230
2231 Omit the wxPG_SEL_NOVALIDATE flag to allow vetoing the event
2232 */
2233 bool SendEvent( int eventType, wxPGProperty* p,
2234 wxVariant* pValue = NULL,
2235 unsigned int selFlags = wxPG_SEL_NOVALIDATE,
2236 unsigned int column = 1 );
2237
2238 // This function only moves focus to the wxPropertyGrid if it already
2239 // was on one of its child controls.
2240 void SetFocusOnCanvas();
2241
2242 bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
2243
2244 private:
2245
2246 bool ButtonTriggerKeyTest( int action, wxKeyEvent& event );
2247
2248 DECLARE_EVENT_TABLE()
2249 };
2250
2251 // -----------------------------------------------------------------------
2252 //
2253 // Bunch of inlines that need to resolved after all classes have been defined.
2254 //
2255
2256 inline bool wxPropertyGridPageState::IsDisplayed() const
2257 {
2258 return ( this == m_pPropGrid->GetState() );
2259 }
2260
2261 inline unsigned int wxPropertyGridPageState::GetActualVirtualHeight() const
2262 {
2263 return DoGetRoot()->GetChildrenHeight(GetGrid()->GetRowHeight());
2264 }
2265
2266 inline wxString wxPGProperty::GetHintText() const
2267 {
2268 wxVariant vHintText = GetAttribute(wxPGGlobalVars->m_strHint);
2269
2270 #if wxPG_COMPATIBILITY_1_4
2271 // Try the old, deprecated "InlineHelp"
2272 if ( vHintText.IsNull() )
2273 vHintText = GetAttribute(wxPGGlobalVars->m_strInlineHelp);
2274 #endif
2275
2276 if ( !vHintText.IsNull() )
2277 return vHintText.GetString();
2278
2279 return wxEmptyString;
2280 }
2281
2282 inline int wxPGProperty::GetDisplayedCommonValueCount() const
2283 {
2284 if ( HasFlag(wxPG_PROP_USES_COMMON_VALUE) )
2285 {
2286 wxPropertyGrid* pg = GetGrid();
2287 if ( pg )
2288 return (int) pg->GetCommonValueCount();
2289 }
2290 return 0;
2291 }
2292
2293 inline void wxPGProperty::SetDefaultValue( wxVariant& value )
2294 {
2295 SetAttribute(wxPG_ATTR_DEFAULT_VALUE, value);
2296 }
2297
2298 inline void wxPGProperty::SetEditor( const wxString& editorName )
2299 {
2300 m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName);
2301 }
2302
2303 inline bool wxPGProperty::SetMaxLength( int maxLen )
2304 {
2305 return GetGrid()->SetPropertyMaxLength(this,maxLen);
2306 }
2307
2308 // -----------------------------------------------------------------------
2309
2310 #define wxPG_BASE_EVT_PRE_ID 1775
2311
2312 #ifndef SWIG
2313
2314 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_SELECTED, wxPropertyGridEvent );
2315 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGING, wxPropertyGridEvent );
2316 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGED, wxPropertyGridEvent );
2317 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_HIGHLIGHTED, wxPropertyGridEvent );
2318 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_RIGHT_CLICK, wxPropertyGridEvent );
2319 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_PAGE_CHANGED, wxPropertyGridEvent );
2320 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEvent );
2321 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEvent );
2322 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_DOUBLE_CLICK, wxPropertyGridEvent );
2323 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
2324 wxEVT_PG_LABEL_EDIT_BEGIN, wxPropertyGridEvent );
2325 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
2326 wxEVT_PG_LABEL_EDIT_ENDING, wxPropertyGridEvent );
2327 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
2328 wxEVT_PG_COL_BEGIN_DRAG, wxPropertyGridEvent );
2329 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
2330 wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent );
2331 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
2332 wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent );
2333
2334 #else
2335 enum {
2336 wxEVT_PG_SELECTED = wxPG_BASE_EVT_PRE_ID,
2337 wxEVT_PG_CHANGING,
2338 wxEVT_PG_CHANGED,
2339 wxEVT_PG_HIGHLIGHTED,
2340 wxEVT_PG_RIGHT_CLICK,
2341 wxEVT_PG_PAGE_CHANGED,
2342 wxEVT_PG_ITEM_COLLAPSED,
2343 wxEVT_PG_ITEM_EXPANDED,
2344 wxEVT_PG_DOUBLE_CLICK,
2345 wxEVT_PG_LABEL_EDIT_BEGIN,
2346 wxEVT_PG_LABEL_EDIT_ENDING,
2347 wxEVT_PG_COL_BEGIN_DRAG,
2348 wxEVT_PG_COL_DRAGGING,
2349 wxEVT_PG_COL_END_DRAG
2350 };
2351 #endif
2352
2353
2354 #define wxPG_BASE_EVT_TYPE wxEVT_PG_SELECTED
2355 #define wxPG_MAX_EVT_TYPE (wxPG_BASE_EVT_TYPE+30)
2356
2357
2358 #ifndef SWIG
2359 typedef void (wxEvtHandler::*wxPropertyGridEventFunction)(wxPropertyGridEvent&);
2360
2361 #define EVT_PG_SELECTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_SELECTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2362 #define EVT_PG_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2363 #define EVT_PG_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2364 #define EVT_PG_HIGHLIGHTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_HIGHLIGHTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2365 #define EVT_PG_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_RIGHT_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2366 #define EVT_PG_DOUBLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_DOUBLE_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2367 #define EVT_PG_PAGE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2368 #define EVT_PG_ITEM_COLLAPSED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2369 #define EVT_PG_ITEM_EXPANDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2370 #define EVT_PG_LABEL_EDIT_BEGIN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_BEGIN, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2371 #define EVT_PG_LABEL_EDIT_ENDING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_ENDING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2372 #define EVT_PG_COL_BEGIN_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_BEGIN_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2373 #define EVT_PG_COL_DRAGGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_DRAGGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2374 #define EVT_PG_COL_END_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_END_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
2375
2376 #define wxPropertyGridEventHandler(fn) \
2377 wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn )
2378
2379 #endif
2380
2381
2382 /** @class wxPropertyGridEvent
2383
2384 A propertygrid event holds information about events associated with
2385 wxPropertyGrid objects.
2386
2387 @library{wxpropgrid}
2388 @category{propgrid}
2389 */
2390 class WXDLLIMPEXP_PROPGRID wxPropertyGridEvent : public wxCommandEvent
2391 {
2392 public:
2393
2394 /** Constructor. */
2395 wxPropertyGridEvent(wxEventType commandType=0, int id=0);
2396
2397 /** Copy constructor. */
2398 wxPropertyGridEvent(const wxPropertyGridEvent& event);
2399
2400 /** Destructor. */
2401 ~wxPropertyGridEvent();
2402
2403 /** Copyer. */
2404 virtual wxEvent* Clone() const;
2405
2406 /**
2407 Returns the column index associated with this event.
2408 For the column dragging events, it is the column to the left
2409 of the splitter being dragged
2410 */
2411 unsigned int GetColumn() const
2412 {
2413 return m_column;
2414 }
2415
2416 wxPGProperty* GetMainParent() const
2417 {
2418 wxASSERT(m_property);
2419 return m_property->GetMainParent();
2420 }
2421
2422 /** Returns id of associated property. */
2423 wxPGProperty* GetProperty() const
2424 {
2425 return m_property;
2426 }
2427
2428 wxPGValidationInfo& GetValidationInfo()
2429 {
2430 wxASSERT(m_validationInfo);
2431 return *m_validationInfo;
2432 }
2433
2434 /** Returns true if you can veto the action that the event is signaling.
2435 */
2436 bool CanVeto() const { return m_canVeto; }
2437
2438 /**
2439 Call this from your event handler to veto action that the event is
2440 signaling.
2441
2442 You can only veto a shutdown if wxPropertyGridEvent::CanVeto returns
2443 true.
2444 @remarks
2445 Currently only wxEVT_PG_CHANGING supports vetoing.
2446 */
2447 void Veto( bool veto = true ) { m_wasVetoed = veto; }
2448
2449 /**
2450 Returns name of the associated property.
2451
2452 @remarks Property name is stored in event, so it remains
2453 accessible even after the associated property or
2454 the property grid has been deleted.
2455 */
2456 wxString GetPropertyName() const
2457 {
2458 return m_propertyName;
2459 }
2460
2461 /**
2462 Returns value of the associated property. Works for all event
2463 types, but for wxEVT_PG_CHANGING this member function returns
2464 the value that is pending, so you can call Veto() if the
2465 value is not satisfactory.
2466
2467 @remarks Property value is stored in event, so it remains
2468 accessible even after the associated property or
2469 the property grid has been deleted.
2470 */
2471 wxVariant GetPropertyValue() const
2472 {
2473 if ( m_validationInfo )
2474 return m_validationInfo->GetValue();
2475 return m_value;
2476 }
2477
2478 /**
2479 Returns value of the associated property.
2480
2481 @see GetPropertyValue
2482 */
2483 wxVariant GetValue() const
2484 {
2485 return GetPropertyValue();
2486 }
2487
2488 /**
2489 Set override validation failure behaviour.
2490
2491 Only effective if Veto was also called, and only allowed if event type
2492 is wxEVT_PG_CHANGING.
2493 */
2494 void SetValidationFailureBehavior( wxPGVFBFlags flags )
2495 {
2496 wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
2497 m_validationInfo->SetFailureBehavior( flags );
2498 }
2499
2500 /** Sets custom failure message for this time only. Only applies if
2501 wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
2502 */
2503 void SetValidationFailureMessage( const wxString& message )
2504 {
2505 wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
2506 m_validationInfo->SetFailureMessage( message );
2507 }
2508
2509 wxPGVFBFlags GetValidationFailureBehavior() const
2510 {
2511 wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
2512 return m_validationInfo->GetFailureBehavior();
2513 }
2514
2515 void SetColumn( unsigned int column )
2516 {
2517 m_column = column;
2518 }
2519
2520 void SetCanVeto( bool canVeto ) { m_canVeto = canVeto; }
2521 bool WasVetoed() const { return m_wasVetoed; }
2522
2523 /** Changes the associated property. */
2524 void SetProperty( wxPGProperty* p )
2525 {
2526 m_property = p;
2527 if ( p )
2528 m_propertyName = p->GetName();
2529 }
2530
2531 void SetPropertyValue( wxVariant value )
2532 {
2533 m_value = value;
2534 }
2535
2536 void SetPropertyGrid( wxPropertyGrid* pg )
2537 {
2538 m_pg = pg;
2539 OnPropertyGridSet();
2540 }
2541
2542 void SetupValidationInfo()
2543 {
2544 wxASSERT(m_pg);
2545 wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
2546 m_validationInfo = &m_pg->GetValidationInfo();
2547 m_value = m_validationInfo->GetValue();
2548 }
2549
2550 private:
2551 void Init();
2552 void OnPropertyGridSet();
2553 DECLARE_DYNAMIC_CLASS(wxPropertyGridEvent)
2554
2555 wxPGProperty* m_property;
2556 wxPropertyGrid* m_pg;
2557 wxPGValidationInfo* m_validationInfo;
2558
2559 wxString m_propertyName;
2560 wxVariant m_value;
2561
2562 unsigned int m_column;
2563
2564 bool m_canVeto;
2565 bool m_wasVetoed;
2566 };
2567
2568
2569 // -----------------------------------------------------------------------
2570
2571 /** @class wxPropertyGridPopulator
2572 @ingroup classes
2573 Allows populating wxPropertyGrid from arbitrary text source.
2574 */
2575 class WXDLLIMPEXP_PROPGRID wxPropertyGridPopulator
2576 {
2577 public:
2578 /** Default constructor.
2579 */
2580 wxPropertyGridPopulator();
2581
2582 /** Destructor. */
2583 virtual ~wxPropertyGridPopulator();
2584
2585 void SetState( wxPropertyGridPageState* state );
2586
2587 void SetGrid( wxPropertyGrid* pg );
2588
2589 /** Appends a new property under bottommost parent.
2590 @param propClass
2591 Property class as string.
2592 */
2593 wxPGProperty* Add( const wxString& propClass,
2594 const wxString& propLabel,
2595 const wxString& propName,
2596 const wxString* propValue,
2597 wxPGChoices* pChoices = NULL );
2598
2599 /**
2600 Pushes property to the back of parent array (ie it becomes bottommost
2601 parent), and starts scanning/adding children for it.
2602
2603 When finished, parent array is returned to the original state.
2604 */
2605 void AddChildren( wxPGProperty* property );
2606
2607 /** Adds attribute to the bottommost property.
2608 @param type
2609 Allowed values: "string", (same as string), "int", "bool". Empty string
2610 mean autodetect.
2611 */
2612 bool AddAttribute( const wxString& name,
2613 const wxString& type,
2614 const wxString& value );
2615
2616 /** Called once in AddChildren.
2617 */
2618 virtual void DoScanForChildren() = 0;
2619
2620 /**
2621 Returns id of parent property for which children can currently be
2622 added.
2623 */
2624 wxPGProperty* GetCurParent() const
2625 {
2626 return (wxPGProperty*) m_propHierarchy[m_propHierarchy.size()-1];
2627 }
2628
2629 wxPropertyGridPageState* GetState() { return m_state; }
2630 const wxPropertyGridPageState* GetState() const { return m_state; }
2631
2632 /** Like wxString::ToLong, except allows N% in addition of N.
2633 */
2634 static bool ToLongPCT( const wxString& s, long* pval, long max );
2635
2636 /** Parses strings of format "choice1"[=value1] ... "choiceN"[=valueN] into
2637 wxPGChoices. Registers parsed result using idString (if not empty).
2638 Also, if choices with given id already registered, then don't parse but
2639 return those choices instead.
2640 */
2641 wxPGChoices ParseChoices( const wxString& choicesString,
2642 const wxString& idString );
2643
2644 /** Implement in derived class to do custom process when an error occurs.
2645 Default implementation uses wxLogError.
2646 */
2647 virtual void ProcessError( const wxString& msg );
2648
2649 protected:
2650
2651 /** Used property grid. */
2652 wxPropertyGrid* m_pg;
2653
2654 /** Used property grid state. */
2655 wxPropertyGridPageState* m_state;
2656
2657 /** Tree-hierarchy of added properties (that can have children). */
2658 wxArrayPGProperty m_propHierarchy;
2659
2660 /** Hashmap for string-id to wxPGChoicesData mapping. */
2661 wxPGHashMapS2P m_dictIdChoices;
2662 };
2663
2664 // -----------------------------------------------------------------------
2665
2666 //
2667 // Undefine macros that are not needed outside propertygrid sources
2668 //
2669 #ifndef __wxPG_SOURCE_FILE__
2670 #undef wxPG_FL_DESC_REFRESH_REQUIRED
2671 #undef wxPG_FL_SCROLLBAR_DETECTED
2672 #undef wxPG_FL_CREATEDSTATE
2673 #undef wxPG_FL_NOSTATUSBARHELP
2674 #undef wxPG_FL_SCROLLED
2675 #undef wxPG_FL_FOCUS_INSIDE_CHILD
2676 #undef wxPG_FL_FOCUS_INSIDE
2677 #undef wxPG_FL_MOUSE_INSIDE_CHILD
2678 #undef wxPG_FL_CUR_USES_CUSTOM_IMAGE
2679 #undef wxPG_FL_PRIMARY_FILLS_ENTIRE
2680 #undef wxPG_FL_VALUE_MODIFIED
2681 #undef wxPG_FL_MOUSE_INSIDE
2682 #undef wxPG_FL_FOCUSED
2683 #undef wxPG_FL_MOUSE_CAPTURED
2684 #undef wxPG_FL_INITIALIZED
2685 #undef wxPG_FL_ACTIVATION_BY_CLICK
2686 #undef wxPG_SUPPORT_TOOLTIPS
2687 #undef wxPG_ICON_WIDTH
2688 #undef wxPG_USE_RENDERER_NATIVE
2689 // Following are needed by the manager headers
2690 // #undef const wxString&
2691 #endif
2692
2693 // -----------------------------------------------------------------------
2694
2695 #endif
2696
2697 #endif // _WX_PROPGRID_PROPGRID_H_
2698