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