]>
Commit | Line | Data |
---|---|---|
1c4293cb VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: propgrid.h | |
3 | // Purpose: interface of wxPropertyGrid | |
4 | // Author: wxWidgets team | |
526954c5 | 5 | // Licence: wxWindows licence |
1c4293cb VZ |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | ||
6b03a638 JS |
9 | /** |
10 | @section propgrid_window_styles wxPropertyGrid Window Styles | |
1c4293cb VZ |
11 | |
12 | SetWindowStyleFlag method can be used to modify some of these at run-time. | |
13 | @{ | |
14 | */ | |
15 | enum wxPG_WINDOW_STYLES | |
16 | { | |
17 | ||
6b03a638 JS |
18 | /** |
19 | This will cause Sort() automatically after an item is added. | |
1c4293cb VZ |
20 | When inserting a lot of items in this mode, it may make sense to |
21 | use Freeze() before operations and Thaw() afterwards to increase | |
22 | performance. | |
23 | */ | |
24 | wxPG_AUTO_SORT = 0x00000010, | |
25 | ||
6b03a638 JS |
26 | /** |
27 | Categories are not initially shown (even if added). | |
1c4293cb VZ |
28 | IMPORTANT NOTE: If you do not plan to use categories, then this |
29 | style will waste resources. | |
30 | This flag can also be changed using wxPropertyGrid::EnableCategories method. | |
31 | */ | |
32 | wxPG_HIDE_CATEGORIES = 0x00000020, | |
33 | ||
0ad10f30 | 34 | /** |
6b03a638 | 35 | This style combines non-categoric mode and automatic sorting. |
1c4293cb VZ |
36 | */ |
37 | wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT), | |
38 | ||
6b03a638 JS |
39 | /** |
40 | Modified values are shown in bold font. Changing this requires Refresh() | |
1c4293cb VZ |
41 | to show changes. |
42 | */ | |
43 | wxPG_BOLD_MODIFIED = 0x00000040, | |
44 | ||
6b03a638 JS |
45 | /** |
46 | When wxPropertyGrid is resized, splitter moves to the center. This | |
4c51a665 | 47 | behaviour stops once the user manually moves the splitter. |
1c4293cb VZ |
48 | */ |
49 | wxPG_SPLITTER_AUTO_CENTER = 0x00000080, | |
50 | ||
6b03a638 JS |
51 | /** |
52 | Display tool tips for cell text that cannot be shown completely. If | |
1c4293cb VZ |
53 | wxUSE_TOOLTIPS is 0, then this doesn't have any effect. |
54 | */ | |
55 | wxPG_TOOLTIPS = 0x00000100, | |
56 | ||
6b03a638 JS |
57 | /** |
58 | Disables margin and hides all expand/collapse buttons that would appear | |
1c4293cb VZ |
59 | outside the margin (for sub-properties). Toggling this style automatically |
60 | expands all collapsed items. | |
61 | */ | |
62 | wxPG_HIDE_MARGIN = 0x00000200, | |
63 | ||
6b03a638 JS |
64 | /** |
65 | This style prevents user from moving the splitter. | |
1c4293cb VZ |
66 | */ |
67 | wxPG_STATIC_SPLITTER = 0x00000400, | |
68 | ||
6b03a638 JS |
69 | /** |
70 | Combination of other styles that make it impossible for user to modify | |
1c4293cb VZ |
71 | the layout. |
72 | */ | |
73 | wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER), | |
74 | ||
6b03a638 JS |
75 | /** |
76 | Disables wxTextCtrl based editors for properties which | |
77 | can be edited in another way. Equals calling | |
78 | wxPropertyGrid::LimitPropertyEditing() for all added properties. | |
1c4293cb VZ |
79 | */ |
80 | wxPG_LIMITED_EDITING = 0x00000800, | |
81 | ||
6b03a638 JS |
82 | /** |
83 | wxPropertyGridManager only: Show tool bar for mode and page selection. | |
84 | */ | |
1c4293cb VZ |
85 | wxPG_TOOLBAR = 0x00001000, |
86 | ||
6b03a638 JS |
87 | /** |
88 | wxPropertyGridManager only: Show adjustable text box showing description | |
1c4293cb VZ |
89 | or help text, if available, for currently selected property. |
90 | */ | |
521f1d83 JS |
91 | wxPG_DESCRIPTION = 0x00002000, |
92 | ||
f5254768 JS |
93 | /** wxPropertyGridManager only: don't show an internal border around the |
94 | property grid. Recommended if you use a header. | |
521f1d83 JS |
95 | */ |
96 | wxPG_NO_INTERNAL_BORDER = 0x00004000 | |
1c4293cb VZ |
97 | |
98 | }; | |
99 | ||
100 | enum wxPG_EX_WINDOW_STYLES | |
101 | { | |
102 | ||
103 | /** | |
104 | NOTE: wxPG_EX_xxx are extra window styles and must be set using SetExtraStyle() | |
105 | member function. | |
106 | ||
6b03a638 JS |
107 | Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if |
108 | wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is not | |
109 | activated, and switching the mode first time becomes somewhat slower. | |
110 | wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away. | |
1c4293cb | 111 | |
6b03a638 JS |
112 | NOTE: If you do plan not switching to non-categoric mode, or if |
113 | you don't plan to use categories at all, then using this style will result | |
114 | in waste of resources. | |
1c4293cb VZ |
115 | */ |
116 | wxPG_EX_INIT_NOCAT = 0x00001000, | |
117 | ||
6b03a638 JS |
118 | /** |
119 | Extended window style that sets wxPropertyGridManager tool bar to not | |
1c4293cb VZ |
120 | use flat style. |
121 | */ | |
122 | wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000, | |
123 | ||
6b03a638 JS |
124 | /** |
125 | Shows alphabetic/categoric mode buttons from tool bar. | |
1c4293cb VZ |
126 | */ |
127 | wxPG_EX_MODE_BUTTONS = 0x00008000, | |
128 | ||
6b03a638 JS |
129 | /** |
130 | Show property help strings as tool tips instead as text on the status bar. | |
1c4293cb VZ |
131 | You can set the help strings using SetPropertyHelpString member function. |
132 | */ | |
133 | wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000, | |
134 | ||
6b03a638 JS |
135 | /** |
136 | Allows relying on native double-buffering. | |
1c4293cb VZ |
137 | */ |
138 | wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000, | |
139 | ||
6b03a638 JS |
140 | /** |
141 | Set this style to let user have ability to set values of properties to | |
1c4293cb VZ |
142 | unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for |
143 | all properties. | |
144 | */ | |
145 | wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000, | |
146 | ||
6b03a638 JS |
147 | /** |
148 | If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION and | |
149 | wxPG_STRING_PASSWORD) are not stored into property's attribute storage (thus | |
150 | they are not readable). | |
1c4293cb VZ |
151 | |
152 | Note that this option is global, and applies to all wxPG property containers. | |
153 | */ | |
154 | wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000, | |
155 | ||
6b03a638 JS |
156 | /** |
157 | Hides page selection buttons from tool bar. | |
1c4293cb | 158 | */ |
fc72fab6 JS |
159 | wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000, |
160 | ||
161 | /** Allows multiple properties to be selected by user (by pressing SHIFT | |
162 | when clicking on a property, or by dragging with left mouse button | |
163 | down). | |
164 | ||
165 | You can get array of selected properties with | |
166 | wxPropertyGridInterface::GetSelectedProperties(). In multiple selection | |
167 | mode wxPropertyGridInterface::GetSelection() returns | |
168 | property which has editor active (usually the first one | |
169 | selected). Other useful member functions are ClearSelection(), | |
170 | AddToSelection() and RemoveFromSelection(). | |
171 | */ | |
08c1613f JS |
172 | wxPG_EX_MULTIPLE_SELECTION = 0x02000000, |
173 | ||
174 | /** | |
175 | This enables top-level window tracking which allows wxPropertyGrid to | |
176 | notify the application of last-minute property value changes by user. | |
177 | ||
178 | This style is not enabled by default because it may cause crashes when | |
179 | wxPropertyGrid is used in with wxAUI or similar system. | |
180 | ||
181 | @remarks If you are not in fact using any system that may change | |
182 | wxPropertyGrid's top-level parent window on its own, then you | |
183 | are recommended to enable this style. | |
184 | */ | |
521f1d83 JS |
185 | wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000, |
186 | ||
187 | /** Don't show divider above toolbar, on Windows. | |
188 | */ | |
189 | wxPG_EX_NO_TOOLBAR_DIVIDER = 0x04000000, | |
190 | ||
191 | /** Show a separator below the toolbar. | |
192 | */ | |
193 | wxPG_EX_TOOLBAR_SEPARATOR = 0x08000000 | |
1c4293cb VZ |
194 | |
195 | }; | |
196 | ||
197 | /** Combines various styles. | |
198 | */ | |
08c1613f | 199 | #define wxPG_DEFAULT_STYLE (0) |
1c4293cb VZ |
200 | |
201 | /** Combines various styles. | |
202 | */ | |
08c1613f | 203 | #define wxPGMAN_DEFAULT_STYLE (0) |
1c4293cb VZ |
204 | |
205 | /** @} | |
206 | */ | |
207 | ||
208 | // ----------------------------------------------------------------------- | |
209 | ||
6b03a638 | 210 | /** |
4c51a665 | 211 | @section propgrid_vfbflags wxPropertyGrid Validation Failure behaviour Flags |
1c4293cb VZ |
212 | @{ |
213 | */ | |
214 | ||
215 | enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS | |
216 | { | |
217 | ||
6b03a638 JS |
218 | /** |
219 | Prevents user from leaving property unless value is valid. If this | |
4c51a665 | 220 | behaviour flag is not used, then value change is instead cancelled. |
1c4293cb VZ |
221 | */ |
222 | wxPG_VFB_STAY_IN_PROPERTY = 0x01, | |
223 | ||
6b03a638 JS |
224 | /** |
225 | Calls wxBell() on validation failure. | |
1c4293cb VZ |
226 | */ |
227 | wxPG_VFB_BEEP = 0x02, | |
228 | ||
6b03a638 JS |
229 | /** |
230 | Cell with invalid value will be marked (with red colour). | |
1c4293cb VZ |
231 | */ |
232 | wxPG_VFB_MARK_CELL = 0x04, | |
233 | ||
6b03a638 | 234 | /** |
abbd88b5 | 235 | Display a text message explaining the situation. |
0ea0604a JS |
236 | |
237 | To customize the way the message is displayed, you need to | |
238 | reimplement wxPropertyGrid::DoShowPropertyError() in a | |
4c51a665 | 239 | derived class. Default behaviour is to display the text on |
0ea0604a JS |
240 | the top-level frame's status bar, if present, and otherwise |
241 | using wxMessageBox. | |
1c4293cb VZ |
242 | */ |
243 | wxPG_VFB_SHOW_MESSAGE = 0x08, | |
244 | ||
0ea0604a JS |
245 | /** |
246 | Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the | |
247 | message using wxMessageBox. | |
248 | */ | |
249 | wxPG_VFB_SHOW_MESSAGEBOX = 0x10, | |
250 | ||
251 | /** | |
252 | Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the | |
253 | message on the status bar (when present - you can reimplement | |
254 | wxPropertyGrid::GetStatusBar() in a derived class to specify | |
255 | this yourself). | |
256 | */ | |
257 | wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20, | |
258 | ||
6b03a638 JS |
259 | /** |
260 | Defaults. | |
261 | */ | |
4fb5dadb JS |
262 | wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL | |
263 | wxPG_VFB_SHOW_MESSAGEBOX, | |
1c4293cb VZ |
264 | }; |
265 | ||
266 | /** @} | |
267 | */ | |
268 | ||
269 | typedef wxByte wxPGVFBFlags; | |
270 | ||
2a8312bc JS |
271 | /** |
272 | wxPGValidationInfo | |
273 | ||
274 | Used to convey validation information to and from functions that | |
0ad10f30 | 275 | actually perform validation. Mostly used in custom property classes. |
2a8312bc JS |
276 | */ |
277 | class wxPGValidationInfo | |
278 | { | |
279 | public: | |
280 | /** | |
4c51a665 | 281 | @return Returns failure behaviour which is a combination of |
0ad10f30 | 282 | @ref propgrid_vfbflags. |
2a8312bc JS |
283 | */ |
284 | wxPGVFBFlags GetFailureBehavior(); | |
285 | ||
286 | /** | |
287 | Returns current failure message. | |
288 | */ | |
289 | const wxString& GetFailureMessage() const; | |
290 | ||
291 | /** | |
292 | Returns reference to pending value. | |
293 | */ | |
644b283d | 294 | wxVariant& GetValue(); |
2a8312bc | 295 | |
4c51a665 | 296 | /** Set validation failure behaviour |
2a8312bc JS |
297 | |
298 | @param failureBehavior | |
299 | Mixture of @ref propgrid_vfbflags. | |
300 | */ | |
301 | void SetFailureBehavior(wxPGVFBFlags failureBehavior); | |
302 | ||
303 | /** | |
304 | Set current failure message. | |
305 | */ | |
306 | void SetFailureMessage(const wxString& message); | |
307 | }; | |
308 | ||
1c4293cb VZ |
309 | // ----------------------------------------------------------------------- |
310 | ||
6b03a638 JS |
311 | /** |
312 | @section propgrid_keyboard_actions wxPropertyGrid Action Identifiers | |
0ad10f30 | 313 | |
6b03a638 JS |
314 | These are used with wxPropertyGrid::AddActionTrigger() and |
315 | wxPropertyGrid::ClearActionTriggers(). | |
1c4293cb VZ |
316 | @{ |
317 | */ | |
318 | ||
319 | enum wxPG_KEYBOARD_ACTIONS | |
320 | { | |
321 | wxPG_ACTION_INVALID = 0, | |
abbd88b5 JS |
322 | |
323 | /** Select the next property. */ | |
1c4293cb | 324 | wxPG_ACTION_NEXT_PROPERTY, |
abbd88b5 JS |
325 | |
326 | /** Select the previous property. */ | |
1c4293cb | 327 | wxPG_ACTION_PREV_PROPERTY, |
abbd88b5 JS |
328 | |
329 | /** Expand the selected property, if it has child items. */ | |
1c4293cb | 330 | wxPG_ACTION_EXPAND_PROPERTY, |
abbd88b5 JS |
331 | |
332 | /** Collapse the selected property, if it has child items. */ | |
1c4293cb | 333 | wxPG_ACTION_COLLAPSE_PROPERTY, |
abbd88b5 JS |
334 | |
335 | /** Cancel and undo any editing done in the currently active property | |
336 | editor. | |
337 | */ | |
1c4293cb | 338 | wxPG_ACTION_CANCEL_EDIT, |
abbd88b5 JS |
339 | |
340 | /** Move focus to the editor control of the currently selected | |
341 | property. | |
342 | */ | |
343 | wxPG_ACTION_EDIT, | |
344 | ||
345 | /** Causes editor's button (if any) to be pressed. */ | |
346 | wxPG_ACTION_PRESS_BUTTON, | |
347 | ||
1c4293cb VZ |
348 | wxPG_ACTION_MAX |
349 | }; | |
350 | ||
351 | /** @} | |
352 | */ | |
353 | ||
43396981 JS |
354 | /** This callback function is used for sorting properties. |
355 | ||
356 | Call wxPropertyGrid::SetSortFunction() to set it. | |
357 | ||
358 | Sort function should return a value greater than 0 if position of p1 is | |
359 | after p2. So, for instance, when comparing property names, you can use | |
360 | following implementation: | |
361 | ||
362 | @code | |
363 | int MyPropertySortFunction(wxPropertyGrid* propGrid, | |
364 | wxPGProperty* p1, | |
365 | wxPGProperty* p2) | |
366 | { | |
367 | return p1->GetBaseName().compare( p2->GetBaseName() ); | |
368 | } | |
369 | @endcode | |
370 | */ | |
371 | typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid, | |
372 | wxPGProperty* p1, | |
373 | wxPGProperty* p2); | |
374 | ||
1c4293cb VZ |
375 | // ----------------------------------------------------------------------- |
376 | ||
0ad10f30 FM |
377 | /** |
378 | @class wxPropertyGrid | |
1c4293cb | 379 | |
0ad10f30 | 380 | wxPropertyGrid is a specialized grid for editing properties - in other |
bba3f9b5 | 381 | words name = value pairs. List of ready-to-use property classes include |
6b03a638 | 382 | strings, numbers, flag sets, fonts, colours and many others. It is possible, |
bba3f9b5 JS |
383 | for example, to categorize properties, set up a complete tree-hierarchy, |
384 | add more than two columns, and set arbitrary per-property attributes. | |
1c4293cb | 385 | |
6b03a638 JS |
386 | Please note that most member functions are inherited and as such not |
387 | documented on this page. This means you will probably also want to read | |
388 | wxPropertyGridInterface class reference. | |
1c4293cb VZ |
389 | |
390 | See also @ref overview_propgrid. | |
391 | ||
392 | @section propgrid_window_styles_ Window Styles | |
393 | ||
394 | See @ref propgrid_window_styles. | |
395 | ||
396 | @section propgrid_event_handling Event Handling | |
397 | ||
6b03a638 JS |
398 | To process input from a property grid control, use these event handler macros |
399 | to direct input to member functions that take a wxPropertyGridEvent argument. | |
1c4293cb | 400 | |
3051a44a | 401 | @beginEventEmissionTable{wxPropertyGridEvent} |
1c4293cb | 402 | @event{EVT_PG_SELECTED (id, func)} |
3a194bda | 403 | Respond to @c wxEVT_PG_SELECTED event, generated when a property selection |
01b5ad3b JS |
404 | has been changed, either by user action or by indirect program |
405 | function. For instance, collapsing a parent property programmatically | |
406 | causes any selected child property to become unselected, and may | |
407 | therefore cause this event to be generated. | |
e72ad2d5 | 408 | @event{EVT_PG_CHANGED(id, func)} |
3a194bda | 409 | Respond to @c wxEVT_PG_CHANGED event, generated when property value |
e72ad2d5 | 410 | has been changed by the user. |
1c4293cb | 411 | @event{EVT_PG_CHANGING(id, func)} |
3a194bda | 412 | Respond to @c wxEVT_PG_CHANGING event, generated when property value |
1c4293cb VZ |
413 | is about to be changed by user. Use wxPropertyGridEvent::GetValue() |
414 | to take a peek at the pending value, and wxPropertyGridEvent::Veto() | |
415 | to prevent change from taking place, if necessary. | |
416 | @event{EVT_PG_HIGHLIGHTED(id, func)} | |
3a194bda | 417 | Respond to @c wxEVT_PG_HIGHLIGHTED event, which occurs when mouse |
1c4293cb VZ |
418 | moves over a property. Event's property is NULL if hovered area does |
419 | not belong to any property. | |
420 | @event{EVT_PG_RIGHT_CLICK(id, func)} | |
3a194bda | 421 | Respond to @c wxEVT_PG_RIGHT_CLICK event, which occurs when property is |
1c4293cb VZ |
422 | clicked on with right mouse button. |
423 | @event{EVT_PG_DOUBLE_CLICK(id, func)} | |
3a194bda | 424 | Respond to @c wxEVT_PG_DOUBLE_CLICK event, which occurs when property is |
6b03a638 | 425 | double-clicked on with left mouse button. |
1c4293cb | 426 | @event{EVT_PG_ITEM_COLLAPSED(id, func)} |
3a194bda | 427 | Respond to @c wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses |
6b03a638 | 428 | a property or category. |
1c4293cb | 429 | @event{EVT_PG_ITEM_EXPANDED(id, func)} |
3a194bda | 430 | Respond to @c wxEVT_PG_ITEM_EXPANDED event, generated when user expands |
6b03a638 | 431 | a property or category. |
58935d4a | 432 | @event{EVT_PG_LABEL_EDIT_BEGIN(id, func)} |
3a194bda | 433 | Respond to @c wxEVT_PG_LABEL_EDIT_BEGIN event, generated when user is |
008a4cb3 JS |
434 | about to begin editing a property label. You can veto this event to |
435 | prevent the action. | |
58935d4a | 436 | @event{EVT_PG_LABEL_EDIT_ENDING(id, func)} |
3a194bda | 437 | Respond to @c wxEVT_PG_LABEL_EDIT_ENDING event, generated when user is |
008a4cb3 JS |
438 | about to end editing of a property label. You can veto this event to |
439 | prevent the action. | |
5405bfb4 | 440 | @event{EVT_PG_COL_BEGIN_DRAG(id, func)} |
3a194bda | 441 | Respond to @c wxEVT_PG_COL_BEGIN_DRAG event, generated when user |
5405bfb4 JS |
442 | starts resizing a column - can be vetoed. |
443 | @event{EVT_PG_COL_DRAGGING,(id, func)} | |
3a194bda | 444 | Respond to @c wxEVT_PG_COL_DRAGGING, event, generated when a |
f5254768 JS |
445 | column resize by user is in progress. This event is also generated |
446 | when user double-clicks the splitter in order to recenter | |
447 | it. | |
5405bfb4 | 448 | @event{EVT_PG_COL_END_DRAG(id, func)} |
3a194bda | 449 | Respond to @c wxEVT_PG_COL_END_DRAG event, generated after column |
5405bfb4 | 450 | resize by user has finished. |
1c4293cb VZ |
451 | @endEventTable |
452 | ||
453 | @remarks | |
0ad10f30 FM |
454 | Use Freeze() and Thaw() respectively to disable and enable drawing. |
455 | This will also delay sorting etc. miscellaneous calculations to the last | |
456 | possible moment. | |
1c4293cb VZ |
457 | |
458 | @library{wxpropgrid} | |
459 | @category{propgrid} | |
ce154616 | 460 | @appearance{propertygrid} |
1c4293cb | 461 | */ |
2e2e62de JS |
462 | class wxPropertyGrid : public wxControl, |
463 | public wxScrollHelper, | |
464 | public wxPropertyGridInterface | |
1c4293cb VZ |
465 | { |
466 | public: | |
0ad10f30 FM |
467 | /** |
468 | Two step constructor. | |
469 | Call Create() when this constructor is called to build up the wxPropertyGrid | |
470 | */ | |
1c4293cb VZ |
471 | wxPropertyGrid(); |
472 | ||
6b03a638 | 473 | /** |
0ad10f30 | 474 | Constructor. |
2e2e62de | 475 | The styles to be used are styles valid for the wxWindow. |
6b03a638 JS |
476 | |
477 | @see @ref propgrid_window_styles. | |
1c4293cb VZ |
478 | */ |
479 | wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY, | |
0ad10f30 FM |
480 | const wxPoint& pos = wxDefaultPosition, |
481 | const wxSize& size = wxDefaultSize, | |
482 | long style = wxPG_DEFAULT_STYLE, | |
5aabd64c | 483 | const wxString& name = wxPropertyGridNameStr ); |
1c4293cb VZ |
484 | |
485 | /** Destructor */ | |
486 | virtual ~wxPropertyGrid(); | |
487 | ||
6b03a638 JS |
488 | /** |
489 | Adds given key combination to trigger given action. | |
490 | ||
8d2c7041 JS |
491 | Here is a sample code to make Enter key press move focus to |
492 | the next property. | |
493 | ||
494 | @code | |
495 | propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY, | |
496 | WXK_RETURN); | |
497 | propGrid->DedicateKey(WXK_RETURN); | |
498 | @endcode | |
499 | ||
1c4293cb | 500 | @param action |
6b03a638 | 501 | Which action to trigger. See @ref propgrid_keyboard_actions. |
6b03a638 JS |
502 | @param keycode |
503 | Which keycode triggers the action. | |
6b03a638 JS |
504 | @param modifiers |
505 | Which key event modifiers, in addition to keycode, are needed to | |
506 | trigger the action. | |
1c4293cb VZ |
507 | */ |
508 | void AddActionTrigger( int action, int keycode, int modifiers = 0 ); | |
509 | ||
fc72fab6 JS |
510 | /** |
511 | Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION | |
512 | extra style is not used, then this has same effect as | |
513 | calling SelectProperty(). | |
514 | ||
515 | @remarks Multiple selection is not supported for categories. This | |
516 | means that if you have properties selected, you cannot | |
517 | add category to selection, and also if you have category | |
518 | selected, you cannot add other properties to selection. | |
519 | This member function will fail silently in these cases, | |
520 | even returning true. | |
521 | */ | |
522 | bool AddToSelection( wxPGPropArg id ); | |
523 | ||
6b03a638 JS |
524 | /** |
525 | This static function enables or disables automatic use of | |
526 | wxGetTranslation() for following strings: wxEnumProperty list labels, | |
527 | wxFlagsProperty child property labels. | |
528 | ||
1c4293cb VZ |
529 | Default is false. |
530 | */ | |
531 | static void AutoGetTranslation( bool enable ); | |
532 | ||
58935d4a JS |
533 | /** |
534 | Creates label editor wxTextCtrl for given column, for property | |
535 | that is currently selected. When multiple selection is | |
536 | enabled, this applies to whatever property GetSelection() | |
537 | returns. | |
538 | ||
539 | @param colIndex | |
540 | Which column's label to edit. Note that you should not | |
541 | use value 1, which is reserved for property value | |
542 | column. | |
543 | ||
544 | @see EndLabelEdit(), MakeColumnEditable() | |
545 | */ | |
d86f721a | 546 | void BeginLabelEdit( unsigned int colIndex = 0 ); |
58935d4a | 547 | |
6b03a638 JS |
548 | /** |
549 | Changes value of a property, as if from an editor. Use this instead of | |
550 | SetPropertyValue() if you need the value to run through validation | |
551 | process, and also send the property change event. | |
1c4293cb | 552 | |
6b03a638 | 553 | @return Returns true if value was successfully changed. |
1c4293cb VZ |
554 | */ |
555 | bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue ); | |
556 | ||
6b03a638 | 557 | /** |
76733d4c JS |
558 | Centers the splitter. |
559 | ||
560 | @param enableAutoResizing | |
561 | If @true, automatic column resizing is enabled (only applicapple | |
562 | if window style wxPG_SPLITTER_AUTO_CENTER is used). | |
1c4293cb | 563 | */ |
76733d4c | 564 | void CenterSplitter( bool enableAutoResizing = false ); |
1c4293cb | 565 | |
6b03a638 JS |
566 | /** |
567 | Deletes all properties. | |
1c4293cb VZ |
568 | */ |
569 | virtual void Clear(); | |
570 | ||
6b03a638 JS |
571 | /** |
572 | Clears action triggers for given action. | |
573 | ||
1c4293cb | 574 | @param action |
6b03a638 | 575 | Which action to trigger. @ref propgrid_keyboard_actions. |
1c4293cb VZ |
576 | */ |
577 | void ClearActionTriggers( int action ); | |
578 | ||
6b03a638 JS |
579 | /** |
580 | Forces updating the value of property from the editor control. | |
3a194bda | 581 | Note that @c wxEVT_PG_CHANGING and @c wxEVT_PG_CHANGED are dispatched using |
6b03a638 | 582 | ProcessEvent, meaning your event handlers will be called immediately. |
1c4293cb | 583 | |
6b03a638 | 584 | @return Returns @true if anything was changed. |
1c4293cb VZ |
585 | */ |
586 | virtual bool CommitChangesFromEditor( wxUint32 flags = 0 ); | |
587 | ||
6b03a638 JS |
588 | /** |
589 | Two step creation. Whenever the control is created without any | |
590 | parameters, use Create to actually create it. Don't access the control's | |
591 | public methods before this is called | |
592 | ||
593 | @see @ref propgrid_window_styles. | |
1c4293cb VZ |
594 | */ |
595 | bool Create( wxWindow *parent, wxWindowID id = wxID_ANY, | |
0ad10f30 FM |
596 | const wxPoint& pos = wxDefaultPosition, |
597 | const wxSize& size = wxDefaultSize, | |
598 | long style = wxPG_DEFAULT_STYLE, | |
5aabd64c | 599 | const wxString& name = wxPropertyGridNameStr ); |
1c4293cb | 600 | |
8d2c7041 JS |
601 | /** |
602 | Dedicates a specific keycode to wxPropertyGrid. This means that such | |
603 | key presses will not be redirected to editor controls. | |
604 | ||
605 | Using this function allows, for example, navigation between | |
606 | properties using arrow keys even when the focus is in the editor | |
607 | control. | |
608 | */ | |
609 | void DedicateKey( int keycode ); | |
610 | ||
6b03a638 JS |
611 | /** |
612 | Enables or disables (shows/hides) categories according to parameter | |
613 | enable. | |
1621f192 JS |
614 | |
615 | @remarks This functions deselects selected property, if any. Validation | |
616 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
617 | selection is cleared even if editor had invalid value. | |
6b03a638 | 618 | */ |
1c4293cb VZ |
619 | bool EnableCategories( bool enable ); |
620 | ||
58935d4a JS |
621 | /** |
622 | Destroys label editor wxTextCtrl, if any. | |
623 | ||
624 | @param commit | |
625 | Use @true (default) to store edited label text in | |
626 | property cell data. | |
627 | ||
628 | @see BeginLabelEdit(), MakeColumnEditable() | |
629 | */ | |
630 | void EndLabelEdit( bool commit = true ); | |
631 | ||
6b03a638 JS |
632 | /** |
633 | Scrolls and/or expands items to ensure that the given item is visible. | |
634 | ||
635 | @return Returns @true if something was actually done. | |
1c4293cb VZ |
636 | */ |
637 | bool EnsureVisible( wxPGPropArg id ); | |
638 | ||
6b03a638 JS |
639 | /** |
640 | Reduces column sizes to minimum possible, while still retaining | |
641 | fully visible grid contents (labels, images). | |
1c4293cb | 642 | |
6b03a638 | 643 | @return Minimum size for the grid to still display everything. |
1c4293cb | 644 | |
6b03a638 | 645 | @remarks Does not work well with wxPG_SPLITTER_AUTO_CENTER window style. |
1c4293cb | 646 | |
6b03a638 JS |
647 | This function only works properly if grid size prior to call was |
648 | already fairly large. | |
1c4293cb | 649 | |
6b03a638 JS |
650 | Note that you can also get calculated column widths by calling |
651 | GetState->GetColumnWidth() immediately after this function | |
652 | returns. | |
1c4293cb | 653 | */ |
6b03a638 | 654 | wxSize FitColumns(); |
1c4293cb | 655 | |
58935d4a JS |
656 | /** |
657 | Returns currently active label editor, NULL if none. | |
658 | */ | |
659 | wxTextCtrl* GetLabelEditor() const; | |
660 | ||
6b03a638 JS |
661 | /** |
662 | Returns wxWindow that the properties are painted on, and which should be | |
663 | used as the parent for editor controls. | |
1c4293cb | 664 | */ |
39e4e221 | 665 | wxWindow* GetPanel(); |
1c4293cb | 666 | |
6b03a638 JS |
667 | /** |
668 | Returns current category caption background colour. | |
669 | */ | |
670 | wxColour GetCaptionBackgroundColour() const; | |
1c4293cb | 671 | |
6b03a638 JS |
672 | /** |
673 | Returns current category caption font. | |
674 | */ | |
675 | wxFont& GetCaptionFont(); | |
1c4293cb | 676 | |
6b03a638 JS |
677 | /** |
678 | Returns current category caption text colour. | |
679 | */ | |
680 | wxColour GetCaptionForegroundColour() const; | |
1c4293cb | 681 | |
6b03a638 JS |
682 | /** |
683 | Returns current cell background colour. | |
684 | */ | |
685 | wxColour GetCellBackgroundColour() const; | |
1c4293cb | 686 | |
6b03a638 JS |
687 | /** |
688 | Returns current cell text colour when disabled. | |
689 | */ | |
690 | wxColour GetCellDisabledTextColour() const; | |
1c4293cb | 691 | |
6b03a638 JS |
692 | /** |
693 | Returns current cell text colour. | |
694 | */ | |
695 | wxColour GetCellTextColour() const; | |
1c4293cb | 696 | |
6b03a638 JS |
697 | /** |
698 | Returns number of columns currently on grid. | |
699 | */ | |
68bcfd2c | 700 | unsigned int GetColumnCount() const; |
1c4293cb | 701 | |
6b03a638 JS |
702 | /** |
703 | Returns colour of empty space below properties. | |
704 | */ | |
705 | wxColour GetEmptySpaceColour() const; | |
1c4293cb | 706 | |
6b03a638 JS |
707 | /** |
708 | Returns height of highest characters of used font. | |
709 | */ | |
710 | int GetFontHeight() const; | |
1c4293cb | 711 | |
6b03a638 JS |
712 | /** |
713 | Returns pointer to itself. Dummy function that enables same kind | |
1c4293cb VZ |
714 | of code to use wxPropertyGrid and wxPropertyGridManager. |
715 | */ | |
6b03a638 JS |
716 | wxPropertyGrid* GetGrid(); |
717 | ||
718 | /** | |
719 | Returns rectangle of custom paint image. | |
1c4293cb | 720 | |
6b03a638 JS |
721 | @param property |
722 | Return image rectangle for this property. | |
723 | ||
724 | @param item | |
725 | Which choice of property to use (each choice may have | |
726 | different image). | |
1c4293cb | 727 | */ |
6b03a638 JS |
728 | wxRect GetImageRect( wxPGProperty* property, int item ) const; |
729 | ||
730 | /** | |
731 | Returns size of the custom paint image in front of property. | |
1c4293cb | 732 | |
6b03a638 JS |
733 | @param property |
734 | Return image rectangle for this property. | |
735 | If this argument is NULL, then preferred size is returned. | |
736 | ||
737 | @param item | |
738 | Which choice of property to use (each choice may have | |
739 | different image). | |
1c4293cb | 740 | */ |
6b03a638 JS |
741 | wxSize GetImageSize( wxPGProperty* property = NULL, int item = -1 ) const; |
742 | ||
743 | /** | |
744 | Returns last item which could be iterated using given flags. | |
1c4293cb | 745 | |
1c4293cb | 746 | @param flags |
6b03a638 | 747 | See @ref propgrid_iterator_flags. |
1c4293cb | 748 | */ |
6b03a638 | 749 | wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ); |
1c4293cb | 750 | |
6b03a638 JS |
751 | /** |
752 | Returns colour of lines between cells. | |
753 | */ | |
754 | wxColour GetLineColour() const; | |
1c4293cb | 755 | |
6b03a638 JS |
756 | /** |
757 | Returns background colour of margin. | |
758 | */ | |
759 | wxColour GetMarginColour() const; | |
1c4293cb | 760 | |
6b03a638 JS |
761 | /** |
762 | Returns "root property". It does not have name, etc. and it is not | |
1c4293cb VZ |
763 | visible. It is only useful for accessing its children. |
764 | */ | |
6b03a638 | 765 | wxPGProperty* GetRoot() const; |
1c4293cb | 766 | |
6b03a638 JS |
767 | /** |
768 | Returns height of a single grid row (in pixels). | |
769 | */ | |
770 | int GetRowHeight() const; | |
1c4293cb | 771 | |
6b03a638 JS |
772 | /** |
773 | Returns currently selected property. | |
774 | */ | |
775 | wxPGProperty* GetSelectedProperty() const; | |
1c4293cb | 776 | |
6b03a638 JS |
777 | /** |
778 | Returns currently selected property. | |
779 | */ | |
780 | wxPGProperty* GetSelection() const; | |
1c4293cb | 781 | |
6b03a638 JS |
782 | /** |
783 | Returns current selection background colour. | |
784 | */ | |
785 | wxColour GetSelectionBackgroundColour() const; | |
1c4293cb | 786 | |
6b03a638 JS |
787 | /** |
788 | Returns current selection text colour. | |
789 | */ | |
790 | wxColour GetSelectionForegroundColour() const; | |
1c4293cb | 791 | |
43396981 JS |
792 | /** |
793 | Returns the property sort function (default is @NULL). | |
794 | ||
795 | @see SetSortFunction | |
796 | */ | |
797 | wxPGSortCallback GetSortFunction() const; | |
798 | ||
6b03a638 JS |
799 | /** |
800 | Returns current splitter x position. | |
801 | */ | |
76733d4c | 802 | int GetSplitterPosition( unsigned int splitterIndex = 0 ) const; |
1c4293cb | 803 | |
6b03a638 JS |
804 | /** |
805 | Returns wxTextCtrl active in currently selected property, if any. Takes | |
806 | wxOwnerDrawnComboBox into account. | |
1c4293cb VZ |
807 | */ |
808 | wxTextCtrl* GetEditorTextCtrl() const; | |
809 | ||
3e6d8c31 JS |
810 | /** |
811 | Returns current appearance of unspecified value cells. | |
812 | ||
813 | @see SetUnspecifiedValueAppearance() | |
814 | */ | |
815 | const wxPGCell& GetUnspecifiedValueAppearance() const; | |
816 | ||
68174df3 JS |
817 | /** |
818 | Returns (visual) text representation of the unspecified | |
819 | property value. | |
820 | ||
821 | @param argFlags For internal use only. | |
822 | */ | |
823 | wxString GetUnspecifiedValueText( int argFlags = 0 ) const; | |
824 | ||
6b03a638 JS |
825 | /** |
826 | Returns current vertical spacing. | |
827 | */ | |
0ad10f30 | 828 | int GetVerticalSpacing() const; |
1c4293cb | 829 | |
6b03a638 JS |
830 | /** |
831 | Returns information about arbitrary position in the grid. | |
e276acb5 JS |
832 | |
833 | @param pt | |
58b6a137 | 834 | Coordinates in the virtual grid space. You may need to use |
2e2e62de | 835 | wxScrolled<T>::CalcScrolledPosition() for translating |
58b6a137 JS |
836 | wxPropertyGrid client coordinates into something this member |
837 | function can use. | |
1c4293cb VZ |
838 | */ |
839 | wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const; | |
840 | ||
6b03a638 JS |
841 | /** |
842 | Returns true if any property has been modified by the user. | |
843 | */ | |
844 | bool IsAnyModified() const; | |
1c4293cb | 845 | |
45843442 JS |
846 | /** |
847 | Returns @true if a property editor control has focus. | |
848 | */ | |
849 | bool IsEditorFocused() const; | |
850 | ||
6b03a638 JS |
851 | /** |
852 | Returns true if updating is frozen (ie. Freeze() called but not | |
853 | yet Thaw() ). | |
854 | */ | |
855 | bool IsFrozen() const; | |
1c4293cb | 856 | |
58935d4a JS |
857 | /** |
858 | Makes given column editable by user. | |
859 | ||
d86f721a FM |
860 | @param column |
861 | The index of the column to make editable. | |
e9fb1910 JS |
862 | @param editable |
863 | Using @false here will disable column from being editable. | |
864 | ||
58935d4a JS |
865 | @see BeginLabelEdit(), EndLabelEdit() |
866 | */ | |
e9fb1910 | 867 | void MakeColumnEditable( unsigned int column, bool editable = true ); |
58935d4a | 868 | |
27c1f235 | 869 | /** |
6edd8829 JS |
870 | It is recommended that you call this function any time your code causes |
871 | wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle() | |
872 | handler should be able to detect most changes, but it is not perfect. | |
27c1f235 JS |
873 | |
874 | @param newTLP | |
875 | New top-level parent that is about to be set. Old top-level parent | |
876 | window should still exist as the current one. | |
877 | ||
878 | @remarks This function is automatically called from wxPropertyGrid:: | |
879 | Reparent() and wxPropertyGridManager::Reparent(). You only | |
880 | need to use it if you reparent wxPropertyGrid indirectly. | |
881 | */ | |
882 | void OnTLPChanging( wxWindow* newTLP ); | |
883 | ||
f521bae6 JS |
884 | /** |
885 | Refreshes any active editor control. | |
886 | */ | |
887 | void RefreshEditor(); | |
888 | ||
6b03a638 JS |
889 | /** |
890 | Redraws given property. | |
1c4293cb VZ |
891 | */ |
892 | virtual void RefreshProperty( wxPGProperty* p ); | |
893 | ||
5aabd64c VZ |
894 | |
895 | /** Forwards to DoRegisterEditorClass with empty name. */ | |
896 | static wxPGEditor* RegisterEditorClass( wxPGEditor* editor, | |
897 | bool noDefCheck = false ); | |
6b03a638 JS |
898 | /** |
899 | Registers a new editor class. | |
900 | ||
901 | @return Returns pointer to the editor class instance that should be used. | |
1c4293cb | 902 | */ |
5aabd64c | 903 | static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editor, |
6b03a638 | 904 | const wxString& name, |
1c4293cb VZ |
905 | bool noDefCheck = false ); |
906 | ||
6b03a638 JS |
907 | /** |
908 | Resets all colours to the original system values. | |
1c4293cb VZ |
909 | */ |
910 | void ResetColours(); | |
911 | ||
76733d4c JS |
912 | /** |
913 | Resets column sizes and splitter positions, based on proportions. | |
914 | ||
915 | @param enableAutoResizing | |
916 | If @true, automatic column resizing is enabled (only applicapple | |
917 | if window style wxPG_SPLITTER_AUTO_CENTER is used). | |
918 | ||
919 | @see wxPropertyGridInterface::SetColumnProportion() | |
920 | */ | |
921 | void ResetColumnSizes( bool enableAutoResizing = false ); | |
922 | ||
fc72fab6 JS |
923 | /** |
924 | Removes given property from selection. If property is not selected, | |
925 | an assertion failure will occur. | |
926 | */ | |
927 | bool RemoveFromSelection( wxPGPropArg id ); | |
928 | ||
6b03a638 JS |
929 | /** |
930 | Selects a property. Editor widget is automatically created, but | |
01b5ad3b | 931 | not focused unless focus is true. |
6b03a638 | 932 | |
1c4293cb | 933 | @param id |
6b03a638 JS |
934 | Property to select (name or pointer). |
935 | ||
936 | @param focus | |
937 | If @true, move keyboard focus to the created editor right away. | |
938 | ||
939 | @return returns @true if selection finished successfully. Usually only | |
940 | fails if current value in editor is not valid. | |
941 | ||
01b5ad3b | 942 | @remarks In wxPropertyGrid 1.4, this member function used to generate |
3a194bda | 943 | @c wxEVT_PG_SELECTED. In wxWidgets 2.9 and later, it no longer |
01b5ad3b JS |
944 | does that. |
945 | ||
fc72fab6 JS |
946 | @remarks This clears any previous selection. |
947 | ||
01b5ad3b | 948 | @see wxPropertyGridInterface::ClearSelection() |
1c4293cb | 949 | */ |
6b03a638 JS |
950 | bool SelectProperty( wxPGPropArg id, bool focus = false ); |
951 | ||
6b03a638 JS |
952 | /** |
953 | Sets category caption background colour. | |
954 | */ | |
1c4293cb VZ |
955 | void SetCaptionBackgroundColour(const wxColour& col); |
956 | ||
6b03a638 JS |
957 | /** |
958 | Sets category caption text colour. | |
959 | */ | |
1c4293cb VZ |
960 | void SetCaptionTextColour(const wxColour& col); |
961 | ||
6b03a638 JS |
962 | /** |
963 | Sets default cell background colour - applies to property cells. | |
1c4293cb VZ |
964 | Note that appearance of editor widgets may not be affected. |
965 | */ | |
966 | void SetCellBackgroundColour(const wxColour& col); | |
967 | ||
6b03a638 JS |
968 | /** |
969 | Sets cell text colour for disabled properties. | |
1c4293cb VZ |
970 | */ |
971 | void SetCellDisabledTextColour(const wxColour& col); | |
972 | ||
6b03a638 JS |
973 | /** |
974 | Sets default cell text colour - applies to property name and value text. | |
1c4293cb VZ |
975 | Note that appearance of editor widgets may not be affected. |
976 | */ | |
977 | void SetCellTextColour(const wxColour& col); | |
978 | ||
6b03a638 JS |
979 | /** |
980 | Set number of columns (2 or more). | |
1c4293cb | 981 | */ |
6b03a638 | 982 | void SetColumnCount( int colCount ); |
1c4293cb | 983 | |
6b03a638 JS |
984 | /** |
985 | Sets the 'current' category - Append will add non-category properties | |
986 | under it. | |
1c4293cb VZ |
987 | */ |
988 | void SetCurrentCategory( wxPGPropArg id ); | |
989 | ||
6b03a638 JS |
990 | /** |
991 | Sets colour of empty space below properties. | |
992 | */ | |
1c4293cb VZ |
993 | void SetEmptySpaceColour(const wxColour& col); |
994 | ||
6b03a638 JS |
995 | /** |
996 | Sets colour of lines between cells. | |
997 | */ | |
1c4293cb VZ |
998 | void SetLineColour(const wxColour& col); |
999 | ||
6b03a638 JS |
1000 | /** |
1001 | Sets background colour of margin. | |
1002 | */ | |
1c4293cb VZ |
1003 | void SetMarginColour(const wxColour& col); |
1004 | ||
fc72fab6 JS |
1005 | /** |
1006 | Set entire new selection from given list of properties. | |
1007 | */ | |
1008 | void SetSelection( const wxArrayPGProperty& newSelection ); | |
1009 | ||
0ad10f30 FM |
1010 | /** |
1011 | Sets selection background colour - applies to selected property name | |
1012 | background. | |
1013 | */ | |
1c4293cb VZ |
1014 | void SetSelectionBackgroundColour(const wxColour& col); |
1015 | ||
0ad10f30 FM |
1016 | /** |
1017 | Sets selection foreground colour - applies to selected property name text. | |
1018 | */ | |
1c4293cb VZ |
1019 | void SetSelectionTextColour(const wxColour& col); |
1020 | ||
43396981 JS |
1021 | |
1022 | /** | |
1023 | Sets the property sorting function. | |
1024 | ||
1025 | @param sortFunction | |
1026 | The sorting function to be used. It should return a value greater | |
1027 | than 0 if position of p1 is after p2. So, for instance, when | |
1028 | comparing property names, you can use following implementation: | |
1029 | ||
1030 | @code | |
1031 | int MyPropertySortFunction(wxPropertyGrid* propGrid, | |
1032 | wxPGProperty* p1, | |
1033 | wxPGProperty* p2) | |
1034 | { | |
1035 | return p1->GetBaseName().compare( p2->GetBaseName() ); | |
1036 | } | |
1037 | @endcode | |
1038 | ||
1039 | @remarks | |
1040 | Default property sort function sorts properties by their labels | |
1041 | (case-insensitively). | |
1042 | ||
1043 | @see GetSortFunction, wxPropertyGridInterface::Sort, | |
1044 | wxPropertyGridInterface::SortChildren | |
1045 | */ | |
1046 | void SetSortFunction( wxPGSortCallback sortFunction ); | |
1047 | ||
0ad10f30 FM |
1048 | /** |
1049 | Sets x coordinate of the splitter. | |
6b03a638 JS |
1050 | |
1051 | @remarks Splitter position cannot exceed grid size, and therefore setting | |
1052 | it during form creation may fail as initial grid size is often | |
1053 | smaller than desired splitter position, especially when sizers | |
1054 | are being used. | |
1c4293cb | 1055 | */ |
6b03a638 | 1056 | void SetSplitterPosition( int newxpos, int col = 0 ); |
1c4293cb | 1057 | |
6b03a638 JS |
1058 | /** |
1059 | Moves splitter as left as possible, while still allowing all | |
1c4293cb | 1060 | labels to be shown in full. |
6b03a638 JS |
1061 | |
1062 | @param privateChildrenToo | |
1063 | If @false, will still allow private children to be cropped. | |
1c4293cb | 1064 | */ |
0ad10f30 | 1065 | void SetSplitterLeft( bool privateChildrenToo = false ); |
1c4293cb | 1066 | |
3e6d8c31 JS |
1067 | /** |
1068 | Sets appearance of value cells representing an unspecified property | |
1069 | value. Default appearance is blank. | |
1070 | ||
1071 | @remarks If you set the unspecified value to have any | |
1072 | textual representation, then that will override | |
1073 | "InlineHelp" attribute. | |
1074 | ||
1075 | @see wxPGProperty::SetValueToUnspecified(), | |
1076 | wxPGProperty::IsValueUnspecified() | |
1077 | */ | |
1078 | void SetUnspecifiedValueAppearance( const wxPGCell& cell ); | |
1079 | ||
6b03a638 JS |
1080 | /** |
1081 | Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font | |
1c4293cb | 1082 | height. Value of 2 should be default on most platforms. |
1c4293cb | 1083 | */ |
6b03a638 | 1084 | void SetVerticalSpacing( int vspacing ); |
1c4293cb | 1085 | |
2d8d109b JS |
1086 | /** |
1087 | @name wxPropertyGrid customization | |
1088 | ||
1089 | Reimplement these member functions in derived class for better | |
4c51a665 | 1090 | control over wxPropertyGrid behaviour. |
2d8d109b JS |
1091 | */ |
1092 | //@{ | |
abbd88b5 | 1093 | |
2d8d109b JS |
1094 | /** |
1095 | Override in derived class to display error messages in custom manner | |
1096 | (these message usually only result from validation failure). | |
1097 | ||
1098 | @remarks If you implement this, then you also need to implement | |
1099 | DoHidePropertyError() - possibly to do nothing, if error | |
1100 | does not need hiding (e.g. it was logged or shown in a | |
1101 | message box). | |
1102 | ||
1103 | @see DoHidePropertyError() | |
1104 | */ | |
1105 | virtual void DoShowPropertyError( wxPGProperty* property, | |
1106 | const wxString& msg ); | |
1107 | ||
1108 | /** | |
1109 | Override in derived class to hide an error displayed by | |
1110 | DoShowPropertyError(). | |
1111 | ||
1112 | @see DoShowPropertyError() | |
1113 | */ | |
1114 | virtual void DoHidePropertyError( wxPGProperty* property ); | |
1115 | ||
1116 | /** | |
1117 | Return wxStatusBar that is used by this wxPropertyGrid. You can | |
1118 | reimplement this member function in derived class to override | |
4c51a665 | 1119 | the default behaviour of using the top-level wxFrame's status |
2d8d109b JS |
1120 | bar, if any. |
1121 | */ | |
1122 | virtual wxStatusBar* GetStatusBar(); | |
1123 | ||
1124 | //@} | |
7dfede7b JS |
1125 | |
1126 | /** | |
1127 | @name Property development functions | |
1128 | ||
1129 | These member functions are usually only called when creating custom | |
1130 | user properties. | |
1131 | */ | |
1132 | //@{ | |
1133 | ||
1134 | /** | |
1135 | Call when editor widget's contents is modified. For example, this is | |
1136 | called when changes text in wxTextCtrl (used in wxStringProperty and | |
1137 | wxIntProperty). | |
1138 | ||
1139 | @remarks This function should only be called by custom properties. | |
1140 | ||
1141 | @see wxPGProperty::OnEvent() | |
1142 | */ | |
1143 | void EditorsValueWasModified(); | |
1144 | ||
1145 | /** | |
1146 | Reverse of EditorsValueWasModified(). | |
1147 | ||
1148 | @remarks This function should only be called by custom properties. | |
1149 | */ | |
1150 | void EditorsValueWasNotModified(); | |
1151 | ||
1152 | /** | |
1153 | Returns most up-to-date value of selected property. This will return | |
1154 | value different from GetSelectedProperty()->GetValue() only when text | |
1155 | editor is activate and string edited by user represents valid, | |
1156 | uncommitted property value. | |
1157 | */ | |
1158 | wxVariant GetUncommittedPropertyValue(); | |
1159 | ||
1160 | /** | |
1161 | Returns true if editor's value was marked modified. | |
1162 | */ | |
1163 | bool IsEditorsValueModified() const; | |
1164 | ||
6b03a638 JS |
1165 | /** |
1166 | Shows an brief error message that is related to a property. | |
1167 | */ | |
1168 | void ShowPropertyError( wxPGPropArg id, const wxString& msg ); | |
eddcc4b4 JS |
1169 | |
1170 | /** | |
1171 | You can use this member function, for instance, to detect in | |
1172 | wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was | |
1173 | already called in wxPGEditor::OnEvent(). It really only detects | |
1174 | if was value was changed using wxPGProperty::SetValueInEvent(), which | |
1175 | is usually used when a 'picker' dialog is displayed. If value was | |
1176 | written by "normal means" in wxPGProperty::StringToValue() or | |
1177 | IntToValue(), then this function will return false (on the other hand, | |
1178 | wxPGProperty::OnEvent() is not even called in those cases). | |
1179 | */ | |
1180 | bool WasValueChangedInEvent() const; | |
7dfede7b JS |
1181 | |
1182 | //@} | |
1c4293cb VZ |
1183 | }; |
1184 | ||
1185 | ||
6b03a638 JS |
1186 | /** |
1187 | @class wxPropertyGridEvent | |
1c4293cb | 1188 | |
6b03a638 | 1189 | A property grid event holds information about events associated with |
1c4293cb VZ |
1190 | wxPropertyGrid objects. |
1191 | ||
1192 | @library{wxpropgrid} | |
1193 | @category{propgrid} | |
1194 | */ | |
1195 | class wxPropertyGridEvent : public wxCommandEvent | |
1196 | { | |
1197 | public: | |
1198 | ||
1199 | /** Constructor. */ | |
1200 | wxPropertyGridEvent(wxEventType commandType=0, int id=0); | |
1201 | ||
1202 | /** Copy constructor. */ | |
1203 | wxPropertyGridEvent(const wxPropertyGridEvent& event); | |
1204 | ||
1205 | /** Destructor. */ | |
1206 | ~wxPropertyGridEvent(); | |
1207 | ||
6b03a638 JS |
1208 | /** |
1209 | Returns true if you can veto the action that the event is signaling. | |
1210 | */ | |
0ad10f30 | 1211 | bool CanVeto() const; |
6b03a638 | 1212 | |
5405bfb4 JS |
1213 | /** |
1214 | Returns the column index associated with this event. | |
1215 | For the column dragging events, it is the column to the left | |
1216 | of the splitter being dragged | |
1217 | */ | |
1218 | unsigned int GetColumn() const; | |
1219 | ||
6b03a638 JS |
1220 | /** |
1221 | Returns highest level non-category, non-root parent of property for | |
1222 | which event occurred. Useful when you have nested properties with | |
1223 | children. | |
1c4293cb | 1224 | |
6b03a638 JS |
1225 | @remarks If immediate parent is root or category, this will return the |
1226 | property itself. | |
1227 | */ | |
1228 | wxPGProperty* GetMainParent() const; | |
1c4293cb | 1229 | |
6b03a638 JS |
1230 | /** |
1231 | Returns property associated with this event. | |
28756ab9 JS |
1232 | |
1233 | @remarks You should assume that this property can always be NULL. | |
3a194bda | 1234 | For instance, @c wxEVT_PG_SELECTED is emitted not only when |
28756ab9 JS |
1235 | a new property is selected, but also when selection is |
1236 | cleared by user activity. | |
6b03a638 JS |
1237 | */ |
1238 | wxPGProperty* GetProperty() const; | |
1c4293cb | 1239 | |
6b03a638 JS |
1240 | /** |
1241 | Returns current validation failure flags. | |
1c4293cb | 1242 | */ |
6b03a638 | 1243 | wxPGVFBFlags GetValidationFailureBehavior() const; |
1c4293cb | 1244 | |
6b03a638 | 1245 | /** |
644b283d JS |
1246 | Returns name of the associated property. |
1247 | ||
1248 | @remarks Property name is stored in event, so it remains | |
1249 | accessible even after the associated property or | |
1250 | the property grid has been deleted. | |
1251 | */ | |
1252 | wxString GetPropertyName() const; | |
1253 | ||
1254 | /** | |
1255 | Returns value of the associated property. Works for all event | |
3a194bda | 1256 | types, but for @c wxEVT_PG_CHANGING this member function returns |
644b283d JS |
1257 | the value that is pending, so you can call Veto() if the |
1258 | value is not satisfactory. | |
1259 | ||
1260 | @remarks Property value is stored in event, so it remains | |
1261 | accessible even after the associated property or | |
1262 | the property grid has been deleted. | |
1263 | */ | |
1264 | wxVariant GetPropertyValue() const | |
1265 | ||
1266 | /** | |
1267 | @see GetPropertyValue() | |
1c4293cb | 1268 | */ |
644b283d | 1269 | wxVariant GetValue() const; |
1c4293cb | 1270 | |
6b03a638 JS |
1271 | /** |
1272 | Set if event can be vetoed. | |
1c4293cb | 1273 | */ |
6b03a638 | 1274 | void SetCanVeto( bool canVeto ); |
0ad10f30 | 1275 | |
6b03a638 JS |
1276 | /** Changes the property associated with this event. */ |
1277 | void SetProperty( wxPGProperty* p ); | |
1c4293cb | 1278 | |
6b03a638 | 1279 | /** |
4c51a665 | 1280 | Set override validation failure behaviour. Only effective if Veto() was |
3a194bda | 1281 | also called, and only allowed if event type is @c wxEVT_PG_CHANGING. |
1c4293cb | 1282 | */ |
2a8312bc | 1283 | void SetValidationFailureBehavior( wxPGVFBFlags flags ); |
1c4293cb | 1284 | |
6b03a638 JS |
1285 | /** |
1286 | Sets custom failure message for this time only. Only applies if | |
1c4293cb VZ |
1287 | wxPG_VFB_SHOW_MESSAGE is set in validation failure flags. |
1288 | */ | |
6b03a638 | 1289 | void SetValidationFailureMessage( const wxString& message ); |
1c4293cb | 1290 | |
6b03a638 JS |
1291 | /** |
1292 | Call this from your event handler to veto action that the event is | |
1293 | signaling. You can only veto a shutdown if wxPropertyGridEvent::CanVeto() | |
1294 | returns true. | |
1c4293cb | 1295 | |
3a194bda | 1296 | @remarks Currently only @c wxEVT_PG_CHANGING supports vetoing. |
6b03a638 JS |
1297 | */ |
1298 | void Veto( bool veto = true ); | |
1c4293cb | 1299 | |
6b03a638 JS |
1300 | /** |
1301 | Returns @true if event was vetoed. | |
1302 | */ | |
1303 | bool WasVetoed() const; | |
1c4293cb | 1304 | }; |