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