]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: grid.h | |
3 | // Purpose: interface of wxGrid and related classes | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxGridCellRenderer | |
11 | ||
12 | This class is responsible for actually drawing the cell in the grid. You | |
13 | may pass it to the wxGridCellAttr (below) to change the format of one given | |
14 | cell or to wxGrid::SetDefaultRenderer() to change the view of all cells. | |
15 | This is an abstract class, and you will normally use one of the predefined | |
16 | derived classes or derive your own class from it. | |
17 | ||
18 | @library{wxadv} | |
19 | @category{grid} | |
20 | ||
21 | @see wxGridCellAutoWrapStringRenderer, wxGridCellBoolRenderer, | |
22 | wxGridCellDateTimeRenderer, wxGridCellEnumRenderer, | |
23 | wxGridCellFloatRenderer, wxGridCellNumberRenderer, | |
24 | wxGridCellStringRenderer | |
25 | */ | |
26 | class wxGridCellRenderer : public wxClientDataContainer, public wxRefCounter | |
27 | { | |
28 | public: | |
29 | wxGridCellRenderer(); | |
30 | ||
31 | /** | |
32 | This function must be implemented in derived classes to return a copy | |
33 | of itself. | |
34 | */ | |
35 | virtual wxGridCellRenderer* Clone() const = 0; | |
36 | ||
37 | /** | |
38 | Draw the given cell on the provided DC inside the given rectangle using | |
39 | the style specified by the attribute and the default or selected state | |
40 | corresponding to the isSelected value. | |
41 | ||
42 | This pure virtual function has a default implementation which will | |
43 | prepare the DC using the given attribute: it will draw the rectangle | |
44 | with the background colour from attr and set the text colour and font. | |
45 | */ | |
46 | virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, | |
47 | const wxRect& rect, int row, int col, | |
48 | bool isSelected) = 0; | |
49 | ||
50 | /** | |
51 | Get the preferred size of the cell for its contents. | |
52 | */ | |
53 | virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, | |
54 | int row, int col) = 0; | |
55 | ||
56 | protected: | |
57 | /** | |
58 | The destructor is private because only DecRef() can delete us. | |
59 | */ | |
60 | virtual ~wxGridCellRenderer(); | |
61 | }; | |
62 | ||
63 | /** | |
64 | @class wxGridCellAutoWrapStringRenderer | |
65 | ||
66 | This class may be used to format string data in a cell. The too | |
67 | long lines are wrapped to be shown entirely at word boundaries. | |
68 | ||
69 | @library{wxadv} | |
70 | @category{grid} | |
71 | ||
72 | @see wxGridCellRenderer, wxGridCellBoolRenderer, | |
73 | wxGridCellDateTimeRenderer, wxGridCellEnumRenderer, | |
74 | wxGridCellFloatRenderer, wxGridCellNumberRenderer, | |
75 | wxGridCellStringRenderer | |
76 | */ | |
77 | ||
78 | class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer | |
79 | { | |
80 | public: | |
81 | /** | |
82 | Default constructor. | |
83 | */ | |
84 | wxGridCellAutoWrapStringRenderer(); | |
85 | }; | |
86 | ||
87 | ||
88 | /** | |
89 | @class wxGridCellBoolRenderer | |
90 | ||
91 | This class may be used to format boolean data in a cell. | |
92 | ||
93 | @library{wxadv} | |
94 | @category{grid} | |
95 | ||
96 | @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer, | |
97 | wxGridCellDateTimeRenderer, wxGridCellEnumRenderer, | |
98 | wxGridCellFloatRenderer, wxGridCellNumberRenderer, | |
99 | wxGridCellStringRenderer | |
100 | */ | |
101 | class wxGridCellBoolRenderer : public wxGridCellRenderer | |
102 | { | |
103 | public: | |
104 | /** | |
105 | Default constructor. | |
106 | */ | |
107 | wxGridCellBoolRenderer(); | |
108 | }; | |
109 | ||
110 | /** | |
111 | @class wxGridCellDateTimeRenderer | |
112 | ||
113 | This class may be used to format a date/time data in a cell. | |
114 | The class wxDateTime is used internally to display the local date/time | |
115 | or to parse the string date entered in the cell thanks to the defined format. | |
116 | ||
117 | @library{wxadv} | |
118 | @category{grid} | |
119 | ||
120 | @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer, | |
121 | wxGridCellBoolRenderer, wxGridCellEnumRenderer, | |
122 | wxGridCellFloatRenderer, wxGridCellNumberRenderer, | |
123 | wxGridCellStringRenderer | |
124 | */ | |
125 | class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer | |
126 | { | |
127 | public: | |
128 | /** | |
129 | Date/time renderer constructor. | |
130 | ||
131 | @param outformat | |
132 | strptime()-like format string used the parse the output date/time. | |
133 | @param informat | |
134 | strptime()-like format string used to parse the string entered in the cell. | |
135 | */ | |
136 | wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat, | |
137 | const wxString& informat = wxDefaultDateTimeFormat); | |
138 | ||
139 | ||
140 | /** | |
141 | Sets the strptime()-like format string which will be used to parse | |
142 | the date/time. | |
143 | ||
144 | @param params | |
145 | strptime()-like format string used to parse the date/time. | |
146 | */ | |
147 | virtual void SetParameters(const wxString& params); | |
148 | }; | |
149 | ||
150 | /** | |
151 | @class wxGridCellEnumRenderer | |
152 | ||
153 | This class may be used to render in a cell a number as a textual | |
154 | equivalent. | |
155 | ||
156 | The corresponding text strings are specified as comma-separated items in | |
157 | the string passed to this renderer ctor or SetParameters() method. For | |
158 | example, if this string is @c "John,Fred,Bob" the cell will be rendered as | |
159 | "John", "Fred" or "Bob" if its contents is 0, 1 or 2 respectively. | |
160 | ||
161 | @library{wxadv} | |
162 | @category{grid} | |
163 | ||
164 | @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer, | |
165 | wxGridCellBoolRenderer, wxGridCellDateTimeRenderer, | |
166 | wxGridCellFloatRenderer, wxGridCellNumberRenderer, | |
167 | wxGridCellStringRenderer | |
168 | */ | |
169 | class wxGridCellEnumRenderer : public wxGridCellStringRenderer | |
170 | { | |
171 | public: | |
172 | /** | |
173 | Enum renderer ctor. | |
174 | ||
175 | @param choices | |
176 | Comma separated string parameters "item1[,item2[...,itemN]]". | |
177 | */ | |
178 | wxGridCellEnumRenderer( const wxString& choices = wxEmptyString ); | |
179 | ||
180 | /** | |
181 | Sets the comma separated string content of the enum. | |
182 | ||
183 | @param params | |
184 | Comma separated string parameters "item1[,item2[...,itemN]]". | |
185 | */ | |
186 | virtual void SetParameters(const wxString& params); | |
187 | }; | |
188 | ||
189 | /** | |
190 | Specifier used to format the data to string for the numbers handled by | |
191 | wxGridCellFloatRenderer and wxGridCellFloatEditor. | |
192 | ||
193 | @since 2.9.3 | |
194 | */ | |
195 | enum wxGridCellFloatFormat | |
196 | { | |
197 | /// Decimal floating point (%f). | |
198 | wxGRID_FLOAT_FORMAT_FIXED = 0x0010, | |
199 | ||
200 | /// Scientific notation (mantise/exponent) using e character (%e). | |
201 | wxGRID_FLOAT_FORMAT_SCIENTIFIC = 0x0020, | |
202 | ||
203 | /// Use the shorter of %e or %f (%g). | |
204 | wxGRID_FLOAT_FORMAT_COMPACT = 0x0040, | |
205 | ||
206 | /// To use in combination with one of the above formats for the upper | |
207 | /// case version (%F/%E/%G) | |
208 | wxGRID_FLOAT_FORMAT_UPPER = 0x0080, | |
209 | ||
210 | /// The format used by default (wxGRID_FLOAT_FORMAT_FIXED). | |
211 | wxGRID_FLOAT_FORMAT_DEFAULT = wxGRID_FLOAT_FORMAT_FIXED | |
212 | }; | |
213 | ||
214 | /** | |
215 | @class wxGridCellFloatRenderer | |
216 | ||
217 | This class may be used to format floating point data in a cell. | |
218 | ||
219 | @library{wxadv} | |
220 | @category{grid} | |
221 | ||
222 | @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer, | |
223 | wxGridCellBoolRenderer, wxGridCellDateTimeRenderer, | |
224 | wxGridCellEnumRenderer, wxGridCellNumberRenderer, | |
225 | wxGridCellStringRenderer | |
226 | */ | |
227 | class wxGridCellFloatRenderer : public wxGridCellStringRenderer | |
228 | { | |
229 | public: | |
230 | /** | |
231 | Float cell renderer ctor. | |
232 | ||
233 | @param width | |
234 | Minimum number of characters to be shown. | |
235 | @param precision | |
236 | Number of digits after the decimal dot. | |
237 | @param format | |
238 | The format used to display the string, must be a combination of | |
239 | ::wxGridCellFloatFormat enum elements. This parameter is only | |
240 | available since wxWidgets 2.9.3. | |
241 | */ | |
242 | wxGridCellFloatRenderer(int width = -1, int precision = -1, | |
243 | int format = wxGRID_FLOAT_FORMAT_DEFAULT); | |
244 | ||
245 | /** | |
246 | Returns the specifier used to format the data to string. | |
247 | ||
248 | The returned value is a combination of ::wxGridCellFloatFormat elements. | |
249 | ||
250 | @since 2.9.3 | |
251 | */ | |
252 | int GetFormat() const; | |
253 | ||
254 | /** | |
255 | Returns the precision. | |
256 | */ | |
257 | int GetPrecision() const; | |
258 | ||
259 | /** | |
260 | Returns the width. | |
261 | */ | |
262 | int GetWidth() const; | |
263 | ||
264 | /** | |
265 | Set the format to use for display the number. | |
266 | ||
267 | @param format | |
268 | Must be a combination of ::wxGridCellFloatFormat enum elements. | |
269 | ||
270 | @since 2.9.3 | |
271 | */ | |
272 | void SetFormat(int format); | |
273 | ||
274 | /** | |
275 | The parameters string format is "width[,precision[,format]]" where | |
276 | @c format should be chosen between f|e|g|E|G (f is used by default) | |
277 | */ | |
278 | virtual void SetParameters(const wxString& params); | |
279 | ||
280 | /** | |
281 | Sets the precision. | |
282 | */ | |
283 | void SetPrecision(int precision); | |
284 | ||
285 | /** | |
286 | Sets the width. | |
287 | */ | |
288 | void SetWidth(int width); | |
289 | }; | |
290 | ||
291 | /** | |
292 | @class wxGridCellNumberRenderer | |
293 | ||
294 | This class may be used to format integer data in a cell. | |
295 | ||
296 | @library{wxadv} | |
297 | @category{grid} | |
298 | ||
299 | @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer, | |
300 | wxGridCellBoolRenderer, wxGridCellDateTimeRenderer, | |
301 | wxGridCellEnumRenderer, wxGridCellFloatRenderer, | |
302 | wxGridCellStringRenderer | |
303 | */ | |
304 | class wxGridCellNumberRenderer : public wxGridCellStringRenderer | |
305 | { | |
306 | public: | |
307 | /** | |
308 | Default constructor. | |
309 | */ | |
310 | wxGridCellNumberRenderer(); | |
311 | }; | |
312 | ||
313 | /** | |
314 | @class wxGridCellStringRenderer | |
315 | ||
316 | This class may be used to format string data in a cell; it is the default | |
317 | for string cells. | |
318 | ||
319 | @library{wxadv} | |
320 | @category{grid} | |
321 | ||
322 | @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer, | |
323 | wxGridCellBoolRenderer, wxGridCellDateTimeRenderer, | |
324 | wxGridCellEnumRenderer, wxGridCellFloatRenderer, | |
325 | wxGridCellNumberRenderer | |
326 | */ | |
327 | class wxGridCellStringRenderer : public wxGridCellRenderer | |
328 | { | |
329 | public: | |
330 | /** | |
331 | Default constructor. | |
332 | */ | |
333 | wxGridCellStringRenderer(); | |
334 | }; | |
335 | ||
336 | ||
337 | /** | |
338 | @class wxGridCellEditor | |
339 | ||
340 | This class is responsible for providing and manipulating the in-place edit | |
341 | controls for the grid. Instances of wxGridCellEditor (actually, instances | |
342 | of derived classes since it is an abstract class) can be associated with | |
343 | the cell attributes for individual cells, rows, columns, or even for the | |
344 | entire grid. | |
345 | ||
346 | @library{wxadv} | |
347 | @category{grid} | |
348 | ||
349 | @see wxGridCellAutoWrapStringEditor, wxGridCellBoolEditor, | |
350 | wxGridCellChoiceEditor, wxGridCellEnumEditor, | |
351 | wxGridCellFloatEditor, wxGridCellNumberEditor, | |
352 | wxGridCellTextEditor | |
353 | */ | |
354 | class wxGridCellEditor : public wxClientDataContainer, public wxRefCounter | |
355 | { | |
356 | public: | |
357 | /** | |
358 | Default constructor. | |
359 | */ | |
360 | wxGridCellEditor(); | |
361 | ||
362 | /** | |
363 | Fetch the value from the table and prepare the edit control to begin | |
364 | editing. | |
365 | ||
366 | This function should save the original value of the grid cell at the | |
367 | given @a row and @a col and show the control allowing the user to | |
368 | change it. | |
369 | ||
370 | @see EndEdit() | |
371 | */ | |
372 | virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; | |
373 | ||
374 | /** | |
375 | Create a new object which is the copy of this one. | |
376 | */ | |
377 | virtual wxGridCellEditor* Clone() const = 0; | |
378 | ||
379 | /** | |
380 | Creates the actual edit control. | |
381 | */ | |
382 | virtual void Create(wxWindow* parent, wxWindowID id, | |
383 | wxEvtHandler* evtHandler) = 0; | |
384 | ||
385 | /** | |
386 | Final cleanup. | |
387 | */ | |
388 | virtual void Destroy(); | |
389 | ||
390 | /** | |
391 | End editing the cell. | |
392 | ||
393 | This function must check if the current value of the editing control is | |
394 | valid and different from the original value (available as @a oldval in | |
395 | its string form and possibly saved internally using its real type by | |
396 | BeginEdit()). If it isn't, it just returns @false, otherwise it must do | |
397 | the following: | |
398 | - Save the new value internally so that ApplyEdit() could apply it. | |
399 | - Fill @a newval (which is never @NULL) with the string | |
400 | representation of the new value. | |
401 | - Return @true | |
402 | ||
403 | Notice that it must @em not modify the grid as the change could still | |
404 | be vetoed. | |
405 | ||
406 | If the user-defined wxEVT_GRID_CELL_CHANGING event handler doesn't veto | |
407 | this change, ApplyEdit() will be called next. | |
408 | */ | |
409 | virtual bool EndEdit(int row, int col, const wxGrid* grid, | |
410 | const wxString& oldval, wxString* newval) = 0; | |
411 | ||
412 | /** | |
413 | Effectively save the changes in the grid. | |
414 | ||
415 | This function should save the value of the control in the grid. It is | |
416 | called only after EndEdit() returns @true. | |
417 | */ | |
418 | virtual void ApplyEdit(int row, int col, wxGrid* grid) = 0; | |
419 | ||
420 | /** | |
421 | Some types of controls on some platforms may need some help with the | |
422 | Return key. | |
423 | */ | |
424 | virtual void HandleReturn(wxKeyEvent& event); | |
425 | ||
426 | /** | |
427 | Returns @true if the edit control has been created. | |
428 | */ | |
429 | bool IsCreated(); | |
430 | ||
431 | /** | |
432 | Draws the part of the cell not occupied by the control: the base class | |
433 | version just fills it with background colour from the attribute. | |
434 | */ | |
435 | virtual void PaintBackground(wxDC& dc, const wxRect& rectCell, wxGridCellAttr& attr); | |
436 | ||
437 | /** | |
438 | Reset the value in the control back to its starting value. | |
439 | */ | |
440 | virtual void Reset() = 0; | |
441 | ||
442 | /** | |
443 | Size and position the edit control. | |
444 | */ | |
445 | virtual void SetSize(const wxRect& rect); | |
446 | ||
447 | /** | |
448 | Show or hide the edit control, use the specified attributes to set | |
449 | colours/fonts for it. | |
450 | */ | |
451 | virtual void Show(bool show, wxGridCellAttr* attr = NULL); | |
452 | ||
453 | /** | |
454 | If the editor is enabled by clicking on the cell, this method will be | |
455 | called. | |
456 | */ | |
457 | virtual void StartingClick(); | |
458 | ||
459 | /** | |
460 | If the editor is enabled by pressing keys on the grid, this will be | |
461 | called to let the editor do something about that first key if desired. | |
462 | */ | |
463 | virtual void StartingKey(wxKeyEvent& event); | |
464 | ||
465 | /** | |
466 | Returns the value currently in the editor control. | |
467 | */ | |
468 | virtual wxString GetValue() const = 0; | |
469 | ||
470 | protected: | |
471 | ||
472 | /** | |
473 | The destructor is private because only DecRef() can delete us. | |
474 | */ | |
475 | virtual ~wxGridCellEditor(); | |
476 | }; | |
477 | ||
478 | /** | |
479 | @class wxGridCellAutoWrapStringEditor | |
480 | ||
481 | Grid cell editor for wrappable string/text data. | |
482 | ||
483 | @library{wxadv} | |
484 | @category{grid} | |
485 | ||
486 | @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor, | |
487 | wxGridCellEnumEditor, wxGridCellFloatEditor, | |
488 | wxGridCellNumberEditor, wxGridCellTextEditor | |
489 | */ | |
490 | class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor | |
491 | { | |
492 | public: | |
493 | wxGridCellAutoWrapStringEditor(); | |
494 | }; | |
495 | ||
496 | /** | |
497 | @class wxGridCellBoolEditor | |
498 | ||
499 | Grid cell editor for boolean data. | |
500 | ||
501 | @library{wxadv} | |
502 | @category{grid} | |
503 | ||
504 | @see wxGridCellEditor, wxGridCellAutoWrapStringEditor, | |
505 | wxGridCellChoiceEditor, wxGridCellEnumEditor, | |
506 | wxGridCellFloatEditor, wxGridCellNumberEditor, | |
507 | wxGridCellTextEditor | |
508 | */ | |
509 | class wxGridCellBoolEditor : public wxGridCellEditor | |
510 | { | |
511 | public: | |
512 | /** | |
513 | Default constructor. | |
514 | */ | |
515 | wxGridCellBoolEditor(); | |
516 | ||
517 | /** | |
518 | Returns @true if the given @a value is equal to the string | |
519 | representation of the truth value we currently use (see | |
520 | UseStringValues()). | |
521 | */ | |
522 | static bool IsTrueValue(const wxString& value); | |
523 | ||
524 | /** | |
525 | This method allows you to customize the values returned by GetValue() | |
526 | for the cell using this editor. By default, the default values of the | |
527 | arguments are used, i.e. @c "1" is returned if the cell is checked and | |
528 | an empty string otherwise. | |
529 | */ | |
530 | static void UseStringValues(const wxString& valueTrue = "1", | |
531 | const wxString& valueFalse = wxEmptyString); | |
532 | }; | |
533 | ||
534 | /** | |
535 | @class wxGridCellChoiceEditor | |
536 | ||
537 | Grid cell editor for string data providing the user a choice from a list of | |
538 | strings. | |
539 | ||
540 | @library{wxadv} | |
541 | @category{grid} | |
542 | ||
543 | @see wxGridCellEditor, wxGridCellAutoWrapStringEditor, | |
544 | wxGridCellBoolEditor, wxGridCellEnumEditor, | |
545 | wxGridCellFloatEditor, wxGridCellNumberEditor, | |
546 | wxGridCellTextEditor | |
547 | */ | |
548 | class wxGridCellChoiceEditor : public wxGridCellEditor | |
549 | { | |
550 | public: | |
551 | /** | |
552 | Choice cell renderer ctor. | |
553 | ||
554 | @param count | |
555 | Number of strings from which the user can choose. | |
556 | @param choices | |
557 | An array of strings from which the user can choose. | |
558 | @param allowOthers | |
559 | If allowOthers is @true, the user can type a string not in choices | |
560 | array. | |
561 | */ | |
562 | wxGridCellChoiceEditor(size_t count = 0, | |
563 | const wxString choices[] = NULL, | |
564 | bool allowOthers = false); | |
565 | ||
566 | /** | |
567 | Choice cell renderer ctor. | |
568 | ||
569 | @param choices | |
570 | An array of strings from which the user can choose. | |
571 | @param allowOthers | |
572 | If allowOthers is @true, the user can type a string not in choices | |
573 | array. | |
574 | */ | |
575 | wxGridCellChoiceEditor(const wxArrayString& choices, | |
576 | bool allowOthers = false); | |
577 | ||
578 | /** | |
579 | Parameters string format is "item1[,item2[...,itemN]]" | |
580 | */ | |
581 | virtual void SetParameters(const wxString& params); | |
582 | }; | |
583 | ||
584 | /** | |
585 | @class wxGridCellEnumEditor | |
586 | ||
587 | Grid cell editor which displays an enum number as a textual equivalent | |
588 | (eg. data in cell is 0,1,2 ... n the cell could be displayed as | |
589 | "John","Fred"..."Bob" in the combo choice box). | |
590 | ||
591 | @library{wxadv} | |
592 | @category{grid} | |
593 | ||
594 | @see wxGridCellEditor, wxGridCellAutoWrapStringEditor, | |
595 | wxGridCellBoolEditor, wxGridCellChoiceEditor, | |
596 | wxGridCellTextEditor, wxGridCellFloatEditor, | |
597 | wxGridCellNumberEditor | |
598 | */ | |
599 | class wxGridCellEnumEditor : public wxGridCellChoiceEditor | |
600 | { | |
601 | public: | |
602 | /** | |
603 | Enum cell editor ctor. | |
604 | ||
605 | @param choices | |
606 | Comma separated choice parameters "item1[,item2[...,itemN]]". | |
607 | */ | |
608 | wxGridCellEnumEditor( const wxString& choices = wxEmptyString ); | |
609 | }; | |
610 | ||
611 | /** | |
612 | @class wxGridCellTextEditor | |
613 | ||
614 | Grid cell editor for string/text data. | |
615 | ||
616 | @library{wxadv} | |
617 | @category{grid} | |
618 | ||
619 | @see wxGridCellEditor, wxGridCellAutoWrapStringEditor, | |
620 | wxGridCellBoolEditor, wxGridCellChoiceEditor, | |
621 | wxGridCellEnumEditor, wxGridCellFloatEditor, | |
622 | wxGridCellNumberEditor | |
623 | */ | |
624 | class wxGridCellTextEditor : public wxGridCellEditor | |
625 | { | |
626 | public: | |
627 | /** | |
628 | Text cell editor constructor. | |
629 | ||
630 | @param maxChars | |
631 | Maximum width of text (this parameter is supported starting since | |
632 | wxWidgets 2.9.5). | |
633 | */ | |
634 | explicit wxGridCellTextEditor(size_t maxChars = 0); | |
635 | ||
636 | /** | |
637 | The parameters string format is "n" where n is a number representing | |
638 | the maximum width. | |
639 | */ | |
640 | virtual void SetParameters(const wxString& params); | |
641 | ||
642 | /** | |
643 | Set validator to validate user input. | |
644 | ||
645 | @since 2.9.5 | |
646 | */ | |
647 | virtual void SetValidator(const wxValidator& validator); | |
648 | }; | |
649 | ||
650 | /** | |
651 | @class wxGridCellFloatEditor | |
652 | ||
653 | The editor for floating point numbers data. | |
654 | ||
655 | @library{wxadv} | |
656 | @category{grid} | |
657 | ||
658 | @see wxGridCellEditor, wxGridCellAutoWrapStringEditor, | |
659 | wxGridCellBoolEditor, wxGridCellChoiceEditor, | |
660 | wxGridCellEnumEditor, wxGridCellNumberEditor, | |
661 | wxGridCellTextEditor | |
662 | */ | |
663 | class wxGridCellFloatEditor : public wxGridCellTextEditor | |
664 | { | |
665 | public: | |
666 | /** | |
667 | Float cell editor ctor. | |
668 | ||
669 | @param width | |
670 | Minimum number of characters to be shown. | |
671 | @param precision | |
672 | Number of digits after the decimal dot. | |
673 | @param format | |
674 | The format to use for displaying the number, a combination of | |
675 | ::wxGridCellFloatFormat enum elements. This parameter is only | |
676 | available since wxWidgets 2.9.3. | |
677 | */ | |
678 | wxGridCellFloatEditor(int width = -1, int precision = -1, | |
679 | int format = wxGRID_FLOAT_FORMAT_DEFAULT); | |
680 | ||
681 | /** | |
682 | The parameters string format is "width[,precision[,format]]" where | |
683 | @c format should be chosen between f|e|g|E|G (f is used by default) | |
684 | */ | |
685 | virtual void SetParameters(const wxString& params); | |
686 | }; | |
687 | ||
688 | /** | |
689 | @class wxGridCellNumberEditor | |
690 | ||
691 | Grid cell editor for numeric integer data. | |
692 | ||
693 | @library{wxadv} | |
694 | @category{grid} | |
695 | ||
696 | @see wxGridCellEditor, wxGridCellAutoWrapStringEditor, | |
697 | wxGridCellBoolEditor, wxGridCellChoiceEditor, | |
698 | wxGridCellEnumEditor, wxGridCellFloatEditor, | |
699 | wxGridCellTextEditor | |
700 | */ | |
701 | class wxGridCellNumberEditor : public wxGridCellTextEditor | |
702 | { | |
703 | public: | |
704 | /** | |
705 | Allows you to specify the range for acceptable data. Values equal to | |
706 | -1 for both @a min and @a max indicate that no range checking should be | |
707 | done. | |
708 | */ | |
709 | wxGridCellNumberEditor(int min = -1, int max = -1); | |
710 | ||
711 | ||
712 | /** | |
713 | Parameters string format is "min,max". | |
714 | */ | |
715 | virtual void SetParameters(const wxString& params); | |
716 | ||
717 | protected: | |
718 | ||
719 | /** | |
720 | If the return value is @true, the editor uses a wxSpinCtrl to get user | |
721 | input, otherwise it uses a wxTextCtrl. | |
722 | */ | |
723 | bool HasRange() const; | |
724 | ||
725 | /** | |
726 | String representation of the value. | |
727 | */ | |
728 | wxString GetString() const; | |
729 | }; | |
730 | ||
731 | ||
732 | ||
733 | /** | |
734 | @class wxGridCellAttr | |
735 | ||
736 | This class can be used to alter the cells' appearance in the grid by | |
737 | changing their attributes from the defaults. An object of this class may be | |
738 | returned by wxGridTableBase::GetAttr(). | |
739 | ||
740 | @library{wxadv} | |
741 | @category{grid} | |
742 | */ | |
743 | class wxGridCellAttr : public wxClientDataContainer, public wxRefCounter | |
744 | { | |
745 | public: | |
746 | /** | |
747 | Kind of the attribute to retrieve. | |
748 | ||
749 | @see wxGridCellAttrProvider::GetAttr(), wxGridTableBase::GetAttr() | |
750 | */ | |
751 | enum wxAttrKind | |
752 | { | |
753 | /// Return the combined effective attribute for the cell. | |
754 | Any, | |
755 | ||
756 | /// Return the attribute explicitly set for this cell. | |
757 | Cell, | |
758 | ||
759 | /// Return the attribute set for this cells row. | |
760 | Row, | |
761 | ||
762 | /// Return the attribute set for this cells column. | |
763 | Col | |
764 | }; | |
765 | ||
766 | /** | |
767 | Default constructor. | |
768 | */ | |
769 | wxGridCellAttr(wxGridCellAttr* attrDefault = NULL); | |
770 | /** | |
771 | Constructor specifying some of the often used attributes. | |
772 | */ | |
773 | wxGridCellAttr(const wxColour& colText, const wxColour& colBack, | |
774 | const wxFont& font, int hAlign, int vAlign); | |
775 | ||
776 | /** | |
777 | Creates a new copy of this object. | |
778 | */ | |
779 | wxGridCellAttr* Clone() const; | |
780 | ||
781 | /** | |
782 | This class is reference counted: it is created with ref count of 1, so | |
783 | calling DecRef() once will delete it. Calling IncRef() allows to lock | |
784 | it until the matching DecRef() is called. | |
785 | */ | |
786 | void DecRef(); | |
787 | ||
788 | /** | |
789 | Get the alignment to use for the cell with the given attribute. | |
790 | ||
791 | If this attribute doesn't specify any alignment, the default attribute | |
792 | alignment is used (which can be changed using | |
793 | wxGrid::SetDefaultCellAlignment() but is left and top by default). | |
794 | ||
795 | Notice that @a hAlign and @a vAlign values are always overwritten by | |
796 | this function, use GetNonDefaultAlignment() if this is not desirable. | |
797 | ||
798 | @param hAlign | |
799 | Horizontal alignment is returned here if this argument is non-@NULL. | |
800 | It is one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. | |
801 | @param vAlign | |
802 | Vertical alignment is returned here if this argument is non-@NULL. | |
803 | It is one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. | |
804 | */ | |
805 | void GetAlignment(int* hAlign, int* vAlign) const; | |
806 | ||
807 | /** | |
808 | Returns the background colour. | |
809 | */ | |
810 | const wxColour& GetBackgroundColour() const; | |
811 | ||
812 | /** | |
813 | Returns the cell editor. | |
814 | */ | |
815 | wxGridCellEditor* GetEditor(const wxGrid* grid, int row, int col) const; | |
816 | ||
817 | /** | |
818 | Returns the font. | |
819 | */ | |
820 | const wxFont& GetFont() const; | |
821 | ||
822 | /** | |
823 | Get the alignment defined by this attribute. | |
824 | ||
825 | Unlike GetAlignment() this function only modifies @a hAlign and @a | |
826 | vAlign if this attribute does define a non-default alignment. This | |
827 | means that they must be initialized before calling this function and | |
828 | that their values will be preserved unchanged if they are different | |
829 | from wxALIGN_INVALID. | |
830 | ||
831 | For example, the following fragment can be used to use the cell | |
832 | alignment if one is defined but right-align its contents by default | |
833 | (instead of left-aligning it by default) while still using the default | |
834 | vertical alignment: | |
835 | @code | |
836 | int hAlign = wxALIGN_RIGHT, | |
837 | vAlign = wxALIGN_INVALID; | |
838 | attr.GetNonDefaultAlignment(&hAlign, &vAlign); | |
839 | @endcode | |
840 | ||
841 | @since 2.9.1 | |
842 | */ | |
843 | void GetNonDefaultAlignment(int *hAlign, int *vAlign) const; | |
844 | ||
845 | /** | |
846 | Returns the cell renderer. | |
847 | */ | |
848 | wxGridCellRenderer* GetRenderer(const wxGrid* grid, int row, int col) const; | |
849 | ||
850 | /** | |
851 | Returns the text colour. | |
852 | */ | |
853 | const wxColour& GetTextColour() const; | |
854 | ||
855 | /** | |
856 | Returns @true if this attribute has a valid alignment set. | |
857 | */ | |
858 | bool HasAlignment() const; | |
859 | ||
860 | /** | |
861 | Returns @true if this attribute has a valid background colour set. | |
862 | */ | |
863 | bool HasBackgroundColour() const; | |
864 | ||
865 | /** | |
866 | Returns @true if this attribute has a valid cell editor set. | |
867 | */ | |
868 | bool HasEditor() const; | |
869 | ||
870 | /** | |
871 | Returns @true if this attribute has a valid font set. | |
872 | */ | |
873 | bool HasFont() const; | |
874 | ||
875 | /** | |
876 | Returns @true if this attribute has a valid cell renderer set. | |
877 | */ | |
878 | bool HasRenderer() const; | |
879 | ||
880 | /** | |
881 | Returns @true if this attribute has a valid text colour set. | |
882 | */ | |
883 | bool HasTextColour() const; | |
884 | ||
885 | /** | |
886 | This class is reference counted: it is created with ref count of 1, so | |
887 | calling DecRef() once will delete it. Calling IncRef() allows to lock | |
888 | it until the matching DecRef() is called. | |
889 | */ | |
890 | void IncRef(); | |
891 | ||
892 | /** | |
893 | Returns @true if this cell is set as read-only. | |
894 | */ | |
895 | bool IsReadOnly() const; | |
896 | ||
897 | /** | |
898 | Sets the alignment. @a hAlign can be one of @c wxALIGN_LEFT, | |
899 | @c wxALIGN_CENTRE or @c wxALIGN_RIGHT and @a vAlign can be one of | |
900 | @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM. | |
901 | */ | |
902 | void SetAlignment(int hAlign, int vAlign); | |
903 | ||
904 | /** | |
905 | Sets the background colour. | |
906 | */ | |
907 | void SetBackgroundColour(const wxColour& colBack); | |
908 | ||
909 | /** | |
910 | @todo Needs documentation. | |
911 | */ | |
912 | void SetDefAttr(wxGridCellAttr* defAttr); | |
913 | ||
914 | /** | |
915 | Sets the editor to be used with the cells with this attribute. | |
916 | */ | |
917 | void SetEditor(wxGridCellEditor* editor); | |
918 | ||
919 | /** | |
920 | Sets the font. | |
921 | */ | |
922 | void SetFont(const wxFont& font); | |
923 | ||
924 | /** | |
925 | Sets the cell as read-only. | |
926 | */ | |
927 | void SetReadOnly(bool isReadOnly = true); | |
928 | ||
929 | /** | |
930 | Sets the renderer to be used for cells with this attribute. Takes | |
931 | ownership of the pointer. | |
932 | */ | |
933 | void SetRenderer(wxGridCellRenderer* renderer); | |
934 | ||
935 | /** | |
936 | Sets the text colour. | |
937 | */ | |
938 | void SetTextColour(const wxColour& colText); | |
939 | ||
940 | protected: | |
941 | ||
942 | /** | |
943 | The destructor is private because only DecRef() can delete us. | |
944 | */ | |
945 | virtual ~wxGridCellAttr(); | |
946 | }; | |
947 | ||
948 | /** | |
949 | Base class for corner window renderer. | |
950 | ||
951 | This is the simplest of all header renderers and only has a single | |
952 | function. | |
953 | ||
954 | @see wxGridCellAttrProvider::GetCornerRenderer() | |
955 | ||
956 | @since 2.9.1 | |
957 | */ | |
958 | class wxGridCornerHeaderRenderer | |
959 | { | |
960 | public: | |
961 | /** | |
962 | Called by the grid to draw the corner window border. | |
963 | ||
964 | This method is responsible for drawing the border inside the given @a | |
965 | rect and adjusting the rectangle size to correspond to the area inside | |
966 | the border, i.e. usually call wxRect::Deflate() to account for the | |
967 | border width. | |
968 | ||
969 | @param grid | |
970 | The grid whose corner window is being drawn. | |
971 | @param dc | |
972 | The device context to use for drawing. | |
973 | @param rect | |
974 | Input/output parameter which contains the border rectangle on input | |
975 | and should be updated to contain the area inside the border on | |
976 | function return. | |
977 | */ | |
978 | virtual void DrawBorder(const wxGrid& grid, | |
979 | wxDC& dc, | |
980 | wxRect& rect) const = 0; | |
981 | }; | |
982 | ||
983 | /** | |
984 | Common base class for row and column headers renderers. | |
985 | ||
986 | @see wxGridColumnHeaderRenderer, wxGridRowHeaderRenderer | |
987 | ||
988 | @since 2.9.1 | |
989 | */ | |
990 | class wxGridHeaderLabelsRenderer : public wxGridCornerHeaderRenderer | |
991 | { | |
992 | public: | |
993 | /** | |
994 | Called by the grid to draw the specified label. | |
995 | ||
996 | Notice that the base class DrawBorder() method is called before this | |
997 | one. | |
998 | ||
999 | The default implementation uses wxGrid::GetLabelTextColour() and | |
1000 | wxGrid::GetLabelFont() to draw the label. | |
1001 | */ | |
1002 | virtual void DrawLabel(const wxGrid& grid, | |
1003 | wxDC& dc, | |
1004 | const wxString& value, | |
1005 | const wxRect& rect, | |
1006 | int horizAlign, | |
1007 | int vertAlign, | |
1008 | int textOrientation) const; | |
1009 | }; | |
1010 | ||
1011 | /** | |
1012 | Base class for row headers renderer. | |
1013 | ||
1014 | This is the same as wxGridHeaderLabelsRenderer currently but we still use a | |
1015 | separate class for it to distinguish it from wxGridColumnHeaderRenderer. | |
1016 | ||
1017 | @see wxGridRowHeaderRendererDefault | |
1018 | ||
1019 | @see wxGridCellAttrProvider::GetRowHeaderRenderer() | |
1020 | ||
1021 | @since 2.9.1 | |
1022 | */ | |
1023 | class wxGridRowHeaderRenderer : public wxGridHeaderLabelsRenderer | |
1024 | { | |
1025 | }; | |
1026 | ||
1027 | /** | |
1028 | Base class for column headers renderer. | |
1029 | ||
1030 | This is the same as wxGridHeaderLabelsRenderer currently but we still use a | |
1031 | separate class for it to distinguish it from wxGridRowHeaderRenderer. | |
1032 | ||
1033 | @see wxGridColumnHeaderRendererDefault | |
1034 | ||
1035 | @see wxGridCellAttrProvider::GetColumnHeaderRenderer() | |
1036 | ||
1037 | @since 2.9.1 | |
1038 | */ | |
1039 | class wxGridColumnHeaderRenderer : public wxGridHeaderLabelsRenderer | |
1040 | { | |
1041 | }; | |
1042 | ||
1043 | /** | |
1044 | Default row header renderer. | |
1045 | ||
1046 | You may derive from this class if you need to only override one of its | |
1047 | methods (i.e. either DrawLabel() or DrawBorder()) but continue to use the | |
1048 | default implementation for the other one. | |
1049 | ||
1050 | @see wxGridColumnHeaderRendererDefault | |
1051 | ||
1052 | @since 2.9.1 | |
1053 | */ | |
1054 | class wxGridRowHeaderRendererDefault : public wxGridRowHeaderRenderer | |
1055 | { | |
1056 | public: | |
1057 | /// Implement border drawing for the row labels. | |
1058 | virtual void DrawBorder(const wxGrid& grid, | |
1059 | wxDC& dc, | |
1060 | wxRect& rect) const; | |
1061 | }; | |
1062 | ||
1063 | /** | |
1064 | Default column header renderer. | |
1065 | ||
1066 | @see wxGridRowHeaderRendererDefault | |
1067 | ||
1068 | @since 2.9.1 | |
1069 | */ | |
1070 | class wxGridColumnHeaderRendererDefault : public wxGridColumnHeaderRenderer | |
1071 | { | |
1072 | public: | |
1073 | /// Implement border drawing for the column labels. | |
1074 | virtual void DrawBorder(const wxGrid& grid, | |
1075 | wxDC& dc, | |
1076 | wxRect& rect) const; | |
1077 | }; | |
1078 | ||
1079 | /** | |
1080 | Default corner window renderer. | |
1081 | ||
1082 | @see wxGridColumnHeaderRendererDefault, wxGridRowHeaderRendererDefault | |
1083 | ||
1084 | @since 2.9.1 | |
1085 | */ | |
1086 | class wxGridCornerHeaderRendererDefault : public wxGridCornerHeaderRenderer | |
1087 | { | |
1088 | public: | |
1089 | /// Implement border drawing for the corner window. | |
1090 | virtual void DrawBorder(const wxGrid& grid, | |
1091 | wxDC& dc, | |
1092 | wxRect& rect) const; | |
1093 | }; | |
1094 | ||
1095 | /** | |
1096 | Class providing attributes to be used for the grid cells. | |
1097 | ||
1098 | This class both defines an interface which grid cell attributes providers | |
1099 | should implement -- and which can be implemented differently in derived | |
1100 | classes -- and a default implementation of this interface which is often | |
1101 | good enough to be used without modification, especially with not very large | |
1102 | grids for which the efficiency of attributes storage hardly matters (see | |
1103 | the discussion below). | |
1104 | ||
1105 | An object of this class can be associated with a wxGrid using | |
1106 | wxGridTableBase::SetAttrProvider() but it's not necessary to call it if you | |
1107 | intend to use the default provider as it is used by wxGridTableBase by | |
1108 | default anyhow. | |
1109 | ||
1110 | Notice that while attributes provided by this class can be set for | |
1111 | individual cells using SetAttr() or the entire rows or columns using | |
1112 | SetRowAttr() and SetColAttr() they are always retrieved using GetAttr() | |
1113 | function. | |
1114 | ||
1115 | ||
1116 | The default implementation of this class stores the attributes passed to | |
1117 | its SetAttr(), SetRowAttr() and SetColAttr() in a straightforward way. A | |
1118 | derived class may use its knowledge about how the attributes are used in | |
1119 | your program to implement it much more efficiently: for example, using a | |
1120 | special background colour for all even-numbered rows can be implemented by | |
1121 | simply returning the same attribute from GetAttr() if the row number is | |
1122 | even instead of having to store N/2 row attributes where N is the total | |
1123 | number of rows in the grid. | |
1124 | ||
1125 | Notice that objects of this class can't be copied. | |
1126 | */ | |
1127 | class wxGridCellAttrProvider : public wxClientDataContainer | |
1128 | { | |
1129 | public: | |
1130 | /// Trivial default constructor. | |
1131 | wxGridCellAttrProvider(); | |
1132 | ||
1133 | /// Destructor releases any attributes held by this class. | |
1134 | virtual ~wxGridCellAttrProvider(); | |
1135 | ||
1136 | /** | |
1137 | Get the attribute to use for the specified cell. | |
1138 | ||
1139 | If wxGridCellAttr::Any is used as @a kind value, this function combines | |
1140 | the attributes set for this cell using SetAttr() and those for its row | |
1141 | or column (set with SetRowAttr() or SetColAttr() respectively), with | |
1142 | the cell attribute having the highest precedence. | |
1143 | ||
1144 | Notice that the caller must call DecRef() on the returned pointer if it | |
1145 | is non-@NULL. | |
1146 | ||
1147 | @param row | |
1148 | The row of the cell. | |
1149 | @param col | |
1150 | The column of the cell. | |
1151 | @param kind | |
1152 | The kind of the attribute to return. | |
1153 | @return | |
1154 | The attribute to use which should be DecRef()'d by caller or @NULL | |
1155 | if no attributes are defined for this cell. | |
1156 | */ | |
1157 | virtual wxGridCellAttr *GetAttr(int row, int col, | |
1158 | wxGridCellAttr::wxAttrKind kind) const; | |
1159 | ||
1160 | /** | |
1161 | Setting attributes. | |
1162 | ||
1163 | All these functions take ownership of the attribute passed to them, | |
1164 | i.e. will call DecRef() on it themselves later and so it should not be | |
1165 | destroyed by the caller. And the attribute can be @NULL to reset a | |
1166 | previously set value. | |
1167 | */ | |
1168 | //@{ | |
1169 | ||
1170 | /// Set attribute for the specified cell. | |
1171 | virtual void SetAttr(wxGridCellAttr *attr, int row, int col); | |
1172 | ||
1173 | /// Set attribute for the specified row. | |
1174 | virtual void SetRowAttr(wxGridCellAttr *attr, int row); | |
1175 | ||
1176 | /// Set attribute for the specified column. | |
1177 | virtual void SetColAttr(wxGridCellAttr *attr, int col); | |
1178 | ||
1179 | //@} | |
1180 | ||
1181 | /** | |
1182 | Getting header renderers. | |
1183 | ||
1184 | These functions return the renderers for the given row or column header | |
1185 | label and the corner window. Unlike cell attributes, these objects are | |
1186 | not reference counted and are never @NULL so they are returned by | |
1187 | reference and not pointer and DecRef() shouldn't (and can't) be called | |
1188 | for them. | |
1189 | ||
1190 | All these functions were added in wxWidgets 2.9.1. | |
1191 | */ | |
1192 | //@{ | |
1193 | ||
1194 | /** | |
1195 | Return the renderer used for drawing column headers. | |
1196 | ||
1197 | By default wxGridColumnHeaderRendererDefault is returned. | |
1198 | ||
1199 | @see wxGrid::SetUseNativeColLabels(), wxGrid::UseNativeColHeader() | |
1200 | ||
1201 | @since 2.9.1 | |
1202 | */ | |
1203 | virtual const wxGridColumnHeaderRenderer& GetColumnHeaderRenderer(int col); | |
1204 | ||
1205 | /** | |
1206 | Return the renderer used for drawing row headers. | |
1207 | ||
1208 | By default wxGridRowHeaderRendererDefault is returned. | |
1209 | ||
1210 | @since 2.9.1 | |
1211 | */ | |
1212 | virtual const wxGridRowHeaderRenderer& GetRowHeaderRenderer(int row); | |
1213 | ||
1214 | /** | |
1215 | Return the renderer used for drawing the corner window. | |
1216 | ||
1217 | By default wxGridCornerHeaderRendererDefault is returned. | |
1218 | ||
1219 | @since 2.9.1 | |
1220 | */ | |
1221 | virtual const wxGridCornerHeaderRenderer& GetCornerRenderer(); | |
1222 | ||
1223 | //@} | |
1224 | }; | |
1225 | ||
1226 | /** | |
1227 | Represents coordinates of a grid cell. | |
1228 | ||
1229 | An object of this class is simply a (row, column) pair. | |
1230 | */ | |
1231 | class wxGridCellCoords | |
1232 | { | |
1233 | public: | |
1234 | /** | |
1235 | Default constructor initializes the object to invalid state. | |
1236 | ||
1237 | Initially the row and column are both invalid (-1) and so operator!() | |
1238 | for an uninitialized wxGridCellCoords returns false. | |
1239 | */ | |
1240 | wxGridCellCoords(); | |
1241 | ||
1242 | /** | |
1243 | Constructor taking a row and a column. | |
1244 | */ | |
1245 | wxGridCellCoords(int row, int col); | |
1246 | ||
1247 | /** | |
1248 | Return the row of the coordinate. | |
1249 | */ | |
1250 | int GetRow() const; | |
1251 | ||
1252 | /** | |
1253 | Set the row of the coordinate. | |
1254 | */ | |
1255 | void SetRow(int n); | |
1256 | ||
1257 | /** | |
1258 | Return the column of the coordinate. | |
1259 | */ | |
1260 | int GetCol() const; | |
1261 | ||
1262 | /** | |
1263 | Set the column of the coordinate. | |
1264 | */ | |
1265 | void SetCol(int n); | |
1266 | ||
1267 | /** | |
1268 | Set the row and column of the coordinate. | |
1269 | */ | |
1270 | void Set(int row, int col); | |
1271 | ||
1272 | /** | |
1273 | Assignment operator for coordinate types. | |
1274 | */ | |
1275 | wxGridCellCoords& operator=(const wxGridCellCoords& other); | |
1276 | ||
1277 | /** | |
1278 | Equality operator. | |
1279 | */ | |
1280 | bool operator==(const wxGridCellCoords& other) const; | |
1281 | ||
1282 | /** | |
1283 | Inequality operator. | |
1284 | */ | |
1285 | bool operator!=(const wxGridCellCoords& other) const; | |
1286 | ||
1287 | /** | |
1288 | Checks whether the coordinates are invalid. | |
1289 | ||
1290 | Returns false only if both row and column are -1. Notice that if either | |
1291 | row or column (but not both) are -1, this method returns true even if | |
1292 | the object is invalid. This is done because objects in such state | |
1293 | should actually never exist, i.e. either both coordinates should be -1 | |
1294 | or none of them should be -1. | |
1295 | */ | |
1296 | bool operator!() const; | |
1297 | }; | |
1298 | ||
1299 | /** | |
1300 | @class wxGridTableBase | |
1301 | ||
1302 | The almost abstract base class for grid tables. | |
1303 | ||
1304 | A grid table is responsible for storing the grid data and, indirectly, grid | |
1305 | cell attributes. The data can be stored in the way most convenient for the | |
1306 | application but has to be provided in string form to wxGrid. It is also | |
1307 | possible to provide cells values in other formats if appropriate, e.g. as | |
1308 | numbers. | |
1309 | ||
1310 | This base class is not quite abstract as it implements a trivial strategy | |
1311 | for storing the attributes by forwarding it to wxGridCellAttrProvider and | |
1312 | also provides stubs for some other functions. However it does have a number | |
1313 | of pure virtual methods which must be implemented in the derived classes. | |
1314 | ||
1315 | @see wxGridStringTable | |
1316 | ||
1317 | @library{wxadv} | |
1318 | @category{grid} | |
1319 | */ | |
1320 | class wxGridTableBase : public wxObject | |
1321 | { | |
1322 | public: | |
1323 | /** | |
1324 | Default constructor. | |
1325 | */ | |
1326 | wxGridTableBase(); | |
1327 | ||
1328 | /** | |
1329 | Destructor frees the attribute provider if it was created. | |
1330 | */ | |
1331 | virtual ~wxGridTableBase(); | |
1332 | ||
1333 | /** | |
1334 | Must be overridden to return the number of rows in the table. | |
1335 | ||
1336 | For backwards compatibility reasons, this method is not const. | |
1337 | Use GetRowsCount() instead of it in const methods of derived table | |
1338 | classes. | |
1339 | */ | |
1340 | virtual int GetNumberRows() = 0; | |
1341 | ||
1342 | /** | |
1343 | Must be overridden to return the number of columns in the table. | |
1344 | ||
1345 | For backwards compatibility reasons, this method is not const. | |
1346 | Use GetColsCount() instead of it in const methods of derived table | |
1347 | classes, | |
1348 | */ | |
1349 | virtual int GetNumberCols() = 0; | |
1350 | ||
1351 | /** | |
1352 | Return the number of rows in the table. | |
1353 | ||
1354 | This method is not virtual and is only provided as a convenience for | |
1355 | the derived classes which can't call GetNumberRows() without a | |
1356 | @c const_cast from their const methods. | |
1357 | */ | |
1358 | int GetRowsCount() const; | |
1359 | ||
1360 | /** | |
1361 | Return the number of columns in the table. | |
1362 | ||
1363 | This method is not virtual and is only provided as a convenience for | |
1364 | the derived classes which can't call GetNumberCols() without a | |
1365 | @c const_cast from their const methods. | |
1366 | */ | |
1367 | int GetColsCount() const; | |
1368 | ||
1369 | ||
1370 | /** | |
1371 | @name Table Cell Accessors | |
1372 | */ | |
1373 | //@{ | |
1374 | ||
1375 | /** | |
1376 | May be overridden to implement testing for empty cells. | |
1377 | ||
1378 | This method is used by the grid to test if the given cell is not used | |
1379 | and so whether a neighbouring cell may overflow into it. By default it | |
1380 | only returns true if the value of the given cell, as returned by | |
1381 | GetValue(), is empty. | |
1382 | */ | |
1383 | virtual bool IsEmptyCell(int row, int col); | |
1384 | ||
1385 | /** | |
1386 | Same as IsEmptyCell() but taking wxGridCellCoords. | |
1387 | ||
1388 | Notice that this method is not virtual, only IsEmptyCell() should be | |
1389 | overridden. | |
1390 | */ | |
1391 | bool IsEmpty(const wxGridCellCoords& coords); | |
1392 | ||
1393 | /** | |
1394 | Must be overridden to implement accessing the table values as text. | |
1395 | */ | |
1396 | virtual wxString GetValue(int row, int col) = 0; | |
1397 | ||
1398 | /** | |
1399 | Must be overridden to implement setting the table values as text. | |
1400 | */ | |
1401 | virtual void SetValue(int row, int col, const wxString& value) = 0; | |
1402 | ||
1403 | /** | |
1404 | Returns the type of the value in the given cell. | |
1405 | ||
1406 | By default all cells are strings and this method returns | |
1407 | @c wxGRID_VALUE_STRING. | |
1408 | */ | |
1409 | virtual wxString GetTypeName(int row, int col); | |
1410 | ||
1411 | /** | |
1412 | Returns true if the value of the given cell can be accessed as if it | |
1413 | were of the specified type. | |
1414 | ||
1415 | By default the cells can only be accessed as strings. Note that a cell | |
1416 | could be accessible in different ways, e.g. a numeric cell may return | |
1417 | @true for @c wxGRID_VALUE_NUMBER but also for @c wxGRID_VALUE_STRING | |
1418 | indicating that the value can be coerced to a string form. | |
1419 | */ | |
1420 | virtual bool CanGetValueAs(int row, int col, const wxString& typeName); | |
1421 | ||
1422 | /** | |
1423 | Returns true if the value of the given cell can be set as if it were of | |
1424 | the specified type. | |
1425 | ||
1426 | @see CanGetValueAs() | |
1427 | */ | |
1428 | virtual bool CanSetValueAs(int row, int col, const wxString& typeName); | |
1429 | ||
1430 | /** | |
1431 | Returns the value of the given cell as a long. | |
1432 | ||
1433 | This should only be called if CanGetValueAs() returns @true when called | |
1434 | with @c wxGRID_VALUE_NUMBER argument. Default implementation always | |
1435 | return 0. | |
1436 | */ | |
1437 | virtual long GetValueAsLong(int row, int col); | |
1438 | ||
1439 | /** | |
1440 | Returns the value of the given cell as a double. | |
1441 | ||
1442 | This should only be called if CanGetValueAs() returns @true when called | |
1443 | with @c wxGRID_VALUE_FLOAT argument. Default implementation always | |
1444 | return 0.0. | |
1445 | */ | |
1446 | virtual double GetValueAsDouble(int row, int col); | |
1447 | ||
1448 | /** | |
1449 | Returns the value of the given cell as a boolean. | |
1450 | ||
1451 | This should only be called if CanGetValueAs() returns @true when called | |
1452 | with @c wxGRID_VALUE_BOOL argument. Default implementation always | |
1453 | return false. | |
1454 | */ | |
1455 | virtual bool GetValueAsBool(int row, int col); | |
1456 | ||
1457 | /** | |
1458 | Returns the value of the given cell as a user-defined type. | |
1459 | ||
1460 | This should only be called if CanGetValueAs() returns @true when called | |
1461 | with @a typeName. Default implementation always return @NULL. | |
1462 | */ | |
1463 | virtual void *GetValueAsCustom(int row, int col, const wxString& typeName); | |
1464 | ||
1465 | /** | |
1466 | Sets the value of the given cell as a long. | |
1467 | ||
1468 | This should only be called if CanSetValueAs() returns @true when called | |
1469 | with @c wxGRID_VALUE_NUMBER argument. Default implementation doesn't do | |
1470 | anything. | |
1471 | */ | |
1472 | virtual void SetValueAsLong(int row, int col, long value); | |
1473 | ||
1474 | /** | |
1475 | Sets the value of the given cell as a double. | |
1476 | ||
1477 | This should only be called if CanSetValueAs() returns @true when called | |
1478 | with @c wxGRID_VALUE_FLOAT argument. Default implementation doesn't do | |
1479 | anything. | |
1480 | */ | |
1481 | virtual void SetValueAsDouble(int row, int col, double value); | |
1482 | ||
1483 | /** | |
1484 | Sets the value of the given cell as a boolean. | |
1485 | ||
1486 | This should only be called if CanSetValueAs() returns @true when called | |
1487 | with @c wxGRID_VALUE_BOOL argument. Default implementation doesn't do | |
1488 | anything. | |
1489 | */ | |
1490 | virtual void SetValueAsBool( int row, int col, bool value ); | |
1491 | ||
1492 | /** | |
1493 | Sets the value of the given cell as a user-defined type. | |
1494 | ||
1495 | This should only be called if CanSetValueAs() returns @true when called | |
1496 | with @a typeName. Default implementation doesn't do anything. | |
1497 | */ | |
1498 | virtual void SetValueAsCustom(int row, int col, const wxString& typeName, | |
1499 | void *value); | |
1500 | ||
1501 | //@} | |
1502 | ||
1503 | ||
1504 | /** | |
1505 | Called by the grid when the table is associated with it. | |
1506 | ||
1507 | The default implementation stores the pointer and returns it from its | |
1508 | GetView() and so only makes sense if the table cannot be associated | |
1509 | with more than one grid at a time. | |
1510 | */ | |
1511 | virtual void SetView(wxGrid *grid); | |
1512 | ||
1513 | /** | |
1514 | Returns the last grid passed to SetView(). | |
1515 | */ | |
1516 | virtual wxGrid *GetView() const; | |
1517 | ||
1518 | ||
1519 | /** | |
1520 | @name Table Structure Modifiers | |
1521 | ||
1522 | Notice that none of these functions are pure virtual as they don't have | |
1523 | to be implemented if the table structure is never modified after | |
1524 | creation, i.e. neither rows nor columns are never added or deleted but | |
1525 | that you do need to implement them if they are called, i.e. if your | |
1526 | code either calls them directly or uses the matching wxGrid methods, as | |
1527 | by default they simply do nothing which is definitely inappropriate. | |
1528 | */ | |
1529 | //@{ | |
1530 | ||
1531 | /** | |
1532 | Clear the table contents. | |
1533 | ||
1534 | This method is used by wxGrid::ClearGrid(). | |
1535 | */ | |
1536 | virtual void Clear(); | |
1537 | ||
1538 | /** | |
1539 | Insert additional rows into the table. | |
1540 | ||
1541 | @param pos | |
1542 | The position of the first new row. | |
1543 | @param numRows | |
1544 | The number of rows to insert. | |
1545 | */ | |
1546 | virtual bool InsertRows(size_t pos = 0, size_t numRows = 1); | |
1547 | ||
1548 | /** | |
1549 | Append additional rows at the end of the table. | |
1550 | ||
1551 | This method is provided in addition to InsertRows() as some data models | |
1552 | may only support appending rows to them but not inserting them at | |
1553 | arbitrary locations. In such case you may implement this method only | |
1554 | and leave InsertRows() unimplemented. | |
1555 | ||
1556 | @param numRows | |
1557 | The number of rows to add. | |
1558 | */ | |
1559 | virtual bool AppendRows(size_t numRows = 1); | |
1560 | ||
1561 | /** | |
1562 | Delete rows from the table. | |
1563 | ||
1564 | Notice that currently deleting a row intersecting a multi-cell (see | |
1565 | SetCellSize()) is not supported and will result in a crash. | |
1566 | ||
1567 | @param pos | |
1568 | The first row to delete. | |
1569 | @param numRows | |
1570 | The number of rows to delete. | |
1571 | */ | |
1572 | virtual bool DeleteRows(size_t pos = 0, size_t numRows = 1); | |
1573 | ||
1574 | /** | |
1575 | Exactly the same as InsertRows() but for columns. | |
1576 | */ | |
1577 | virtual bool InsertCols(size_t pos = 0, size_t numCols = 1); | |
1578 | ||
1579 | /** | |
1580 | Exactly the same as AppendRows() but for columns. | |
1581 | */ | |
1582 | virtual bool AppendCols(size_t numCols = 1); | |
1583 | ||
1584 | /** | |
1585 | Exactly the same as DeleteRows() but for columns. | |
1586 | */ | |
1587 | virtual bool DeleteCols(size_t pos = 0, size_t numCols = 1); | |
1588 | ||
1589 | //@} | |
1590 | ||
1591 | /** | |
1592 | @name Table Row and Column Labels | |
1593 | ||
1594 | By default the numbers are used for labeling rows and Latin letters for | |
1595 | labeling columns. If the table has more than 26 columns, the pairs of | |
1596 | letters are used starting from the 27-th one and so on, i.e. the | |
1597 | sequence of labels is A, B, ..., Z, AA, AB, ..., AZ, BA, ..., ..., ZZ, | |
1598 | AAA, ... | |
1599 | */ | |
1600 | //@{ | |
1601 | ||
1602 | /** | |
1603 | Return the label of the specified row. | |
1604 | */ | |
1605 | virtual wxString GetRowLabelValue(int row); | |
1606 | ||
1607 | /** | |
1608 | Return the label of the specified column. | |
1609 | */ | |
1610 | virtual wxString GetColLabelValue(int col); | |
1611 | ||
1612 | /** | |
1613 | Set the given label for the specified row. | |
1614 | ||
1615 | The default version does nothing, i.e. the label is not stored. You | |
1616 | must override this method in your derived class if you wish | |
1617 | wxGrid::SetRowLabelValue() to work. | |
1618 | */ | |
1619 | virtual void SetRowLabelValue(int row, const wxString& label); | |
1620 | ||
1621 | /** | |
1622 | Exactly the same as SetRowLabelValue() but for columns. | |
1623 | */ | |
1624 | virtual void SetColLabelValue(int col, const wxString& label); | |
1625 | ||
1626 | //@} | |
1627 | ||
1628 | ||
1629 | /** | |
1630 | @name Attributes Management | |
1631 | ||
1632 | By default the attributes management is delegated to | |
1633 | wxGridCellAttrProvider class. You may override the methods in this | |
1634 | section to handle the attributes directly if, for example, they can be | |
1635 | computed from the cell values. | |
1636 | */ | |
1637 | //@{ | |
1638 | ||
1639 | /** | |
1640 | Associate this attributes provider with the table. | |
1641 | ||
1642 | The table takes ownership of @a attrProvider pointer and will delete it | |
1643 | when it doesn't need it any more. The pointer can be @NULL, however | |
1644 | this won't disable attributes management in the table but will just | |
1645 | result in a default attributes being recreated the next time any of the | |
1646 | other functions in this section is called. To completely disable the | |
1647 | attributes support, should this be needed, you need to override | |
1648 | CanHaveAttributes() to return @false. | |
1649 | */ | |
1650 | void SetAttrProvider(wxGridCellAttrProvider *attrProvider); | |
1651 | ||
1652 | /** | |
1653 | Returns the attribute provider currently being used. | |
1654 | ||
1655 | This function may return @NULL if the attribute provider hasn't been | |
1656 | neither associated with this table by SetAttrProvider() nor created on | |
1657 | demand by any other methods. | |
1658 | */ | |
1659 | wxGridCellAttrProvider *GetAttrProvider() const; | |
1660 | ||
1661 | /** | |
1662 | Return the attribute for the given cell. | |
1663 | ||
1664 | By default this function is simply forwarded to | |
1665 | wxGridCellAttrProvider::GetAttr() but it may be overridden to handle | |
1666 | attributes directly in the table. | |
1667 | */ | |
1668 | virtual wxGridCellAttr *GetAttr(int row, int col, | |
1669 | wxGridCellAttr::wxAttrKind kind); | |
1670 | ||
1671 | /** | |
1672 | Set attribute of the specified cell. | |
1673 | ||
1674 | By default this function is simply forwarded to | |
1675 | wxGridCellAttrProvider::SetAttr(). | |
1676 | ||
1677 | The table takes ownership of @a attr, i.e. will call DecRef() on it. | |
1678 | */ | |
1679 | virtual void SetAttr(wxGridCellAttr* attr, int row, int col); | |
1680 | ||
1681 | /** | |
1682 | Set attribute of the specified row. | |
1683 | ||
1684 | By default this function is simply forwarded to | |
1685 | wxGridCellAttrProvider::SetRowAttr(). | |
1686 | ||
1687 | The table takes ownership of @a attr, i.e. will call DecRef() on it. | |
1688 | */ | |
1689 | virtual void SetRowAttr(wxGridCellAttr *attr, int row); | |
1690 | ||
1691 | /** | |
1692 | Set attribute of the specified column. | |
1693 | ||
1694 | By default this function is simply forwarded to | |
1695 | wxGridCellAttrProvider::SetColAttr(). | |
1696 | ||
1697 | The table takes ownership of @a attr, i.e. will call DecRef() on it. | |
1698 | */ | |
1699 | virtual void SetColAttr(wxGridCellAttr *attr, int col); | |
1700 | ||
1701 | //@} | |
1702 | ||
1703 | /** | |
1704 | Returns true if this table supports attributes or false otherwise. | |
1705 | ||
1706 | By default, the table automatically creates a wxGridCellAttrProvider | |
1707 | when this function is called if it had no attribute provider before and | |
1708 | returns @true. | |
1709 | */ | |
1710 | virtual bool CanHaveAttributes(); | |
1711 | }; | |
1712 | ||
1713 | ||
1714 | ||
1715 | enum wxGridTableRequest | |
1716 | { | |
1717 | wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, | |
1718 | wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, | |
1719 | wxGRIDTABLE_NOTIFY_ROWS_INSERTED, | |
1720 | wxGRIDTABLE_NOTIFY_ROWS_APPENDED, | |
1721 | wxGRIDTABLE_NOTIFY_ROWS_DELETED, | |
1722 | wxGRIDTABLE_NOTIFY_COLS_INSERTED, | |
1723 | wxGRIDTABLE_NOTIFY_COLS_APPENDED, | |
1724 | wxGRIDTABLE_NOTIFY_COLS_DELETED | |
1725 | }; | |
1726 | ||
1727 | ||
1728 | /** | |
1729 | @class wxGridTableMessage | |
1730 | ||
1731 | A simple class used to pass messages from the table to the grid. | |
1732 | ||
1733 | @library{wxadv} | |
1734 | @category{grid} | |
1735 | */ | |
1736 | class wxGridTableMessage | |
1737 | { | |
1738 | public: | |
1739 | wxGridTableMessage(); | |
1740 | wxGridTableMessage( wxGridTableBase *table, int id, | |
1741 | int comInt1 = -1, | |
1742 | int comInt2 = -1 ); | |
1743 | ||
1744 | void SetTableObject( wxGridTableBase *table ); | |
1745 | wxGridTableBase * GetTableObject() const; | |
1746 | void SetId( int id ); | |
1747 | int GetId(); | |
1748 | void SetCommandInt( int comInt1 ); | |
1749 | int GetCommandInt(); | |
1750 | void SetCommandInt2( int comInt2 ); | |
1751 | int GetCommandInt2(); | |
1752 | }; | |
1753 | ||
1754 | ||
1755 | ||
1756 | /** | |
1757 | @class wxGridStringTable | |
1758 | ||
1759 | Simplest type of data table for a grid for small tables of strings | |
1760 | that are stored in memory | |
1761 | */ | |
1762 | class wxGridStringTable : public wxGridTableBase | |
1763 | { | |
1764 | public: | |
1765 | wxGridStringTable(); | |
1766 | wxGridStringTable( int numRows, int numCols ); | |
1767 | ||
1768 | // these are pure virtual in wxGridTableBase | |
1769 | virtual int GetNumberRows(); | |
1770 | virtual int GetNumberCols(); | |
1771 | virtual wxString GetValue( int row, int col ); | |
1772 | virtual void SetValue( int row, int col, const wxString& value ); | |
1773 | ||
1774 | // overridden functions from wxGridTableBase | |
1775 | void Clear(); | |
1776 | bool InsertRows( size_t pos = 0, size_t numRows = 1 ); | |
1777 | bool AppendRows( size_t numRows = 1 ); | |
1778 | bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); | |
1779 | bool InsertCols( size_t pos = 0, size_t numCols = 1 ); | |
1780 | bool AppendCols( size_t numCols = 1 ); | |
1781 | bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); | |
1782 | ||
1783 | void SetRowLabelValue( int row, const wxString& ); | |
1784 | void SetColLabelValue( int col, const wxString& ); | |
1785 | wxString GetRowLabelValue( int row ); | |
1786 | wxString GetColLabelValue( int col ); | |
1787 | }; | |
1788 | ||
1789 | ||
1790 | ||
1791 | ||
1792 | ||
1793 | ||
1794 | /** | |
1795 | @class wxGridSizesInfo | |
1796 | ||
1797 | wxGridSizesInfo stores information about sizes of all wxGrid rows or | |
1798 | columns. | |
1799 | ||
1800 | It assumes that most of the rows or columns (which are both called elements | |
1801 | here as the difference between them doesn't matter at this class level) | |
1802 | have the default size and so stores it separately. And it uses a wxHashMap | |
1803 | to store the sizes of all elements which have the non-default size. | |
1804 | ||
1805 | This structure is particularly useful for serializing the sizes of all | |
1806 | wxGrid elements at once. | |
1807 | ||
1808 | @library{wxadv} | |
1809 | @category{grid} | |
1810 | */ | |
1811 | struct wxGridSizesInfo | |
1812 | { | |
1813 | /** | |
1814 | Default constructor. | |
1815 | ||
1816 | m_sizeDefault and m_customSizes must be initialized later. | |
1817 | */ | |
1818 | wxGridSizesInfo(); | |
1819 | ||
1820 | /** | |
1821 | Constructor. | |
1822 | ||
1823 | This constructor is used by wxGrid::GetRowSizes() and GetColSizes() | |
1824 | methods. User code will usually use the default constructor instead. | |
1825 | ||
1826 | @param defSize | |
1827 | The default element size. | |
1828 | @param allSizes | |
1829 | Array containing the sizes of @em all elements, including those | |
1830 | which have the default size. | |
1831 | */ | |
1832 | wxGridSizesInfo(int defSize, const wxArrayInt& allSizes); | |
1833 | ||
1834 | /** | |
1835 | Get the element size. | |
1836 | ||
1837 | @param pos | |
1838 | The index of the element. | |
1839 | @return | |
1840 | The size for this element, using m_customSizes if @a pos is in it | |
1841 | or m_sizeDefault otherwise. | |
1842 | */ | |
1843 | int GetSize(unsigned pos) const; | |
1844 | ||
1845 | ||
1846 | /// Default size | |
1847 | int m_sizeDefault; | |
1848 | ||
1849 | /** | |
1850 | Map with element indices as keys and their sizes as values. | |
1851 | ||
1852 | This map only contains the elements with non-default size. | |
1853 | */ | |
1854 | wxUnsignedToIntHashMap m_customSizes; | |
1855 | }; | |
1856 | ||
1857 | ||
1858 | ||
1859 | /** | |
1860 | Rendering styles supported by wxGrid::Render() method. | |
1861 | ||
1862 | @since 2.9.4 | |
1863 | */ | |
1864 | enum wxGridRenderStyle | |
1865 | { | |
1866 | /// Draw grid row header labels. | |
1867 | wxGRID_DRAW_ROWS_HEADER = 0x001, | |
1868 | ||
1869 | /// Draw grid column header labels. | |
1870 | wxGRID_DRAW_COLS_HEADER = 0x002, | |
1871 | ||
1872 | /// Draw grid cell border lines. | |
1873 | wxGRID_DRAW_CELL_LINES = 0x004, | |
1874 | ||
1875 | /** | |
1876 | Draw a bounding rectangle around the rendered cell area. | |
1877 | ||
1878 | Useful where row or column headers are not drawn or where there is | |
1879 | multi row or column cell clipping and therefore no cell border at | |
1880 | the rendered outer boundary. | |
1881 | */ | |
1882 | wxGRID_DRAW_BOX_RECT = 0x008, | |
1883 | ||
1884 | /** | |
1885 | Draw the grid cell selection highlight if a selection is present. | |
1886 | ||
1887 | At present the highlight colour drawn depends on whether the grid | |
1888 | window loses focus before drawing begins. | |
1889 | */ | |
1890 | wxGRID_DRAW_SELECTION = 0x010, | |
1891 | ||
1892 | /** | |
1893 | The default render style. | |
1894 | ||
1895 | Includes all except wxGRID_DRAW_SELECTION. | |
1896 | */ | |
1897 | wxGRID_DRAW_DEFAULT = wxGRID_DRAW_ROWS_HEADER | | |
1898 | wxGRID_DRAW_COLS_HEADER | | |
1899 | wxGRID_DRAW_CELL_LINES | | |
1900 | wxGRID_DRAW_BOX_RECT | |
1901 | }; | |
1902 | ||
1903 | ||
1904 | ||
1905 | /** | |
1906 | @class wxGrid | |
1907 | ||
1908 | wxGrid and its related classes are used for displaying and editing tabular | |
1909 | data. They provide a rich set of features for display, editing, and | |
1910 | interacting with a variety of data sources. For simple applications, and to | |
1911 | help you get started, wxGrid is the only class you need to refer to | |
1912 | directly. It will set up default instances of the other classes and manage | |
1913 | them for you. For more complex applications you can derive your own classes | |
1914 | for custom grid views, grid data tables, cell editors and renderers. The | |
1915 | @ref overview_grid has examples of simple and more complex applications, | |
1916 | explains the relationship between the various grid classes and has a | |
1917 | summary of the keyboard shortcuts and mouse functions provided by wxGrid. | |
1918 | ||
1919 | A wxGridTableBase class holds the actual data to be displayed by a wxGrid | |
1920 | class. One or more wxGrid classes may act as a view for one table class. | |
1921 | The default table class is called wxGridStringTable and holds an array of | |
1922 | strings. An instance of such a class is created by CreateGrid(). | |
1923 | ||
1924 | wxGridCellRenderer is the abstract base class for rendering contents in a | |
1925 | cell. The following renderers are predefined: | |
1926 | ||
1927 | - wxGridCellBoolRenderer | |
1928 | - wxGridCellFloatRenderer | |
1929 | - wxGridCellNumberRenderer | |
1930 | - wxGridCellStringRenderer | |
1931 | ||
1932 | The look of a cell can be further defined using wxGridCellAttr. An object | |
1933 | of this type may be returned by wxGridTableBase::GetAttr(). | |
1934 | ||
1935 | wxGridCellEditor is the abstract base class for editing the value of a | |
1936 | cell. The following editors are predefined: | |
1937 | ||
1938 | - wxGridCellBoolEditor | |
1939 | - wxGridCellChoiceEditor | |
1940 | - wxGridCellFloatEditor | |
1941 | - wxGridCellNumberEditor | |
1942 | - wxGridCellTextEditor | |
1943 | ||
1944 | Please see wxGridEvent, wxGridSizeEvent, wxGridRangeSelectEvent, and | |
1945 | wxGridEditorCreatedEvent for the documentation of all event types you can | |
1946 | use with wxGrid. | |
1947 | ||
1948 | @library{wxadv} | |
1949 | @category{grid} | |
1950 | ||
1951 | @see @ref overview_grid, wxGridUpdateLocker | |
1952 | */ | |
1953 | class wxGrid : public wxScrolledWindow | |
1954 | { | |
1955 | public: | |
1956 | ||
1957 | /** | |
1958 | Different selection modes supported by the grid. | |
1959 | */ | |
1960 | enum wxGridSelectionModes | |
1961 | { | |
1962 | /** | |
1963 | The default selection mode allowing selection of the individual | |
1964 | cells as well as of the entire rows and columns. | |
1965 | */ | |
1966 | wxGridSelectCells, | |
1967 | ||
1968 | /** | |
1969 | The selection mode allowing the selection of the entire rows only. | |
1970 | ||
1971 | The user won't be able to select any cells or columns in this mode. | |
1972 | */ | |
1973 | wxGridSelectRows, | |
1974 | ||
1975 | /** | |
1976 | The selection mode allowing the selection of the entire columns only. | |
1977 | ||
1978 | The user won't be able to select any cells or rows in this mode. | |
1979 | */ | |
1980 | wxGridSelectColumns, | |
1981 | ||
1982 | /** | |
1983 | The selection mode allowing the user to select either the entire | |
1984 | columns or the entire rows but not individual cells nor blocks. | |
1985 | ||
1986 | Notice that while this constant is defined as @code | |
1987 | wxGridSelectColumns | wxGridSelectRows @endcode this doesn't mean | |
1988 | that all the other combinations are valid -- at least currently | |
1989 | they are not. | |
1990 | ||
1991 | @since 2.9.1 | |
1992 | */ | |
1993 | wxGridSelectRowsOrColumns | |
1994 | }; | |
1995 | ||
1996 | /** | |
1997 | Return values for GetCellSize(). | |
1998 | ||
1999 | @since 2.9.1 | |
2000 | */ | |
2001 | enum CellSpan | |
2002 | { | |
2003 | /// This cell is inside a span covered by another cell. | |
2004 | CellSpan_Inside = -1, | |
2005 | ||
2006 | /// This is a normal, non-spanning cell. | |
2007 | CellSpan_None = 0, | |
2008 | ||
2009 | /// This cell spans several physical wxGrid cells. | |
2010 | CellSpan_Main | |
2011 | }; | |
2012 | ||
2013 | /** | |
2014 | Constants defining different support built-in TAB handling behaviours. | |
2015 | ||
2016 | The elements of this enum determine what happens when TAB is pressed | |
2017 | when the cursor is in the rightmost column (or Shift-TAB is pressed | |
2018 | when the cursor is in the leftmost one). | |
2019 | ||
2020 | @see SetTabBehaviour(), @c wxEVT_GRID_TABBING | |
2021 | ||
2022 | @since 2.9.5 | |
2023 | */ | |
2024 | enum TabBehaviour | |
2025 | { | |
2026 | /// Do nothing, this is default. | |
2027 | Tab_Stop, | |
2028 | ||
2029 | /// Move to the beginning of the next (or the end of the previous) row. | |
2030 | Tab_Wrap, | |
2031 | ||
2032 | /// Move to the next (or the previous) control after the grid. | |
2033 | Tab_Leave | |
2034 | }; | |
2035 | ||
2036 | /** | |
2037 | @name Constructors and Initialization | |
2038 | */ | |
2039 | //@{ | |
2040 | ||
2041 | /** | |
2042 | Default constructor. | |
2043 | ||
2044 | You must call Create() to really create the grid window and also call | |
2045 | CreateGrid() or SetTable() to initialize the grid contents. | |
2046 | */ | |
2047 | wxGrid(); | |
2048 | /** | |
2049 | Constructor creating the grid window. | |
2050 | ||
2051 | You must call either CreateGrid() or SetTable() to initialize the grid | |
2052 | contents before using it. | |
2053 | */ | |
2054 | wxGrid(wxWindow* parent, wxWindowID id, | |
2055 | const wxPoint& pos = wxDefaultPosition, | |
2056 | const wxSize& size = wxDefaultSize, | |
2057 | long style = wxWANTS_CHARS, | |
2058 | const wxString& name = wxGridNameStr); | |
2059 | ||
2060 | /** | |
2061 | Destructor. | |
2062 | ||
2063 | This will also destroy the associated grid table unless you passed a | |
2064 | table object to the grid and specified that the grid should not take | |
2065 | ownership of the table (see SetTable()). | |
2066 | */ | |
2067 | virtual ~wxGrid(); | |
2068 | ||
2069 | /** | |
2070 | Creates the grid window for an object initialized using the default | |
2071 | constructor. | |
2072 | ||
2073 | You must call either CreateGrid() or SetTable() to initialize the grid | |
2074 | contents before using it. | |
2075 | */ | |
2076 | bool Create(wxWindow* parent, wxWindowID id, | |
2077 | const wxPoint& pos = wxDefaultPosition, | |
2078 | const wxSize& size = wxDefaultSize, | |
2079 | long style = wxWANTS_CHARS, | |
2080 | const wxString& name = wxGridNameStr); | |
2081 | ||
2082 | /** | |
2083 | Creates a grid with the specified initial number of rows and columns. | |
2084 | ||
2085 | Call this directly after the grid constructor. When you use this | |
2086 | function wxGrid will create and manage a simple table of string values | |
2087 | for you. All of the grid data will be stored in memory. | |
2088 | ||
2089 | For applications with more complex data types or relationships, or for | |
2090 | dealing with very large datasets, you should derive your own grid table | |
2091 | class and pass a table object to the grid with SetTable(). | |
2092 | */ | |
2093 | bool CreateGrid(int numRows, int numCols, | |
2094 | wxGridSelectionModes selmode = wxGridSelectCells); | |
2095 | ||
2096 | /** | |
2097 | Passes a pointer to a custom grid table to be used by the grid. | |
2098 | ||
2099 | This should be called after the grid constructor and before using the | |
2100 | grid object. If @a takeOwnership is set to @true then the table will be | |
2101 | deleted by the wxGrid destructor. | |
2102 | ||
2103 | Use this function instead of CreateGrid() when your application | |
2104 | involves complex or non-string data or data sets that are too large to | |
2105 | fit wholly in memory. | |
2106 | */ | |
2107 | bool SetTable(wxGridTableBase* table, bool takeOwnership = false, | |
2108 | wxGridSelectionModes selmode = wxGridSelectCells); | |
2109 | ||
2110 | /** | |
2111 | Receive and handle a message from the table. | |
2112 | */ | |
2113 | bool ProcessTableMessage(wxGridTableMessage& msg); | |
2114 | ||
2115 | //@} | |
2116 | ||
2117 | ||
2118 | /** | |
2119 | @name Grid Line Formatting | |
2120 | */ | |
2121 | //@{ | |
2122 | ||
2123 | /** | |
2124 | Turns the drawing of grid lines on or off. | |
2125 | */ | |
2126 | void EnableGridLines(bool enable = true); | |
2127 | ||
2128 | /** | |
2129 | Returns the pen used for vertical grid lines. | |
2130 | ||
2131 | This virtual function may be overridden in derived classes in order to | |
2132 | change the appearance of individual grid lines for the given column | |
2133 | @a col. | |
2134 | ||
2135 | See GetRowGridLinePen() for an example. | |
2136 | */ | |
2137 | virtual wxPen GetColGridLinePen(int col); | |
2138 | ||
2139 | /** | |
2140 | Returns the pen used for grid lines. | |
2141 | ||
2142 | This virtual function may be overridden in derived classes in order to | |
2143 | change the appearance of grid lines. Note that currently the pen width | |
2144 | must be 1. | |
2145 | ||
2146 | @see GetColGridLinePen(), GetRowGridLinePen() | |
2147 | */ | |
2148 | virtual wxPen GetDefaultGridLinePen(); | |
2149 | ||
2150 | /** | |
2151 | Returns the colour used for grid lines. | |
2152 | ||
2153 | @see GetDefaultGridLinePen() | |
2154 | */ | |
2155 | wxColour GetGridLineColour() const; | |
2156 | ||
2157 | /** | |
2158 | Returns the pen used for horizontal grid lines. | |
2159 | ||
2160 | This virtual function may be overridden in derived classes in order to | |
2161 | change the appearance of individual grid line for the given @a row. | |
2162 | ||
2163 | Example: | |
2164 | @code | |
2165 | // in a grid displaying music notation, use a solid black pen between | |
2166 | // octaves (C0=row 127, C1=row 115 etc.) | |
2167 | wxPen MidiGrid::GetRowGridLinePen(int row) | |
2168 | { | |
2169 | if ( row % 12 == 7 ) | |
2170 | return wxPen(*wxBLACK, 1, wxSOLID); | |
2171 | else | |
2172 | return GetDefaultGridLinePen(); | |
2173 | } | |
2174 | @endcode | |
2175 | */ | |
2176 | virtual wxPen GetRowGridLinePen(int row); | |
2177 | ||
2178 | /** | |
2179 | Returns @true if drawing of grid lines is turned on, @false otherwise. | |
2180 | */ | |
2181 | bool GridLinesEnabled() const; | |
2182 | ||
2183 | /** | |
2184 | Sets the colour used to draw grid lines. | |
2185 | */ | |
2186 | void SetGridLineColour(const wxColour& colour); | |
2187 | ||
2188 | //@} | |
2189 | ||
2190 | ||
2191 | /** | |
2192 | @name Label Values and Formatting | |
2193 | */ | |
2194 | //@{ | |
2195 | ||
2196 | /** | |
2197 | Sets the arguments to the current column label alignment values. | |
2198 | ||
2199 | Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE | |
2200 | or @c wxALIGN_RIGHT. | |
2201 | ||
2202 | Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or | |
2203 | @c wxALIGN_BOTTOM. | |
2204 | */ | |
2205 | void GetColLabelAlignment(int* horiz, int* vert) const; | |
2206 | ||
2207 | /** | |
2208 | Returns the orientation of the column labels (either @c wxHORIZONTAL or | |
2209 | @c wxVERTICAL). | |
2210 | */ | |
2211 | int GetColLabelTextOrientation() const; | |
2212 | ||
2213 | /** | |
2214 | Returns the specified column label. | |
2215 | ||
2216 | The default grid table class provides column labels of the form | |
2217 | A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can | |
2218 | override wxGridTableBase::GetColLabelValue() to provide your own | |
2219 | labels. | |
2220 | */ | |
2221 | wxString GetColLabelValue(int col) const; | |
2222 | ||
2223 | /** | |
2224 | Returns the colour used for the background of row and column labels. | |
2225 | */ | |
2226 | wxColour GetLabelBackgroundColour() const; | |
2227 | ||
2228 | /** | |
2229 | Returns the font used for row and column labels. | |
2230 | */ | |
2231 | wxFont GetLabelFont() const; | |
2232 | ||
2233 | /** | |
2234 | Returns the colour used for row and column label text. | |
2235 | */ | |
2236 | wxColour GetLabelTextColour() const; | |
2237 | ||
2238 | /** | |
2239 | Returns the alignment used for row labels. | |
2240 | ||
2241 | Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE | |
2242 | or @c wxALIGN_RIGHT. | |
2243 | ||
2244 | Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or | |
2245 | @c wxALIGN_BOTTOM. | |
2246 | */ | |
2247 | void GetRowLabelAlignment(int* horiz, int* vert) const; | |
2248 | ||
2249 | /** | |
2250 | Returns the specified row label. | |
2251 | ||
2252 | The default grid table class provides numeric row labels. If you are | |
2253 | using a custom grid table you can override | |
2254 | wxGridTableBase::GetRowLabelValue() to provide your own labels. | |
2255 | */ | |
2256 | wxString GetRowLabelValue(int row) const; | |
2257 | ||
2258 | /** | |
2259 | Hides the column labels by calling SetColLabelSize() with a size of 0. | |
2260 | Show labels again by calling that method with a width greater than 0. | |
2261 | */ | |
2262 | void HideColLabels(); | |
2263 | ||
2264 | /** | |
2265 | Hides the row labels by calling SetRowLabelSize() with a size of 0. | |
2266 | ||
2267 | The labels can be shown again by calling SetRowLabelSize() with a width | |
2268 | greater than 0. | |
2269 | */ | |
2270 | void HideRowLabels(); | |
2271 | ||
2272 | /** | |
2273 | Sets the horizontal and vertical alignment of column label text. | |
2274 | ||
2275 | Horizontal alignment should be one of @c wxALIGN_LEFT, | |
2276 | @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one | |
2277 | of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM. | |
2278 | */ | |
2279 | void SetColLabelAlignment(int horiz, int vert); | |
2280 | ||
2281 | /** | |
2282 | Sets the orientation of the column labels (either @c wxHORIZONTAL or | |
2283 | @c wxVERTICAL). | |
2284 | */ | |
2285 | void SetColLabelTextOrientation(int textOrientation); | |
2286 | ||
2287 | /** | |
2288 | Set the value for the given column label. | |
2289 | ||
2290 | If you are using a custom grid table you must override | |
2291 | wxGridTableBase::SetColLabelValue() for this to have any effect. | |
2292 | */ | |
2293 | void SetColLabelValue(int col, const wxString& value); | |
2294 | ||
2295 | /** | |
2296 | Sets the background colour for row and column labels. | |
2297 | */ | |
2298 | void SetLabelBackgroundColour(const wxColour& colour); | |
2299 | ||
2300 | /** | |
2301 | Sets the font for row and column labels. | |
2302 | */ | |
2303 | void SetLabelFont(const wxFont& font); | |
2304 | ||
2305 | /** | |
2306 | Sets the colour for row and column label text. | |
2307 | */ | |
2308 | void SetLabelTextColour(const wxColour& colour); | |
2309 | ||
2310 | /** | |
2311 | Sets the horizontal and vertical alignment of row label text. | |
2312 | ||
2313 | Horizontal alignment should be one of @c wxALIGN_LEFT, | |
2314 | @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one | |
2315 | of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM. | |
2316 | */ | |
2317 | void SetRowLabelAlignment(int horiz, int vert); | |
2318 | ||
2319 | /** | |
2320 | Sets the value for the given row label. | |
2321 | ||
2322 | If you are using a derived grid table you must override | |
2323 | wxGridTableBase::SetRowLabelValue() for this to have any effect. | |
2324 | */ | |
2325 | void SetRowLabelValue(int row, const wxString& value); | |
2326 | ||
2327 | /** | |
2328 | Call this in order to make the column labels use a native look by using | |
2329 | wxRendererNative::DrawHeaderButton() internally. | |
2330 | ||
2331 | There is no equivalent method for drawing row columns as there is not | |
2332 | native look for that. This option is useful when using wxGrid for | |
2333 | displaying tables and not as a spread-sheet. | |
2334 | ||
2335 | @see UseNativeColHeader() | |
2336 | */ | |
2337 | void SetUseNativeColLabels(bool native = true); | |
2338 | ||
2339 | /** | |
2340 | Enable the use of native header window for column labels. | |
2341 | ||
2342 | If this function is called with @true argument, a wxHeaderCtrl is used | |
2343 | instead to display the column labels instead of drawing them in wxGrid | |
2344 | code itself. This has the advantage of making the grid look and feel | |
2345 | perfectly the same as native applications (using SetUseNativeColLabels() | |
2346 | the grid can be made to look more natively but it still doesn't feel | |
2347 | natively, notably the column resizing and dragging still works slightly | |
2348 | differently as it is implemented in wxWidgets itself) but results in | |
2349 | different behaviour for column and row headers, for which there is no | |
2350 | equivalent function, and, most importantly, is unsuitable for grids | |
2351 | with huge numbers of columns as wxHeaderCtrl doesn't support virtual | |
2352 | mode. Because of this, by default the grid does not use the native | |
2353 | header control but you should call this function to enable it if you | |
2354 | are using the grid to display tabular data and don't have thousands of | |
2355 | columns in it. | |
2356 | ||
2357 | Another difference between the default behaviour and the native header | |
2358 | behaviour is that the latter provides the user with a context menu | |
2359 | (which appears on right clicking the header) allowing to rearrange the | |
2360 | grid columns if CanDragColMove() returns @true. If you want to prevent | |
2361 | this from happening for some reason, you need to define a handler for | |
2362 | @c wxEVT_GRID_LABEL_RIGHT_CLICK event which simply does nothing (in | |
2363 | particular doesn't skip the event) as this will prevent the default | |
2364 | right click handling from working. | |
2365 | ||
2366 | Also note that currently @c wxEVT_GRID_LABEL_RIGHT_DCLICK event is not | |
2367 | generated for the column labels if the native columns header is used | |
2368 | (but this limitation could possibly be lifted in the future). | |
2369 | */ | |
2370 | void UseNativeColHeader(bool native = true); | |
2371 | ||
2372 | //@} | |
2373 | ||
2374 | ||
2375 | /** | |
2376 | @name Cell Formatting | |
2377 | ||
2378 | Note that wxGridCellAttr can be used alternatively to most of these | |
2379 | methods. See the "Attributes Management" of wxGridTableBase. | |
2380 | */ | |
2381 | //@{ | |
2382 | ||
2383 | /** | |
2384 | Sets the arguments to the horizontal and vertical text alignment values | |
2385 | for the grid cell at the specified location. | |
2386 | ||
2387 | Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE | |
2388 | or @c wxALIGN_RIGHT. | |
2389 | ||
2390 | Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or | |
2391 | @c wxALIGN_BOTTOM. | |
2392 | */ | |
2393 | void GetCellAlignment(int row, int col, int* horiz, int* vert) const; | |
2394 | ||
2395 | /** | |
2396 | Returns the background colour of the cell at the specified location. | |
2397 | */ | |
2398 | wxColour GetCellBackgroundColour(int row, int col) const; | |
2399 | ||
2400 | /** | |
2401 | Returns the font for text in the grid cell at the specified location. | |
2402 | */ | |
2403 | wxFont GetCellFont(int row, int col) const; | |
2404 | ||
2405 | /** | |
2406 | Returns the text colour for the grid cell at the specified location. | |
2407 | */ | |
2408 | wxColour GetCellTextColour(int row, int col) const; | |
2409 | ||
2410 | /** | |
2411 | Returns the default cell alignment. | |
2412 | ||
2413 | Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE | |
2414 | or @c wxALIGN_RIGHT. | |
2415 | ||
2416 | Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or | |
2417 | @c wxALIGN_BOTTOM. | |
2418 | ||
2419 | @see SetDefaultCellAlignment() | |
2420 | */ | |
2421 | void GetDefaultCellAlignment(int* horiz, int* vert) const; | |
2422 | ||
2423 | /** | |
2424 | Returns the current default background colour for grid cells. | |
2425 | */ | |
2426 | wxColour GetDefaultCellBackgroundColour() const; | |
2427 | ||
2428 | /** | |
2429 | Returns the current default font for grid cell text. | |
2430 | */ | |
2431 | wxFont GetDefaultCellFont() const; | |
2432 | ||
2433 | /** | |
2434 | Returns the current default colour for grid cell text. | |
2435 | */ | |
2436 | wxColour GetDefaultCellTextColour() const; | |
2437 | ||
2438 | /** | |
2439 | Sets the horizontal and vertical alignment for grid cell text at the | |
2440 | specified location. | |
2441 | ||
2442 | Horizontal alignment should be one of @c wxALIGN_LEFT, | |
2443 | @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. | |
2444 | ||
2445 | Vertical alignment should be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE | |
2446 | or @c wxALIGN_BOTTOM. | |
2447 | */ | |
2448 | void SetCellAlignment(int row, int col, int horiz, int vert); | |
2449 | /** | |
2450 | Sets the horizontal and vertical alignment for grid cell text at the | |
2451 | specified location. | |
2452 | ||
2453 | Horizontal alignment should be one of @c wxALIGN_LEFT, | |
2454 | @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. | |
2455 | ||
2456 | Vertical alignment should be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE | |
2457 | or @c wxALIGN_BOTTOM. | |
2458 | */ | |
2459 | void SetCellAlignment(int align, int row, int col); | |
2460 | ||
2461 | /** | |
2462 | Set the background colour for the given cell or all cells by default. | |
2463 | */ | |
2464 | void SetCellBackgroundColour(int row, int col, const wxColour& colour); | |
2465 | ||
2466 | /** | |
2467 | Sets the font for text in the grid cell at the specified location. | |
2468 | */ | |
2469 | void SetCellFont(int row, int col, const wxFont& font); | |
2470 | ||
2471 | /** | |
2472 | Sets the text colour for the given cell. | |
2473 | */ | |
2474 | void SetCellTextColour(int row, int col, const wxColour& colour); | |
2475 | /** | |
2476 | Sets the text colour for the given cell. | |
2477 | */ | |
2478 | void SetCellTextColour(const wxColour& val, int row, int col); | |
2479 | /** | |
2480 | Sets the text colour for all cells by default. | |
2481 | */ | |
2482 | void SetCellTextColour(const wxColour& colour); | |
2483 | ||
2484 | /** | |
2485 | Sets the default horizontal and vertical alignment for grid cell text. | |
2486 | ||
2487 | Horizontal alignment should be one of @c wxALIGN_LEFT, | |
2488 | @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one | |
2489 | of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM. | |
2490 | */ | |
2491 | void SetDefaultCellAlignment(int horiz, int vert); | |
2492 | ||
2493 | /** | |
2494 | Sets the default background colour for grid cells. | |
2495 | */ | |
2496 | void SetDefaultCellBackgroundColour(const wxColour& colour); | |
2497 | ||
2498 | /** | |
2499 | Sets the default font to be used for grid cell text. | |
2500 | */ | |
2501 | void SetDefaultCellFont(const wxFont& font); | |
2502 | ||
2503 | /** | |
2504 | Sets the current default colour for grid cell text. | |
2505 | */ | |
2506 | void SetDefaultCellTextColour(const wxColour& colour); | |
2507 | ||
2508 | //@} | |
2509 | ||
2510 | ||
2511 | /** | |
2512 | @name Cell Values, Editors, and Renderers | |
2513 | ||
2514 | Note that wxGridCellAttr can be used alternatively to most of these | |
2515 | methods. See the "Attributes Management" of wxGridTableBase. | |
2516 | */ | |
2517 | //@{ | |
2518 | ||
2519 | /** | |
2520 | Returns @true if the in-place edit control for the current grid cell | |
2521 | can be used and @false otherwise. | |
2522 | ||
2523 | This function always returns @false for the read-only cells. | |
2524 | */ | |
2525 | bool CanEnableCellControl() const; | |
2526 | ||
2527 | /** | |
2528 | Disables in-place editing of grid cells. | |
2529 | ||
2530 | Equivalent to calling EnableCellEditControl(@false). | |
2531 | */ | |
2532 | void DisableCellEditControl(); | |
2533 | ||
2534 | /** | |
2535 | Enables or disables in-place editing of grid cell data. | |
2536 | ||
2537 | The grid will issue either a @c wxEVT_GRID_EDITOR_SHOWN or | |
2538 | @c wxEVT_GRID_EDITOR_HIDDEN event. | |
2539 | */ | |
2540 | void EnableCellEditControl(bool enable = true); | |
2541 | ||
2542 | /** | |
2543 | Makes the grid globally editable or read-only. | |
2544 | ||
2545 | If the edit argument is @false this function sets the whole grid as | |
2546 | read-only. If the argument is @true the grid is set to the default | |
2547 | state where cells may be editable. In the default state you can set | |
2548 | single grid cells and whole rows and columns to be editable or | |
2549 | read-only via wxGridCellAttr::SetReadOnly(). For single cells you | |
2550 | can also use the shortcut function SetReadOnly(). | |
2551 | ||
2552 | For more information about controlling grid cell attributes see the | |
2553 | wxGridCellAttr class and the @ref overview_grid. | |
2554 | */ | |
2555 | void EnableEditing(bool edit); | |
2556 | ||
2557 | /** | |
2558 | Returns a pointer to the editor for the cell at the specified location. | |
2559 | ||
2560 | See wxGridCellEditor and the @ref overview_grid for more information | |
2561 | about cell editors and renderers. | |
2562 | ||
2563 | The caller must call DecRef() on the returned pointer. | |
2564 | */ | |
2565 | wxGridCellEditor* GetCellEditor(int row, int col) const; | |
2566 | ||
2567 | /** | |
2568 | Returns a pointer to the renderer for the grid cell at the specified | |
2569 | location. | |
2570 | ||
2571 | See wxGridCellRenderer and the @ref overview_grid for more information | |
2572 | about cell editors and renderers. | |
2573 | ||
2574 | The caller must call DecRef() on the returned pointer. | |
2575 | */ | |
2576 | wxGridCellRenderer* GetCellRenderer(int row, int col) const; | |
2577 | ||
2578 | /** | |
2579 | Returns the string contained in the cell at the specified location. | |
2580 | ||
2581 | For simple applications where a grid object automatically uses a | |
2582 | default grid table of string values you use this function together with | |
2583 | SetCellValue() to access cell values. For more complex applications | |
2584 | where you have derived your own grid table class that contains various | |
2585 | data types (e.g. numeric, boolean or user-defined custom types) then | |
2586 | you only use this function for those cells that contain string values. | |
2587 | ||
2588 | See wxGridTableBase::CanGetValueAs() and the @ref overview_grid for | |
2589 | more information. | |
2590 | */ | |
2591 | wxString GetCellValue(int row, int col) const; | |
2592 | /** | |
2593 | Returns the string contained in the cell at the specified location. | |
2594 | ||
2595 | For simple applications where a grid object automatically uses a | |
2596 | default grid table of string values you use this function together with | |
2597 | SetCellValue() to access cell values. For more complex applications | |
2598 | where you have derived your own grid table class that contains various | |
2599 | data types (e.g. numeric, boolean or user-defined custom types) then | |
2600 | you only use this function for those cells that contain string values. | |
2601 | ||
2602 | See wxGridTableBase::CanGetValueAs() and the @ref overview_grid for | |
2603 | more information. | |
2604 | */ | |
2605 | wxString GetCellValue(const wxGridCellCoords& coords) const; | |
2606 | ||
2607 | /** | |
2608 | Returns a pointer to the current default grid cell editor. | |
2609 | ||
2610 | See wxGridCellEditor and the @ref overview_grid for more information | |
2611 | about cell editors and renderers. | |
2612 | */ | |
2613 | wxGridCellEditor* GetDefaultEditor() const; | |
2614 | ||
2615 | /** | |
2616 | Returns the default editor for the specified cell. | |
2617 | ||
2618 | The base class version returns the editor appropriate for the current | |
2619 | cell type but this method may be overridden in the derived classes to | |
2620 | use custom editors for some cells by default. | |
2621 | ||
2622 | Notice that the same may be achieved in a usually simpler way by | |
2623 | associating a custom editor with the given cell or cells. | |
2624 | ||
2625 | The caller must call DecRef() on the returned pointer. | |
2626 | */ | |
2627 | virtual wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; | |
2628 | /** | |
2629 | Returns the default editor for the specified cell. | |
2630 | ||
2631 | The base class version returns the editor appropriate for the current | |
2632 | cell type but this method may be overridden in the derived classes to | |
2633 | use custom editors for some cells by default. | |
2634 | ||
2635 | Notice that the same may be achieved in a usually simpler way by | |
2636 | associating a custom editor with the given cell or cells. | |
2637 | ||
2638 | The caller must call DecRef() on the returned pointer. | |
2639 | */ | |
2640 | wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const; | |
2641 | ||
2642 | /** | |
2643 | Returns the default editor for the cells containing values of the given | |
2644 | type. | |
2645 | ||
2646 | The base class version returns the editor which was associated with the | |
2647 | specified @a typeName when it was registered RegisterDataType() but | |
2648 | this function may be overridden to return something different. This | |
2649 | allows to override an editor used for one of the standard types. | |
2650 | ||
2651 | The caller must call DecRef() on the returned pointer. | |
2652 | */ | |
2653 | virtual wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; | |
2654 | ||
2655 | /** | |
2656 | Returns a pointer to the current default grid cell renderer. | |
2657 | ||
2658 | See wxGridCellRenderer and the @ref overview_grid for more information | |
2659 | about cell editors and renderers. | |
2660 | ||
2661 | The caller must call DecRef() on the returned pointer. | |
2662 | */ | |
2663 | wxGridCellRenderer* GetDefaultRenderer() const; | |
2664 | ||
2665 | /** | |
2666 | Returns the default renderer for the given cell. | |
2667 | ||
2668 | The base class version returns the renderer appropriate for the current | |
2669 | cell type but this method may be overridden in the derived classes to | |
2670 | use custom renderers for some cells by default. | |
2671 | ||
2672 | The caller must call DecRef() on the returned pointer. | |
2673 | */ | |
2674 | virtual wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; | |
2675 | ||
2676 | /** | |
2677 | Returns the default renderer for the cell containing values of the | |
2678 | given type. | |
2679 | ||
2680 | @see GetDefaultEditorForType() | |
2681 | */ | |
2682 | virtual wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; | |
2683 | ||
2684 | /** | |
2685 | Hides the in-place cell edit control. | |
2686 | */ | |
2687 | void HideCellEditControl(); | |
2688 | ||
2689 | /** | |
2690 | Returns @true if the in-place edit control is currently enabled. | |
2691 | */ | |
2692 | bool IsCellEditControlEnabled() const; | |
2693 | ||
2694 | /** | |
2695 | Returns @true if the current cell is read-only. | |
2696 | ||
2697 | @see SetReadOnly(), IsReadOnly() | |
2698 | */ | |
2699 | bool IsCurrentCellReadOnly() const; | |
2700 | ||
2701 | /** | |
2702 | Returns @false if the whole grid has been set as read-only or @true | |
2703 | otherwise. | |
2704 | ||
2705 | See EnableEditing() for more information about controlling the editing | |
2706 | status of grid cells. | |
2707 | */ | |
2708 | bool IsEditable() const; | |
2709 | ||
2710 | /** | |
2711 | Returns @true if the cell at the specified location can't be edited. | |
2712 | ||
2713 | @see SetReadOnly(), IsCurrentCellReadOnly() | |
2714 | */ | |
2715 | bool IsReadOnly(int row, int col) const; | |
2716 | ||
2717 | /** | |
2718 | Register a new data type. | |
2719 | ||
2720 | The data types allow to naturally associate specific renderers and | |
2721 | editors to the cells containing values of the given type. For example, | |
2722 | the grid automatically registers a data type with the name | |
2723 | @c wxGRID_VALUE_STRING which uses wxGridCellStringRenderer and | |
2724 | wxGridCellTextEditor as its renderer and editor respectively -- this is | |
2725 | the data type used by all the cells of the default wxGridStringTable, | |
2726 | so this renderer and editor are used by default for all grid cells. | |
2727 | ||
2728 | However if a custom table returns @c wxGRID_VALUE_BOOL from its | |
2729 | wxGridTableBase::GetTypeName() method, then wxGridCellBoolRenderer and | |
2730 | wxGridCellBoolEditor are used for it because the grid also registers a | |
2731 | boolean data type with this name. | |
2732 | ||
2733 | And as this mechanism is completely generic, you may register your own | |
2734 | data types using your own custom renderers and editors. Just remember | |
2735 | that the table must identify a cell as being of the given type for them | |
2736 | to be used for this cell. | |
2737 | ||
2738 | @param typeName | |
2739 | Name of the new type. May be any string, but if the type name is | |
2740 | the same as the name of an already registered type, including one | |
2741 | of the standard ones (which are @c wxGRID_VALUE_STRING, @c | |
2742 | wxGRID_VALUE_BOOL, @c wxGRID_VALUE_NUMBER, @c wxGRID_VALUE_FLOAT | |
2743 | and @c wxGRID_VALUE_CHOICE), then the new registration information | |
2744 | replaces the previously used renderer and editor. | |
2745 | @param renderer | |
2746 | The renderer to use for the cells of this type. Its ownership is | |
2747 | taken by the grid, i.e. it will call DecRef() on this pointer when | |
2748 | it doesn't need it any longer. | |
2749 | @param editor | |
2750 | The editor to use for the cells of this type. Its ownership is also | |
2751 | taken by the grid. | |
2752 | */ | |
2753 | void RegisterDataType(const wxString& typeName, | |
2754 | wxGridCellRenderer* renderer, | |
2755 | wxGridCellEditor* editor); | |
2756 | ||
2757 | /** | |
2758 | Sets the value of the current grid cell to the current in-place edit | |
2759 | control value. | |
2760 | ||
2761 | This is called automatically when the grid cursor moves from the | |
2762 | current cell to a new cell. It is also a good idea to call this | |
2763 | function when closing a grid since any edits to the final cell location | |
2764 | will not be saved otherwise. | |
2765 | */ | |
2766 | void SaveEditControlValue(); | |
2767 | ||
2768 | /** | |
2769 | Sets the editor for the grid cell at the specified location. | |
2770 | ||
2771 | The grid will take ownership of the pointer. | |
2772 | ||
2773 | See wxGridCellEditor and the @ref overview_grid for more information | |
2774 | about cell editors and renderers. | |
2775 | */ | |
2776 | void SetCellEditor(int row, int col, wxGridCellEditor* editor); | |
2777 | ||
2778 | /** | |
2779 | Sets the renderer for the grid cell at the specified location. | |
2780 | ||
2781 | The grid will take ownership of the pointer. | |
2782 | ||
2783 | See wxGridCellRenderer and the @ref overview_grid for more information | |
2784 | about cell editors and renderers. | |
2785 | */ | |
2786 | void SetCellRenderer(int row, int col, wxGridCellRenderer* renderer); | |
2787 | ||
2788 | /** | |
2789 | Sets the string value for the cell at the specified location. | |
2790 | ||
2791 | For simple applications where a grid object automatically uses a | |
2792 | default grid table of string values you use this function together with | |
2793 | GetCellValue() to access cell values. For more complex applications | |
2794 | where you have derived your own grid table class that contains various | |
2795 | data types (e.g. numeric, boolean or user-defined custom types) then | |
2796 | you only use this function for those cells that contain string values. | |
2797 | ||
2798 | See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for | |
2799 | more information. | |
2800 | */ | |
2801 | void SetCellValue(int row, int col, const wxString& s); | |
2802 | /** | |
2803 | Sets the string value for the cell at the specified location. | |
2804 | ||
2805 | For simple applications where a grid object automatically uses a | |
2806 | default grid table of string values you use this function together with | |
2807 | GetCellValue() to access cell values. For more complex applications | |
2808 | where you have derived your own grid table class that contains various | |
2809 | data types (e.g. numeric, boolean or user-defined custom types) then | |
2810 | you only use this function for those cells that contain string values. | |
2811 | ||
2812 | See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for | |
2813 | more information. | |
2814 | */ | |
2815 | void SetCellValue(const wxGridCellCoords& coords, const wxString& s); | |
2816 | /** | |
2817 | @deprecated Please use SetCellValue(int,int,const wxString&) or | |
2818 | SetCellValue(const wxGridCellCoords&,const wxString&) | |
2819 | instead. | |
2820 | ||
2821 | Sets the string value for the cell at the specified location. | |
2822 | ||
2823 | For simple applications where a grid object automatically uses a | |
2824 | default grid table of string values you use this function together with | |
2825 | GetCellValue() to access cell values. For more complex applications | |
2826 | where you have derived your own grid table class that contains various | |
2827 | data types (e.g. numeric, boolean or user-defined custom types) then | |
2828 | you only use this function for those cells that contain string values. | |
2829 | ||
2830 | See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for | |
2831 | more information. | |
2832 | */ | |
2833 | void SetCellValue(const wxString& val, int row, int col); | |
2834 | ||
2835 | /** | |
2836 | Sets the specified column to display boolean values. | |
2837 | ||
2838 | @see SetColFormatCustom() | |
2839 | */ | |
2840 | void SetColFormatBool(int col); | |
2841 | ||
2842 | /** | |
2843 | Sets the specified column to display data in a custom format. | |
2844 | ||
2845 | This method provides an alternative to defining a custom grid table | |
2846 | which would return @a typeName from its GetTypeName() method for the | |
2847 | cells in this column: while it doesn't really change the type of the | |
2848 | cells in this column, it does associate the renderer and editor used | |
2849 | for the cells of the specified type with them. | |
2850 | ||
2851 | See the @ref overview_grid for more information on working with custom | |
2852 | data types. | |
2853 | */ | |
2854 | void SetColFormatCustom(int col, const wxString& typeName); | |
2855 | ||
2856 | /** | |
2857 | Sets the specified column to display floating point values with the | |
2858 | given width and precision. | |
2859 | ||
2860 | @see SetColFormatCustom() | |
2861 | */ | |
2862 | void SetColFormatFloat(int col, int width = -1, int precision = -1); | |
2863 | ||
2864 | /** | |
2865 | Sets the specified column to display integer values. | |
2866 | ||
2867 | @see SetColFormatCustom() | |
2868 | */ | |
2869 | void SetColFormatNumber(int col); | |
2870 | ||
2871 | /** | |
2872 | Sets the default editor for grid cells. | |
2873 | ||
2874 | The grid will take ownership of the pointer. | |
2875 | ||
2876 | See wxGridCellEditor and the @ref overview_grid for more information | |
2877 | about cell editors and renderers. | |
2878 | */ | |
2879 | void SetDefaultEditor(wxGridCellEditor* editor); | |
2880 | ||
2881 | /** | |
2882 | Sets the default renderer for grid cells. | |
2883 | ||
2884 | The grid will take ownership of the pointer. | |
2885 | ||
2886 | See wxGridCellRenderer and the @ref overview_grid for more information | |
2887 | about cell editors and renderers. | |
2888 | */ | |
2889 | void SetDefaultRenderer(wxGridCellRenderer* renderer); | |
2890 | ||
2891 | /** | |
2892 | Makes the cell at the specified location read-only or editable. | |
2893 | ||
2894 | @see IsReadOnly() | |
2895 | */ | |
2896 | void SetReadOnly(int row, int col, bool isReadOnly = true); | |
2897 | ||
2898 | /** | |
2899 | Displays the in-place cell edit control for the current cell. | |
2900 | */ | |
2901 | void ShowCellEditControl(); | |
2902 | ||
2903 | //@} | |
2904 | ||
2905 | ||
2906 | /** | |
2907 | @name Column and Row Sizes | |
2908 | ||
2909 | @see @ref overview_grid_resizing | |
2910 | */ | |
2911 | //@{ | |
2912 | ||
2913 | /** | |
2914 | Automatically sets the height and width of all rows and columns to fit | |
2915 | their contents. | |
2916 | */ | |
2917 | void AutoSize(); | |
2918 | ||
2919 | /** | |
2920 | Automatically adjusts width of the column to fit its label. | |
2921 | */ | |
2922 | void AutoSizeColLabelSize(int col); | |
2923 | ||
2924 | /** | |
2925 | Automatically sizes the column to fit its contents. If @a setAsMin is | |
2926 | @true the calculated width will also be set as the minimal width for | |
2927 | the column. | |
2928 | */ | |
2929 | void AutoSizeColumn(int col, bool setAsMin = true); | |
2930 | ||
2931 | /** | |
2932 | Automatically sizes all columns to fit their contents. If @a setAsMin | |
2933 | is @true the calculated widths will also be set as the minimal widths | |
2934 | for the columns. | |
2935 | */ | |
2936 | void AutoSizeColumns(bool setAsMin = true); | |
2937 | ||
2938 | /** | |
2939 | Automatically sizes the row to fit its contents. If @a setAsMin is | |
2940 | @true the calculated height will also be set as the minimal height for | |
2941 | the row. | |
2942 | */ | |
2943 | void AutoSizeRow(int row, bool setAsMin = true); | |
2944 | ||
2945 | /** | |
2946 | Automatically adjusts height of the row to fit its label. | |
2947 | */ | |
2948 | void AutoSizeRowLabelSize(int col); | |
2949 | ||
2950 | /** | |
2951 | Automatically sizes all rows to fit their contents. If @a setAsMin is | |
2952 | @true the calculated heights will also be set as the minimal heights | |
2953 | for the rows. | |
2954 | */ | |
2955 | void AutoSizeRows(bool setAsMin = true); | |
2956 | ||
2957 | /** | |
2958 | Returns @true if the cell value can overflow. | |
2959 | ||
2960 | A cell can overflow if the next cell in the row is empty. | |
2961 | */ | |
2962 | bool GetCellOverflow(int row, int col) const; | |
2963 | ||
2964 | /** | |
2965 | Returns the current height of the column labels. | |
2966 | */ | |
2967 | int GetColLabelSize() const; | |
2968 | ||
2969 | /** | |
2970 | Returns the minimal width to which a column may be resized. | |
2971 | ||
2972 | Use SetColMinimalAcceptableWidth() to change this value globally or | |
2973 | SetColMinimalWidth() to do it for individual columns. | |
2974 | ||
2975 | @see GetRowMinimalAcceptableHeight() | |
2976 | */ | |
2977 | int GetColMinimalAcceptableWidth() const; | |
2978 | ||
2979 | /** | |
2980 | Returns the width of the specified column. | |
2981 | */ | |
2982 | int GetColSize(int col) const; | |
2983 | ||
2984 | /** | |
2985 | Returns @true if the specified column is not currently hidden. | |
2986 | */ | |
2987 | bool IsColShown(int col) const; | |
2988 | ||
2989 | /** | |
2990 | Returns @true if the cells can overflow by default. | |
2991 | */ | |
2992 | bool GetDefaultCellOverflow() const; | |
2993 | ||
2994 | /** | |
2995 | Returns the default height for column labels. | |
2996 | */ | |
2997 | int GetDefaultColLabelSize() const; | |
2998 | ||
2999 | /** | |
3000 | Returns the current default width for grid columns. | |
3001 | */ | |
3002 | int GetDefaultColSize() const; | |
3003 | ||
3004 | /** | |
3005 | Returns the default width for the row labels. | |
3006 | */ | |
3007 | int GetDefaultRowLabelSize() const; | |
3008 | ||
3009 | /** | |
3010 | Returns the current default height for grid rows. | |
3011 | */ | |
3012 | int GetDefaultRowSize() const; | |
3013 | ||
3014 | /** | |
3015 | Returns the minimal size to which rows can be resized. | |
3016 | ||
3017 | Use SetRowMinimalAcceptableHeight() to change this value globally or | |
3018 | SetRowMinimalHeight() to do it for individual cells. | |
3019 | ||
3020 | @see GetColMinimalAcceptableWidth() | |
3021 | */ | |
3022 | int GetRowMinimalAcceptableHeight() const; | |
3023 | ||
3024 | /** | |
3025 | Returns the current width of the row labels. | |
3026 | */ | |
3027 | int GetRowLabelSize() const; | |
3028 | ||
3029 | /** | |
3030 | Returns the height of the specified row. | |
3031 | */ | |
3032 | int GetRowSize(int row) const; | |
3033 | ||
3034 | /** | |
3035 | Returns @true if the specified row is not currently hidden. | |
3036 | */ | |
3037 | bool IsRowShown(int row) const; | |
3038 | ||
3039 | /** | |
3040 | Sets the overflow permission of the cell. | |
3041 | */ | |
3042 | void SetCellOverflow(int row, int col, bool allow); | |
3043 | ||
3044 | /** | |
3045 | Sets the height of the column labels. | |
3046 | ||
3047 | If @a height equals to @c wxGRID_AUTOSIZE then height is calculated | |
3048 | automatically so that no label is truncated. Note that this could be | |
3049 | slow for a large table. | |
3050 | */ | |
3051 | void SetColLabelSize(int height); | |
3052 | ||
3053 | /** | |
3054 | Sets the minimal @a width to which the user can resize columns. | |
3055 | ||
3056 | @see GetColMinimalAcceptableWidth() | |
3057 | */ | |
3058 | void SetColMinimalAcceptableWidth(int width); | |
3059 | ||
3060 | /** | |
3061 | Sets the minimal @a width for the specified column @a col. | |
3062 | ||
3063 | It is usually best to call this method during grid creation as calling | |
3064 | it later will not resize the column to the given minimal width even if | |
3065 | it is currently narrower than it. | |
3066 | ||
3067 | @a width must be greater than the minimal acceptable column width as | |
3068 | returned by GetColMinimalAcceptableWidth(). | |
3069 | */ | |
3070 | void SetColMinimalWidth(int col, int width); | |
3071 | ||
3072 | /** | |
3073 | Sets the width of the specified column. | |
3074 | ||
3075 | @param col | |
3076 | The column index. | |
3077 | @param width | |
3078 | The new column width in pixels, 0 to hide the column or -1 to fit | |
3079 | the column width to its label width. | |
3080 | */ | |
3081 | void SetColSize(int col, int width); | |
3082 | ||
3083 | /** | |
3084 | Hides the specified column. | |
3085 | ||
3086 | To show the column later you need to call SetColSize() with non-0 | |
3087 | width or ShowCol() to restore the previous column width. | |
3088 | ||
3089 | If the column is already hidden, this method doesn't do anything. | |
3090 | ||
3091 | @param col | |
3092 | The column index. | |
3093 | */ | |
3094 | void HideCol(int col); | |
3095 | ||
3096 | /** | |
3097 | Shows the previously hidden column by resizing it to non-0 size. | |
3098 | ||
3099 | The column is shown again with the same width that it had before | |
3100 | HideCol() call. | |
3101 | ||
3102 | If the column is currently shown, this method doesn't do anything. | |
3103 | ||
3104 | @see HideCol(), SetColSize() | |
3105 | */ | |
3106 | void ShowCol(int col); | |
3107 | ||
3108 | ||
3109 | /** | |
3110 | Sets the default overflow permission of the cells. | |
3111 | */ | |
3112 | void SetDefaultCellOverflow( bool allow ); | |
3113 | ||
3114 | /** | |
3115 | Sets the default width for columns in the grid. | |
3116 | ||
3117 | This will only affect columns subsequently added to the grid unless | |
3118 | @a resizeExistingCols is @true. | |
3119 | ||
3120 | If @a width is less than GetColMinimalAcceptableWidth(), then the | |
3121 | minimal acceptable width is used instead of it. | |
3122 | */ | |
3123 | void SetDefaultColSize(int width, bool resizeExistingCols = false); | |
3124 | ||
3125 | /** | |
3126 | Sets the default height for rows in the grid. | |
3127 | ||
3128 | This will only affect rows subsequently added to the grid unless | |
3129 | @a resizeExistingRows is @true. | |
3130 | ||
3131 | If @a height is less than GetRowMinimalAcceptableHeight(), then the | |
3132 | minimal acceptable height is used instead of it. | |
3133 | */ | |
3134 | void SetDefaultRowSize(int height, bool resizeExistingRows = false); | |
3135 | ||
3136 | /** | |
3137 | Sets the width of the row labels. | |
3138 | ||
3139 | If @a width equals @c wxGRID_AUTOSIZE then width is calculated | |
3140 | automatically so that no label is truncated. Note that this could be | |
3141 | slow for a large table. | |
3142 | */ | |
3143 | void SetRowLabelSize(int width); | |
3144 | ||
3145 | /** | |
3146 | Sets the minimal row @a height used by default. | |
3147 | ||
3148 | See SetColMinimalAcceptableWidth() for more information. | |
3149 | */ | |
3150 | void SetRowMinimalAcceptableHeight(int height); | |
3151 | ||
3152 | /** | |
3153 | Sets the minimal @a height for the specified @a row. | |
3154 | ||
3155 | See SetColMinimalWidth() for more information. | |
3156 | */ | |
3157 | void SetRowMinimalHeight(int row, int height); | |
3158 | ||
3159 | /** | |
3160 | Sets the height of the specified row. | |
3161 | ||
3162 | See SetColSize() for more information. | |
3163 | */ | |
3164 | void SetRowSize(int row, int height); | |
3165 | ||
3166 | /** | |
3167 | Hides the specified row. | |
3168 | ||
3169 | To show the row later you need to call SetRowSize() with non-0 | |
3170 | width or ShowRow() to restore its original height. | |
3171 | ||
3172 | If the row is already hidden, this method doesn't do anything. | |
3173 | ||
3174 | @param col | |
3175 | The row index. | |
3176 | */ | |
3177 | void HideRow(int col); | |
3178 | ||
3179 | /** | |
3180 | Shows the previously hidden row. | |
3181 | ||
3182 | The row is shown again with the same height that it had before | |
3183 | HideRow() call. | |
3184 | ||
3185 | If the row is currently shown, this method doesn't do anything. | |
3186 | ||
3187 | @see HideRow(), SetRowSize() | |
3188 | */ | |
3189 | void ShowRow(int col); | |
3190 | ||
3191 | /** | |
3192 | Get size information for all columns at once. | |
3193 | ||
3194 | This method is useful when the information about all column widths | |
3195 | needs to be saved. The widths can be later restored using | |
3196 | SetColSizes(). | |
3197 | ||
3198 | @sa wxGridSizesInfo, GetRowSizes() | |
3199 | */ | |
3200 | wxGridSizesInfo GetColSizes() const; | |
3201 | ||
3202 | /** | |
3203 | Get size information for all row at once. | |
3204 | ||
3205 | @sa wxGridSizesInfo, GetColSizes() | |
3206 | */ | |
3207 | wxGridSizesInfo GetRowSizes() const; | |
3208 | ||
3209 | /** | |
3210 | Restore all columns sizes. | |
3211 | ||
3212 | This is usually called with wxGridSizesInfo object previously returned | |
3213 | by GetColSizes(). | |
3214 | ||
3215 | @sa SetRowSizes() | |
3216 | */ | |
3217 | void SetColSizes(const wxGridSizesInfo& sizeInfo); | |
3218 | ||
3219 | /** | |
3220 | Restore all rows sizes. | |
3221 | ||
3222 | @sa SetColSizes() | |
3223 | */ | |
3224 | void SetRowSizes(const wxGridSizesInfo& sizeInfo); | |
3225 | ||
3226 | /** | |
3227 | Set the size of the cell. | |
3228 | ||
3229 | Specifying a value of more than 1 in @a num_rows or @a num_cols will | |
3230 | make the cell at (@a row, @a col) span the block of the specified size, | |
3231 | covering the other cells which would be normally shown in it. Passing 1 | |
3232 | for both arguments resets the cell to normal appearance. | |
3233 | ||
3234 | @see GetCellSize() | |
3235 | ||
3236 | @param row | |
3237 | The row of the cell. | |
3238 | @param col | |
3239 | The column of the cell. | |
3240 | @param num_rows | |
3241 | Number of rows to be occupied by this cell, must be >= 1. | |
3242 | @param num_cols | |
3243 | Number of columns to be occupied by this cell, must be >= 1. | |
3244 | */ | |
3245 | void SetCellSize(int row, int col, int num_rows, int num_cols); | |
3246 | ||
3247 | /** | |
3248 | Get the size of the cell in number of cells covered by it. | |
3249 | ||
3250 | For normal cells, the function fills both @a num_rows and @a num_cols | |
3251 | with 1 and returns CellSpan_None. For cells which span multiple cells, i.e. | |
3252 | for which SetCellSize() had been called, the returned values are the | |
3253 | same ones as were passed to SetCellSize() call and the function return | |
3254 | value is CellSpan_Main. | |
3255 | ||
3256 | More unexpectedly, perhaps, the returned values may be @em negative for | |
3257 | the cells which are inside a span covered by a cell occupying multiple | |
3258 | rows or columns. They correspond to the offset of the main cell of the | |
3259 | span from the cell passed to this functions and the function returns | |
3260 | CellSpan_Inside value to indicate this. | |
3261 | ||
3262 | As an example, consider a 3*3 grid with the cell (1, 1) (the one in the | |
3263 | middle) having a span of 2 rows and 2 columns, i.e. the grid looks like | |
3264 | @code | |
3265 | +----+----+----+ | |
3266 | | | | | | |
3267 | +----+----+----+ | |
3268 | | | | | |
3269 | +----+ | | |
3270 | | | | | |
3271 | +----+----+----+ | |
3272 | @endcode | |
3273 | Then the function returns 2 and 2 in @a num_rows and @a num_cols for | |
3274 | the cell (1, 1) itself and -1 and -1 for the cell (2, 2) as well as -1 | |
3275 | and 0 for the cell (2, 1). | |
3276 | ||
3277 | @param row | |
3278 | The row of the cell. | |
3279 | @param col | |
3280 | The column of the cell. | |
3281 | @param num_rows | |
3282 | Pointer to variable receiving the number of rows, must not be @NULL. | |
3283 | @param num_cols | |
3284 | Pointer to variable receiving the number of columns, must not be | |
3285 | @NULL. | |
3286 | @return | |
3287 | The kind of this cell span (the return value is new in wxWidgets | |
3288 | 2.9.1, this function was void in previous wxWidgets versions). | |
3289 | */ | |
3290 | CellSpan GetCellSize( int row, int col, int *num_rows, int *num_cols ) const; | |
3291 | ||
3292 | /** | |
3293 | Get the number of rows and columns allocated for this cell. | |
3294 | ||
3295 | This overload doesn't return a CellSpan value but the values returned | |
3296 | may still be negative, see GetCellSize(int, int, int *, int *) for | |
3297 | details. | |
3298 | */ | |
3299 | wxSize GetCellSize(const wxGridCellCoords& coords); | |
3300 | ||
3301 | //@} | |
3302 | ||
3303 | ||
3304 | /** | |
3305 | @name User-Resizing and Dragging | |
3306 | ||
3307 | Functions controlling various interactive mouse operations. | |
3308 | ||
3309 | By default, columns and rows can be resized by dragging the edges of | |
3310 | their labels (this can be disabled using DisableDragColSize() and | |
3311 | DisableDragRowSize() methods). And if grid line dragging is enabled with | |
3312 | EnableDragGridSize() they can also be resized by dragging the right or | |
3313 | bottom edge of the grid cells. | |
3314 | ||
3315 | Columns can also be moved to interactively change their order but this | |
3316 | needs to be explicitly enabled with EnableDragColMove(). | |
3317 | */ | |
3318 | //@{ | |
3319 | ||
3320 | /** | |
3321 | Return @true if the dragging of cells is enabled or @false otherwise. | |
3322 | */ | |
3323 | bool CanDragCell() const; | |
3324 | ||
3325 | /** | |
3326 | Returns @true if columns can be moved by dragging with the mouse. | |
3327 | ||
3328 | Columns can be moved by dragging on their labels. | |
3329 | */ | |
3330 | bool CanDragColMove() const; | |
3331 | ||
3332 | /** | |
3333 | Returns @true if the given column can be resized by dragging with the | |
3334 | mouse. | |
3335 | ||
3336 | This function returns @true if resizing the columns interactively is | |
3337 | globally enabled, i.e. if DisableDragColSize() hadn't been called, and | |
3338 | if this column wasn't explicitly marked as non-resizable with | |
3339 | DisableColResize(). | |
3340 | */ | |
3341 | bool CanDragColSize(int col) const; | |
3342 | ||
3343 | /** | |
3344 | Return @true if the dragging of grid lines to resize rows and columns | |
3345 | is enabled or @false otherwise. | |
3346 | */ | |
3347 | bool CanDragGridSize() const; | |
3348 | ||
3349 | /** | |
3350 | Returns @true if the given row can be resized by dragging with the | |
3351 | mouse. | |
3352 | ||
3353 | This is the same as CanDragColSize() but for rows. | |
3354 | */ | |
3355 | bool CanDragRowSize(int row) const; | |
3356 | ||
3357 | /** | |
3358 | Disable interactive resizing of the specified column. | |
3359 | ||
3360 | This method allows to disable resizing of an individual column in a | |
3361 | grid where the columns are otherwise resizable (which is the case by | |
3362 | default). | |
3363 | ||
3364 | Notice that currently there is no way to make some columns resizable in | |
3365 | a grid where columns can't be resized by default as there doesn't seem | |
3366 | to be any need for this in practice. There is also no way to make the | |
3367 | column marked as fixed using this method resizable again because it is | |
3368 | supposed that fixed columns are used for static parts of the grid and | |
3369 | so should remain fixed during the entire grid lifetime. | |
3370 | ||
3371 | Also notice that disabling interactive column resizing will not prevent | |
3372 | the program from changing the column size. | |
3373 | ||
3374 | @see EnableDragColSize() | |
3375 | */ | |
3376 | void DisableColResize(int col); | |
3377 | ||
3378 | /** | |
3379 | Disable interactive resizing of the specified row. | |
3380 | ||
3381 | This is the same as DisableColResize() but for rows. | |
3382 | ||
3383 | @see EnableDragRowSize() | |
3384 | */ | |
3385 | void DisableRowResize(int row); | |
3386 | ||
3387 | /** | |
3388 | Disables column moving by dragging with the mouse. | |
3389 | ||
3390 | Equivalent to passing @false to EnableDragColMove(). | |
3391 | */ | |
3392 | void DisableDragColMove(); | |
3393 | ||
3394 | /** | |
3395 | Disables column sizing by dragging with the mouse. | |
3396 | ||
3397 | Equivalent to passing @false to EnableDragColSize(). | |
3398 | */ | |
3399 | void DisableDragColSize(); | |
3400 | ||
3401 | /** | |
3402 | Disable mouse dragging of grid lines to resize rows and columns. | |
3403 | ||
3404 | Equivalent to passing @false to EnableDragGridSize() | |
3405 | */ | |
3406 | void DisableDragGridSize(); | |
3407 | ||
3408 | /** | |
3409 | Disables row sizing by dragging with the mouse. | |
3410 | ||
3411 | Equivalent to passing @false to EnableDragRowSize(). | |
3412 | */ | |
3413 | void DisableDragRowSize(); | |
3414 | ||
3415 | /** | |
3416 | Enables or disables cell dragging with the mouse. | |
3417 | */ | |
3418 | void EnableDragCell(bool enable = true); | |
3419 | ||
3420 | /** | |
3421 | Enables or disables column moving by dragging with the mouse. | |
3422 | */ | |
3423 | void EnableDragColMove(bool enable = true); | |
3424 | ||
3425 | /** | |
3426 | Enables or disables column sizing by dragging with the mouse. | |
3427 | ||
3428 | @see DisableColResize() | |
3429 | */ | |
3430 | void EnableDragColSize(bool enable = true); | |
3431 | ||
3432 | /** | |
3433 | Enables or disables row and column resizing by dragging gridlines with | |
3434 | the mouse. | |
3435 | */ | |
3436 | void EnableDragGridSize(bool enable = true); | |
3437 | ||
3438 | /** | |
3439 | Enables or disables row sizing by dragging with the mouse. | |
3440 | ||
3441 | @see DisableRowResize() | |
3442 | */ | |
3443 | void EnableDragRowSize(bool enable = true); | |
3444 | ||
3445 | /** | |
3446 | Returns the column ID of the specified column position. | |
3447 | */ | |
3448 | int GetColAt(int colPos) const; | |
3449 | ||
3450 | /** | |
3451 | Returns the position of the specified column. | |
3452 | */ | |
3453 | int GetColPos(int colID) const; | |
3454 | ||
3455 | /** | |
3456 | Sets the position of the specified column. | |
3457 | */ | |
3458 | void SetColPos(int colID, int newPos); | |
3459 | ||
3460 | /** | |
3461 | Sets the positions of all columns at once. | |
3462 | ||
3463 | This method takes an array containing the indices of the columns in | |
3464 | their display order, i.e. uses the same convention as | |
3465 | wxHeaderCtrl::SetColumnsOrder(). | |
3466 | */ | |
3467 | void SetColumnsOrder(const wxArrayInt& order); | |
3468 | ||
3469 | /** | |
3470 | Resets the position of the columns to the default. | |
3471 | */ | |
3472 | void ResetColPos(); | |
3473 | ||
3474 | //@} | |
3475 | ||
3476 | ||
3477 | /** | |
3478 | @name Cursor Movement | |
3479 | */ | |
3480 | //@{ | |
3481 | ||
3482 | /** | |
3483 | Returns the current grid cell column position. | |
3484 | */ | |
3485 | int GetGridCursorCol() const; | |
3486 | ||
3487 | /** | |
3488 | Returns the current grid cell row position. | |
3489 | */ | |
3490 | int GetGridCursorRow() const; | |
3491 | ||
3492 | /** | |
3493 | Make the given cell current and ensure it is visible. | |
3494 | ||
3495 | This method is equivalent to calling MakeCellVisible() and | |
3496 | SetGridCursor() and so, as with the latter, a @c wxEVT_GRID_SELECT_CELL | |
3497 | event is generated by it and the selected cell doesn't change if the | |
3498 | event is vetoed. | |
3499 | */ | |
3500 | void GoToCell(int row, int col); | |
3501 | /** | |
3502 | Make the given cell current and ensure it is visible. | |
3503 | ||
3504 | This method is equivalent to calling MakeCellVisible() and | |
3505 | SetGridCursor() and so, as with the latter, a @c wxEVT_GRID_SELECT_CELL | |
3506 | event is generated by it and the selected cell doesn't change if the | |
3507 | event is vetoed. | |
3508 | */ | |
3509 | void GoToCell(const wxGridCellCoords& coords); | |
3510 | ||
3511 | /** | |
3512 | Moves the grid cursor down by one row. | |
3513 | ||
3514 | If a block of cells was previously selected it will expand if the | |
3515 | argument is @true or be cleared if the argument is @false. | |
3516 | */ | |
3517 | bool MoveCursorDown(bool expandSelection); | |
3518 | ||
3519 | /** | |
3520 | Moves the grid cursor down in the current column such that it skips to | |
3521 | the beginning or end of a block of non-empty cells. | |
3522 | ||
3523 | If a block of cells was previously selected it will expand if the | |
3524 | argument is @true or be cleared if the argument is @false. | |
3525 | */ | |
3526 | bool MoveCursorDownBlock(bool expandSelection); | |
3527 | ||
3528 | /** | |
3529 | Moves the grid cursor left by one column. | |
3530 | ||
3531 | If a block of cells was previously selected it will expand if the | |
3532 | argument is @true or be cleared if the argument is @false. | |
3533 | */ | |
3534 | bool MoveCursorLeft(bool expandSelection); | |
3535 | ||
3536 | /** | |
3537 | Moves the grid cursor left in the current row such that it skips to the | |
3538 | beginning or end of a block of non-empty cells. | |
3539 | ||
3540 | If a block of cells was previously selected it will expand if the | |
3541 | argument is @true or be cleared if the argument is @false. | |
3542 | */ | |
3543 | bool MoveCursorLeftBlock(bool expandSelection); | |
3544 | ||
3545 | /** | |
3546 | Moves the grid cursor right by one column. | |
3547 | ||
3548 | If a block of cells was previously selected it will expand if the | |
3549 | argument is @true or be cleared if the argument is @false. | |
3550 | */ | |
3551 | bool MoveCursorRight(bool expandSelection); | |
3552 | ||
3553 | /** | |
3554 | Moves the grid cursor right in the current row such that it skips to | |
3555 | the beginning or end of a block of non-empty cells. | |
3556 | ||
3557 | If a block of cells was previously selected it will expand if the | |
3558 | argument is @true or be cleared if the argument is @false. | |
3559 | */ | |
3560 | bool MoveCursorRightBlock(bool expandSelection); | |
3561 | ||
3562 | /** | |
3563 | Moves the grid cursor up by one row. | |
3564 | ||
3565 | If a block of cells was previously selected it will expand if the | |
3566 | argument is @true or be cleared if the argument is @false. | |
3567 | */ | |
3568 | bool MoveCursorUp(bool expandSelection); | |
3569 | ||
3570 | /** | |
3571 | Moves the grid cursor up in the current column such that it skips to | |
3572 | the beginning or end of a block of non-empty cells. | |
3573 | ||
3574 | If a block of cells was previously selected it will expand if the | |
3575 | argument is @true or be cleared if the argument is @false. | |
3576 | */ | |
3577 | bool MoveCursorUpBlock(bool expandSelection); | |
3578 | ||
3579 | /** | |
3580 | Moves the grid cursor down by some number of rows so that the previous | |
3581 | bottom visible row becomes the top visible row. | |
3582 | */ | |
3583 | bool MovePageDown(); | |
3584 | ||
3585 | /** | |
3586 | Moves the grid cursor up by some number of rows so that the previous | |
3587 | top visible row becomes the bottom visible row. | |
3588 | */ | |
3589 | bool MovePageUp(); | |
3590 | ||
3591 | /** | |
3592 | Set the grid cursor to the specified cell. | |
3593 | ||
3594 | The grid cursor indicates the current cell and can be moved by the user | |
3595 | using the arrow keys or the mouse. | |
3596 | ||
3597 | Calling this function generates a @c wxEVT_GRID_SELECT_CELL event and | |
3598 | if the event handler vetoes this event, the cursor is not moved. | |
3599 | ||
3600 | This function doesn't make the target call visible, use GoToCell() to | |
3601 | do this. | |
3602 | */ | |
3603 | void SetGridCursor(int row, int col); | |
3604 | /** | |
3605 | Set the grid cursor to the specified cell. | |
3606 | ||
3607 | The grid cursor indicates the current cell and can be moved by the user | |
3608 | using the arrow keys or the mouse. | |
3609 | ||
3610 | Calling this function generates a @c wxEVT_GRID_SELECT_CELL event and | |
3611 | if the event handler vetoes this event, the cursor is not moved. | |
3612 | ||
3613 | This function doesn't make the target call visible, use GoToCell() to | |
3614 | do this. | |
3615 | */ | |
3616 | void SetGridCursor(const wxGridCellCoords& coords); | |
3617 | ||
3618 | /** | |
3619 | Set the grid's behaviour when the user presses the TAB key. | |
3620 | ||
3621 | Pressing the TAB key moves the grid cursor right in the current row, if | |
3622 | there is a cell at the right and, similarly, Shift-TAB moves the cursor | |
3623 | to the left in the current row if it's not in the first column. | |
3624 | ||
3625 | What happens if the cursor can't be moved because it it's already at | |
3626 | the beginning or end of the row can be configured using this function, | |
3627 | see wxGrid::TabBehaviour documentation for the detailed description. | |
3628 | ||
3629 | IF none of the standard behaviours is appropriate, you can always | |
3630 | handle @c wxEVT_GRID_TABBING event directly to implement a custom | |
3631 | TAB-handling logic. | |
3632 | ||
3633 | @since 2.9.5 | |
3634 | */ | |
3635 | void SetTabBehaviour(TabBehaviour behaviour); | |
3636 | ||
3637 | //@} | |
3638 | ||
3639 | ||
3640 | /** | |
3641 | @name User Selection | |
3642 | */ | |
3643 | //@{ | |
3644 | ||
3645 | /** | |
3646 | Deselects all cells that are currently selected. | |
3647 | */ | |
3648 | void ClearSelection(); | |
3649 | ||
3650 | /** | |
3651 | Returns an array of individually selected cells. | |
3652 | ||
3653 | Notice that this array does @em not contain all the selected cells in | |
3654 | general as it doesn't include the cells selected as part of column, row | |
3655 | or block selection. You must use this method, GetSelectedCols(), | |
3656 | GetSelectedRows() and GetSelectionBlockTopLeft() and | |
3657 | GetSelectionBlockBottomRight() methods to obtain the entire selection | |
3658 | in general. | |
3659 | ||
3660 | Please notice this behaviour is by design and is needed in order to | |
3661 | support grids of arbitrary size (when an entire column is selected in | |
3662 | a grid with a million of columns, we don't want to create an array with | |
3663 | a million of entries in this function, instead it returns an empty | |
3664 | array and GetSelectedCols() returns an array containing one element). | |
3665 | */ | |
3666 | wxGridCellCoordsArray GetSelectedCells() const; | |
3667 | ||
3668 | /** | |
3669 | Returns an array of selected columns. | |
3670 | ||
3671 | Please notice that this method alone is not sufficient to find all the | |
3672 | selected columns as it contains only the columns which were | |
3673 | individually selected but not those being part of the block selection | |
3674 | or being selected in virtue of all of their cells being selected | |
3675 | individually, please see GetSelectedCells() for more details. | |
3676 | */ | |
3677 | wxArrayInt GetSelectedCols() const; | |
3678 | ||
3679 | /** | |
3680 | Returns an array of selected rows. | |
3681 | ||
3682 | Please notice that this method alone is not sufficient to find all the | |
3683 | selected rows as it contains only the rows which were individually | |
3684 | selected but not those being part of the block selection or being | |
3685 | selected in virtue of all of their cells being selected individually, | |
3686 | please see GetSelectedCells() for more details. | |
3687 | */ | |
3688 | wxArrayInt GetSelectedRows() const; | |
3689 | ||
3690 | /** | |
3691 | Returns the colour used for drawing the selection background. | |
3692 | */ | |
3693 | wxColour GetSelectionBackground() const; | |
3694 | ||
3695 | /** | |
3696 | Returns an array of the bottom right corners of blocks of selected | |
3697 | cells. | |
3698 | ||
3699 | Please see GetSelectedCells() for more information about the selection | |
3700 | representation in wxGrid. | |
3701 | ||
3702 | @see GetSelectionBlockTopLeft() | |
3703 | */ | |
3704 | wxGridCellCoordsArray GetSelectionBlockBottomRight() const; | |
3705 | ||
3706 | /** | |
3707 | Returns an array of the top left corners of blocks of selected cells. | |
3708 | ||
3709 | Please see GetSelectedCells() for more information about the selection | |
3710 | representation in wxGrid. | |
3711 | ||
3712 | @see GetSelectionBlockBottomRight() | |
3713 | */ | |
3714 | wxGridCellCoordsArray GetSelectionBlockTopLeft() const; | |
3715 | ||
3716 | /** | |
3717 | Returns the colour used for drawing the selection foreground. | |
3718 | */ | |
3719 | wxColour GetSelectionForeground() const; | |
3720 | ||
3721 | /** | |
3722 | Returns the current selection mode. | |
3723 | ||
3724 | @see SetSelectionMode(). | |
3725 | */ | |
3726 | wxGridSelectionModes GetSelectionMode() const; | |
3727 | ||
3728 | /** | |
3729 | Returns @true if the given cell is selected. | |
3730 | */ | |
3731 | bool IsInSelection(int row, int col) const; | |
3732 | /** | |
3733 | Returns @true if the given cell is selected. | |
3734 | */ | |
3735 | bool IsInSelection(const wxGridCellCoords& coords) const; | |
3736 | ||
3737 | /** | |
3738 | Returns @true if there are currently any selected cells, rows, columns | |
3739 | or blocks. | |
3740 | */ | |
3741 | bool IsSelection() const; | |
3742 | ||
3743 | /** | |
3744 | Selects all cells in the grid. | |
3745 | */ | |
3746 | void SelectAll(); | |
3747 | ||
3748 | /** | |
3749 | Selects a rectangular block of cells. | |
3750 | ||
3751 | If @a addToSelected is @false then any existing selection will be | |
3752 | deselected; if @true the column will be added to the existing | |
3753 | selection. | |
3754 | */ | |
3755 | void SelectBlock(int topRow, int leftCol, int bottomRow, int rightCol, | |
3756 | bool addToSelected = false); | |
3757 | /** | |
3758 | Selects a rectangular block of cells. | |
3759 | ||
3760 | If @a addToSelected is @false then any existing selection will be | |
3761 | deselected; if @true the column will be added to the existing | |
3762 | selection. | |
3763 | */ | |
3764 | void SelectBlock(const wxGridCellCoords& topLeft, | |
3765 | const wxGridCellCoords& bottomRight, | |
3766 | bool addToSelected = false); | |
3767 | ||
3768 | /** | |
3769 | Selects the specified column. | |
3770 | ||
3771 | If @a addToSelected is @false then any existing selection will be | |
3772 | deselected; if @true the column will be added to the existing | |
3773 | selection. | |
3774 | ||
3775 | This method won't select anything if the current selection mode is | |
3776 | wxGridSelectRows. | |
3777 | */ | |
3778 | void SelectCol(int col, bool addToSelected = false); | |
3779 | ||
3780 | /** | |
3781 | Selects the specified row. | |
3782 | ||
3783 | If @a addToSelected is @false then any existing selection will be | |
3784 | deselected; if @true the row will be added to the existing selection. | |
3785 | ||
3786 | This method won't select anything if the current selection mode is | |
3787 | wxGridSelectColumns. | |
3788 | */ | |
3789 | void SelectRow(int row, bool addToSelected = false); | |
3790 | ||
3791 | /** | |
3792 | Set the colour to be used for drawing the selection background. | |
3793 | */ | |
3794 | void SetSelectionBackground(const wxColour& c); | |
3795 | ||
3796 | /** | |
3797 | Set the colour to be used for drawing the selection foreground. | |
3798 | */ | |
3799 | void SetSelectionForeground(const wxColour& c); | |
3800 | ||
3801 | /** | |
3802 | Set the selection behaviour of the grid. | |
3803 | ||
3804 | The existing selection is converted to conform to the new mode if | |
3805 | possible and discarded otherwise (e.g. any individual selected cells | |
3806 | are deselected if the new mode allows only the selection of the entire | |
3807 | rows or columns). | |
3808 | */ | |
3809 | void SetSelectionMode(wxGridSelectionModes selmode); | |
3810 | ||
3811 | //@} | |
3812 | ||
3813 | ||
3814 | /** | |
3815 | @name Scrolling | |
3816 | */ | |
3817 | //@{ | |
3818 | ||
3819 | /** | |
3820 | Returns the number of pixels per horizontal scroll increment. | |
3821 | ||
3822 | The default is 15. | |
3823 | ||
3824 | @see GetScrollLineY(), SetScrollLineX(), SetScrollLineY() | |
3825 | */ | |
3826 | int GetScrollLineX() const; | |
3827 | ||
3828 | /** | |
3829 | Returns the number of pixels per vertical scroll increment. | |
3830 | ||
3831 | The default is 15. | |
3832 | ||
3833 | @see GetScrollLineX(), SetScrollLineX(), SetScrollLineY() | |
3834 | */ | |
3835 | int GetScrollLineY() const; | |
3836 | ||
3837 | /** | |
3838 | Returns @true if a cell is either entirely or at least partially | |
3839 | visible in the grid window. | |
3840 | ||
3841 | By default, the cell must be entirely visible for this function to | |
3842 | return @true but if @a wholeCellVisible is @false, the function returns | |
3843 | @true even if the cell is only partially visible. | |
3844 | */ | |
3845 | bool IsVisible(int row, int col, bool wholeCellVisible = true) const; | |
3846 | /** | |
3847 | Returns @true if a cell is either entirely or at least partially | |
3848 | visible in the grid window. | |
3849 | ||
3850 | By default, the cell must be entirely visible for this function to | |
3851 | return @true but if @a wholeCellVisible is @false, the function returns | |
3852 | @true even if the cell is only partially visible. | |
3853 | */ | |
3854 | bool IsVisible(const wxGridCellCoords& coords, | |
3855 | bool wholeCellVisible = true) const; | |
3856 | ||
3857 | /** | |
3858 | Brings the specified cell into the visible grid cell area with minimal | |
3859 | scrolling. | |
3860 | ||
3861 | Does nothing if the cell is already visible. | |
3862 | */ | |
3863 | void MakeCellVisible(int row, int col); | |
3864 | /** | |
3865 | Brings the specified cell into the visible grid cell area with minimal | |
3866 | scrolling. | |
3867 | ||
3868 | Does nothing if the cell is already visible. | |
3869 | */ | |
3870 | void MakeCellVisible(const wxGridCellCoords& coords); | |
3871 | ||
3872 | /** | |
3873 | Sets the number of pixels per horizontal scroll increment. | |
3874 | ||
3875 | The default is 15. | |
3876 | ||
3877 | @see GetScrollLineX(), GetScrollLineY(), SetScrollLineY() | |
3878 | */ | |
3879 | void SetScrollLineX(int x); | |
3880 | ||
3881 | /** | |
3882 | Sets the number of pixels per vertical scroll increment. | |
3883 | ||
3884 | The default is 15. | |
3885 | ||
3886 | @see GetScrollLineX(), GetScrollLineY(), SetScrollLineX() | |
3887 | */ | |
3888 | void SetScrollLineY(int y); | |
3889 | ||
3890 | //@} | |
3891 | ||
3892 | ||
3893 | /** | |
3894 | @name Cell and Device Coordinate Translation | |
3895 | */ | |
3896 | //@{ | |
3897 | ||
3898 | /** | |
3899 | Convert grid cell coordinates to grid window pixel coordinates. | |
3900 | ||
3901 | This function returns the rectangle that encloses the block of cells | |
3902 | limited by @a topLeft and @a bottomRight cell in device coords and | |
3903 | clipped to the client size of the grid window. | |
3904 | ||
3905 | @see CellToRect() | |
3906 | */ | |
3907 | wxRect BlockToDeviceRect(const wxGridCellCoords& topLeft, | |
3908 | const wxGridCellCoords& bottomRight) const; | |
3909 | ||
3910 | /** | |
3911 | Return the rectangle corresponding to the grid cell's size and position | |
3912 | in logical coordinates. | |
3913 | ||
3914 | @see BlockToDeviceRect() | |
3915 | */ | |
3916 | wxRect CellToRect(int row, int col) const; | |
3917 | /** | |
3918 | Return the rectangle corresponding to the grid cell's size and position | |
3919 | in logical coordinates. | |
3920 | ||
3921 | @see BlockToDeviceRect() | |
3922 | */ | |
3923 | wxRect CellToRect(const wxGridCellCoords& coords) const; | |
3924 | ||
3925 | /** | |
3926 | Returns the column at the given pixel position. | |
3927 | ||
3928 | @param x | |
3929 | The x position to evaluate. | |
3930 | @param clipToMinMax | |
3931 | If @true, rather than returning @c wxNOT_FOUND, it returns either | |
3932 | the first or last column depending on whether @a x is too far to | |
3933 | the left or right respectively. | |
3934 | @return | |
3935 | The column index or @c wxNOT_FOUND. | |
3936 | */ | |
3937 | int XToCol(int x, bool clipToMinMax = false) const; | |
3938 | ||
3939 | /** | |
3940 | Returns the column whose right hand edge is close to the given logical | |
3941 | @a x position. | |
3942 | ||
3943 | If no column edge is near to this position @c wxNOT_FOUND is returned. | |
3944 | */ | |
3945 | int XToEdgeOfCol(int x) const; | |
3946 | ||
3947 | /** | |
3948 | Translates logical pixel coordinates to the grid cell coordinates. | |
3949 | ||
3950 | Notice that this function expects logical coordinates on input so if | |
3951 | you use this function in a mouse event handler you need to translate | |
3952 | the mouse position, which is expressed in device coordinates, to | |
3953 | logical ones. | |
3954 | ||
3955 | @see XToCol(), YToRow() | |
3956 | */ | |
3957 | wxGridCellCoords XYToCell(int x, int y) const; | |
3958 | /** | |
3959 | Translates logical pixel coordinates to the grid cell coordinates. | |
3960 | ||
3961 | Notice that this function expects logical coordinates on input so if | |
3962 | you use this function in a mouse event handler you need to translate | |
3963 | the mouse position, which is expressed in device coordinates, to | |
3964 | logical ones. | |
3965 | ||
3966 | @see XToCol(), YToRow() | |
3967 | */ | |
3968 | wxGridCellCoords XYToCell(const wxPoint& pos) const; | |
3969 | // XYToCell(int, int, wxGridCellCoords&) overload is intentionally | |
3970 | // undocumented, using it is ugly and non-const reference parameters are | |
3971 | // not used in wxWidgets API | |
3972 | ||
3973 | /** | |
3974 | Returns the row whose bottom edge is close to the given logical @a y | |
3975 | position. | |
3976 | ||
3977 | If no row edge is near to this position @c wxNOT_FOUND is returned. | |
3978 | */ | |
3979 | int YToEdgeOfRow(int y) const; | |
3980 | ||
3981 | /** | |
3982 | Returns the grid row that corresponds to the logical @a y coordinate. | |
3983 | ||
3984 | Returns @c wxNOT_FOUND if there is no row at the @a y position. | |
3985 | */ | |
3986 | int YToRow(int y, bool clipToMinMax = false) const; | |
3987 | ||
3988 | //@} | |
3989 | ||
3990 | ||
3991 | /** | |
3992 | @name Miscellaneous Functions | |
3993 | */ | |
3994 | //@{ | |
3995 | ||
3996 | /** | |
3997 | Appends one or more new columns to the right of the grid. | |
3998 | ||
3999 | The @a updateLabels argument is not used at present. If you are using a | |
4000 | derived grid table class you will need to override | |
4001 | wxGridTableBase::AppendCols(). See InsertCols() for further | |
4002 | information. | |
4003 | ||
4004 | @return @true on success or @false if appending columns failed. | |
4005 | */ | |
4006 | bool AppendCols(int numCols = 1, bool updateLabels = true); | |
4007 | ||
4008 | /** | |
4009 | Appends one or more new rows to the bottom of the grid. | |
4010 | ||
4011 | The @a updateLabels argument is not used at present. If you are using a | |
4012 | derived grid table class you will need to override | |
4013 | wxGridTableBase::AppendRows(). See InsertRows() for further | |
4014 | information. | |
4015 | ||
4016 | @return @true on success or @false if appending rows failed. | |
4017 | */ | |
4018 | bool AppendRows(int numRows = 1, bool updateLabels = true); | |
4019 | ||
4020 | /** | |
4021 | Return @true if the horizontal grid lines stop at the last column | |
4022 | boundary or @false if they continue to the end of the window. | |
4023 | ||
4024 | The default is to clip grid lines. | |
4025 | ||
4026 | @see ClipHorzGridLines(), AreVertGridLinesClipped() | |
4027 | */ | |
4028 | bool AreHorzGridLinesClipped() const; | |
4029 | ||
4030 | /** | |
4031 | Return @true if the vertical grid lines stop at the last row | |
4032 | boundary or @false if they continue to the end of the window. | |
4033 | ||
4034 | The default is to clip grid lines. | |
4035 | ||
4036 | @see ClipVertGridLines(), AreHorzGridLinesClipped() | |
4037 | */ | |
4038 | bool AreVertGridLinesClipped() const; | |
4039 | ||
4040 | /** | |
4041 | Increments the grid's batch count. | |
4042 | ||
4043 | When the count is greater than zero repainting of the grid is | |
4044 | suppressed. Each call to BeginBatch must be matched by a later call to | |
4045 | EndBatch(). Code that does a lot of grid modification can be enclosed | |
4046 | between BeginBatch() and EndBatch() calls to avoid screen flicker. The | |
4047 | final EndBatch() call will cause the grid to be repainted. | |
4048 | ||
4049 | Notice that you should use wxGridUpdateLocker which ensures that there | |
4050 | is always a matching EndBatch() call for this BeginBatch() if possible | |
4051 | instead of calling this method directly. | |
4052 | */ | |
4053 | void BeginBatch(); | |
4054 | ||
4055 | /** | |
4056 | Clears all data in the underlying grid table and repaints the grid. | |
4057 | ||
4058 | The table is not deleted by this function. If you are using a derived | |
4059 | table class then you need to override wxGridTableBase::Clear() for this | |
4060 | function to have any effect. | |
4061 | */ | |
4062 | void ClearGrid(); | |
4063 | ||
4064 | /** | |
4065 | Change whether the horizontal grid lines are clipped by the end of the | |
4066 | last column. | |
4067 | ||
4068 | By default the grid lines are not drawn beyond the end of the last | |
4069 | column but after calling this function with @a clip set to @false they | |
4070 | will be drawn across the entire grid window. | |
4071 | ||
4072 | @see AreHorzGridLinesClipped(), ClipVertGridLines() | |
4073 | */ | |
4074 | void ClipHorzGridLines(bool clip); | |
4075 | ||
4076 | /** | |
4077 | Change whether the vertical grid lines are clipped by the end of the | |
4078 | last row. | |
4079 | ||
4080 | By default the grid lines are not drawn beyond the end of the last | |
4081 | row but after calling this function with @a clip set to @false they | |
4082 | will be drawn across the entire grid window. | |
4083 | ||
4084 | @see AreVertGridLinesClipped(), ClipHorzGridLines() | |
4085 | */ | |
4086 | void ClipVertGridLines(bool clip); | |
4087 | ||
4088 | /** | |
4089 | Deletes one or more columns from a grid starting at the specified | |
4090 | position. | |
4091 | ||
4092 | The @a updateLabels argument is not used at present. If you are using a | |
4093 | derived grid table class you will need to override | |
4094 | wxGridTableBase::DeleteCols(). See InsertCols() for further | |
4095 | information. | |
4096 | ||
4097 | @return @true on success or @false if deleting columns failed. | |
4098 | */ | |
4099 | bool DeleteCols(int pos = 0, int numCols = 1, bool updateLabels = true); | |
4100 | ||
4101 | /** | |
4102 | Deletes one or more rows from a grid starting at the specified | |
4103 | position. | |
4104 | ||
4105 | The @a updateLabels argument is not used at present. If you are using a | |
4106 | derived grid table class you will need to override | |
4107 | wxGridTableBase::DeleteRows(). See InsertRows() for further | |
4108 | information. | |
4109 | ||
4110 | @return @true on success or @false if appending rows failed. | |
4111 | */ | |
4112 | bool DeleteRows(int pos = 0, int numRows = 1, bool updateLabels = true); | |
4113 | ||
4114 | /** | |
4115 | Decrements the grid's batch count. | |
4116 | ||
4117 | When the count is greater than zero repainting of the grid is | |
4118 | suppressed. Each previous call to BeginBatch() must be matched by a | |
4119 | later call to EndBatch(). Code that does a lot of grid modification can | |
4120 | be enclosed between BeginBatch() and EndBatch() calls to avoid screen | |
4121 | flicker. The final EndBatch() will cause the grid to be repainted. | |
4122 | ||
4123 | @see wxGridUpdateLocker | |
4124 | */ | |
4125 | void EndBatch(); | |
4126 | ||
4127 | /** | |
4128 | Overridden wxWindow method. | |
4129 | */ | |
4130 | virtual void Fit(); | |
4131 | ||
4132 | /** | |
4133 | Causes immediate repainting of the grid. | |
4134 | ||
4135 | Use this instead of the usual wxWindow::Refresh(). | |
4136 | */ | |
4137 | void ForceRefresh(); | |
4138 | ||
4139 | /** | |
4140 | Returns the number of times that BeginBatch() has been called without | |
4141 | (yet) matching calls to EndBatch(). While the grid's batch count is | |
4142 | greater than zero the display will not be updated. | |
4143 | */ | |
4144 | int GetBatchCount(); | |
4145 | ||
4146 | /** | |
4147 | Returns the total number of grid columns. | |
4148 | ||
4149 | This is the same as the number of columns in the underlying grid table. | |
4150 | */ | |
4151 | int GetNumberCols() const; | |
4152 | ||
4153 | /** | |
4154 | Returns the total number of grid rows. | |
4155 | ||
4156 | This is the same as the number of rows in the underlying grid table. | |
4157 | */ | |
4158 | int GetNumberRows() const; | |
4159 | ||
4160 | /** | |
4161 | Returns the attribute for the given cell creating one if necessary. | |
4162 | ||
4163 | If the cell already has an attribute, it is returned. Otherwise a new | |
4164 | attribute is created, associated with the cell and returned. In any | |
4165 | case the caller must call DecRef() on the returned pointer. | |
4166 | ||
4167 | This function may only be called if CanHaveAttributes() returns @true. | |
4168 | */ | |
4169 | wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; | |
4170 | ||
4171 | /** | |
4172 | Returns a base pointer to the current table object. | |
4173 | ||
4174 | The returned pointer is still owned by the grid. | |
4175 | */ | |
4176 | wxGridTableBase *GetTable() const; | |
4177 | ||
4178 | /** | |
4179 | Inserts one or more new columns into a grid with the first new column | |
4180 | at the specified position. | |
4181 | ||
4182 | Notice that inserting the columns in the grid requires grid table | |
4183 | cooperation: when this method is called, grid object begins by | |
4184 | requesting the underlying grid table to insert new columns. If this is | |
4185 | successful the table notifies the grid and the grid updates the | |
4186 | display. For a default grid (one where you have called CreateGrid()) | |
4187 | this process is automatic. If you are using a custom grid table | |
4188 | (specified with SetTable()) then you must override | |
4189 | wxGridTableBase::InsertCols() in your derived table class. | |
4190 | ||
4191 | @param pos | |
4192 | The position which the first newly inserted column will have. | |
4193 | @param numCols | |
4194 | The number of columns to insert. | |
4195 | @param updateLabels | |
4196 | Currently not used. | |
4197 | @return | |
4198 | @true if the columns were successfully inserted, @false if an error | |
4199 | occurred (most likely the table couldn't be updated). | |
4200 | */ | |
4201 | bool InsertCols(int pos = 0, int numCols = 1, bool updateLabels = true); | |
4202 | ||
4203 | /** | |
4204 | Inserts one or more new rows into a grid with the first new row at the | |
4205 | specified position. | |
4206 | ||
4207 | Notice that you must implement wxGridTableBase::InsertRows() if you use | |
4208 | a grid with a custom table, please see InsertCols() for more | |
4209 | information. | |
4210 | ||
4211 | @param pos | |
4212 | The position which the first newly inserted row will have. | |
4213 | @param numRows | |
4214 | The number of rows to insert. | |
4215 | @param updateLabels | |
4216 | Currently not used. | |
4217 | @return | |
4218 | @true if the rows were successfully inserted, @false if an error | |
4219 | occurred (most likely the table couldn't be updated). | |
4220 | */ | |
4221 | bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true); | |
4222 | ||
4223 | /** | |
4224 | Invalidates the cached attribute for the given cell. | |
4225 | ||
4226 | For efficiency reasons, wxGrid may cache the recently used attributes | |
4227 | (currently it caches only the single most recently used one, in fact) | |
4228 | which can result in the cell appearance not being refreshed even when | |
4229 | the attribute returned by your custom wxGridCellAttrProvider-derived | |
4230 | class has changed. To force the grid to refresh the cell attribute, | |
4231 | this function may be used. Notice that calling it will not result in | |
4232 | actually redrawing the cell, you still need to call | |
4233 | wxWindow::RefreshRect() to invalidate the area occupied by the cell in | |
4234 | the window to do this. Also note that you don't need to call this | |
4235 | function if you store the attributes in wxGrid itself, i.e. use its | |
4236 | SetAttr() and similar methods, it is only useful when using a separate | |
4237 | custom attributes provider. | |
4238 | ||
4239 | @param row | |
4240 | The row of the cell whose attribute needs to be queried again. | |
4241 | @param col | |
4242 | The column of the cell whose attribute needs to be queried again. | |
4243 | ||
4244 | @since 2.9.2 | |
4245 | */ | |
4246 | void RefreshAttr(int row, int col); | |
4247 | ||
4248 | /** | |
4249 | Draws part or all of a wxGrid on a wxDC for printing or display. | |
4250 | ||
4251 | Pagination can be accomplished by using sequential Render() calls | |
4252 | with appropriate values in wxGridCellCoords topLeft and bottomRight. | |
4253 | ||
4254 | @param dc | |
4255 | The wxDC to be drawn on. | |
4256 | @param pos | |
4257 | The position on the wxDC where rendering should begin. If not | |
4258 | specified drawing will begin at the wxDC MaxX() and MaxY(). | |
4259 | @param size | |
4260 | The size of the area on the wxDC that the rendered wxGrid should | |
4261 | occupy. If not specified the drawing will be scaled to fit the | |
4262 | available dc width or height. The wxGrid's aspect ratio is | |
4263 | maintained whether or not size is specified. | |
4264 | @param topLeft | |
4265 | The top left cell of the block to be drawn. Defaults to ( 0, 0 ). | |
4266 | @param bottomRight | |
4267 | The bottom right cell of the block to be drawn. Defaults to row and | |
4268 | column counts. | |
4269 | @param style | |
4270 | A combination of values from wxGridRenderStyle. | |
4271 | ||
4272 | @since 2.9.4 | |
4273 | */ | |
4274 | void Render( wxDC& dc, | |
4275 | const wxPoint& pos = wxDefaultPosition, | |
4276 | const wxSize& size = wxDefaultSize, | |
4277 | const wxGridCellCoords& topLeft = wxGridCellCoords( -1, -1 ), | |
4278 | const wxGridCellCoords& bottomRight = wxGridCellCoords( -1, -1 ), | |
4279 | int style = wxGRID_DRAW_DEFAULT ); | |
4280 | ||
4281 | /** | |
4282 | Sets the cell attributes for all cells in the specified column. | |
4283 | ||
4284 | For more information about controlling grid cell attributes see the | |
4285 | wxGridCellAttr cell attribute class and the @ref overview_grid. | |
4286 | */ | |
4287 | void SetColAttr(int col, wxGridCellAttr* attr); | |
4288 | ||
4289 | /** | |
4290 | Sets the extra margins used around the grid area. | |
4291 | ||
4292 | A grid may occupy more space than needed for its data display and | |
4293 | this function allows to set how big this extra space is | |
4294 | */ | |
4295 | void SetMargins(int extraWidth, int extraHeight); | |
4296 | ||
4297 | /** | |
4298 | Sets the cell attributes for all cells in the specified row. | |
4299 | ||
4300 | The grid takes ownership of the attribute pointer. | |
4301 | ||
4302 | See the wxGridCellAttr class for more information about controlling | |
4303 | cell attributes. | |
4304 | */ | |
4305 | void SetRowAttr(int row, wxGridCellAttr* attr); | |
4306 | ||
4307 | //@} | |
4308 | ||
4309 | ||
4310 | /** | |
4311 | @name Sorting support. | |
4312 | ||
4313 | wxGrid doesn't provide any support for sorting the data but it does | |
4314 | generate events allowing the user code to sort it and supports | |
4315 | displaying the sort indicator in the column used for sorting. | |
4316 | ||
4317 | To use wxGrid sorting support you need to handle wxEVT_GRID_COL_SORT | |
4318 | event (and not veto it) and resort the data displayed in the grid. The | |
4319 | grid will automatically update the sorting indicator on the column | |
4320 | which was clicked. | |
4321 | ||
4322 | You can also call the functions in this section directly to update the | |
4323 | sorting indicator. Once again, they don't do anything with the grid | |
4324 | data, it remains your responsibility to actually sort it appropriately. | |
4325 | */ | |
4326 | //@{ | |
4327 | ||
4328 | /** | |
4329 | Return the column in which the sorting indicator is currently | |
4330 | displayed. | |
4331 | ||
4332 | Returns @c wxNOT_FOUND if sorting indicator is not currently displayed | |
4333 | at all. | |
4334 | ||
4335 | @see SetSortingColumn() | |
4336 | */ | |
4337 | int GetSortingColumn() const; | |
4338 | ||
4339 | /** | |
4340 | Return @true if this column is currently used for sorting. | |
4341 | ||
4342 | @see GetSortingColumn() | |
4343 | */ | |
4344 | bool IsSortingBy(int col) const; | |
4345 | ||
4346 | /** | |
4347 | Return @true if the current sorting order is ascending or @false if it | |
4348 | is descending. | |
4349 | ||
4350 | It only makes sense to call this function if GetSortingColumn() returns | |
4351 | a valid column index and not @c wxNOT_FOUND. | |
4352 | ||
4353 | @see SetSortingColumn() | |
4354 | */ | |
4355 | bool IsSortOrderAscending() const; | |
4356 | ||
4357 | /** | |
4358 | Set the column to display the sorting indicator in and its direction. | |
4359 | ||
4360 | @param col | |
4361 | The column to display the sorting indicator in or @c wxNOT_FOUND to | |
4362 | remove any currently displayed sorting indicator. | |
4363 | @param ascending | |
4364 | If @true, display the ascending sort indicator, otherwise display | |
4365 | the descending sort indicator. | |
4366 | ||
4367 | @see GetSortingColumn(), IsSortOrderAscending() | |
4368 | */ | |
4369 | void SetSortingColumn(int col, bool ascending = true); | |
4370 | ||
4371 | /** | |
4372 | Remove any currently shown sorting indicator. | |
4373 | ||
4374 | This is equivalent to calling SetSortingColumn() with @c wxNOT_FOUND | |
4375 | first argument. | |
4376 | */ | |
4377 | void UnsetSortingColumn(); | |
4378 | //@} | |
4379 | ||
4380 | ||
4381 | /** | |
4382 | @name Accessors for component windows. | |
4383 | ||
4384 | Return the various child windows of wxGrid. | |
4385 | ||
4386 | wxGrid is an empty parent window for 4 children representing the column | |
4387 | labels window (top), the row labels window (left), the corner window | |
4388 | (top left) and the main grid window. It may be necessary to use these | |
4389 | individual windows and not the wxGrid window itself if you need to | |
4390 | handle events for them (this can be done using wxEvtHandler::Connect() | |
4391 | or wxWindow::PushEventHandler()) or do something else requiring the use | |
4392 | of the correct window pointer. Notice that you should not, however, | |
4393 | change these windows (e.g. reposition them or draw over them) because | |
4394 | they are managed by wxGrid itself. | |
4395 | */ | |
4396 | //@{ | |
4397 | ||
4398 | /** | |
4399 | Return the main grid window containing the grid cells. | |
4400 | ||
4401 | This window is always shown. | |
4402 | */ | |
4403 | wxWindow *GetGridWindow() const; | |
4404 | ||
4405 | /** | |
4406 | Return the row labels window. | |
4407 | ||
4408 | This window is not shown if the row labels were hidden using | |
4409 | HideRowLabels(). | |
4410 | */ | |
4411 | wxWindow *GetGridRowLabelWindow() const; | |
4412 | ||
4413 | /** | |
4414 | Return the column labels window. | |
4415 | ||
4416 | This window is not shown if the columns labels were hidden using | |
4417 | HideColLabels(). | |
4418 | ||
4419 | Depending on whether UseNativeColHeader() was called or not this can be | |
4420 | either a wxHeaderCtrl or a plain wxWindow. This function returns a valid | |
4421 | window pointer in either case but in the former case you can also use | |
4422 | GetGridColHeader() to access it if you need wxHeaderCtrl-specific | |
4423 | functionality. | |
4424 | */ | |
4425 | wxWindow *GetGridColLabelWindow() const; | |
4426 | ||
4427 | /** | |
4428 | Return the window in the top left grid corner. | |
4429 | ||
4430 | This window is shown only of both columns and row labels are shown and | |
4431 | normally doesn't contain anything. Clicking on it is handled by wxGrid | |
4432 | however and can be used to select the entire grid. | |
4433 | */ | |
4434 | wxWindow *GetGridCornerLabelWindow() const; | |
4435 | ||
4436 | /** | |
4437 | Return the header control used for column labels display. | |
4438 | ||
4439 | This function can only be called if UseNativeColHeader() had been | |
4440 | called. | |
4441 | */ | |
4442 | wxHeaderCtrl *GetGridColHeader() const; | |
4443 | ||
4444 | //@} | |
4445 | ||
4446 | protected: | |
4447 | /** | |
4448 | Returns @true if this grid has support for cell attributes. | |
4449 | ||
4450 | The grid supports attributes if it has the associated table which, in | |
4451 | turn, has attributes support, i.e. wxGridTableBase::CanHaveAttributes() | |
4452 | returns @true. | |
4453 | */ | |
4454 | bool CanHaveAttributes() const; | |
4455 | ||
4456 | /** | |
4457 | Get the minimal width of the given column/row. | |
4458 | ||
4459 | The value returned by this function may be different than that returned | |
4460 | by GetColMinimalAcceptableWidth() if SetColMinimalWidth() had been | |
4461 | called for this column. | |
4462 | */ | |
4463 | int GetColMinimalWidth(int col) const; | |
4464 | ||
4465 | /** | |
4466 | Returns the coordinate of the right border specified column. | |
4467 | */ | |
4468 | int GetColRight(int col) const; | |
4469 | ||
4470 | /** | |
4471 | Returns the coordinate of the left border specified column. | |
4472 | */ | |
4473 | int GetColLeft(int col) const; | |
4474 | ||
4475 | /** | |
4476 | Returns the minimal size for the given column. | |
4477 | ||
4478 | The value returned by this function may be different than that returned | |
4479 | by GetRowMinimalAcceptableHeight() if SetRowMinimalHeight() had been | |
4480 | called for this row. | |
4481 | */ | |
4482 | int GetRowMinimalHeight(int col) const; | |
4483 | }; | |
4484 | ||
4485 | ||
4486 | ||
4487 | /** | |
4488 | @class wxGridUpdateLocker | |
4489 | ||
4490 | This small class can be used to prevent wxGrid from redrawing during its | |
4491 | lifetime by calling wxGrid::BeginBatch() in its constructor and | |
4492 | wxGrid::EndBatch() in its destructor. It is typically used in a function | |
4493 | performing several operations with a grid which would otherwise result in | |
4494 | flicker. For example: | |
4495 | ||
4496 | @code | |
4497 | void MyFrame::Foo() | |
4498 | { | |
4499 | m_grid = new wxGrid(this, ...); | |
4500 | ||
4501 | wxGridUpdateLocker noUpdates(m_grid); | |
4502 | m_grid-AppendColumn(); | |
4503 | // ... many other operations with m_grid ... | |
4504 | m_grid-AppendRow(); | |
4505 | ||
4506 | // destructor called, grid refreshed | |
4507 | } | |
4508 | @endcode | |
4509 | ||
4510 | Using this class is easier and safer than calling wxGrid::BeginBatch() and | |
4511 | wxGrid::EndBatch() because you don't risk missing the call the latter (due | |
4512 | to an exception for example). | |
4513 | ||
4514 | @library{wxadv} | |
4515 | @category{grid} | |
4516 | */ | |
4517 | class wxGridUpdateLocker | |
4518 | { | |
4519 | public: | |
4520 | /** | |
4521 | Creates an object preventing the updates of the specified @a grid. The | |
4522 | parameter could be @NULL in which case nothing is done. If @a grid is | |
4523 | non-@NULL then the grid must exist for longer than this | |
4524 | wxGridUpdateLocker object itself. | |
4525 | ||
4526 | The default constructor could be followed by a call to Create() to set | |
4527 | the grid object later. | |
4528 | */ | |
4529 | wxGridUpdateLocker(wxGrid* grid = NULL); | |
4530 | ||
4531 | /** | |
4532 | Destructor reenables updates for the grid this object is associated | |
4533 | with. | |
4534 | */ | |
4535 | ~wxGridUpdateLocker(); | |
4536 | ||
4537 | /** | |
4538 | This method can be called if the object had been constructed using the | |
4539 | default constructor. It must not be called more than once. | |
4540 | */ | |
4541 | void Create(wxGrid* grid); | |
4542 | }; | |
4543 | ||
4544 | ||
4545 | ||
4546 | /** | |
4547 | @class wxGridEvent | |
4548 | ||
4549 | This event class contains information about various grid events. | |
4550 | ||
4551 | Notice that all grid event table macros are available in two versions: | |
4552 | @c EVT_GRID_XXX and @c EVT_GRID_CMD_XXX. The only difference between the | |
4553 | two is that the former doesn't allow to specify the grid window identifier | |
4554 | and so takes a single parameter, the event handler, but is not suitable if | |
4555 | there is more than one grid control in the window where the event table is | |
4556 | used (as it would catch the events from all the grids). The version with @c | |
4557 | CMD takes the id as first argument and the event handler as the second one | |
4558 | and so can be used with multiple grids as well. Otherwise there are no | |
4559 | difference between the two and only the versions without the id are | |
4560 | documented below for brevity. | |
4561 | ||
4562 | @beginEventTable{wxGridEvent} | |
4563 | @event{EVT_GRID_CELL_CHANGING(func)} | |
4564 | The user is about to change the data in a cell. The new cell value as | |
4565 | string is available from GetString() event object method. This event | |
4566 | can be vetoed if the change is not allowed. | |
4567 | Processes a @c wxEVT_GRID_CELL_CHANGING event type. | |
4568 | @event{EVT_GRID_CELL_CHANGED(func)} | |
4569 | The user changed the data in a cell. The old cell value as string is | |
4570 | available from GetString() event object method. Notice that vetoing | |
4571 | this event still works for backwards compatibility reasons but any new | |
4572 | code should only veto EVT_GRID_CELL_CHANGING event and not this one. | |
4573 | Processes a @c wxEVT_GRID_CELL_CHANGED event type. | |
4574 | @event{EVT_GRID_CELL_LEFT_CLICK(func)} | |
4575 | The user clicked a cell with the left mouse button. Processes a | |
4576 | @c wxEVT_GRID_CELL_LEFT_CLICK event type. | |
4577 | @event{EVT_GRID_CELL_LEFT_DCLICK(func)} | |
4578 | The user double-clicked a cell with the left mouse button. Processes a | |
4579 | @c wxEVT_GRID_CELL_LEFT_DCLICK event type. | |
4580 | @event{EVT_GRID_CELL_RIGHT_CLICK(func)} | |
4581 | The user clicked a cell with the right mouse button. Processes a | |
4582 | @c wxEVT_GRID_CELL_RIGHT_CLICK event type. | |
4583 | @event{EVT_GRID_CELL_RIGHT_DCLICK(func)} | |
4584 | The user double-clicked a cell with the right mouse button. Processes a | |
4585 | @c wxEVT_GRID_CELL_RIGHT_DCLICK event type. | |
4586 | @event{EVT_GRID_EDITOR_HIDDEN(func)} | |
4587 | The editor for a cell was hidden. Processes a | |
4588 | @c wxEVT_GRID_EDITOR_HIDDEN event type. | |
4589 | @event{EVT_GRID_EDITOR_SHOWN(func)} | |
4590 | The editor for a cell was shown. Processes a | |
4591 | @c wxEVT_GRID_EDITOR_SHOWN event type. | |
4592 | @event{EVT_GRID_LABEL_LEFT_CLICK(func)} | |
4593 | The user clicked a label with the left mouse button. Processes a | |
4594 | @c wxEVT_GRID_LABEL_LEFT_CLICK event type. | |
4595 | @event{EVT_GRID_LABEL_LEFT_DCLICK(func)} | |
4596 | The user double-clicked a label with the left mouse button. Processes a | |
4597 | @c wxEVT_GRID_LABEL_LEFT_DCLICK event type. | |
4598 | @event{EVT_GRID_LABEL_RIGHT_CLICK(func)} | |
4599 | The user clicked a label with the right mouse button. Processes a | |
4600 | @c wxEVT_GRID_LABEL_RIGHT_CLICK event type. | |
4601 | @event{EVT_GRID_LABEL_RIGHT_DCLICK(func)} | |
4602 | The user double-clicked a label with the right mouse button. Processes | |
4603 | a @c wxEVT_GRID_LABEL_RIGHT_DCLICK event type. | |
4604 | @event{EVT_GRID_SELECT_CELL(func)} | |
4605 | The given cell was made current, either by user or by the program via a | |
4606 | call to SetGridCursor() or GoToCell(). Processes a | |
4607 | @c wxEVT_GRID_SELECT_CELL event type. | |
4608 | @event{EVT_GRID_COL_MOVE(func)} | |
4609 | The user tries to change the order of the columns in the grid by | |
4610 | dragging the column specified by GetCol(). This event can be vetoed to | |
4611 | either prevent the user from reordering the column change completely | |
4612 | (but notice that if you don't want to allow it at all, you simply | |
4613 | shouldn't call wxGrid::EnableDragColMove() in the first place), vetoed | |
4614 | but handled in some way in the handler, e.g. by really moving the | |
4615 | column to the new position at the associated table level, or allowed to | |
4616 | proceed in which case wxGrid::SetColPos() is used to reorder the | |
4617 | columns display order without affecting the use of the column indices | |
4618 | otherwise. | |
4619 | This event macro corresponds to @c wxEVT_GRID_COL_MOVE event type. | |
4620 | @event{EVT_GRID_COL_SORT(func)} | |
4621 | This event is generated when a column is clicked by the user and its | |
4622 | name is explained by the fact that the custom reaction to a click on a | |
4623 | column is to sort the grid contents by this column. However the grid | |
4624 | itself has no special support for sorting and it's up to the handler of | |
4625 | this event to update the associated table. But if the event is handled | |
4626 | (and not vetoed) the grid supposes that the table was indeed resorted | |
4627 | and updates the column to indicate the new sort order and refreshes | |
4628 | itself. | |
4629 | This event macro corresponds to @c wxEVT_GRID_COL_SORT event type. | |
4630 | @event{EVT_GRID_TABBING(func)} | |
4631 | This event is generated when the user presses TAB or Shift-TAB in the | |
4632 | grid. It can be used to customize the simple default TAB handling | |
4633 | logic, e.g. to go to the next non-empty cell instead of just the next | |
4634 | cell. See also wxGrid::SetTabBehaviour(). This event is new since | |
4635 | wxWidgets 2.9.5. | |
4636 | @endEventTable | |
4637 | ||
4638 | @library{wxadv} | |
4639 | @category{grid,events} | |
4640 | */ | |
4641 | class wxGridEvent : public wxNotifyEvent | |
4642 | { | |
4643 | public: | |
4644 | /** | |
4645 | Default constructor. | |
4646 | */ | |
4647 | wxGridEvent(); | |
4648 | /** | |
4649 | Constructor for initializing all event attributes. | |
4650 | */ | |
4651 | wxGridEvent(int id, wxEventType type, wxObject* obj, | |
4652 | int row = -1, int col = -1, int x = -1, int y = -1, | |
4653 | bool sel = true, const wxKeyboardState& kbd = wxKeyboardState()); | |
4654 | ||
4655 | /** | |
4656 | Returns @true if the Alt key was down at the time of the event. | |
4657 | */ | |
4658 | bool AltDown() const; | |
4659 | ||
4660 | /** | |
4661 | Returns @true if the Control key was down at the time of the event. | |
4662 | */ | |
4663 | bool ControlDown() const; | |
4664 | ||
4665 | /** | |
4666 | Column at which the event occurred. | |
4667 | ||
4668 | Notice that for a @c wxEVT_GRID_SELECT_CELL event this column is the | |
4669 | column of the newly selected cell while the previously selected cell | |
4670 | can be retrieved using wxGrid::GetGridCursorCol(). | |
4671 | */ | |
4672 | virtual int GetCol(); | |
4673 | ||
4674 | /** | |
4675 | Position in pixels at which the event occurred. | |
4676 | */ | |
4677 | wxPoint GetPosition(); | |
4678 | ||
4679 | /** | |
4680 | Row at which the event occurred. | |
4681 | ||
4682 | Notice that for a @c wxEVT_GRID_SELECT_CELL event this row is the row | |
4683 | of the newly selected cell while the previously selected cell can be | |
4684 | retrieved using wxGrid::GetGridCursorRow(). | |
4685 | */ | |
4686 | virtual int GetRow(); | |
4687 | ||
4688 | /** | |
4689 | Returns @true if the Meta key was down at the time of the event. | |
4690 | */ | |
4691 | bool MetaDown() const; | |
4692 | ||
4693 | /** | |
4694 | Returns @true if the user is selecting grid cells, or @false if | |
4695 | deselecting. | |
4696 | */ | |
4697 | bool Selecting(); | |
4698 | ||
4699 | /** | |
4700 | Returns @true if the Shift key was down at the time of the event. | |
4701 | */ | |
4702 | bool ShiftDown() const; | |
4703 | }; | |
4704 | ||
4705 | ||
4706 | ||
4707 | /** | |
4708 | @class wxGridSizeEvent | |
4709 | ||
4710 | This event class contains information about a row/column resize event. | |
4711 | ||
4712 | @beginEventTable{wxGridSizeEvent} | |
4713 | @event{EVT_GRID_CMD_COL_SIZE(id, func)} | |
4714 | The user resized a column, corresponds to @c wxEVT_GRID_COL_SIZE event | |
4715 | type. | |
4716 | @event{EVT_GRID_CMD_ROW_SIZE(id, func)} | |
4717 | The user resized a row, corresponds to @c wxEVT_GRID_ROW_SIZE event | |
4718 | type. | |
4719 | @event{EVT_GRID_COL_SIZE(func)} | |
4720 | Same as EVT_GRID_CMD_COL_SIZE() but uses `wxID_ANY` id. | |
4721 | @event{EVT_GRID_COL_AUTO_SIZE(func)} | |
4722 | This event is sent when a column must be resized to its best size, e.g. | |
4723 | when the user double clicks the column divider. The default | |
4724 | implementation simply resizes the column to fit the column label (but | |
4725 | not its contents as this could be too slow for big grids). This macro | |
4726 | corresponds to @c wxEVT_GRID_COL_AUTO_SIZE event type and is new since | |
4727 | wxWidgets 2.9.5. | |
4728 | @event{EVT_GRID_ROW_SIZE(func)} | |
4729 | Same as EVT_GRID_CMD_ROW_SIZE() but uses `wxID_ANY` id. | |
4730 | @endEventTable | |
4731 | ||
4732 | @library{wxadv} | |
4733 | @category{grid,events} | |
4734 | */ | |
4735 | class wxGridSizeEvent : public wxNotifyEvent | |
4736 | { | |
4737 | public: | |
4738 | /** | |
4739 | Default constructor. | |
4740 | */ | |
4741 | wxGridSizeEvent(); | |
4742 | /** | |
4743 | Constructor for initializing all event attributes. | |
4744 | */ | |
4745 | wxGridSizeEvent(int id, wxEventType type, wxObject* obj, | |
4746 | int rowOrCol = -1, int x = -1, int y = -1, | |
4747 | const wxKeyboardState& kbd = wxKeyboardState()); | |
4748 | ||
4749 | /** | |
4750 | Returns @true if the Alt key was down at the time of the event. | |
4751 | */ | |
4752 | bool AltDown() const; | |
4753 | ||
4754 | /** | |
4755 | Returns @true if the Control key was down at the time of the event. | |
4756 | */ | |
4757 | bool ControlDown() const; | |
4758 | ||
4759 | /** | |
4760 | Position in pixels at which the event occurred. | |
4761 | */ | |
4762 | wxPoint GetPosition(); | |
4763 | ||
4764 | /** | |
4765 | Row or column at that was resized. | |
4766 | */ | |
4767 | int GetRowOrCol(); | |
4768 | ||
4769 | /** | |
4770 | Returns @true if the Meta key was down at the time of the event. | |
4771 | */ | |
4772 | bool MetaDown() const; | |
4773 | ||
4774 | /** | |
4775 | Returns @true if the Shift key was down at the time of the event. | |
4776 | */ | |
4777 | bool ShiftDown() const; | |
4778 | }; | |
4779 | ||
4780 | ||
4781 | ||
4782 | /** | |
4783 | @class wxGridRangeSelectEvent | |
4784 | ||
4785 | @beginEventTable{wxGridRangeSelectEvent} | |
4786 | @event{EVT_GRID_RANGE_SELECT(func)} | |
4787 | The user selected a group of contiguous cells. Processes a | |
4788 | @c wxEVT_GRID_RANGE_SELECT event type. | |
4789 | @event{EVT_GRID_CMD_RANGE_SELECT(id, func)} | |
4790 | The user selected a group of contiguous cells; variant taking a window | |
4791 | identifier. Processes a @c wxEVT_GRID_RANGE_SELECT event type. | |
4792 | @endEventTable | |
4793 | ||
4794 | @library{wxadv} | |
4795 | @category{grid,events} | |
4796 | */ | |
4797 | class wxGridRangeSelectEvent : public wxNotifyEvent | |
4798 | { | |
4799 | public: | |
4800 | /** | |
4801 | Default constructor. | |
4802 | */ | |
4803 | wxGridRangeSelectEvent(); | |
4804 | /** | |
4805 | Constructor for initializing all event attributes. | |
4806 | */ | |
4807 | wxGridRangeSelectEvent(int id, wxEventType type, | |
4808 | wxObject* obj, | |
4809 | const wxGridCellCoords& topLeft, | |
4810 | const wxGridCellCoords& bottomRight, | |
4811 | bool sel = true, const wxKeyboardState& kbd = wxKeyboardState()); | |
4812 | ||
4813 | /** | |
4814 | Returns @true if the Alt key was down at the time of the event. | |
4815 | */ | |
4816 | bool AltDown() const; | |
4817 | ||
4818 | /** | |
4819 | Returns @true if the Control key was down at the time of the event. | |
4820 | */ | |
4821 | bool ControlDown() const; | |
4822 | ||
4823 | /** | |
4824 | Top left corner of the rectangular area that was (de)selected. | |
4825 | */ | |
4826 | wxGridCellCoords GetBottomRightCoords(); | |
4827 | ||
4828 | /** | |
4829 | Bottom row of the rectangular area that was (de)selected. | |
4830 | */ | |
4831 | int GetBottomRow(); | |
4832 | ||
4833 | /** | |
4834 | Left column of the rectangular area that was (de)selected. | |
4835 | */ | |
4836 | int GetLeftCol(); | |
4837 | ||
4838 | /** | |
4839 | Right column of the rectangular area that was (de)selected. | |
4840 | */ | |
4841 | int GetRightCol(); | |
4842 | ||
4843 | /** | |
4844 | Top left corner of the rectangular area that was (de)selected. | |
4845 | */ | |
4846 | wxGridCellCoords GetTopLeftCoords(); | |
4847 | ||
4848 | /** | |
4849 | Top row of the rectangular area that was (de)selected. | |
4850 | */ | |
4851 | int GetTopRow(); | |
4852 | ||
4853 | /** | |
4854 | Returns @true if the Meta key was down at the time of the event. | |
4855 | */ | |
4856 | bool MetaDown() const; | |
4857 | ||
4858 | /** | |
4859 | Returns @true if the area was selected, @false otherwise. | |
4860 | */ | |
4861 | bool Selecting(); | |
4862 | ||
4863 | /** | |
4864 | Returns @true if the Shift key was down at the time of the event. | |
4865 | */ | |
4866 | bool ShiftDown() const; | |
4867 | }; | |
4868 | ||
4869 | ||
4870 | ||
4871 | /** | |
4872 | @class wxGridEditorCreatedEvent | |
4873 | ||
4874 | @beginEventTable{wxGridEditorCreatedEvent} | |
4875 | @event{EVT_GRID_EDITOR_CREATED(func)} | |
4876 | The editor for a cell was created. Processes a | |
4877 | @c wxEVT_GRID_EDITOR_CREATED event type. | |
4878 | @event{EVT_GRID_CMD_EDITOR_CREATED(id, func)} | |
4879 | The editor for a cell was created; variant taking a window identifier. | |
4880 | Processes a @c wxEVT_GRID_EDITOR_CREATED event type. | |
4881 | @endEventTable | |
4882 | ||
4883 | @library{wxadv} | |
4884 | @category{grid,events} | |
4885 | */ | |
4886 | class wxGridEditorCreatedEvent : public wxCommandEvent | |
4887 | { | |
4888 | public: | |
4889 | /** | |
4890 | Default constructor. | |
4891 | */ | |
4892 | wxGridEditorCreatedEvent(); | |
4893 | /** | |
4894 | Constructor for initializing all event attributes. | |
4895 | */ | |
4896 | wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, | |
4897 | int row, int col, wxControl* ctrl); | |
4898 | ||
4899 | /** | |
4900 | Returns the column at which the event occurred. | |
4901 | */ | |
4902 | int GetCol(); | |
4903 | ||
4904 | /** | |
4905 | Returns the edit control. | |
4906 | */ | |
4907 | wxControl* GetControl(); | |
4908 | ||
4909 | /** | |
4910 | Returns the row at which the event occurred. | |
4911 | */ | |
4912 | int GetRow(); | |
4913 | ||
4914 | /** | |
4915 | Sets the column at which the event occurred. | |
4916 | */ | |
4917 | void SetCol(int col); | |
4918 | ||
4919 | /** | |
4920 | Sets the edit control. | |
4921 | */ | |
4922 | void SetControl(wxControl* ctrl); | |
4923 | ||
4924 | /** | |
4925 | Sets the row at which the event occurred. | |
4926 | */ | |
4927 | void SetRow(int row); | |
4928 | }; | |
4929 | ||
4930 | ||
4931 | wxEventType wxEVT_GRID_CELL_LEFT_CLICK; | |
4932 | wxEventType wxEVT_GRID_CELL_RIGHT_CLICK; | |
4933 | wxEventType wxEVT_GRID_CELL_LEFT_DCLICK; | |
4934 | wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK; | |
4935 | wxEventType wxEVT_GRID_LABEL_LEFT_CLICK; | |
4936 | wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK; | |
4937 | wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK; | |
4938 | wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK; | |
4939 | wxEventType wxEVT_GRID_ROW_SIZE; | |
4940 | wxEventType wxEVT_GRID_COL_SIZE; | |
4941 | wxEventType wxEVT_GRID_COL_AUTO_SIZE; | |
4942 | wxEventType wxEVT_GRID_RANGE_SELECT; | |
4943 | wxEventType wxEVT_GRID_CELL_CHANGING; | |
4944 | wxEventType wxEVT_GRID_CELL_CHANGED; | |
4945 | wxEventType wxEVT_GRID_SELECT_CELL; | |
4946 | wxEventType wxEVT_GRID_EDITOR_SHOWN; | |
4947 | wxEventType wxEVT_GRID_EDITOR_HIDDEN; | |
4948 | wxEventType wxEVT_GRID_EDITOR_CREATED; | |
4949 | wxEventType wxEVT_GRID_CELL_BEGIN_DRAG; | |
4950 | wxEventType wxEVT_GRID_COL_MOVE; | |
4951 | wxEventType wxEVT_GRID_COL_SORT; | |
4952 | wxEventType wxEVT_GRID_TABBING; | |
4953 |