]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/grid.h
remove references to datetime_constants; they're not needed anymore
[wxWidgets.git] / interface / wx / grid.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: grid.h
afe0e400 3// Purpose: interface of wxGrid and related classes
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
8b9ef005
BP
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 wxGridCellBoolRenderer, wxGridCellFloatRenderer,
22 wxGridCellNumberRenderer, wxGridCellStringRenderer
23*/
24class wxGridCellRenderer
25{
26public:
27 /**
28 This function must be implemented in derived classes to return a copy
29 of itself.
30 */
31 virtual wxGridCellRenderer* Clone() const = 0;
32
33 /**
34 Draw the given cell on the provided DC inside the given rectangle using
35 the style specified by the attribute and the default or selected state
36 corresponding to the isSelected value.
37
38 This pure virtual function has a default implementation which will
39 prepare the DC using the given attribute: it will draw the rectangle
40 with the background colour from attr and set the text colour and font.
41 */
42 virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
43 const wxRect& rect, int row, int col,
44 bool isSelected) = 0;
45
46 /**
47 Get the preferred size of the cell for its contents.
48 */
49 virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
50 int row, int col) = 0;
51};
52
53/**
54 @class wxGridCellBoolRenderer
55
56 This class may be used to format boolean data in a cell.
57
58 @library{wxadv}
59 @category{grid}
60
61 @see wxGridCellRenderer, wxGridCellFloatRenderer, wxGridCellNumberRenderer,
62 wxGridCellStringRenderer
63*/
64class wxGridCellBoolRenderer : public wxGridCellRenderer
65{
66public:
67 /**
68 Default constructor.
69 */
70 wxGridCellBoolRenderer();
71};
72
23324ae1
FM
73/**
74 @class wxGridCellFloatRenderer
7c913512 75
23324ae1 76 This class may be used to format floating point data in a cell.
7c913512 77
23324ae1 78 @library{wxadv}
42b5841f 79 @category{grid}
7c913512 80
afe0e400
BP
81 @see wxGridCellRenderer, wxGridCellBoolRenderer, wxGridCellNumberRenderer,
82 wxGridCellStringRenderer
23324ae1
FM
83*/
84class wxGridCellFloatRenderer : public wxGridCellStringRenderer
85{
86public:
87 /**
7c913512 88 @param width
4cc4bfaf 89 Minimum number of characters to be shown.
7c913512 90 @param precision
4cc4bfaf 91 Number of digits after the decimal dot.
23324ae1
FM
92 */
93 wxGridCellFloatRenderer(int width = -1, int precision = -1);
94
95 /**
42b5841f 96 Returns the precision.
23324ae1 97 */
328f5751 98 int GetPrecision() const;
23324ae1
FM
99
100 /**
42b5841f 101 Returns the width.
23324ae1 102 */
328f5751 103 int GetWidth() const;
23324ae1
FM
104
105 /**
106 Parameters string format is "width[,precision]".
107 */
adaaa686 108 virtual void SetParameters(const wxString& params);
23324ae1
FM
109
110 /**
42b5841f 111 Sets the precision.
23324ae1
FM
112 */
113 void SetPrecision(int precision);
114
115 /**
42b5841f 116 Sets the width.
23324ae1
FM
117 */
118 void SetWidth(int width);
119};
120
23324ae1 121/**
8b9ef005 122 @class wxGridCellNumberRenderer
7c913512 123
8b9ef005 124 This class may be used to format integer data in a cell.
5039f140 125
8b9ef005
BP
126 @library{wxadv}
127 @category{grid}
5039f140 128
8b9ef005
BP
129 @see wxGridCellRenderer, wxGridCellBoolRenderer, wxGridCellFloatRenderer,
130 wxGridCellStringRenderer
131*/
132class wxGridCellNumberRenderer : public wxGridCellStringRenderer
133{
134public:
135 /**
136 Default constructor.
137 */
138 wxGridCellNumberRenderer();
139};
5039f140 140
8b9ef005
BP
141/**
142 @class wxGridCellStringRenderer
143
144 This class may be used to format string data in a cell; it is the default
145 for string cells.
7c913512 146
23324ae1 147 @library{wxadv}
42b5841f 148 @category{grid}
8b9ef005
BP
149
150 @see wxGridCellRenderer, wxGridCellBoolRenderer, wxGridCellFloatRenderer,
151 wxGridCellNumberRenderer
23324ae1 152*/
8b9ef005 153class wxGridCellStringRenderer : public wxGridCellRenderer
23324ae1
FM
154{
155public:
afe0e400
BP
156 /**
157 Default constructor.
8b9ef005
BP
158 */
159 wxGridCellStringRenderer();
160};
23324ae1 161
3c4f71cc 162
77d2c45c 163
8b9ef005
BP
164/**
165 @class wxGridCellEditor
23324ae1 166
8b9ef005
BP
167 This class is responsible for providing and manipulating the in-place edit
168 controls for the grid. Instances of wxGridCellEditor (actually, instances
169 of derived classes since it is an abstract class) can be associated with
170 the cell attributes for individual cells, rows, columns, or even for the
171 entire grid.
77d2c45c 172
8b9ef005
BP
173 @library{wxadv}
174 @category{grid}
3c4f71cc 175
8b9ef005
BP
176 @see wxGridCellBoolEditor, wxGridCellChoiceEditor, wxGridCellFloatEditor,
177 wxGridCellNumberEditor, wxGridCellTextEditor
178*/
179class wxGridCellEditor
180{
181public:
77d2c45c 182 /**
8b9ef005
BP
183 Default constructor.
184 */
185 wxGridCellEditor();
77d2c45c
VZ
186
187 /**
8b9ef005 188 Fetch the value from the table and prepare the edit control to begin
763163a8
VZ
189 editing.
190
191 This function should save the original value of the grid cell at the
192 given @a row and @a col and show the control allowing the user to
193 change it.
194
195 @see EndEdit()
8b9ef005
BP
196 */
197 virtual void BeginEdit(int row, int col, wxGrid* grid) = 0;
77d2c45c 198
8b9ef005
BP
199 /**
200 Create a new object which is the copy of this one.
201 */
202 virtual wxGridCellEditor* Clone() const = 0;
23324ae1
FM
203
204 /**
8b9ef005
BP
205 Creates the actual edit control.
206 */
207 virtual void Create(wxWindow* parent, wxWindowID id,
208 wxEvtHandler* evtHandler) = 0;
3c4f71cc 209
afe0e400 210 /**
8b9ef005
BP
211 Final cleanup.
212 */
213 virtual void Destroy();
23324ae1 214
10a4531d 215 /**
763163a8 216 End editing the cell.
10a4531d 217
763163a8
VZ
218 This function must check if the current value of the editing control is
219 valid and different from the original value (available as @a oldval in
220 its string form and possibly saved internally using its real type by
221 BeginEdit()). If it isn't, it just returns @false, otherwise it fills
222 @a newval with the representation of the new value in the string form,
223 if necessary saves it using its real type internally, and returns @true.
224
225 If the user-defined wxEVT_GRID_CELL_CHANGING event handler doesn't veto
226 this change, ApplyEdit() will be called next.
8b9ef005 227 */
d56f17d8 228 virtual bool EndEdit(const wxString& oldval, wxString* newval) = 0;
10a4531d 229
763163a8
VZ
230 /**
231 Effectively save the changes in the grid.
232
233 This function should save the value of the control in the grid. It is
234 called only after EndEdit() returns @true.
235 */
236 virtual void ApplyEdit(int row, int col, wxGrid* grid) = 0;
237
afe0e400 238 /**
8b9ef005
BP
239 Some types of controls on some platforms may need some help with the
240 Return key.
241 */
242 virtual void HandleReturn(wxKeyEvent& event);
3c4f71cc 243
afe0e400 244 /**
8b9ef005
BP
245 Returns @true if the edit control has been created.
246 */
247 bool IsCreated();
23324ae1
FM
248
249 /**
8b9ef005
BP
250 Draws the part of the cell not occupied by the control: the base class
251 version just fills it with background colour from the attribute.
252 */
253 virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr* attr);
23324ae1
FM
254
255 /**
8b9ef005
BP
256 Reset the value in the control back to its starting value.
257 */
258 virtual void Reset() = 0;
3c4f71cc 259
8b9ef005
BP
260 /**
261 Size and position the edit control.
262 */
263 virtual void SetSize(const wxRect& rect);
23324ae1
FM
264
265 /**
8b9ef005
BP
266 Show or hide the edit control, use the specified attributes to set
267 colours/fonts for it.
268 */
269 virtual void Show(bool show, wxGridCellAttr* attr = NULL);
3c4f71cc 270
8b9ef005
BP
271 /**
272 If the editor is enabled by clicking on the cell, this method will be
273 called.
274 */
275 virtual void StartingClick();
23324ae1
FM
276
277 /**
8b9ef005
BP
278 If the editor is enabled by pressing keys on the grid, this will be
279 called to let the editor do something about that first key if desired.
280 */
281 virtual void StartingKey(wxKeyEvent& event);
3c4f71cc 282
8b9ef005 283protected:
23324ae1
FM
284
285 /**
8b9ef005
BP
286 The destructor is private because only DecRef() can delete us.
287 */
288 virtual ~wxGridCellEditor();
289};
3c4f71cc 290
8b9ef005
BP
291/**
292 @class wxGridCellBoolEditor
23324ae1 293
8b9ef005 294 Grid cell editor for boolean data.
23324ae1 295
8b9ef005
BP
296 @library{wxadv}
297 @category{grid}
23324ae1 298
8b9ef005
BP
299 @see wxGridCellEditor, wxGridCellChoiceEditor, wxGridCellFloatEditor,
300 wxGridCellNumberEditor, wxGridCellTextEditor
301*/
302class wxGridCellBoolEditor : public wxGridCellEditor
303{
304public:
23324ae1 305 /**
8b9ef005
BP
306 Default constructor.
307 */
308 wxGridCellBoolEditor();
5039f140 309
8b9ef005
BP
310 /**
311 Returns @true if the given @a value is equal to the string
312 representation of the truth value we currently use (see
313 UseStringValues()).
314 */
315 static bool IsTrueValue(const wxString& value);
3c4f71cc 316
23324ae1 317 /**
8b9ef005
BP
318 This method allows you to customize the values returned by GetValue()
319 for the cell using this editor. By default, the default values of the
320 arguments are used, i.e. @c "1" is returned if the cell is checked and
321 an empty string otherwise.
322 */
323 static void UseStringValues(const wxString& valueTrue = "1",
57bf907d 324 const wxString& valueFalse = wxEmptyString);
8b9ef005 325};
3c4f71cc 326
8b9ef005
BP
327/**
328 @class wxGridCellChoiceEditor
23324ae1 329
8b9ef005
BP
330 Grid cell editor for string data providing the user a choice from a list of
331 strings.
5039f140 332
8b9ef005
BP
333 @library{wxadv}
334 @category{grid}
23324ae1 335
8b9ef005
BP
336 @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellFloatEditor,
337 wxGridCellNumberEditor, wxGridCellTextEditor
338*/
339class wxGridCellChoiceEditor : public wxGridCellEditor
340{
341public:
23324ae1 342 /**
8b9ef005
BP
343 @param count
344 Number of strings from which the user can choose.
345 @param choices
346 An array of strings from which the user can choose.
347 @param allowOthers
348 If allowOthers is @true, the user can type a string not in choices
349 array.
350 */
351 wxGridCellChoiceEditor(size_t count = 0,
352 const wxString choices[] = NULL,
353 bool allowOthers = false);
354 /**
355 @param choices
356 An array of strings from which the user can choose.
357 @param allowOthers
358 If allowOthers is @true, the user can type a string not in choices
359 array.
360 */
361 wxGridCellChoiceEditor(const wxArrayString& choices,
362 bool allowOthers = false);
23324ae1
FM
363
364 /**
8b9ef005
BP
365 Parameters string format is "item1[,item2[...,itemN]]"
366 */
367 virtual void SetParameters(const wxString& params);
368};
23324ae1 369
8b9ef005
BP
370/**
371 @class wxGridCellTextEditor
3c4f71cc 372
8b9ef005 373 Grid cell editor for string/text data.
23324ae1 374
8b9ef005
BP
375 @library{wxadv}
376 @category{grid}
afe0e400 377
8b9ef005
BP
378 @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor,
379 wxGridCellFloatEditor, wxGridCellNumberEditor
380*/
381class wxGridCellTextEditor : public wxGridCellEditor
382{
383public:
23324ae1 384 /**
8b9ef005
BP
385 Default constructor.
386 */
387 wxGridCellTextEditor();
23324ae1
FM
388
389 /**
8b9ef005
BP
390 The parameters string format is "n" where n is a number representing
391 the maximum width.
392 */
393 virtual void SetParameters(const wxString& params);
394};
5039f140 395
8b9ef005
BP
396/**
397 @class wxGridCellFloatEditor
23324ae1 398
8b9ef005 399 The editor for floating point numbers data.
3c4f71cc 400
8b9ef005
BP
401 @library{wxadv}
402 @category{grid}
23324ae1 403
8b9ef005
BP
404 @see wxGridCellEditor, wxGridCellNumberEditor, wxGridCellBoolEditor,
405 wxGridCellTextEditor, wxGridCellChoiceEditor
406*/
407class wxGridCellFloatEditor : public wxGridCellTextEditor
408{
409public:
23324ae1 410 /**
8b9ef005
BP
411 @param width
412 Minimum number of characters to be shown.
413 @param precision
414 Number of digits after the decimal dot.
415 */
416 wxGridCellFloatEditor(int width = -1, int precision = -1);
23324ae1
FM
417
418 /**
8b9ef005
BP
419 Parameters string format is "width,precision"
420 */
421 virtual void SetParameters(const wxString& params);
422};
23324ae1 423
8b9ef005
BP
424/**
425 @class wxGridCellNumberEditor
3c4f71cc 426
8b9ef005 427 Grid cell editor for numeric integer data.
5039f140 428
8b9ef005
BP
429 @library{wxadv}
430 @category{grid}
23324ae1 431
8b9ef005
BP
432 @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor,
433 wxGridCellFloatEditor, wxGridCellTextEditor
434*/
435class wxGridCellNumberEditor : public wxGridCellTextEditor
436{
437public:
23324ae1 438 /**
8b9ef005
BP
439 Allows you to specify the range for acceptable data. Values equal to
440 -1 for both @a min and @a max indicate that no range checking should be
441 done.
442 */
443 wxGridCellNumberEditor(int min = -1, int max = -1);
3c4f71cc 444
23324ae1 445
afe0e400 446 /**
8b9ef005
BP
447 Parameters string format is "min,max".
448 */
449 virtual void SetParameters(const wxString& params);
450
451protected:
3c4f71cc 452
afe0e400 453 /**
8b9ef005
BP
454 If the return value is @true, the editor uses a wxSpinCtrl to get user
455 input, otherwise it uses a wxTextCtrl.
456 */
457 bool HasRange() const;
23324ae1 458
afe0e400 459 /**
8b9ef005
BP
460 String representation of the value.
461 */
462 wxString GetString() const;
463};
23324ae1 464
23324ae1 465
3c4f71cc 466
8b9ef005
BP
467/**
468 @class wxGridCellAttr
23324ae1 469
8b9ef005
BP
470 This class can be used to alter the cells' appearance in the grid by
471 changing their attributes from the defaults. An object of this class may be
472 returned by wxGridTableBase::GetAttr().
5039f140 473
8b9ef005
BP
474 @library{wxadv}
475 @category{grid}
476*/
477class wxGridCellAttr
478{
479public:
afe0e400 480 /**
8b9ef005
BP
481 Default constructor.
482 */
ccf39540 483 wxGridCellAttr(wxGridCellAttr* attrDefault = NULL);
23324ae1 484 /**
8b9ef005
BP
485 Constructor specifying some of the often used attributes.
486 */
487 wxGridCellAttr(const wxColour& colText, const wxColour& colBack,
488 const wxFont& font, int hAlign, int vAlign);
5039f140 489
afe0e400 490 /**
8b9ef005
BP
491 Creates a new copy of this object.
492 */
493 wxGridCellAttr* Clone() const;
23324ae1
FM
494
495 /**
8b9ef005
BP
496 This class is reference counted: it is created with ref count of 1, so
497 calling DecRef() once will delete it. Calling IncRef() allows to lock
498 it until the matching DecRef() is called.
499 */
500 void DecRef();
23324ae1
FM
501
502 /**
8b9ef005
BP
503 See SetAlignment() for the returned values.
504 */
505 void GetAlignment(int* hAlign, int* vAlign) const;
23324ae1
FM
506
507 /**
8b9ef005
BP
508 Returns the background colour.
509 */
510 const wxColour& GetBackgroundColour() const;
23324ae1 511
23324ae1 512 /**
8b9ef005
BP
513 Returns the cell editor.
514 */
515 wxGridCellEditor* GetEditor(const wxGrid* grid, int row, int col) const;
23324ae1
FM
516
517 /**
8b9ef005
BP
518 Returns the font.
519 */
520 const wxFont& GetFont() const;
23324ae1
FM
521
522 /**
8b9ef005
BP
523 Returns the cell renderer.
524 */
525 wxGridCellRenderer* GetRenderer(const wxGrid* grid, int row, int col) const;
23324ae1
FM
526
527 /**
8b9ef005
BP
528 Returns the text colour.
529 */
530 const wxColour& GetTextColour() const;
5e6e278d
FM
531
532 /**
8b9ef005
BP
533 Returns @true if this attribute has a valid alignment set.
534 */
535 bool HasAlignment() const;
7c913512 536
23324ae1 537 /**
8b9ef005 538 Returns @true if this attribute has a valid background colour set.
23324ae1 539 */
8b9ef005 540 bool HasBackgroundColour() const;
23324ae1 541
23324ae1 542 /**
8b9ef005 543 Returns @true if this attribute has a valid cell editor set.
23324ae1 544 */
8b9ef005 545 bool HasEditor() const;
23324ae1
FM
546
547 /**
8b9ef005 548 Returns @true if this attribute has a valid font set.
23324ae1 549 */
8b9ef005 550 bool HasFont() const;
23324ae1
FM
551
552 /**
8b9ef005 553 Returns @true if this attribute has a valid cell renderer set.
23324ae1 554 */
8b9ef005 555 bool HasRenderer() const;
23324ae1
FM
556
557 /**
8b9ef005 558 Returns @true if this attribute has a valid text colour set.
23324ae1 559 */
8b9ef005 560 bool HasTextColour() const;
23324ae1
FM
561
562 /**
8b9ef005
BP
563 This class is reference counted: it is created with ref count of 1, so
564 calling DecRef() once will delete it. Calling IncRef() allows to lock
565 it until the matching DecRef() is called.
23324ae1 566 */
8b9ef005 567 void IncRef();
23324ae1
FM
568
569 /**
8b9ef005 570 Returns @true if this cell is set as read-only.
23324ae1 571 */
8b9ef005 572 bool IsReadOnly() const;
23324ae1
FM
573
574 /**
8b9ef005
BP
575 Sets the alignment. @a hAlign can be one of @c wxALIGN_LEFT,
576 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT and @a vAlign can be one of
577 @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
23324ae1 578 */
8b9ef005 579 void SetAlignment(int hAlign, int vAlign);
23324ae1
FM
580
581 /**
8b9ef005 582 Sets the background colour.
23324ae1 583 */
8b9ef005 584 void SetBackgroundColour(const wxColour& colBack);
23324ae1
FM
585
586 /**
8b9ef005 587 @todo Needs documentation.
23324ae1 588 */
8b9ef005 589 void SetDefAttr(wxGridCellAttr* defAttr);
23324ae1
FM
590
591 /**
8b9ef005 592 Sets the editor to be used with the cells with this attribute.
23324ae1 593 */
8b9ef005 594 void SetEditor(wxGridCellEditor* editor);
23324ae1
FM
595
596 /**
8b9ef005 597 Sets the font.
23324ae1 598 */
8b9ef005 599 void SetFont(const wxFont& font);
23324ae1
FM
600
601 /**
8b9ef005 602 Sets the cell as read-only.
23324ae1 603 */
8b9ef005 604 void SetReadOnly(bool isReadOnly = true);
23324ae1
FM
605
606 /**
8b9ef005
BP
607 Sets the renderer to be used for cells with this attribute. Takes
608 ownership of the pointer.
23324ae1 609 */
8b9ef005 610 void SetRenderer(wxGridCellRenderer* renderer);
5e6e278d
FM
611
612 /**
8b9ef005 613 Sets the text colour.
5e6e278d 614 */
8b9ef005 615 void SetTextColour(const wxColour& colText);
23324ae1
FM
616};
617
618
e54c96f1 619
23324ae1 620/**
8b9ef005 621 @class wxGridTableBase
7c913512 622
8b9ef005
BP
623 The almost abstract base class for grid tables.
624
625 A grid table is responsible for storing the grid data and, indirectly, grid
626 cell attributes. The data can be stored in the way most convenient for the
627 application but has to be provided in string form to wxGrid. It is also
628 possible to provide cells values in other formats if appropriate, e.g. as
629 numbers.
630
631 This base class is not quite abstract as it implements a trivial strategy
632 for storing the attributes by forwarding it to wxGridCellAttrProvider and
633 also provides stubs for some other functions. However it does have a number
634 of pure virtual methods which must be implemented in the derived classes.
635
636 @see wxGridStringTable
7c913512 637
23324ae1 638 @library{wxadv}
42b5841f 639 @category{grid}
23324ae1 640*/
8b9ef005 641class wxGridTableBase : public wxObject
23324ae1
FM
642{
643public:
644 /**
645 Default constructor.
8b9ef005
BP
646 */
647 wxGridTableBase();
23324ae1
FM
648
649 /**
8b9ef005
BP
650 Destructor frees the attribute provider if it was created.
651 */
652 virtual ~wxGridTableBase();
23324ae1 653
8b9ef005
BP
654 /**
655 Must be overridden to return the number of rows in the table.
e54c96f1 656
8b9ef005
BP
657 For backwards compatibility reasons, this method is not const.
658 Use GetRowsCount() instead of it in const methods of derived table
659 classes.
660 */
661 virtual int GetNumberRows() = 0;
7c913512 662
8b9ef005
BP
663 /**
664 Must be overridden to return the number of columns in the table.
7c913512 665
8b9ef005
BP
666 For backwards compatibility reasons, this method is not const.
667 Use GetColsCount() instead of it in const methods of derived table
668 classes,
669 */
670 virtual int GetNumberCols() = 0;
7c913512 671
23324ae1 672 /**
8b9ef005 673 Return the number of rows in the table.
23324ae1 674
8b9ef005
BP
675 This method is not virtual and is only provided as a convenience for
676 the derived classes which can't call GetNumberRows() without a
677 @c const_cast from their const methods.
678 */
679 int GetRowsCount() const;
23324ae1 680
8b9ef005
BP
681 /**
682 Return the number of columns in the table.
e54c96f1 683
8b9ef005
BP
684 This method is not virtual and is only provided as a convenience for
685 the derived classes which can't call GetNumberCols() without a
686 @c const_cast from their const methods.
687 */
688 int GetColsCount() const;
7c913512 689
7c913512 690
23324ae1 691 /**
8b9ef005
BP
692 @name Table Cell Accessors
693 */
694 //@{
23324ae1
FM
695
696 /**
8acad210
VZ
697 May be overridden to implement testing for empty cells.
698
699 This method is used by the grid to test if the given cell is not used
700 and so whether a neighbouring cell may overflow into it. By default it
701 only returns true if the value of the given cell, as returned by
702 GetValue(), is empty.
8b9ef005 703 */
8acad210 704 virtual bool IsEmptyCell(int row, int col);
e54c96f1 705
8b9ef005
BP
706 /**
707 Same as IsEmptyCell() but taking wxGridCellCoords.
7c913512 708
8b9ef005
BP
709 Notice that this method is not virtual, only IsEmptyCell() should be
710 overridden.
711 */
712 bool IsEmpty(const wxGridCellCoords& coords);
7c913512 713
afe0e400 714 /**
8b9ef005
BP
715 Must be overridden to implement accessing the table values as text.
716 */
717 virtual wxString GetValue(int row, int col) = 0;
23324ae1
FM
718
719 /**
8b9ef005
BP
720 Must be overridden to implement setting the table values as text.
721 */
722 virtual void SetValue(int row, int col, const wxString& value) = 0;
23324ae1
FM
723
724 /**
8b9ef005 725 Returns the type of the value in the given cell.
23324ae1 726
8b9ef005
BP
727 By default all cells are strings and this method returns
728 @c wxGRID_VALUE_STRING.
729 */
730 virtual wxString GetTypeName(int row, int col);
23324ae1
FM
731
732 /**
8b9ef005
BP
733 Returns true if the value of the given cell can be accessed as if it
734 were of the specified type.
23324ae1 735
8b9ef005
BP
736 By default the cells can only be accessed as strings. Note that a cell
737 could be accessible in different ways, e.g. a numeric cell may return
738 @true for @c wxGRID_VALUE_NUMBER but also for @c wxGRID_VALUE_STRING
739 indicating that the value can be coerced to a string form.
740 */
741 virtual bool CanGetValueAs(int row, int col, const wxString& typeName);
23324ae1
FM
742
743 /**
8b9ef005
BP
744 Returns true if the value of the given cell can be set as if it were of
745 the specified type.
23324ae1 746
8b9ef005
BP
747 @see CanGetValueAs()
748 */
749 virtual bool CanSetValueAs(int row, int col, const wxString& typeName);
e54c96f1 750
8b9ef005
BP
751 /**
752 Returns the value of the given cell as a long.
7c913512 753
8b9ef005
BP
754 This should only be called if CanGetValueAs() returns @true when called
755 with @c wxGRID_VALUE_NUMBER argument. Default implementation always
756 return 0.
757 */
758 virtual long GetValueAsLong(int row, int col);
7c913512 759
afe0e400 760 /**
8b9ef005 761 Returns the value of the given cell as a double.
23324ae1 762
8b9ef005
BP
763 This should only be called if CanGetValueAs() returns @true when called
764 with @c wxGRID_VALUE_FLOAT argument. Default implementation always
765 return 0.0.
766 */
767 virtual double GetValueAsDouble(int row, int col);
23324ae1
FM
768
769 /**
8b9ef005 770 Returns the value of the given cell as a boolean.
23324ae1 771
8b9ef005
BP
772 This should only be called if CanGetValueAs() returns @true when called
773 with @c wxGRID_VALUE_BOOL argument. Default implementation always
774 return false.
775 */
776 virtual bool GetValueAsBool(int row, int col);
23324ae1
FM
777
778 /**
8b9ef005
BP
779 Returns the value of the given cell as a user-defined type.
780
781 This should only be called if CanGetValueAs() returns @true when called
782 with @a typeName. Default implementation always return @NULL.
783 */
784 virtual void *GetValueAsCustom(int row, int col, const wxString& typeName);
23324ae1
FM
785
786 /**
8b9ef005
BP
787 Sets the value of the given cell as a long.
788
789 This should only be called if CanSetValueAs() returns @true when called
790 with @c wxGRID_VALUE_NUMBER argument. Default implementation doesn't do
791 anything.
792 */
793 virtual void SetValueAsLong(int row, int col, long value);
23324ae1
FM
794
795 /**
8b9ef005
BP
796 Sets the value of the given cell as a double.
797
798 This should only be called if CanSetValueAs() returns @true when called
799 with @c wxGRID_VALUE_FLOAT argument. Default implementation doesn't do
800 anything.
801 */
802 virtual void SetValueAsDouble(int row, int col, double value);
23324ae1
FM
803
804 /**
8b9ef005
BP
805 Sets the value of the given cell as a boolean.
806
807 This should only be called if CanSetValueAs() returns @true when called
808 with @c wxGRID_VALUE_BOOL argument. Default implementation doesn't do
809 anything.
810 */
811 virtual void SetValueAsBool( int row, int col, bool value );
23324ae1
FM
812
813 /**
8b9ef005
BP
814 Sets the value of the given cell as a user-defined type.
815
816 This should only be called if CanSetValueAs() returns @true when called
817 with @a typeName. Default implementation doesn't do anything.
818 */
819 virtual void SetValueAsCustom(int row, int col, const wxString& typeName,
820 void *value);
821
822 //@}
823
23324ae1
FM
824
825 /**
8b9ef005
BP
826 Called by the grid when the table is associated with it.
827
828 The default implementation stores the pointer and returns it from its
829 GetView() and so only makes sense if the table cannot be associated
830 with more than one grid at a time.
831 */
832 virtual void SetView(wxGrid *grid);
23324ae1
FM
833
834 /**
8b9ef005
BP
835 Returns the last grid passed to SetView().
836 */
837 virtual wxGrid *GetView() const;
838
23324ae1
FM
839
840 /**
8b9ef005 841 @name Table Structure Modifiers
23324ae1 842
8b9ef005
BP
843 Notice that none of these functions are pure virtual as they don't have
844 to be implemented if the table structure is never modified after
845 creation, i.e. neither rows nor columns are never added or deleted but
846 that you do need to implement them if they are called, i.e. if your
847 code either calls them directly or uses the matching wxGrid methods, as
848 by default they simply do nothing which is definitely inappropriate.
849 */
850 //@{
23324ae1 851
8b9ef005
BP
852 /**
853 Clear the table contents.
e54c96f1 854
8b9ef005
BP
855 This method is used by wxGrid::ClearGrid().
856 */
857 virtual void Clear();
7c913512 858
8b9ef005
BP
859 /**
860 Insert additional rows into the table.
7c913512 861
8b9ef005
BP
862 @param pos
863 The position of the first new row.
864 @param numRows
865 The number of rows to insert.
866 */
867 virtual bool InsertRows(size_t pos = 0, size_t numRows = 1);
7c913512 868
23324ae1 869 /**
8b9ef005
BP
870 Append additional rows at the end of the table.
871
872 This method is provided in addition to InsertRows() as some data models
873 may only support appending rows to them but not inserting them at
874 arbitrary locations. In such case you may implement this method only
875 and leave InsertRows() unimplemented.
876
877 @param numRows
878 The number of rows to add.
879 */
880 virtual bool AppendRows(size_t numRows = 1);
23324ae1
FM
881
882 /**
8b9ef005 883 Delete rows from the table.
afe0e400 884
8b9ef005
BP
885 @param pos
886 The first row to delete.
887 @param numRows
888 The number of rows to delete.
889 */
890 virtual bool DeleteRows(size_t pos = 0, size_t numRows = 1);
891
892 /**
893 Exactly the same as InsertRows() but for columns.
894 */
895 virtual bool InsertCols(size_t pos = 0, size_t numCols = 1);
23324ae1
FM
896
897 /**
8b9ef005
BP
898 Exactly the same as AppendRows() but for columns.
899 */
900 virtual bool AppendCols(size_t numCols = 1);
23324ae1 901
8b9ef005
BP
902 /**
903 Exactly the same as DeleteRows() but for columns.
904 */
905 virtual bool DeleteCols(size_t pos = 0, size_t numCols = 1);
e54c96f1 906
8b9ef005 907 //@}
7c913512 908
8b9ef005
BP
909 /**
910 @name Table Row and Column Labels
7c913512 911
8b9ef005
BP
912 By default the numbers are used for labeling rows and Latin letters for
913 labeling columns. If the table has more than 26 columns, the pairs of
914 letters are used starting from the 27-th one and so on, i.e. the
915 sequence of labels is A, B, ..., Z, AA, AB, ..., AZ, BA, ..., ..., ZZ,
916 AAA, ...
917 */
918 //@{
7c913512 919
23324ae1 920 /**
8b9ef005
BP
921 Return the label of the specified row.
922 */
923 virtual wxString GetRowLabelValue(int row);
23324ae1 924
8b9ef005
BP
925 /**
926 Return the label of the specified column.
927 */
928 virtual wxString GetColLabelValue(int col);
5e6e278d 929
23324ae1 930 /**
8b9ef005 931 Set the given label for the specified row.
5e6e278d 932
8b9ef005
BP
933 The default version does nothing, i.e. the label is not stored. You
934 must override this method in your derived class if you wish
935 wxGrid::SetRowLabelValue() to work.
936 */
937 virtual void SetRowLabelValue(int row, const wxString& label);
23324ae1
FM
938
939 /**
8b9ef005
BP
940 Exactly the same as SetRowLabelValue() but for columns.
941 */
942 virtual void SetColLabelValue(int col, const wxString& label);
23324ae1 943
8b9ef005 944 //@}
23324ae1
FM
945
946
8b9ef005
BP
947 /**
948 @name Attributes Management
e54c96f1 949
8b9ef005
BP
950 By default the attributes management is delegated to
951 wxGridCellAttrProvider class. You may override the methods in this
952 section to handle the attributes directly if, for example, they can be
953 computed from the cell values.
954 */
955 //@{
7c913512 956
8b9ef005
BP
957 /**
958 Associate this attributes provider with the table.
7c913512 959
8b9ef005
BP
960 The table takes ownership of @a attrProvider pointer and will delete it
961 when it doesn't need it any more. The pointer can be @NULL, however
962 this won't disable attributes management in the table but will just
963 result in a default attributes being recreated the next time any of the
964 other functions in this section is called. To completely disable the
965 attributes support, should this be needed, you need to override
966 CanHaveAttributes() to return @false.
967 */
968 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
afe0e400 969
23324ae1 970 /**
8b9ef005 971 Returns the attribute provider currently being used.
23324ae1 972
8b9ef005
BP
973 This function may return @NULL if the attribute provider hasn't been
974 neither associated with this table by SetAttrProvider() nor created on
975 demand by any other methods.
976 */
977 wxGridCellAttrProvider *GetAttrProvider() const;
23324ae1
FM
978
979 /**
8b9ef005 980 Return the attribute for the given cell.
23324ae1 981
8b9ef005
BP
982 By default this function is simply forwarded to
983 wxGridCellAttrProvider::GetAttr() but it may be overridden to handle
984 attributes directly in the table.
985 */
986 virtual wxGridCellAttr *GetAttr(int row, int col,
987 wxGridCellAttr::wxAttrKind kind);
23324ae1
FM
988
989 /**
8b9ef005 990 Set attribute of the specified cell.
23324ae1 991
8b9ef005
BP
992 By default this function is simply forwarded to
993 wxGridCellAttrProvider::SetAttr().
994
995 The table takes ownership of @a attr, i.e. will call DecRef() on it.
996 */
997 virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
23324ae1
FM
998
999 /**
8b9ef005 1000 Set attribute of the specified row.
23324ae1 1001
8b9ef005
BP
1002 By default this function is simply forwarded to
1003 wxGridCellAttrProvider::SetRowAttr().
23324ae1 1004
8b9ef005
BP
1005 The table takes ownership of @a attr, i.e. will call DecRef() on it.
1006 */
1007 virtual void SetRowAttr(wxGridCellAttr *attr, int row);
e54c96f1 1008
8b9ef005
BP
1009 /**
1010 Set attribute of the specified column.
7c913512 1011
8b9ef005
BP
1012 By default this function is simply forwarded to
1013 wxGridCellAttrProvider::SetColAttr().
7c913512 1014
8b9ef005
BP
1015 The table takes ownership of @a attr, i.e. will call DecRef() on it.
1016 */
1017 virtual void SetColAttr(wxGridCellAttr *attr, int col);
1018
1019 //@}
7c913512 1020
23324ae1 1021 /**
8b9ef005
BP
1022 Returns true if this table supports attributes or false otherwise.
1023
1024 By default, the table automatically creates a wxGridCellAttrProvider
1025 when this function is called if it had no attribute provider before and
1026 returns @true.
1027 */
1028 virtual bool CanHaveAttributes();
23324ae1
FM
1029};
1030
574e1c5a
VZ
1031/**
1032 @class wxGridSizesInfo
1033
1034 wxGridSizesInfo stores information about sizes of all wxGrid rows or
d455444a 1035 columns.
574e1c5a
VZ
1036
1037 It assumes that most of the rows or columns (which are both called elements
1038 here as the difference between them doesn't matter at this class level)
1039 have the default size and so stores it separately. And it uses a wxHashMap
1040 to store the sizes of all elements which have the non-default size.
1041
1042 This structure is particularly useful for serializing the sizes of all
1043 wxGrid elements at once.
1044
1045 @library{wxadv}
1046 @category{grid}
1047 */
1048struct wxGridSizesInfo
1049{
1050 /**
1051 Default constructor.
1052
1053 m_sizeDefault and m_customSizes must be initialized later.
1054 */
1055 wxGridSizesInfo();
1056
1057 /**
1058 Constructor.
1059
1060 This constructor is used by wxGrid::GetRowSizes() and GetColSizes()
1061 methods. User code will usually use the default constructor instead.
1062
1063 @param defSize
1064 The default element size.
d455444a 1065 @param allSizes
574e1c5a
VZ
1066 Array containing the sizes of @em all elements, including those
1067 which have the default size.
1068 */
1069 wxGridSizesInfo(int defSize, const wxArrayInt& allSizes);
1070
1071 /**
1072 Get the element size.
1073
1074 @param pos
1075 The index of the element.
1076 @return
1077 The size for this element, using m_customSizes if @a pos is in it
1078 or m_sizeDefault otherwise.
1079 */
1080 int GetSize(unsigned pos) const;
1081
1082
1083 /// Default size
1084 int m_sizeDefault;
1085
1086 /**
1087 Map with element indices as keys and their sizes as values.
1088
1089 This map only contains the elements with non-default size.
1090 */
1091 wxUnsignedToIntHashMap m_customSizes;
1092};
23324ae1 1093
e54c96f1 1094
23324ae1 1095/**
8b9ef005 1096 @class wxGrid
7c913512 1097
8b9ef005 1098 wxGrid and its related classes are used for displaying and editing tabular
caac7804
BP
1099 data. They provide a rich set of features for display, editing, and
1100 interacting with a variety of data sources. For simple applications, and to
1101 help you get started, wxGrid is the only class you need to refer to
1102 directly. It will set up default instances of the other classes and manage
1103 them for you. For more complex applications you can derive your own classes
1104 for custom grid views, grid data tables, cell editors and renderers. The
1105 @ref overview_grid has examples of simple and more complex applications,
8b9ef005
BP
1106 explains the relationship between the various grid classes and has a
1107 summary of the keyboard shortcuts and mouse functions provided by wxGrid.
7c913512 1108
8b9ef005
BP
1109 A wxGridTableBase class holds the actual data to be displayed by a wxGrid
1110 class. One or more wxGrid classes may act as a view for one table class.
1111 The default table class is called wxGridStringTable and holds an array of
caac7804 1112 strings. An instance of such a class is created by CreateGrid().
23324ae1 1113
8b9ef005
BP
1114 wxGridCellRenderer is the abstract base class for rendereing contents in a
1115 cell. The following renderers are predefined:
caac7804
BP
1116
1117 - wxGridCellBoolRenderer
1118 - wxGridCellFloatRenderer
1119 - wxGridCellNumberRenderer
1120 - wxGridCellStringRenderer
1121
8b9ef005 1122 The look of a cell can be further defined using wxGridCellAttr. An object
caac7804 1123 of this type may be returned by wxGridTableBase::GetAttr().
3c4f71cc 1124
8b9ef005
BP
1125 wxGridCellEditor is the abstract base class for editing the value of a
1126 cell. The following editors are predefined:
caac7804
BP
1127
1128 - wxGridCellBoolEditor
1129 - wxGridCellChoiceEditor
1130 - wxGridCellFloatEditor
1131 - wxGridCellNumberEditor
1132 - wxGridCellTextEditor
f8f31de6 1133
caac7804
BP
1134 Please see wxGridEvent, wxGridSizeEvent, wxGridRangeSelectEvent, and
1135 wxGridEditorCreatedEvent for the documentation of all event types you can
1136 use with wxGrid.
8b9ef005
BP
1137
1138 @library{wxadv}
1139 @category{grid}
23324ae1 1140
caac7804 1141 @see @ref overview_grid, wxGridUpdateLocker
8b9ef005
BP
1142*/
1143class wxGrid : public wxScrolledWindow
1144{
1145public:
caac7804 1146
23324ae1 1147 /**
8b9ef005
BP
1148 Different selection modes supported by the grid.
1149 */
1150 enum wxGridSelectionModes
1151 {
1152 /**
1153 The default selection mode allowing selection of the individual
1154 cells as well as of the entire rows and columns.
1155 */
1156 wxGridSelectCells,
23324ae1 1157
8b9ef005
BP
1158 /**
1159 The selection mode allowing the selection of the entire rows only.
3c4f71cc 1160
8b9ef005
BP
1161 The user won't be able to select any cells or columns in this mode.
1162 */
1163 wxGridSelectRows,
23324ae1 1164
8b9ef005
BP
1165 /**
1166 The selection mode allowing the selection of the entire columns only.
3c4f71cc 1167
8b9ef005
BP
1168 The user won't be able to select any cells or rows in this mode.
1169 */
1170 wxGridSelectColumns
1171 };
23324ae1 1172
caac7804
BP
1173
1174 /**
1175 @name Constructors and Initialization
1176 */
1177 //@{
1178
23324ae1 1179 /**
8b9ef005 1180 Default constructor.
3c4f71cc 1181
8b9ef005
BP
1182 You must call Create() to really create the grid window and also call
1183 CreateGrid() or SetTable() to initialize the grid contents.
1184 */
1185 wxGrid();
23324ae1 1186 /**
8b9ef005 1187 Constructor creating the grid window.
3c4f71cc 1188
8b9ef005
BP
1189 You must call either CreateGrid() or SetTable() to initialize the grid
1190 contents before using it.
23324ae1 1191 */
caac7804 1192 wxGrid(wxWindow* parent, wxWindowID id,
8b9ef005
BP
1193 const wxPoint& pos = wxDefaultPosition,
1194 const wxSize& size = wxDefaultSize,
1195 long style = wxWANTS_CHARS,
1196 const wxString& name = wxGridNameStr);
23324ae1 1197
caac7804
BP
1198 /**
1199 Destructor.
1200
1201 This will also destroy the associated grid table unless you passed a
1202 table object to the grid and specified that the grid should not take
1203 ownership of the table (see SetTable()).
1204 */
1205 virtual ~wxGrid();
1206
23324ae1 1207 /**
8b9ef005
BP
1208 Creates the grid window for an object initialized using the default
1209 constructor.
3c4f71cc 1210
8b9ef005
BP
1211 You must call either CreateGrid() or SetTable() to initialize the grid
1212 contents before using it.
1213 */
caac7804 1214 bool Create(wxWindow* parent, wxWindowID id,
8b9ef005
BP
1215 const wxPoint& pos = wxDefaultPosition,
1216 const wxSize& size = wxDefaultSize,
1217 long style = wxWANTS_CHARS,
1218 const wxString& name = wxGridNameStr);
23324ae1
FM
1219
1220 /**
caac7804 1221 Creates a grid with the specified initial number of rows and columns.
3c4f71cc 1222
caac7804
BP
1223 Call this directly after the grid constructor. When you use this
1224 function wxGrid will create and manage a simple table of string values
1225 for you. All of the grid data will be stored in memory.
1226
1227 For applications with more complex data types or relationships, or for
1228 dealing with very large datasets, you should derive your own grid table
1229 class and pass a table object to the grid with SetTable().
23324ae1 1230 */
caac7804
BP
1231 bool CreateGrid(int numRows, int numCols,
1232 wxGridSelectionModes selmode = wxGridSelectCells);
23324ae1
FM
1233
1234 /**
caac7804 1235 Passes a pointer to a custom grid table to be used by the grid.
3c4f71cc 1236
caac7804
BP
1237 This should be called after the grid constructor and before using the
1238 grid object. If @a takeOwnership is set to @true then the table will be
1239 deleted by the wxGrid destructor.
3c4f71cc 1240
caac7804
BP
1241 Use this function instead of CreateGrid() when your application
1242 involves complex or non-string data or data sets that are too large to
1243 fit wholly in memory.
23324ae1 1244 */
caac7804
BP
1245 bool SetTable(wxGridTableBase* table, bool takeOwnership = false,
1246 wxGridSelectionModes selmode = wxGridSelectCells);
23324ae1 1247
caac7804 1248 //@}
8b9ef005 1249
3c4f71cc 1250
caac7804
BP
1251 /**
1252 @name Grid Line Formatting
1253 */
1254 //@{
1255
1256 /**
1257 Turns the drawing of grid lines on or off.
23324ae1 1258 */
caac7804 1259 void EnableGridLines(bool enable = true);
23324ae1
FM
1260
1261 /**
caac7804 1262 Returns the pen used for vertical grid lines.
3c4f71cc 1263
caac7804
BP
1264 This virtual function may be overridden in derived classes in order to
1265 change the appearance of individual grid lines for the given column
1266 @a col.
23324ae1 1267
caac7804
BP
1268 See GetRowGridLinePen() for an example.
1269 */
1270 virtual wxPen GetColGridLinePen(int col);
23324ae1
FM
1271
1272 /**
caac7804 1273 Returns the pen used for grid lines.
23324ae1 1274
caac7804
BP
1275 This virtual function may be overridden in derived classes in order to
1276 change the appearance of grid lines. Note that currently the pen width
1277 must be 1.
3c4f71cc 1278
caac7804
BP
1279 @see GetColGridLinePen(), GetRowGridLinePen()
1280 */
1281 virtual wxPen GetDefaultGridLinePen();
23324ae1
FM
1282
1283 /**
caac7804
BP
1284 Returns the colour used for grid lines.
1285
1286 @see GetDefaultGridLinePen()
23324ae1 1287 */
caac7804 1288 wxColour GetGridLineColour() const;
23324ae1
FM
1289
1290 /**
caac7804
BP
1291 Returns the pen used for horizontal grid lines.
1292
1293 This virtual function may be overridden in derived classes in order to
1294 change the appearance of individual grid line for the given @a row.
1295
1296 Example:
1297 @code
1298 // in a grid displaying music notation, use a solid black pen between
1299 // octaves (C0=row 127, C1=row 115 etc.)
1300 wxPen MidiGrid::GetRowGridLinePen(int row)
1301 {
1302 if ( row % 12 == 7 )
1303 return wxPen(*wxBLACK, 1, wxSOLID);
1304 else
1305 return GetDefaultGridLinePen();
1306 }
1307 @endcode
23324ae1 1308 */
caac7804 1309 virtual wxPen GetRowGridLinePen(int row);
23324ae1
FM
1310
1311 /**
caac7804 1312 Returns @true if drawing of grid lines is turned on, @false otherwise.
23324ae1 1313 */
caac7804 1314 bool GridLinesEnabled() const;
23324ae1
FM
1315
1316 /**
caac7804 1317 Sets the colour used to draw grid lines.
23324ae1 1318 */
caac7804
BP
1319 void SetGridLineColour(const wxColour& colour);
1320
1321 //@}
1322
23324ae1
FM
1323
1324 /**
caac7804
BP
1325 @name Label Values and Formatting
1326 */
1327 //@{
23324ae1
FM
1328
1329 /**
caac7804
BP
1330 Sets the arguments to the current column label alignment values.
1331
1332 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
1333 or @c wxALIGN_RIGHT.
1334
1335 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
1336 @c wxALIGN_BOTTOM.
23324ae1 1337 */
caac7804 1338 void GetColLabelAlignment(int* horiz, int* vert) const;
23324ae1
FM
1339
1340 /**
caac7804
BP
1341 Returns the orientation of the column labels (either @c wxHORIZONTAL or
1342 @c wxVERTICAL).
23324ae1 1343 */
caac7804 1344 int GetColLabelTextOrientation() const;
23324ae1
FM
1345
1346 /**
caac7804 1347 Returns the specified column label.
7c913512 1348
caac7804
BP
1349 The default grid table class provides column labels of the form
1350 A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can
1351 override wxGridTableBase::GetColLabelValue() to provide your own
1352 labels.
23324ae1 1353 */
caac7804 1354 wxString GetColLabelValue(int col) const;
23324ae1 1355
8b9ef005 1356 /**
caac7804
BP
1357 Returns the colour used for the background of row and column labels.
1358 */
1359 wxColour GetLabelBackgroundColour() const;
e54c96f1 1360
caac7804
BP
1361 /**
1362 Returns the font used for row and column labels.
1363 */
1364 wxFont GetLabelFont() const;
7c913512 1365
caac7804
BP
1366 /**
1367 Returns the colour used for row and column label text.
8b9ef005 1368 */
caac7804 1369 wxColour GetLabelTextColour() const;
7c913512 1370
23324ae1 1371 /**
caac7804 1372 Returns the alignment used for row labels.
3c4f71cc 1373
caac7804
BP
1374 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
1375 or @c wxALIGN_RIGHT.
1376
1377 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
1378 @c wxALIGN_BOTTOM.
23324ae1 1379 */
caac7804 1380 void GetRowLabelAlignment(int* horiz, int* vert) const;
23324ae1
FM
1381
1382 /**
caac7804 1383 Returns the specified row label.
23324ae1 1384
caac7804
BP
1385 The default grid table class provides numeric row labels. If you are
1386 using a custom grid table you can override
1387 wxGridTableBase::GetRowLabelValue() to provide your own labels.
23324ae1 1388 */
caac7804 1389 wxString GetRowLabelValue(int row) const;
23324ae1
FM
1390
1391 /**
caac7804
BP
1392 Hides the column labels by calling SetColLabelSize() with a size of 0.
1393 Show labels again by calling that method with a width greater than 0.
23324ae1 1394 */
caac7804 1395 void HideColLabels();
23324ae1
FM
1396
1397 /**
caac7804 1398 Hides the row labels by calling SetRowLabelSize() with a size of 0.
23324ae1 1399
caac7804
BP
1400 The labels can be shown again by calling SetRowLabelSize() with a width
1401 greater than 0.
23324ae1 1402 */
caac7804 1403 void HideRowLabels();
23324ae1
FM
1404
1405 /**
caac7804 1406 Sets the horizontal and vertical alignment of column label text.
23324ae1 1407
caac7804
BP
1408 Horizontal alignment should be one of @c wxALIGN_LEFT,
1409 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one
1410 of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
23324ae1 1411 */
caac7804 1412 void SetColLabelAlignment(int horiz, int vert);
23324ae1
FM
1413
1414 /**
caac7804
BP
1415 Sets the orientation of the column labels (either @c wxHORIZONTAL or
1416 @c wxVERTICAL).
8b9ef005 1417 */
caac7804 1418 void SetColLabelTextOrientation(int textOrientation);
7c913512 1419
23324ae1 1420 /**
caac7804 1421 Set the value for the given column label.
8b9ef005 1422
caac7804
BP
1423 If you are using a custom grid table you must override
1424 wxGridTableBase::SetColLabelValue() for this to have any effect.
23324ae1 1425 */
caac7804 1426 void SetColLabelValue(int col, const wxString& value);
23324ae1
FM
1427
1428 /**
caac7804 1429 Sets the background colour for row and column labels.
23324ae1 1430 */
caac7804 1431 void SetLabelBackgroundColour(const wxColour& colour);
23324ae1 1432
8b9ef005 1433 /**
caac7804
BP
1434 Sets the font for row and column labels.
1435 */
1436 void SetLabelFont(const wxFont& font);
55f0bf1f 1437
8b9ef005 1438 /**
caac7804
BP
1439 Sets the colour for row and column label text.
1440 */
1441 void SetLabelTextColour(const wxColour& colour);
55f0bf1f 1442
8b9ef005 1443 /**
caac7804 1444 Sets the horizontal and vertical alignment of row label text.
7c913512 1445
caac7804
BP
1446 Horizontal alignment should be one of @c wxALIGN_LEFT,
1447 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one
1448 of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
8b9ef005 1449 */
caac7804 1450 void SetRowLabelAlignment(int horiz, int vert);
7c913512 1451
23324ae1 1452 /**
caac7804 1453 Sets the value for the given row label.
55f0bf1f 1454
caac7804
BP
1455 If you are using a derived grid table you must override
1456 wxGridTableBase::SetRowLabelValue() for this to have any effect.
8b9ef005 1457 */
caac7804 1458 void SetRowLabelValue(int row, const wxString& value);
55f0bf1f 1459
8b9ef005 1460 /**
caac7804 1461 Call this in order to make the column labels use a native look by using
03faec76 1462 wxRendererNative::DrawHeaderButton() internally.
55f0bf1f 1463
caac7804
BP
1464 There is no equivalent method for drawing row columns as there is not
1465 native look for that. This option is useful when using wxGrid for
1466 displaying tables and not as a spread-sheet.
ad805b9e 1467
03faec76 1468 @see UseNativeColHeader()
8b9ef005 1469 */
caac7804 1470 void SetUseNativeColLabels(bool native = true);
55f0bf1f 1471
ad805b9e
VZ
1472 /**
1473 Enable the use of native header window for column labels.
1474
1475 If this function is called with @true argument, a wxHeaderCtrl is used
1476 instead to display the column labels instead of drawing them in wxGrid
1477 code itself. This has the advantage of making the grid look and feel
1478 perfectly the same as native applications (using SetUseNativeColLabels()
1479 the grid can be made to look more natively but it still doesn't feel
1480 natively, notably the column resizing and dragging still works slightly
1481 differently as it is implemented in wxWidgets itself) but results in
1482 different behaviour for column and row headers, for which there is no
1483 equivalent function, and, most importantly, is unsuitable for grids
1484 with huge numbers of columns as wxHeaderCtrl doesn't support virtual
1485 mode. Because of this, by default the grid does not use the native
1486 header control but you should call this function to enable it if you
1487 are using the grid to display tabular data and don't have thousands of
1488 columns in it.
1489
03faec76
FM
1490 Also note that currently @c wxEVT_GRID_LABEL_LEFT_DCLICK and
1491 @c wxEVT_GRID_LABEL_RIGHT_DCLICK events are not generated for the column
ad805b9e
VZ
1492 labels if the native columns header is used (but this limitation could
1493 possibly be lifted in the future).
1494 */
1495 void UseNativeColHeader(bool native = true);
1496
caac7804 1497 //@}
55f0bf1f 1498
55f0bf1f
VZ
1499
1500 /**
caac7804 1501 @name Cell Formatting
55f0bf1f 1502
caac7804
BP
1503 Note that wxGridCellAttr can be used alternatively to most of these
1504 methods. See the "Attributes Management" of wxGridTableBase.
1505 */
1506 //@{
23324ae1
FM
1507
1508 /**
caac7804
BP
1509 Sets the arguments to the horizontal and vertical text alignment values
1510 for the grid cell at the specified location.
55f0bf1f 1511
caac7804
BP
1512 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
1513 or @c wxALIGN_RIGHT.
1514
1515 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
1516 @c wxALIGN_BOTTOM.
8b9ef005 1517 */
caac7804 1518 void GetCellAlignment(int row, int col, int* horiz, int* vert) const;
55f0bf1f
VZ
1519
1520 /**
caac7804 1521 Returns the background colour of the cell at the specified location.
23324ae1 1522 */
caac7804 1523 wxColour GetCellBackgroundColour(int row, int col) const;
23324ae1
FM
1524
1525 /**
caac7804
BP
1526 Returns the font for text in the grid cell at the specified location.
1527 */
1528 wxFont GetCellFont(int row, int col) const;
55f0bf1f 1529
caac7804
BP
1530 /**
1531 Returns the text colour for the grid cell at the specified location.
23324ae1 1532 */
caac7804 1533 wxColour GetCellTextColour(int row, int col) const;
23324ae1
FM
1534
1535 /**
caac7804
BP
1536 Returns the default cell alignment.
1537
1538 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
1539 or @c wxALIGN_RIGHT.
55f0bf1f 1540
caac7804
BP
1541 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
1542 @c wxALIGN_BOTTOM.
1543
1544 @see SetDefaultCellAlignment()
8b9ef005 1545 */
caac7804 1546 void GetDefaultCellAlignment(int* horiz, int* vert) const;
55f0bf1f 1547
8b9ef005 1548 /**
caac7804 1549 Returns the current default background colour for grid cells.
23324ae1 1550 */
caac7804 1551 wxColour GetDefaultCellBackgroundColour() const;
23324ae1 1552
9f7aee01 1553 /**
caac7804 1554 Returns the current default font for grid cell text.
8b9ef005 1555 */
caac7804 1556 wxFont GetDefaultCellFont() const;
9f7aee01 1557
8b9ef005 1558 /**
caac7804 1559 Returns the current default colour for grid cell text.
8b9ef005 1560 */
caac7804 1561 wxColour GetDefaultCellTextColour() const;
9f7aee01 1562
8b9ef005 1563 /**
caac7804
BP
1564 Sets the horizontal and vertical alignment for grid cell text at the
1565 specified location.
9f7aee01 1566
caac7804
BP
1567 Horizontal alignment should be one of @c wxALIGN_LEFT,
1568 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT.
1569
1570 Vertical alignment should be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE
1571 or @c wxALIGN_BOTTOM.
1572 */
1573 void SetCellAlignment(int row, int col, int horiz, int vert);
9f7aee01 1574 /**
caac7804
BP
1575 Sets the horizontal and vertical alignment for grid cell text at the
1576 specified location.
9f7aee01 1577
caac7804
BP
1578 Horizontal alignment should be one of @c wxALIGN_LEFT,
1579 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT.
9f7aee01 1580
caac7804
BP
1581 Vertical alignment should be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE
1582 or @c wxALIGN_BOTTOM.
8b9ef005 1583 */
caac7804 1584 void SetCellAlignment(int align, int row, int col);
9f7aee01 1585
23324ae1 1586 /**
caac7804 1587 Set the background colour for the given cell or all cells by default.
23324ae1 1588 */
caac7804 1589 void SetCellBackgroundColour(int row, int col, const wxColour& colour);
23324ae1
FM
1590
1591 /**
caac7804
BP
1592 Sets the font for text in the grid cell at the specified location.
1593 */
1594 void SetCellFont(int row, int col, const wxFont& font);
8b9ef005 1595
caac7804
BP
1596 /**
1597 Sets the text colour for the given cell.
1598 */
1599 void SetCellTextColour(int row, int col, const wxColour& colour);
1600 /**
1601 Sets the text colour for the given cell.
1602 */
1603 void SetCellTextColour(const wxColour& val, int row, int col);
1604 /**
1605 Sets the text colour for all cells by default.
1606 */
1607 void SetCellTextColour(const wxColour& colour);
8b9ef005 1608
caac7804
BP
1609 /**
1610 Sets the default horizontal and vertical alignment for grid cell text.
1611
1612 Horizontal alignment should be one of @c wxALIGN_LEFT,
1613 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one
1614 of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
23324ae1 1615 */
caac7804 1616 void SetDefaultCellAlignment(int horiz, int vert);
23324ae1
FM
1617
1618 /**
caac7804 1619 Sets the default background colour for grid cells.
23324ae1 1620 */
caac7804 1621 void SetDefaultCellBackgroundColour(const wxColour& colour);
23324ae1
FM
1622
1623 /**
caac7804
BP
1624 Sets the default font to be used for grid cell text.
1625 */
1626 void SetDefaultCellFont(const wxFont& font);
8b9ef005 1627
caac7804
BP
1628 /**
1629 Sets the current default colour for grid cell text.
23324ae1 1630 */
caac7804
BP
1631 void SetDefaultCellTextColour(const wxColour& colour);
1632
1633 //@}
1634
1635
1636 /**
1637 @name Cell Values, Editors, and Renderers
1638
1639 Note that wxGridCellAttr can be used alternatively to most of these
1640 methods. See the "Attributes Management" of wxGridTableBase.
1641 */
1642 //@{
23324ae1
FM
1643
1644 /**
caac7804
BP
1645 Returns @true if the in-place edit control for the current grid cell
1646 can be used and @false otherwise.
1647
1648 This function always returns @false for the read-only cells.
23324ae1 1649 */
caac7804 1650 bool CanEnableCellControl() const;
23324ae1
FM
1651
1652 /**
caac7804 1653 Disables in-place editing of grid cells.
8b9ef005 1654
caac7804
BP
1655 Equivalent to calling EnableCellEditControl(@false).
1656 */
1657 void DisableCellEditControl();
8b9ef005 1658
caac7804
BP
1659 /**
1660 Enables or disables in-place editing of grid cell data.
1661
1662 The grid will issue either a @c wxEVT_GRID_EDITOR_SHOWN or
1663 @c wxEVT_GRID_EDITOR_HIDDEN event.
23324ae1 1664 */
caac7804 1665 void EnableCellEditControl(bool enable = true);
23324ae1
FM
1666
1667 /**
caac7804
BP
1668 Makes the grid globally editable or read-only.
1669
1670 If the edit argument is @false this function sets the whole grid as
1671 read-only. If the argument is @true the grid is set to the default
1672 state where cells may be editable. In the default state you can set
1673 single grid cells and whole rows and columns to be editable or
1674 read-only via wxGridCellAttr::SetReadOnly(). For single cells you
1675 can also use the shortcut function SetReadOnly().
1676
1677 For more information about controlling grid cell attributes see the
1678 wxGridCellAttr class and the @ref overview_grid.
23324ae1 1679 */
caac7804 1680 void EnableEditing(bool edit);
23324ae1
FM
1681
1682 /**
8b9ef005 1683 Returns a pointer to the editor for the cell at the specified location.
3c4f71cc 1684
caac7804
BP
1685 See wxGridCellEditor and the @ref overview_grid for more information
1686 about cell editors and renderers.
3c4f71cc 1687
8b9ef005 1688 The caller must call DecRef() on the returned pointer.
23324ae1 1689 */
8b9ef005 1690 wxGridCellEditor* GetCellEditor(int row, int col) const;
23324ae1 1691
8b9ef005
BP
1692 /**
1693 Returns a pointer to the renderer for the grid cell at the specified
1694 location.
08dd9b5a 1695
caac7804
BP
1696 See wxGridCellRenderer and the @ref overview_grid for more information
1697 about cell editors and renderers.
8b9ef005
BP
1698
1699 The caller must call DecRef() on the returned pointer.
23324ae1 1700 */
8b9ef005 1701 wxGridCellRenderer* GetCellRenderer(int row, int col) const;
23324ae1
FM
1702
1703 /**
caac7804 1704 Returns the string contained in the cell at the specified location.
23324ae1 1705
caac7804
BP
1706 For simple applications where a grid object automatically uses a
1707 default grid table of string values you use this function together with
1708 SetCellValue() to access cell values. For more complex applications
1709 where you have derived your own grid table class that contains various
1710 data types (e.g. numeric, boolean or user-defined custom types) then
1711 you only use this function for those cells that contain string values.
1712
1713 See wxGridTableBase::CanGetValueAs() and the @ref overview_grid for
1714 more information.
1715 */
1716 wxString GetCellValue(int row, int col) const;
23324ae1 1717 /**
8b9ef005 1718 Returns the string contained in the cell at the specified location.
08dd9b5a 1719
8b9ef005
BP
1720 For simple applications where a grid object automatically uses a
1721 default grid table of string values you use this function together with
1722 SetCellValue() to access cell values. For more complex applications
1723 where you have derived your own grid table class that contains various
1724 data types (e.g. numeric, boolean or user-defined custom types) then
1725 you only use this function for those cells that contain string values.
1726
caac7804
BP
1727 See wxGridTableBase::CanGetValueAs() and the @ref overview_grid for
1728 more information.
23324ae1 1729 */
882678eb 1730 wxString GetCellValue(const wxGridCellCoords& coords) const;
23324ae1
FM
1731
1732 /**
caac7804
BP
1733 Returns a pointer to the current default grid cell editor.
1734
1735 See wxGridCellEditor and the @ref overview_grid for more information
1736 about cell editors and renderers.
23324ae1 1737 */
caac7804 1738 wxGridCellEditor* GetDefaultEditor() const;
23324ae1
FM
1739
1740 /**
caac7804 1741 Returns the default editor for the specified cell.
08dd9b5a 1742
caac7804
BP
1743 The base class version returns the editor appropriate for the current
1744 cell type but this method may be overridden in the derived classes to
1745 use custom editors for some cells by default.
8b9ef005 1746
caac7804
BP
1747 Notice that the same may be achieved in a usually simpler way by
1748 associating a custom editor with the given cell or cells.
23324ae1 1749
caac7804
BP
1750 The caller must call DecRef() on the returned pointer.
1751 */
1752 virtual wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
23324ae1 1753 /**
caac7804 1754 Returns the default editor for the specified cell.
08dd9b5a 1755
caac7804
BP
1756 The base class version returns the editor appropriate for the current
1757 cell type but this method may be overridden in the derived classes to
1758 use custom editors for some cells by default.
8b9ef005 1759
caac7804
BP
1760 Notice that the same may be achieved in a usually simpler way by
1761 associating a custom editor with the given cell or cells.
23324ae1 1762
caac7804 1763 The caller must call DecRef() on the returned pointer.
23324ae1 1764 */
caac7804 1765 wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const;
23324ae1
FM
1766
1767 /**
caac7804
BP
1768 Returns the default editor for the cells containing values of the given
1769 type.
55f0bf1f 1770
caac7804
BP
1771 The base class version returns the editor which was associated with the
1772 specified @a typeName when it was registered RegisterDataType() but
1773 this function may be overridden to return something different. This
1774 allows to override an editor used for one of the standard types.
1775
1776 The caller must call DecRef() on the returned pointer.
23324ae1 1777 */
caac7804 1778 virtual wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
23324ae1
FM
1779
1780 /**
caac7804 1781 Returns a pointer to the current default grid cell renderer.
8b9ef005 1782
caac7804
BP
1783 See wxGridCellRenderer and the @ref overview_grid for more information
1784 about cell editors and renderers.
1785
1786 The caller must call DecRef() on the returned pointer.
23324ae1 1787 */
caac7804 1788 wxGridCellRenderer* GetDefaultRenderer() const;
23324ae1 1789
9f7aee01 1790 /**
caac7804
BP
1791 Returns the default renderer for the given cell.
1792
1793 The base class version returns the renderer appropriate for the current
1794 cell type but this method may be overridden in the derived classes to
1795 use custom renderers for some cells by default.
1796
1797 The caller must call DecRef() on the returned pointer.
8b9ef005 1798 */
caac7804 1799 virtual wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
9f7aee01 1800
8b9ef005 1801 /**
caac7804
BP
1802 Returns the default renderer for the cell containing values of the
1803 given type.
9f7aee01 1804
caac7804 1805 @see GetDefaultEditorForType()
8b9ef005 1806 */
caac7804 1807 virtual wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
08dd9b5a 1808
8b9ef005 1809 /**
caac7804 1810 Hides the in-place cell edit control.
23324ae1 1811 */
caac7804 1812 void HideCellEditControl();
23324ae1
FM
1813
1814 /**
caac7804 1815 Returns @true if the in-place edit control is currently enabled.
8b9ef005 1816 */
caac7804 1817 bool IsCellEditControlEnabled() const;
3c4f71cc 1818
8b9ef005 1819 /**
caac7804 1820 Returns @true if the current cell is read-only.
3c4f71cc 1821
caac7804 1822 @see SetReadOnly(), IsReadOnly()
23324ae1 1823 */
caac7804 1824 bool IsCurrentCellReadOnly() const;
23324ae1
FM
1825
1826 /**
caac7804
BP
1827 Returns @false if the whole grid has been set as read-only or @true
1828 otherwise.
1829
1830 See EnableEditing() for more information about controlling the editing
1831 status of grid cells.
8b9ef005 1832 */
caac7804 1833 bool IsEditable() const;
23324ae1 1834
8b9ef005 1835 /**
caac7804 1836 Returns @true if the cell at the specified location can't be edited.
55f0bf1f 1837
caac7804 1838 @see SetReadOnly(), IsCurrentCellReadOnly()
23324ae1 1839 */
caac7804 1840 bool IsReadOnly(int row, int col) const;
23324ae1
FM
1841
1842 /**
caac7804 1843 Register a new data type.
08dd9b5a 1844
caac7804
BP
1845 The data types allow to naturally associate specific renderers and
1846 editors to the cells containing values of the given type. For example,
1847 the grid automatically registers a data type with the name
1848 @c wxGRID_VALUE_STRING which uses wxGridCellStringRenderer and
1849 wxGridCellTextEditor as its renderer and editor respectively -- this is
1850 the data type used by all the cells of the default wxGridStringTable,
1851 so this renderer and editor are used by default for all grid cells.
8b9ef005 1852
caac7804
BP
1853 However if a custom table returns @c wxGRID_VALUE_BOOL from its
1854 wxGridTableBase::GetTypeName() method, then wxGridCellBoolRenderer and
1855 wxGridCellBoolEditor are used for it because the grid also registers a
1856 boolean data type with this name.
8b9ef005 1857
caac7804
BP
1858 And as this mechanism is completely generic, you may register your own
1859 data types using your own custom renderers and editors. Just remember
1860 that the table must identify a cell as being of the given type for them
1861 to be used for this cell.
1862
1863 @param typeName
1864 Name of the new type. May be any string, but if the type name is
1865 the same as the name of an already registered type, including one
1866 of the standard ones (which are @c wxGRID_VALUE_STRING, @c
1867 wxGRID_VALUE_BOOL, @c wxGRID_VALUE_NUMBER, @c wxGRID_VALUE_FLOAT
1868 and @c wxGRID_VALUE_CHOICE), then the new registration information
1869 replaces the previously used renderer and editor.
1870 @param renderer
1871 The renderer to use for the cells of this type. Its ownership is
1872 taken by the grid, i.e. it will call DecRef() on this pointer when
1873 it doesn't need it any longer.
1874 @param editor
1875 The editor to use for the cells of this type. Its ownership is also
1876 taken by the grid.
23324ae1 1877 */
caac7804
BP
1878 void RegisterDataType(const wxString& typeName,
1879 wxGridCellRenderer* renderer,
1880 wxGridCellEditor* editor);
23324ae1
FM
1881
1882 /**
caac7804
BP
1883 Sets the value of the current grid cell to the current in-place edit
1884 control value.
55f0bf1f 1885
caac7804
BP
1886 This is called automatically when the grid cursor moves from the
1887 current cell to a new cell. It is also a good idea to call this
1888 function when closing a grid since any edits to the final cell location
1889 will not be saved otherwise.
23324ae1 1890 */
caac7804 1891 void SaveEditControlValue();
23324ae1
FM
1892
1893 /**
caac7804 1894 Sets the editor for the grid cell at the specified location.
55f0bf1f 1895
caac7804 1896 The grid will take ownership of the pointer.
8b9ef005 1897
caac7804
BP
1898 See wxGridCellEditor and the @ref overview_grid for more information
1899 about cell editors and renderers.
23324ae1 1900 */
caac7804 1901 void SetCellEditor(int row, int col, wxGridCellEditor* editor);
23324ae1
FM
1902
1903 /**
caac7804 1904 Sets the renderer for the grid cell at the specified location.
55f0bf1f 1905
caac7804 1906 The grid will take ownership of the pointer.
8b9ef005 1907
caac7804
BP
1908 See wxGridCellRenderer and the @ref overview_grid for more information
1909 about cell editors and renderers.
23324ae1 1910 */
caac7804 1911 void SetCellRenderer(int row, int col, wxGridCellRenderer* renderer);
23324ae1
FM
1912
1913 /**
caac7804 1914 Sets the string value for the cell at the specified location.
55f0bf1f 1915
caac7804
BP
1916 For simple applications where a grid object automatically uses a
1917 default grid table of string values you use this function together with
1918 GetCellValue() to access cell values. For more complex applications
1919 where you have derived your own grid table class that contains various
1920 data types (e.g. numeric, boolean or user-defined custom types) then
1921 you only use this function for those cells that contain string values.
8b9ef005 1922
caac7804
BP
1923 See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for
1924 more information.
23324ae1 1925 */
caac7804 1926 void SetCellValue(int row, int col, const wxString& s);
23324ae1 1927 /**
caac7804 1928 Sets the string value for the cell at the specified location.
55f0bf1f 1929
caac7804
BP
1930 For simple applications where a grid object automatically uses a
1931 default grid table of string values you use this function together with
1932 GetCellValue() to access cell values. For more complex applications
1933 where you have derived your own grid table class that contains various
1934 data types (e.g. numeric, boolean or user-defined custom types) then
1935 you only use this function for those cells that contain string values.
23324ae1 1936
caac7804
BP
1937 See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for
1938 more information.
23324ae1 1939 */
caac7804 1940 void SetCellValue(const wxGridCellCoords& coords, const wxString& s);
23324ae1 1941 /**
caac7804
BP
1942 @deprecated Please use SetCellValue(int,int,const wxString&) or
1943 SetCellValue(const wxGridCellCoords&,const wxString&)
1944 instead.
23324ae1 1945
caac7804 1946 Sets the string value for the cell at the specified location.
23324ae1 1947
caac7804
BP
1948 For simple applications where a grid object automatically uses a
1949 default grid table of string values you use this function together with
1950 GetCellValue() to access cell values. For more complex applications
1951 where you have derived your own grid table class that contains various
1952 data types (e.g. numeric, boolean or user-defined custom types) then
1953 you only use this function for those cells that contain string values.
1954
1955 See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for
1956 more information.
23324ae1 1957 */
caac7804 1958 void SetCellValue(const wxString& val, int row, int col);
23324ae1
FM
1959
1960 /**
caac7804 1961 Sets the specified column to display boolean values.
55f0bf1f 1962
caac7804 1963 @see SetColFormatCustom()
23324ae1 1964 */
caac7804 1965 void SetColFormatBool(int col);
23324ae1
FM
1966
1967 /**
caac7804 1968 Sets the specified column to display data in a custom format.
23324ae1 1969
caac7804
BP
1970 This method provides an alternative to defining a custom grid table
1971 which would return @a typeName from its GetTypeName() method for the
1972 cells in this column: while it doesn't really change the type of the
1973 cells in this column, it does associate the renderer and editor used
1974 for the cells of the specified type with them.
23324ae1 1975
caac7804
BP
1976 See the @ref overview_grid for more information on working with custom
1977 data types.
23324ae1 1978 */
caac7804 1979 void SetColFormatCustom(int col, const wxString& typeName);
23324ae1
FM
1980
1981 /**
caac7804
BP
1982 Sets the specified column to display floating point values with the
1983 given width and precision.
55f0bf1f 1984
caac7804 1985 @see SetColFormatCustom()
23324ae1 1986 */
caac7804 1987 void SetColFormatFloat(int col, int width = -1, int precision = -1);
23324ae1
FM
1988
1989 /**
caac7804 1990 Sets the specified column to display integer values.
8b9ef005 1991
caac7804 1992 @see SetColFormatCustom()
23324ae1 1993 */
caac7804 1994 void SetColFormatNumber(int col);
23324ae1
FM
1995
1996 /**
caac7804 1997 Sets the default editor for grid cells.
3c4f71cc 1998
caac7804 1999 The grid will take ownership of the pointer.
55f0bf1f 2000
caac7804
BP
2001 See wxGridCellEditor and the @ref overview_grid for more information
2002 about cell editors and renderers.
23324ae1 2003 */
caac7804 2004 void SetDefaultEditor(wxGridCellEditor* editor);
23324ae1
FM
2005
2006 /**
caac7804 2007 Sets the default renderer for grid cells.
8b9ef005 2008
caac7804 2009 The grid will take ownership of the pointer.
8b9ef005 2010
caac7804
BP
2011 See wxGridCellRenderer and the @ref overview_grid for more information
2012 about cell editors and renderers.
23324ae1 2013 */
caac7804 2014 void SetDefaultRenderer(wxGridCellRenderer* renderer);
23324ae1
FM
2015
2016 /**
caac7804 2017 Makes the cell at the specified location read-only or editable.
08dd9b5a 2018
caac7804 2019 @see IsReadOnly()
23324ae1 2020 */
caac7804 2021 void SetReadOnly(int row, int col, bool isReadOnly = true);
23324ae1
FM
2022
2023 /**
caac7804 2024 Displays the in-place cell edit control for the current cell.
23324ae1 2025 */
caac7804 2026 void ShowCellEditControl();
23324ae1 2027
caac7804 2028 //@}
23324ae1 2029
23324ae1 2030
23324ae1 2031 /**
caac7804
BP
2032 @name Column and Row Sizes
2033 */
2034 //@{
08dd9b5a 2035
caac7804
BP
2036 /**
2037 Automatically sets the height and width of all rows and columns to fit
2038 their contents.
23324ae1 2039 */
caac7804 2040 void AutoSize();
23324ae1
FM
2041
2042 /**
caac7804 2043 Automatically adjusts width of the column to fit its label.
23324ae1 2044 */
caac7804 2045 void AutoSizeColLabelSize(int col);
23324ae1
FM
2046
2047 /**
caac7804
BP
2048 Automatically sizes the column to fit its contents. If @a setAsMin is
2049 @true the calculated width will also be set as the minimal width for
2050 the column.
2051 */
2052 void AutoSizeColumn(int col, bool setAsMin = true);
23324ae1
FM
2053
2054 /**
caac7804
BP
2055 Automatically sizes all columns to fit their contents. If @a setAsMin
2056 is @true the calculated widths will also be set as the minimal widths
2057 for the columns.
23324ae1 2058 */
caac7804 2059 void AutoSizeColumns(bool setAsMin = true);
23324ae1
FM
2060
2061 /**
caac7804
BP
2062 Automatically sizes the row to fit its contents. If @a setAsMin is
2063 @true the calculated height will also be set as the minimal height for
2064 the row.
23324ae1 2065 */
caac7804 2066 void AutoSizeRow(int row, bool setAsMin = true);
23324ae1 2067
23324ae1 2068 /**
caac7804 2069 Automatically adjusts height of the row to fit its label.
23324ae1 2070 */
caac7804 2071 void AutoSizeRowLabelSize(int col);
23324ae1 2072
23324ae1 2073 /**
caac7804
BP
2074 Automatically sizes all rows to fit their contents. If @a setAsMin is
2075 @true the calculated heights will also be set as the minimal heights
2076 for the rows.
23324ae1 2077 */
caac7804 2078 void AutoSizeRows(bool setAsMin = true);
23324ae1 2079
23324ae1 2080 /**
caac7804 2081 Returns the current height of the column labels.
23324ae1 2082 */
caac7804 2083 int GetColLabelSize() const;
23324ae1
FM
2084
2085 /**
caac7804 2086 Returns the minimal width to which a column may be resized.
08dd9b5a 2087
caac7804
BP
2088 Use SetColMinimalAcceptableWidth() to change this value globally or
2089 SetColMinimalWidth() to do it for individual columns.
08dd9b5a 2090
caac7804 2091 @see GetRowMinimalAcceptableHeight()
23324ae1 2092 */
caac7804 2093 int GetColMinimalAcceptableWidth() const;
23324ae1
FM
2094
2095 /**
caac7804 2096 Returns the width of the specified column.
23324ae1 2097 */
caac7804 2098 int GetColSize(int col) const;
23324ae1 2099
fe79f76b
VZ
2100 /**
2101 Returns @true if the specified column is not currently hidden.
2102 */
2103 bool IsColShown(int col) const;
2104
23324ae1 2105 /**
caac7804 2106 Returns the default height for column labels.
23324ae1 2107 */
caac7804 2108 int GetDefaultColLabelSize() const;
23324ae1
FM
2109
2110 /**
caac7804 2111 Returns the current default width for grid columns.
23324ae1 2112 */
caac7804 2113 int GetDefaultColSize() const;
23324ae1
FM
2114
2115 /**
caac7804
BP
2116 Returns the default width for the row labels.
2117 */
2118 int GetDefaultRowLabelSize() const;
08dd9b5a 2119
caac7804
BP
2120 /**
2121 Returns the current default height for grid rows.
23324ae1 2122 */
caac7804 2123 int GetDefaultRowSize() const;
23324ae1 2124
23324ae1 2125 /**
caac7804 2126 Returns the minimal size to which rows can be resized.
08dd9b5a 2127
caac7804
BP
2128 Use SetRowMinimalAcceptableHeight() to change this value globally or
2129 SetRowMinimalHeight() to do it for individual cells.
23324ae1 2130
caac7804 2131 @see GetColMinimalAcceptableWidth()
23324ae1 2132 */
caac7804 2133 int GetRowMinimalAcceptableHeight() const;
23324ae1
FM
2134
2135 /**
caac7804 2136 Returns the current width of the row labels.
23324ae1 2137 */
caac7804 2138 int GetRowLabelSize() const;
23324ae1
FM
2139
2140 /**
caac7804 2141 Returns the height of the specified row.
8b9ef005 2142 */
caac7804 2143 int GetRowSize(int row) const;
08dd9b5a 2144
fe79f76b
VZ
2145 /**
2146 Returns @true if the specified row is not currently hidden.
2147 */
2148 bool IsRowShown(int row) const;
2149
8b9ef005 2150 /**
caac7804 2151 Sets the height of the column labels.
08dd9b5a 2152
caac7804
BP
2153 If @a height equals to @c wxGRID_AUTOSIZE then height is calculated
2154 automatically so that no label is truncated. Note that this could be
2155 slow for a large table.
23324ae1 2156 */
caac7804 2157 void SetColLabelSize(int height);
23324ae1
FM
2158
2159 /**
caac7804 2160 Sets the minimal @a width to which the user can resize columns.
08dd9b5a 2161
caac7804 2162 @see GetColMinimalAcceptableWidth()
23324ae1 2163 */
caac7804 2164 void SetColMinimalAcceptableWidth(int width);
23324ae1
FM
2165
2166 /**
caac7804 2167 Sets the minimal @a width for the specified column @a col.
3c4f71cc 2168
caac7804
BP
2169 It is usually best to call this method during grid creation as calling
2170 it later will not resize the column to the given minimal width even if
2171 it is currently narrower than it.
23324ae1 2172
caac7804
BP
2173 @a width must be greater than the minimal acceptable column width as
2174 returned by GetColMinimalAcceptableWidth().
23324ae1 2175 */
caac7804 2176 void SetColMinimalWidth(int col, int width);
23324ae1
FM
2177
2178 /**
caac7804
BP
2179 Sets the width of the specified column.
2180
caac7804
BP
2181 @param col
2182 The column index.
2183 @param width
009c7216
VZ
2184 The new column width in pixels, 0 to hide the column or -1 to fit
2185 the column width to its label width.
23324ae1 2186 */
caac7804 2187 void SetColSize(int col, int width);
23324ae1 2188
009c7216
VZ
2189 /**
2190 Hides the specified column.
2191
2192 To show the column later you need to call SetColSize() with non-0
2193 width or ShowCol().
2194
2195 @param col
2196 The column index.
2197 */
2198 void HideCol(int col);
2199
2200 /**
2201 Shows the previously hidden column by resizing it to non-0 size.
2202
2203 @see HideCol(), SetColSize()
2204 */
2205 void ShowCol(int col);
2206
2207
23324ae1 2208 /**
caac7804 2209 Sets the default width for columns in the grid.
23324ae1 2210
caac7804
BP
2211 This will only affect columns subsequently added to the grid unless
2212 @a resizeExistingCols is @true.
2213
2214 If @a width is less than GetColMinimalAcceptableWidth(), then the
2215 minimal acceptable width is used instead of it.
23324ae1 2216 */
caac7804 2217 void SetDefaultColSize(int width, bool resizeExistingCols = false);
23324ae1
FM
2218
2219 /**
caac7804 2220 Sets the default height for rows in the grid.
3c4f71cc 2221
caac7804
BP
2222 This will only affect rows subsequently added to the grid unless
2223 @a resizeExistingRows is @true.
2224
2225 If @a height is less than GetRowMinimalAcceptableHeight(), then the
2226 minimal acceptable heihgt is used instead of it.
23324ae1 2227 */
caac7804 2228 void SetDefaultRowSize(int height, bool resizeExistingRows = false);
23324ae1
FM
2229
2230 /**
caac7804
BP
2231 Sets the width of the row labels.
2232
2233 If @a width equals @c wxGRID_AUTOSIZE then width is calculated
2234 automatically so that no label is truncated. Note that this could be
2235 slow for a large table.
23324ae1 2236 */
caac7804 2237 void SetRowLabelSize(int width);
23324ae1
FM
2238
2239 /**
caac7804 2240 Sets the minimal row @a height used by default.
8b9ef005 2241
caac7804 2242 See SetColMinimalAcceptableWidth() for more information.
23324ae1 2243 */
caac7804 2244 void SetRowMinimalAcceptableHeight(int height);
23324ae1
FM
2245
2246 /**
caac7804
BP
2247 Sets the minimal @a height for the specified @a row.
2248
2249 See SetColMinimalWidth() for more information.
23324ae1 2250 */
caac7804 2251 void SetRowMinimalHeight(int row, int height);
23324ae1
FM
2252
2253 /**
caac7804 2254 Sets the height of the specified row.
08dd9b5a 2255
caac7804 2256 See SetColSize() for more information.
23324ae1 2257 */
caac7804
BP
2258 void SetRowSize(int row, int height);
2259
009c7216
VZ
2260 /**
2261 Hides the specified row.
2262
2263 To show the row later you need to call SetRowSize() with non-0
2264 width or ShowRow().
2265
2266 @param col
2267 The row index.
2268 */
2269 void HideRow(int col);
2270
2271 /**
2272 Shows the previously hidden row by resizing it to non-0 size.
2273
2274 @see HideRow(), SetRowSize()
2275 */
2276 void ShowRow(int col);
2277
574e1c5a
VZ
2278 /**
2279 Get size information for all columns at once.
2280
2281 This method is useful when the information about all column widths
2282 needs to be saved. The widths can be later restored using
2283 SetColSizes().
2284
2285 @sa wxGridSizesInfo, GetRowSizes()
2286 */
2287 wxGridSizesInfo GetColSizes() const;
2288
2289 /**
2290 Get size information for all row at once.
2291
2292 @sa wxGridSizesInfo, GetColSizes()
2293 */
2294 wxGridSizesInfo GetRowSizes() const;
2295
2296 /**
2297 Restore all columns sizes.
2298
2299 This is usually called with wxGridSizesInfo object previously returned
2300 by GetColSizes().
2301
2302 @sa SetRowSizes()
2303 */
2304 void SetColSizes(const wxGridSizesInfo& sizeInfo);
2305
2306 /**
2307 Restore all rows sizes.
2308
2309 @sa SetColSizes()
2310 */
2311 void SetRowSizes(const wxGridSizesInfo& sizeInfo);
2312
8b9ef005 2313 //@}
23324ae1 2314
caac7804 2315
23324ae1 2316 /**
caac7804
BP
2317 @name User-Resizing and Dragging
2318 */
2319 //@{
08dd9b5a 2320
caac7804
BP
2321 /**
2322 Return @true if the dragging of cells is enabled or @false otherwise.
23324ae1 2323 */
caac7804 2324 bool CanDragCell() const;
23324ae1
FM
2325
2326 /**
caac7804 2327 Returns @true if columns can be moved by dragging with the mouse.
08dd9b5a 2328
caac7804 2329 Columns can be moved by dragging on their labels.
23324ae1 2330 */
caac7804 2331 bool CanDragColMove() const;
23324ae1
FM
2332
2333 /**
caac7804 2334 Returns @true if columns can be resized by dragging with the mouse.
8b9ef005 2335
caac7804
BP
2336 Columns can be resized by dragging the edges of their labels. If grid
2337 line dragging is enabled they can also be resized by dragging the right
2338 edge of the column in the grid cell area (see EnableDragGridSize()).
23324ae1 2339 */
caac7804 2340 bool CanDragColSize() const;
23324ae1
FM
2341
2342 /**
caac7804
BP
2343 Return @true if the dragging of grid lines to resize rows and columns
2344 is enabled or @false otherwise.
2345 */
2346 bool CanDragGridSize() const;
2347
2348 /**
2349 Returns @true if rows can be resized by dragging with the mouse.
2350
2351 Rows can be resized by dragging the edges of their labels. If grid line
2352 dragging is enabled they can also be resized by dragging the lower edge
2353 of the row in the grid cell area (see EnableDragGridSize()).
2354 */
2355 bool CanDragRowSize() const;
2356
2357 /**
2358 Disables column moving by dragging with the mouse.
2359
2360 Equivalent to passing @false to EnableDragColMove().
2361 */
2362 void DisableDragColMove();
2363
2364 /**
2365 Disables column sizing by dragging with the mouse.
2366
2367 Equivalent to passing @false to EnableDragColSize().
2368 */
2369 void DisableDragColSize();
2370
2371 /**
2372 Disable mouse dragging of grid lines to resize rows and columns.
2373
2374 Equivalent to passing @false to EnableDragGridSize()
2375 */
2376 void DisableDragGridSize();
2377
2378 /**
2379 Disables row sizing by dragging with the mouse.
2380
2381 Equivalent to passing @false to EnableDragRowSize().
2382 */
2383 void DisableDragRowSize();
2384
2385 /**
2386 Enables or disables cell dragging with the mouse.
2387 */
2388 void EnableDragCell(bool enable = true);
2389
2390 /**
2391 Enables or disables column moving by dragging with the mouse.
2392 */
2393 void EnableDragColMove(bool enable = true);
2394
2395 /**
2396 Enables or disables column sizing by dragging with the mouse.
2397 */
2398 void EnableDragColSize(bool enable = true);
2399
2400 /**
2401 Enables or disables row and column resizing by dragging gridlines with
2402 the mouse.
2403 */
2404 void EnableDragGridSize(bool enable = true);
2405
2406 /**
2407 Enables or disables row sizing by dragging with the mouse.
2408 */
2409 void EnableDragRowSize(bool enable = true);
2410
2411 /**
2412 Returns the column ID of the specified column position.
2413 */
2414 int GetColAt(int colPos) const;
2415
2416 /**
2417 Returns the position of the specified column.
2418 */
2419 int GetColPos(int colID) const;
2420
2421 /**
2422 Sets the position of the specified column.
2423 */
2424 void SetColPos(int colID, int newPos);
2425
31ec8b4e
VZ
2426 /**
2427 Sets the positions of all columns at once.
2428
2429 This method takes an array containing the indices of the columns in
2430 their display order, i.e. uses the same convention as
2431 wxHeaderCtrl::SetColumnsOrder().
f8f31de6 2432 */
31ec8b4e
VZ
2433 void SetColumnsOrder(const wxArrayInt& order);
2434
009c7216
VZ
2435 /**
2436 Resets the position of the columns to the default.
f8f31de6 2437 */
009c7216
VZ
2438 void ResetColPos();
2439
caac7804
BP
2440 //@}
2441
2442
2443 /**
2444 @name Cursor Movement
f8f31de6 2445 */
caac7804
BP
2446 //@{
2447
2448 /**
2449 Returns the current grid cell column position.
2450 */
2451 int GetGridCursorCol() const;
2452
2453 /**
2454 Returns the current grid cell row position.
2455 */
2456 int GetGridCursorRow() const;
2457
2458 /**
2459 Make the given cell current and ensure it is visible.
2460
2461 This method is equivalent to calling MakeCellVisible() and
2462 SetGridCursor() and so, as with the latter, a @c wxEVT_GRID_SELECT_CELL
2463 event is generated by it and the selected cell doesn't change if the
2464 event is vetoed.
2465 */
2466 void GoToCell(int row, int col);
2467 /**
2468 Make the given cell current and ensure it is visible.
2469
2470 This method is equivalent to calling MakeCellVisible() and
2471 SetGridCursor() and so, as with the latter, a @c wxEVT_GRID_SELECT_CELL
2472 event is generated by it and the selected cell doesn't change if the
2473 event is vetoed.
2474 */
2475 void GoToCell(const wxGridCellCoords& coords);
2476
2477 /**
2478 Moves the grid cursor down by one row.
2479
2480 If a block of cells was previously selected it will expand if the
2481 argument is @true or be cleared if the argument is @false.
2482 */
2483 bool MoveCursorDown(bool expandSelection);
2484
2485 /**
2486 Moves the grid cursor down in the current column such that it skips to
2487 the beginning or end of a block of non-empty cells.
2488
2489 If a block of cells was previously selected it will expand if the
2490 argument is @true or be cleared if the argument is @false.
2491 */
2492 bool MoveCursorDownBlock(bool expandSelection);
2493
2494 /**
2495 Moves the grid cursor left by one column.
08dd9b5a 2496
8b9ef005
BP
2497 If a block of cells was previously selected it will expand if the
2498 argument is @true or be cleared if the argument is @false.
23324ae1 2499 */
8b9ef005 2500 bool MoveCursorLeft(bool expandSelection);
23324ae1
FM
2501
2502 /**
8b9ef005
BP
2503 Moves the grid cursor left in the current row such that it skips to the
2504 beginning or end of a block of non-empty cells.
2505
2506 If a block of cells was previously selected it will expand if the
2507 argument is @true or be cleared if the argument is @false.
23324ae1 2508 */
8b9ef005 2509 bool MoveCursorLeftBlock(bool expandSelection);
23324ae1
FM
2510
2511 /**
8b9ef005 2512 Moves the grid cursor right by one column.
08dd9b5a 2513
8b9ef005
BP
2514 If a block of cells was previously selected it will expand if the
2515 argument is @true or be cleared if the argument is @false.
23324ae1 2516 */
8b9ef005 2517 bool MoveCursorRight(bool expandSelection);
23324ae1
FM
2518
2519 /**
8b9ef005
BP
2520 Moves the grid cursor right in the current row such that it skips to
2521 the beginning or end of a block of non-empty cells.
08dd9b5a 2522
8b9ef005
BP
2523 If a block of cells was previously selected it will expand if the
2524 argument is @true or be cleared if the argument is @false.
23324ae1 2525 */
8b9ef005 2526 bool MoveCursorRightBlock(bool expandSelection);
23324ae1 2527
23324ae1 2528 /**
8b9ef005
BP
2529 Moves the grid cursor up by one row.
2530
2531 If a block of cells was previously selected it will expand if the
2532 argument is @true or be cleared if the argument is @false.
23324ae1 2533 */
8b9ef005 2534 bool MoveCursorUp(bool expandSelection);
23324ae1
FM
2535
2536 /**
8b9ef005
BP
2537 Moves the grid cursor up in the current column such that it skips to
2538 the beginning or end of a block of non-empty cells.
3c4f71cc 2539
8b9ef005
BP
2540 If a block of cells was previously selected it will expand if the
2541 argument is @true or be cleared if the argument is @false.
23324ae1 2542 */
8b9ef005 2543 bool MoveCursorUpBlock(bool expandSelection);
23324ae1
FM
2544
2545 /**
8b9ef005
BP
2546 Moves the grid cursor down by some number of rows so that the previous
2547 bottom visible row becomes the top visible row.
2548 */
2549 bool MovePageDown();
3c4f71cc 2550
8b9ef005
BP
2551 /**
2552 Moves the grid cursor up by some number of rows so that the previous
2553 top visible row becomes the bottom visible row.
23324ae1 2554 */
8b9ef005 2555 bool MovePageUp();
23324ae1
FM
2556
2557 /**
caac7804 2558 Set the grid cursor to the specified cell.
08dd9b5a 2559
caac7804
BP
2560 The grid cursor indicates the current cell and can be moved by the user
2561 using the arrow keys or the mouse.
8b9ef005 2562
caac7804
BP
2563 Calling this function generates a @c wxEVT_GRID_SELECT_CELL event and
2564 if the event handler vetoes this event, the cursor is not moved.
8b9ef005 2565
caac7804
BP
2566 This function doesn't make the target call visible, use GoToCell() to
2567 do this.
23324ae1 2568 */
caac7804 2569 void SetGridCursor(int row, int col);
23324ae1 2570 /**
caac7804 2571 Set the grid cursor to the specified cell.
23324ae1 2572
caac7804
BP
2573 The grid cursor indicates the current cell and can be moved by the user
2574 using the arrow keys or the mouse.
bb778cae 2575
caac7804
BP
2576 Calling this function generates a @c wxEVT_GRID_SELECT_CELL event and
2577 if the event handler vetoes this event, the cursor is not moved.
8b9ef005 2578
caac7804
BP
2579 This function doesn't make the target call visible, use GoToCell() to
2580 do this.
23324ae1 2581 */
caac7804
BP
2582 void SetGridCursor(const wxGridCellCoords& coords);
2583
8b9ef005 2584 //@}
23324ae1 2585
8b9ef005 2586
caac7804
BP
2587 /**
2588 @name User Selection
2589 */
2590 //@{
8b9ef005 2591
caac7804
BP
2592 /**
2593 Deselects all cells that are currently selected.
23324ae1 2594 */
caac7804 2595 void ClearSelection();
23324ae1
FM
2596
2597 /**
caac7804 2598 Returns an array of individually selected cells.
08dd9b5a 2599
caac7804
BP
2600 Notice that this array does @em not contain all the selected cells in
2601 general as it doesn't include the cells selected as part of column, row
2602 or block selection. You must use this method, GetSelectedCols(),
2603 GetSelectedRows() and GetSelectionBlockTopLeft() and
2604 GetSelectionBlockBottomRight() methods to obtain the entire selection
2605 in general.
08dd9b5a 2606
caac7804
BP
2607 Please notice this behaviour is by design and is needed in order to
2608 support grids of arbitrary size (when an entire column is selected in
2609 a grid with a million of columns, we don't want to create an array with
2610 a million of entries in this function, instead it returns an empty
2611 array and GetSelectedCols() returns an array containing one element).
23324ae1 2612 */
caac7804 2613 wxGridCellCoordsArray GetSelectedCells() const;
23324ae1
FM
2614
2615 /**
caac7804 2616 Returns an array of selected columns.
08dd9b5a 2617
caac7804
BP
2618 Please notice that this method alone is not sufficient to find all the
2619 selected columns as it contains only the columns which were
2620 individually selected but not those being part of the block selection
2621 or being selected in virtue of all of their cells being selected
2622 individually, please see GetSelectedCells() for more details.
23324ae1 2623 */
caac7804 2624 wxArrayInt GetSelectedCols() const;
23324ae1
FM
2625
2626 /**
caac7804 2627 Returns an array of selected rows.
23324ae1 2628
caac7804
BP
2629 Please notice that this method alone is not sufficient to find all the
2630 selected rows as it contains only the rows which were individually
2631 selected but not those being part of the block selection or being
2632 selected in virtue of all of their cells being selected individually,
2633 please see GetSelectedCells() for more details.
23324ae1 2634 */
caac7804 2635 wxArrayInt GetSelectedRows() const;
23324ae1
FM
2636
2637 /**
caac7804 2638 Returns the colour used for drawing the selection background.
23324ae1 2639 */
caac7804 2640 wxColour GetSelectionBackground() const;
23324ae1 2641
8a3e536c 2642 /**
caac7804
BP
2643 Returns an array of the bottom right corners of blocks of selected
2644 cells.
8a3e536c 2645
caac7804
BP
2646 Please see GetSelectedCells() for more information about the selection
2647 representation in wxGrid.
23324ae1 2648
caac7804 2649 @see GetSelectionBlockTopLeft()
23324ae1 2650 */
caac7804 2651 wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
8b9ef005 2652
8b9ef005 2653 /**
caac7804 2654 Returns an array of the top left corners of blocks of selected cells.
8b9ef005 2655
caac7804
BP
2656 Please see GetSelectedCells() for more information about the selection
2657 representation in wxGrid.
23324ae1 2658
caac7804 2659 @see GetSelectionBlockBottomRight()
23324ae1 2660 */
caac7804 2661 wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
23324ae1
FM
2662
2663 /**
caac7804 2664 Returns the colour used for drawing the selection foreground.
23324ae1 2665 */
caac7804 2666 wxColour GetSelectionForeground() const;
23324ae1
FM
2667
2668 /**
caac7804 2669 Returns the current selection mode.
23324ae1 2670
caac7804 2671 @see SetSelectionMode().
23324ae1 2672 */
caac7804 2673 wxGridSelectionModes GetSelectionMode() const;
23324ae1
FM
2674
2675 /**
caac7804
BP
2676 Returns @true if the given cell is selected.
2677 */
2678 bool IsInSelection(int row, int col) const;
2679 /**
2680 Returns @true if the given cell is selected.
2681 */
2682 bool IsInSelection(const wxGridCellCoords& coords) const;
08dd9b5a 2683
caac7804
BP
2684 /**
2685 Returns @true if there are currently any selected cells, rows, columns
2686 or blocks.
2687 */
2688 bool IsSelection() const;
08dd9b5a 2689
caac7804
BP
2690 /**
2691 Selects all cells in the grid.
23324ae1 2692 */
caac7804 2693 void SelectAll();
23324ae1
FM
2694
2695 /**
caac7804 2696 Selects a rectangular block of cells.
8b9ef005 2697
caac7804
BP
2698 If @a addToSelected is @false then any existing selection will be
2699 deselected; if @true the column will be added to the existing
2700 selection.
23324ae1 2701 */
caac7804
BP
2702 void SelectBlock(int topRow, int leftCol, int bottomRow, int rightCol,
2703 bool addToSelected = false);
23324ae1 2704 /**
caac7804 2705 Selects a rectangular block of cells.
08dd9b5a 2706
caac7804
BP
2707 If @a addToSelected is @false then any existing selection will be
2708 deselected; if @true the column will be added to the existing
2709 selection.
23324ae1 2710 */
caac7804
BP
2711 void SelectBlock(const wxGridCellCoords& topLeft,
2712 const wxGridCellCoords& bottomRight,
2713 bool addToSelected = false);
23324ae1
FM
2714
2715 /**
caac7804 2716 Selects the specified column.
08dd9b5a 2717
caac7804
BP
2718 If @a addToSelected is @false then any existing selection will be
2719 deselected; if @true the column will be added to the existing
2720 selection.
2721
2722 This method won't select anything if the current selection mode is
2723 wxGridSelectRows.
23324ae1 2724 */
caac7804 2725 void SelectCol(int col, bool addToSelected = false);
23324ae1 2726
23324ae1 2727 /**
caac7804 2728 Selects the specified row.
8b9ef005 2729
caac7804
BP
2730 If @a addToSelected is @false then any existing selection will be
2731 deselected; if @true the row will be added to the existing selection.
2732
2733 This method won't select anything if the current selection mode is
2734 wxGridSelectColumns.
23324ae1 2735 */
caac7804 2736 void SelectRow(int row, bool addToSelected = false);
23324ae1
FM
2737
2738 /**
caac7804
BP
2739 Set the colour to be used for drawing the selection background.
2740 */
2741 void SetSelectionBackground(const wxColour& c);
08dd9b5a 2742
caac7804
BP
2743 /**
2744 Set the colour to be used for drawing the selection foreground.
23324ae1 2745 */
caac7804 2746 void SetSelectionForeground(const wxColour& c);
23324ae1
FM
2747
2748 /**
caac7804 2749 Set the selection behaviour of the grid.
8b9ef005 2750
caac7804
BP
2751 The existing selection is converted to conform to the new mode if
2752 possible and discarded otherwise (e.g. any individual selected cells
2753 are deselected if the new mode allows only the selection of the entire
2754 rows or columns).
23324ae1 2755 */
caac7804 2756 void SetSelectionMode(wxGridSelectionModes selmode);
23324ae1 2757
caac7804 2758 //@}
08dd9b5a 2759
8b9ef005 2760
caac7804
BP
2761 /**
2762 @name Scrolling
2763 */
2764 //@{
23324ae1 2765
23324ae1 2766 /**
caac7804
BP
2767 Returns the number of pixels per horizontal scroll increment.
2768
2769 The default is 15.
2770
2771 @see GetScrollLineY(), SetScrollLineX(), SetScrollLineY()
23324ae1 2772 */
caac7804 2773 int GetScrollLineX() const;
23324ae1
FM
2774
2775 /**
caac7804 2776 Returns the number of pixels per vertical scroll increment.
08dd9b5a 2777
caac7804 2778 The default is 15.
8b9ef005 2779
caac7804 2780 @see GetScrollLineX(), SetScrollLineX(), SetScrollLineY()
23324ae1 2781 */
caac7804 2782 int GetScrollLineY() const;
23324ae1
FM
2783
2784 /**
caac7804
BP
2785 Returns @true if a cell is either entirely or at least partially
2786 visible in the grid window.
08dd9b5a 2787
caac7804
BP
2788 By default, the cell must be entirely visible for this function to
2789 return @true but if @a wholeCellVisible is @false, the function returns
2790 @true even if the cell is only partially visible.
23324ae1 2791 */
caac7804 2792 bool IsVisible(int row, int col, bool wholeCellVisible = true) const;
23324ae1 2793 /**
caac7804
BP
2794 Returns @true if a cell is either entirely or at least partially
2795 visible in the grid window.
2796
2797 By default, the cell must be entirely visible for this function to
2798 return @true but if @a wholeCellVisible is @false, the function returns
2799 @true even if the cell is only partially visible.
23324ae1 2800 */
caac7804
BP
2801 bool IsVisible(const wxGridCellCoords& coords,
2802 bool wholeCellVisible = true) const;
23324ae1
FM
2803
2804 /**
caac7804
BP
2805 Brings the specified cell into the visible grid cell area with minimal
2806 scrolling.
23324ae1 2807
caac7804
BP
2808 Does nothing if the cell is already visible.
2809 */
2810 void MakeCellVisible(int row, int col);
23324ae1 2811 /**
caac7804
BP
2812 Brings the specified cell into the visible grid cell area with minimal
2813 scrolling.
2814
2815 Does nothing if the cell is already visible.
23324ae1 2816 */
caac7804 2817 void MakeCellVisible(const wxGridCellCoords& coords);
23324ae1
FM
2818
2819 /**
caac7804 2820 Sets the number of pixels per horizontal scroll increment.
08dd9b5a 2821
caac7804 2822 The default is 15.
8b9ef005 2823
caac7804 2824 @see GetScrollLineX(), GetScrollLineY(), SetScrollLineY()
23324ae1 2825 */
caac7804 2826 void SetScrollLineX(int x);
23324ae1
FM
2827
2828 /**
caac7804 2829 Sets the number of pixels per vertical scroll increment.
08dd9b5a 2830
caac7804 2831 The default is 15.
8b9ef005 2832
caac7804 2833 @see GetScrollLineX(), GetScrollLineY(), SetScrollLineX()
23324ae1 2834 */
caac7804 2835 void SetScrollLineY(int y);
23324ae1 2836
caac7804 2837 //@}
08dd9b5a 2838
23324ae1 2839
caac7804
BP
2840 /**
2841 @name Cell and Device Coordinate Translation
2842 */
2843 //@{
23324ae1
FM
2844
2845 /**
caac7804 2846 Convert grid cell coordinates to grid window pixel coordinates.
8b9ef005 2847
caac7804
BP
2848 This function returns the rectangle that encloses the block of cells
2849 limited by @a topLeft and @a bottomRight cell in device coords and
2850 clipped to the client size of the grid window.
8b9ef005 2851
caac7804 2852 @see CellToRect()
23324ae1 2853 */
caac7804
BP
2854 wxRect BlockToDeviceRect(const wxGridCellCoords& topLeft,
2855 const wxGridCellCoords& bottomRight) const;
23324ae1
FM
2856
2857 /**
caac7804
BP
2858 Return the rectangle corresponding to the grid cell's size and position
2859 in logical coordinates.
08dd9b5a 2860
caac7804
BP
2861 @see BlockToDeviceRect()
2862 */
2863 wxRect CellToRect(int row, int col) const;
2864 /**
2865 Return the rectangle corresponding to the grid cell's size and position
2866 in logical coordinates.
08dd9b5a 2867
caac7804 2868 @see BlockToDeviceRect()
23324ae1 2869 */
882678eb 2870 wxRect CellToRect(const wxGridCellCoords& coords) const;
23324ae1 2871
23324ae1 2872 /**
caac7804
BP
2873 Returns the column at the given pixel position.
2874
2875 @param x
2876 The x position to evaluate.
2877 @param clipToMinMax
2878 If @true, rather than returning @c wxNOT_FOUND, it returns either
2879 the first or last column depending on whether @a x is too far to
2880 the left or right respectively.
2881 @return
2882 The column index or @c wxNOT_FOUND.
23324ae1 2883 */
caac7804 2884 int XToCol(int x, bool clipToMinMax = false) const;
23324ae1
FM
2885
2886 /**
caac7804
BP
2887 Returns the column whose right hand edge is close to the given logical
2888 @a x position.
2889
2890 If no column edge is near to this position @c wxNOT_FOUND is returned.
23324ae1 2891 */
caac7804 2892 int XToEdgeOfCol(int x) const;
23324ae1 2893
23324ae1 2894 /**
caac7804
BP
2895 Translates logical pixel coordinates to the grid cell coordinates.
2896
2897 Notice that this function expects logical coordinates on input so if
2898 you use this function in a mouse event handler you need to translate
2899 the mouse position, which is expressed in device coordinates, to
2900 logical ones.
2901
2902 @see XToCol(), YToRow()
2903 */
2904 wxGridCellCoords XYToCell(int x, int y) const;
2905 /**
2906 Translates logical pixel coordinates to the grid cell coordinates.
2907
2908 Notice that this function expects logical coordinates on input so if
2909 you use this function in a mouse event handler you need to translate
2910 the mouse position, which is expressed in device coordinates, to
2911 logical ones.
2912
2913 @see XToCol(), YToRow()
2914 */
2915 wxGridCellCoords XYToCell(const wxPoint& pos) const;
2916 // XYToCell(int, int, wxGridCellCoords&) overload is intentionally
2917 // undocumented, using it is ugly and non-const reference parameters are
2918 // not used in wxWidgets API
08dd9b5a 2919
8b9ef005 2920 /**
caac7804
BP
2921 Returns the row whose bottom edge is close to the given logical @a y
2922 position.
2923
2924 If no row edge is near to this position @c wxNOT_FOUND is returned.
23324ae1 2925 */
caac7804 2926 int YToEdgeOfRow(int y) const;
23324ae1
FM
2927
2928 /**
caac7804 2929 Returns the grid row that corresponds to the logical @a y coordinate.
08dd9b5a 2930
caac7804 2931 Returns @c wxNOT_FOUND if there is no row at the @a y position.
8b9ef005 2932 */
caac7804
BP
2933 int YToRow(int y, bool clipToMinMax = false) const;
2934
2935 //@}
2936
08dd9b5a 2937
8b9ef005 2938 /**
caac7804
BP
2939 @name Miscellaneous Functions
2940 */
2941 //@{
8b9ef005 2942
caac7804
BP
2943 /**
2944 Appends one or more new columns to the right of the grid.
2945
2946 The @a updateLabels argument is not used at present. If you are using a
2947 derived grid table class you will need to override
2948 wxGridTableBase::AppendCols(). See InsertCols() for further
2949 information.
2950
2951 @return @true on success or @false if appending columns failed.
23324ae1 2952 */
caac7804 2953 bool AppendCols(int numCols = 1, bool updateLabels = true);
23324ae1
FM
2954
2955 /**
caac7804 2956 Appends one or more new rows to the bottom of the grid.
08dd9b5a 2957
caac7804
BP
2958 The @a updateLabels argument is not used at present. If you are using a
2959 derived grid table class you will need to override
2960 wxGridTableBase::AppendRows(). See InsertRows() for further
2961 information.
23324ae1 2962
caac7804 2963 @return @true on success or @false if appending rows failed.
23324ae1 2964 */
caac7804 2965 bool AppendRows(int numRows = 1, bool updateLabels = true);
23324ae1 2966
23324ae1 2967 /**
caac7804
BP
2968 Return @true if the horizontal grid lines stop at the last column
2969 boundary or @false if they continue to the end of the window.
3c4f71cc 2970
caac7804
BP
2971 The default is to clip grid lines.
2972
2973 @see ClipHorzGridLines(), AreVertGridLinesClipped()
2974 */
2975 bool AreHorzGridLinesClipped() const;
23324ae1
FM
2976
2977 /**
caac7804
BP
2978 Return @true if the vertical grid lines stop at the last row
2979 boundary or @false if they continue to the end of the window.
8b9ef005 2980
caac7804
BP
2981 The default is to clip grid lines.
2982
2983 @see ClipVertGridLines(), AreHorzGridLinesClipped()
2984 */
2985 bool AreVertGridLinesClipped() const;
23324ae1
FM
2986
2987 /**
caac7804 2988 Increments the grid's batch count.
08dd9b5a 2989
caac7804
BP
2990 When the count is greater than zero repainting of the grid is
2991 suppressed. Each call to BeginBatch must be matched by a later call to
2992 EndBatch(). Code that does a lot of grid modification can be enclosed
2993 between BeginBatch() and EndBatch() calls to avoid screen flicker. The
2994 final EndBatch() call will cause the grid to be repainted.
2995
2996 Notice that you should use wxGridUpdateLocker which ensures that there
2997 is always a matching EndBatch() call for this BeginBatch() if possible
2998 instead of calling this method directly.
8b9ef005 2999 */
caac7804 3000 void BeginBatch();
08dd9b5a 3001
8b9ef005 3002 /**
caac7804 3003 Clears all data in the underlying grid table and repaints the grid.
8b9ef005 3004
caac7804
BP
3005 The table is not deleted by this function. If you are using a derived
3006 table class then you need to override wxGridTableBase::Clear() for this
3007 function to have any effect.
23324ae1 3008 */
caac7804 3009 void ClearGrid();
23324ae1
FM
3010
3011 /**
caac7804
BP
3012 Change whether the horizontal grid lines are clipped by the end of the
3013 last column.
8b9ef005 3014
caac7804
BP
3015 By default the grid lines are not drawn beyond the end of the last
3016 column but after calling this function with @a clip set to @false they
3017 will be drawn across the entire grid window.
3018
3019 @see AreHorzGridLinesClipped(), ClipVertGridLines()
3020 */
3021 void ClipHorzGridLines(bool clip);
23324ae1
FM
3022
3023 /**
caac7804
BP
3024 Change whether the vertical grid lines are clipped by the end of the
3025 last row.
08dd9b5a 3026
caac7804
BP
3027 By default the grid lines are not drawn beyond the end of the last
3028 row but after calling this function with @a clip set to @false they
3029 will be drawn across the entire grid window.
3030
3031 @see AreVertGridLinesClipped(), ClipHorzGridLines()
3032 */
3033 void ClipVertGridLines(bool clip);
08dd9b5a 3034
8b9ef005 3035 /**
caac7804
BP
3036 Deletes one or more columns from a grid starting at the specified
3037 position.
8b9ef005 3038
caac7804
BP
3039 The @a updateLabels argument is not used at present. If you are using a
3040 derived grid table class you will need to override
3041 wxGridTableBase::DeleteCols(). See InsertCols() for further
3042 information.
8b9ef005 3043
caac7804 3044 @return @true on success or @false if deleting columns failed.
23324ae1 3045 */
caac7804 3046 bool DeleteCols(int pos = 0, int numCols = 1, bool updateLabels = true);
23324ae1 3047
23324ae1 3048 /**
caac7804
BP
3049 Deletes one or more rows from a grid starting at the specified
3050 position.
8b9ef005 3051
caac7804
BP
3052 The @a updateLabels argument is not used at present. If you are using a
3053 derived grid table class you will need to override
3054 wxGridTableBase::DeleteRows(). See InsertRows() for further
3055 information.
8b9ef005 3056
caac7804 3057 @return @true on success or @false if appending rows failed.
23324ae1 3058 */
caac7804 3059 bool DeleteRows(int pos = 0, int numRows = 1, bool updateLabels = true);
23324ae1 3060
23324ae1 3061 /**
caac7804
BP
3062 Decrements the grid's batch count.
3063
3064 When the count is greater than zero repainting of the grid is
3065 suppressed. Each previous call to BeginBatch() must be matched by a
3066 later call to EndBatch(). Code that does a lot of grid modification can
3067 be enclosed between BeginBatch() and EndBatch() calls to avoid screen
3068 flicker. The final EndBatch() will cause the grid to be repainted.
3069
3070 @see wxGridUpdateLocker
8b9ef005 3071 */
caac7804 3072 void EndBatch();
08dd9b5a 3073
8b9ef005 3074 /**
caac7804 3075 Overridden wxWindow method.
8b9ef005 3076 */
caac7804 3077 virtual void Fit();
08dd9b5a 3078
8b9ef005 3079 /**
caac7804 3080 Causes immediate repainting of the grid.
8b9ef005 3081
caac7804 3082 Use this instead of the usual wxWindow::Refresh().
23324ae1 3083 */
caac7804 3084 void ForceRefresh();
23324ae1
FM
3085
3086 /**
caac7804
BP
3087 Returns the number of times that BeginBatch() has been called without
3088 (yet) matching calls to EndBatch(). While the grid's batch count is
3089 greater than zero the display will not be updated.
3090 */
3091 int GetBatchCount();
08dd9b5a 3092
caac7804
BP
3093 /**
3094 Returns the total number of grid columns.
8b9ef005 3095
caac7804 3096 This is the same as the number of columns in the underlying grid table.
23324ae1 3097 */
caac7804 3098 int GetNumberCols() const;
23324ae1
FM
3099
3100 /**
caac7804 3101 Returns the total number of grid rows.
08dd9b5a 3102
caac7804 3103 This is the same as the number of rows in the underlying grid table.
23324ae1 3104 */
caac7804 3105 int GetNumberRows() const;
23324ae1
FM
3106
3107 /**
caac7804
BP
3108 Returns the attribute for the given cell creating one if necessary.
3109
3110 If the cell already has an attribute, it is returned. Otherwise a new
3111 attribute is created, associated with the cell and returned. In any
3112 case the caller must call DecRef() on the returned pointer.
3113
3114 This function may only be called if CanHaveAttributes() returns @true.
8b9ef005 3115 */
caac7804 3116 wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
08dd9b5a 3117
8b9ef005 3118 /**
caac7804 3119 Returns a base pointer to the current table object.
08dd9b5a 3120
caac7804 3121 The returned pointer is still owned by the grid.
23324ae1 3122 */
caac7804 3123 wxGridTableBase *GetTable() const;
23324ae1
FM
3124
3125 /**
caac7804
BP
3126 Inserts one or more new columns into a grid with the first new column
3127 at the specified position.
08dd9b5a 3128
caac7804
BP
3129 Notice that inserting the columns in the grid requires grid table
3130 cooperation: when this method is called, grid object begins by
3131 requesting the underlying grid table to insert new columns. If this is
3132 successful the table notifies the grid and the grid updates the
3133 display. For a default grid (one where you have called CreateGrid())
3134 this process is automatic. If you are using a custom grid table
3135 (specified with SetTable()) then you must override
3136 wxGridTableBase::InsertCols() in your derived table class.
3137
3138 @param pos
3139 The position which the first newly inserted column will have.
3140 @param numCols
3141 The number of columns to insert.
3142 @param updateLabels
3143 Currently not used.
3144 @return
3145 @true if the columns were successfully inserted, @false if an error
3146 occurred (most likely the table couldn't be updated).
23324ae1 3147 */
caac7804 3148 bool InsertCols(int pos = 0, int numCols = 1, bool updateLabels = true);
23324ae1
FM
3149
3150 /**
caac7804
BP
3151 Inserts one or more new rows into a grid with the first new row at the
3152 specified position.
8b9ef005 3153
caac7804
BP
3154 Notice that you must implement wxGridTableBase::InsertRows() if you use
3155 a grid with a custom table, please see InsertCols() for more
3156 information.
8b9ef005 3157
caac7804
BP
3158 @param pos
3159 The position which the first newly inserted row will have.
3160 @param numRows
3161 The number of rows to insert.
3162 @param updateLabels
3163 Currently not used.
3164 @return
3165 @true if the rows were successfully inserted, @false if an error
3166 occurred (most likely the table couldn't be updated).
3167 */
3168 bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true);
8b9ef005 3169
caac7804
BP
3170 /**
3171 Sets the cell attributes for all cells in the specified column.
08dd9b5a 3172
caac7804
BP
3173 For more information about controlling grid cell attributes see the
3174 wxGridCellAttr cell attribute class and the @ref overview_grid.
3175 */
3176 void SetColAttr(int col, wxGridCellAttr* attr);
23324ae1
FM
3177
3178 /**
caac7804 3179 Sets the extra margins used around the grid area.
08dd9b5a 3180
caac7804
BP
3181 A grid may occupy more space than needed for its data display and
3182 this function allows to set how big this extra space is
23324ae1 3183 */
caac7804 3184 void SetMargins(int extraWidth, int extraHeight);
23324ae1
FM
3185
3186 /**
caac7804 3187 Sets the cell attributes for all cells in the specified row.
08dd9b5a 3188
caac7804
BP
3189 The grid takes ownership of the attribute pointer.
3190
3191 See the wxGridCellAttr class for more information about controlling
3192 cell attributes.
23324ae1 3193 */
caac7804
BP
3194 void SetRowAttr(int row, wxGridCellAttr* attr);
3195
3196 //@}
23324ae1 3197
11393d29
VZ
3198
3199 /**
3200 @name Sorting support.
3201
3202 wxGrid doesn't provide any support for sorting the data but it does
3203 generate events allowing the user code to sort it and supports
3204 displaying the sort indicator in the column used for sorting.
3205
3206 To use wxGrid sorting support you need to handle wxEVT_GRID_COL_SORT
3207 event (and not veto it) and resort the data displayed in the grid. The
3208 grid will automatically update the sorting indicator on the column
3209 which was clicked.
3210
3211 You can also call the functions in this section directly to update the
3212 sorting indicator. Once again, they don't do anything with the grid
3213 data, it remains your responsibility to actually sort it appropriately.
3214 */
3215 //@{
3216
3217 /**
3218 Return the column in which the sorting indicator is currently
3219 displayed.
3220
3221 Returns @c wxNOT_FOUND if sorting indicator is not currently displayed
3222 at all.
3223
3224 @see SetSortingColumn()
3225 */
3226 int GetSortingColumn() const;
3227
3228 /**
3229 Return @true if this column is currently used for sorting.
3230
3231 @see GetSortingColumn()
3232 */
3233 bool IsSortingBy(int col) const;
3234
3235 /**
3236 Return @true if the current sorting order is ascending or @false if it
3237 is descending.
3238
3239 It only makes sense to call this function if GetSortingColumn() returns
3240 a valid column index and not @c wxNOT_FOUND.
3241
3242 @see SetSortingColumn()
3243 */
3244 bool IsSortOrderAscending() const;
3245
3246 /**
3247 Set the column to display the sorting indicator in and its direction.
3248
3249 @param col
3250 The column to display the sorting indicator in or @c wxNOT_FOUND to
3251 remove any currently displayed sorting indicator.
3252 @param ascending
3253 If @true, display the ascending sort indicator, otherwise display
3254 the descending sort indicator.
3255
3256 @see GetSortingColumn(), IsSortOrderAscending()
3257 */
3258 void SetSortingColumn(int col, bool ascending = true);
3259
3260 /**
3261 Remove any currently shown sorting indicator.
3262
3263 This is equivalent to calling SetSortingColumn() with @c wxNOT_FOUND
3264 first argument.
3265 */
3266 void UnsetSortingColumn();
3267 //@}
3039ade9 3268
882678eb 3269
3039ade9
VZ
3270 /**
3271 @name Accessors for component windows.
3272
3273 Return the various child windows of wxGrid.
3274
3275 wxGrid is an empty parent window for 4 children representing the column
3276 labels window (top), the row labels window (left), the corner window
3277 (top left) and the main grid window. It may be necessary to use these
3278 individual windows and not the wxGrid window itself if you need to
3279 handle events for them (this can be done using wxEvtHandler::Connect()
3280 or wxWindow::PushEventHandler()) or do something else requiring the use
3281 of the correct window pointer. Notice that you should not, however,
3282 change these windows (e.g. reposition them or draw over them) because
3283 they are managed by wxGrid itself.
3284 */
3285 //@{
3286
3287 /**
3288 Return the main grid window containing the grid cells.
3289
3290 This window is always shown.
3291 */
3292 wxWindow *GetGridWindow() const;
3293
3294 /**
3295 Return the row labels window.
3296
3297 This window is not shown if the row labels were hidden using
3298 HideRowLabels().
3299 */
3300 wxWindow *GetGridRowLabelWindow() const;
3301
3302 /**
3303 Return the column labels window.
3304
3305 This window is not shown if the columns labels were hidden using
3306 HideColLabels().
3307
3308 Depending on whether UseNativeColHeader() was called or not this can be
3309 either a wxHeaderCtrl or a plain wxWindow. This function returns a valid
3310 window pointer in either case but in the former case you can also use
3311 GetGridColHeader() to access it if you need wxHeaderCtrl-specific
3312 functionality.
3313 */
600e986a 3314 wxWindow *GetGridColLabelWindow() const;
3039ade9
VZ
3315
3316 /**
3317 Return the window in the top left grid corner.
3318
3319 This window is shown only of both columns and row labels are shown and
3320 normally doesn't contain anything. Clicking on it is handled by wxGrid
3321 however and can be used to select the entire grid.
3322 */
3323 wxWindow *GetGridCornerLabelWindow() const;
3324
3325 /**
3326 Return the header control used for column labels display.
3327
3328 This function can only be called if UseNativeColHeader() had been
3329 called.
3330 */
3331 wxHeaderCtrl *GetGridColHeader() const;
3332
3333 //@}
882678eb
FM
3334
3335protected:
3336 /**
3337 Returns @true if this grid has support for cell attributes.
3338
3339 The grid supports attributes if it has the associated table which, in
3340 turn, has attributes support, i.e. wxGridTableBase::CanHaveAttributes()
3341 returns @true.
3342 */
3343 bool CanHaveAttributes() const;
3344
3345 /**
3346 Get the minimal width of the given column/row.
3347
3348 The value returned by this function may be different than that returned
3349 by GetColMinimalAcceptableWidth() if SetColMinimalWidth() had been
3350 called for this column.
3351 */
3352 int GetColMinimalWidth(int col) const;
3353
3354 /**
3355 Returns the coordinate of the right border specified column.
3356 */
3357 int GetColRight(int col) const;
3358
3359 /**
3360 Returns the coordinate of the left border specified column.
3361 */
3362 int GetColLeft(int col) const;
3363
3364 /**
3365 Returns the minimal size for the given column.
3366
3367 The value returned by this function may be different than that returned
3368 by GetRowMinimalAcceptableHeight() if SetRowMinimalHeight() had been
3369 called for this row.
3370 */
3371 int GetRowMinimalHeight(int col) const;
8b9ef005 3372};
23324ae1 3373
08dd9b5a 3374
23324ae1 3375
8b9ef005
BP
3376/**
3377 @class wxGridUpdateLocker
23324ae1 3378
8b9ef005
BP
3379 This small class can be used to prevent wxGrid from redrawing during its
3380 lifetime by calling wxGrid::BeginBatch() in its constructor and
3381 wxGrid::EndBatch() in its destructor. It is typically used in a function
3382 performing several operations with a grid which would otherwise result in
3383 flicker. For example:
23324ae1 3384
8b9ef005
BP
3385 @code
3386 void MyFrame::Foo()
3387 {
3388 m_grid = new wxGrid(this, ...);
23324ae1 3389
8b9ef005
BP
3390 wxGridUpdateLocker noUpdates(m_grid);
3391 m_grid-AppendColumn();
3392 // ... many other operations with m_grid ...
3393 m_grid-AppendRow();
08dd9b5a 3394
8b9ef005
BP
3395 // destructor called, grid refreshed
3396 }
3397 @endcode
08dd9b5a 3398
8b9ef005
BP
3399 Using this class is easier and safer than calling wxGrid::BeginBatch() and
3400 wxGrid::EndBatch() because you don't risk missing the call the latter (due
3401 to an exception for example).
23324ae1 3402
8b9ef005
BP
3403 @library{wxadv}
3404 @category{grid}
3405*/
3406class wxGridUpdateLocker
3407{
3408public:
23324ae1 3409 /**
8b9ef005
BP
3410 Creates an object preventing the updates of the specified @a grid. The
3411 parameter could be @NULL in which case nothing is done. If @a grid is
3412 non-@NULL then the grid must exist for longer than this
3413 wxGridUpdateLocker object itself.
08dd9b5a 3414
8b9ef005
BP
3415 The default constructor could be followed by a call to Create() to set
3416 the grid object later.
23324ae1 3417 */
8b9ef005 3418 wxGridUpdateLocker(wxGrid* grid = NULL);
23324ae1
FM
3419
3420 /**
8b9ef005
BP
3421 Destructor reenables updates for the grid this object is associated
3422 with.
23324ae1 3423 */
8b9ef005 3424 ~wxGridUpdateLocker();
23324ae1
FM
3425
3426 /**
8b9ef005
BP
3427 This method can be called if the object had been constructed using the
3428 default constructor. It must not be called more than once.
3429 */
3430 void Create(wxGrid* grid);
3431};
08dd9b5a 3432
08dd9b5a 3433
23324ae1 3434
8b9ef005
BP
3435/**
3436 @class wxGridEvent
08dd9b5a 3437
8b9ef005 3438 This event class contains information about various grid events.
8a3e536c 3439
2b1f9fa0
VZ
3440 Notice that all grid event table macros are available in two versions:
3441 @c EVT_GRID_XXX and @c EVT_GRID_CMD_XXX. The only difference between the
3442 two is that the former doesn't allow to specify the grid window identifier
3443 and so takes a single parameter, the event handler, but is not suitable if
3444 there is more than one grid control in the window where the event table is
3445 used (as it would catch the events from all the grids). The version with @c
3446 CMD takes the id as first argument and the event handler as the second one
3447 and so can be used with multiple grids as well. Otherwise there are no
3448 difference between the two and only the versions without the id are
3449 documented below for brevity.
3450
8b9ef005 3451 @beginEventTable{wxGridEvent}
763163a8
VZ
3452 @event{EVT_GRID_CELL_CHANGING(func)}
3453 The user is about to change the data in a cell. The new cell value as
3454 string is available from GetString() event object method. This event
f8f31de6
FM
3455 can be vetoed if the change is not allowed.
3456 Processes a @c wxEVT_GRID_CELL_CHANGING event type.
763163a8
VZ
3457 @event{EVT_GRID_CELL_CHANGED(func)}
3458 The user changed the data in a cell. The old cell value as string is
3459 available from GetString() event object method. Notice that vetoing
3460 this event still works for backwards compatibility reasons but any new
3461 code should only veto EVT_GRID_CELL_CHANGING event and not this one.
3462 Processes a @c wxEVT_GRID_CELL_CHANGED event type.
8b9ef005
BP
3463 @event{EVT_GRID_CELL_LEFT_CLICK(func)}
3464 The user clicked a cell with the left mouse button. Processes a
3465 @c wxEVT_GRID_CELL_LEFT_CLICK event type.
3466 @event{EVT_GRID_CELL_LEFT_DCLICK(func)}
3467 The user double-clicked a cell with the left mouse button. Processes a
3468 @c wxEVT_GRID_CELL_LEFT_DCLICK event type.
3469 @event{EVT_GRID_CELL_RIGHT_CLICK(func)}
3470 The user clicked a cell with the right mouse button. Processes a
3471 @c wxEVT_GRID_CELL_RIGHT_CLICK event type.
3472 @event{EVT_GRID_CELL_RIGHT_DCLICK(func)}
3473 The user double-clicked a cell with the right mouse button. Processes a
3474 @c wxEVT_GRID_CELL_RIGHT_DCLICK event type.
3475 @event{EVT_GRID_EDITOR_HIDDEN(func)}
3476 The editor for a cell was hidden. Processes a
3477 @c wxEVT_GRID_EDITOR_HIDDEN event type.
3478 @event{EVT_GRID_EDITOR_SHOWN(func)}
3479 The editor for a cell was shown. Processes a
3480 @c wxEVT_GRID_EDITOR_SHOWN event type.
3481 @event{EVT_GRID_LABEL_LEFT_CLICK(func)}
3482 The user clicked a label with the left mouse button. Processes a
3483 @c wxEVT_GRID_LABEL_LEFT_CLICK event type.
3484 @event{EVT_GRID_LABEL_LEFT_DCLICK(func)}
3485 The user double-clicked a label with the left mouse button. Processes a
3486 @c wxEVT_GRID_LABEL_LEFT_DCLICK event type.
3487 @event{EVT_GRID_LABEL_RIGHT_CLICK(func)}
3488 The user clicked a label with the right mouse button. Processes a
3489 @c wxEVT_GRID_LABEL_RIGHT_CLICK event type.
3490 @event{EVT_GRID_LABEL_RIGHT_DCLICK(func)}
3491 The user double-clicked a label with the right mouse button. Processes
3492 a @c wxEVT_GRID_LABEL_RIGHT_DCLICK event type.
3493 @event{EVT_GRID_SELECT_CELL(func)}
3494 The user moved to, and selected a cell. Processes a
3495 @c wxEVT_GRID_SELECT_CELL event type.
cd68daf5
VZ
3496 @event{EVT_GRID_COL_MOVE(func)}
3497 The user tries to change the order of the columns in the grid by
3498 dragging the column specified by GetCol(). This event can be vetoed to
3499 either prevent the user from reordering the column change completely
3500 (but notice that if you don't want to allow it at all, you simply
3501 shouldn't call wxGrid::EnableDragColMove() in the first place), vetoed
3502 but handled in some way in the handler, e.g. by really moving the
3503 column to the new position at the associated table level, or allowed to
3504 proceed in which case wxGrid::SetColPos() is used to reorder the
3505 columns display order without affecting the use of the column indices
3506 otherwise.
3507 This event macro corresponds to @c wxEVT_GRID_COL_MOVE event type.
11393d29
VZ
3508 @event{EVT_GRID_COL_SORT(func)}
3509 This event is generated when a column is clicked by the user and its
3510 name is explained by the fact that the custom reaction to a click on a
3511 column is to sort the grid contents by this column. However the grid
3512 itself has no special support for sorting and it's up to the handler of
3513 this event to update the associated table. But if the event is handled
3514 (and not vetoed) the grid supposes that the table was indeed resorted
3515 and updates the column to indicate the new sort order and refreshes
3516 itself.
11393d29 3517 This event macro corresponds to @c wxEVT_GRID_COL_SORT event type.
8b9ef005 3518 @endEventTable
8a3e536c 3519
8b9ef005 3520 @library{wxadv}
87638422 3521 @category{grid,events}
8b9ef005
BP
3522*/
3523class wxGridEvent : public wxNotifyEvent
3524{
3525public:
3526 /**
3527 Default constructor.
23324ae1 3528 */
8b9ef005 3529 wxGridEvent();
23324ae1 3530 /**
8b9ef005 3531 Constructor for initializing all event attributes.
23324ae1 3532 */
8b9ef005
BP
3533 wxGridEvent(int id, wxEventType type, wxObject* obj,
3534 int row = -1, int col = -1, int x = -1, int y = -1,
ccf39540 3535 bool sel = true, const wxKeyboardState& kbd = wxKeyboardState());
23324ae1
FM
3536
3537 /**
8b9ef005 3538 Returns @true if the Alt key was down at the time of the event.
23324ae1 3539 */
8b9ef005 3540 bool AltDown() const;
23324ae1
FM
3541
3542 /**
8b9ef005 3543 Returns @true if the Control key was down at the time of the event.
23324ae1 3544 */
8b9ef005 3545 bool ControlDown() const;
23324ae1
FM
3546
3547 /**
8b9ef005 3548 Column at which the event occurred.
23324ae1 3549 */
8b9ef005 3550 virtual int GetCol();
23324ae1
FM
3551
3552 /**
8b9ef005 3553 Position in pixels at which the event occurred.
23324ae1 3554 */
8b9ef005 3555 wxPoint GetPosition();
23324ae1
FM
3556
3557 /**
8b9ef005 3558 Row at which the event occurred.
23324ae1 3559 */
8b9ef005 3560 virtual int GetRow();
23324ae1
FM
3561
3562 /**
8b9ef005 3563 Returns @true if the Meta key was down at the time of the event.
23324ae1 3564 */
8b9ef005 3565 bool MetaDown() const;
23324ae1
FM
3566
3567 /**
8b9ef005
BP
3568 Returns @true if the user is selecting grid cells, or @false if
3569 deselecting.
23324ae1 3570 */
8b9ef005 3571 bool Selecting();
23324ae1
FM
3572
3573 /**
8b9ef005 3574 Returns @true if the Shift key was down at the time of the event.
23324ae1 3575 */
8b9ef005
BP
3576 bool ShiftDown() const;
3577};
23324ae1 3578
08dd9b5a 3579
8b9ef005
BP
3580
3581/**
3582 @class wxGridSizeEvent
3583
3584 This event class contains information about a row/column resize event.
3585
3586 @beginEventTable{wxGridSizeEvent}
3587 @event{EVT_GRID_COL_SIZE(func)}
3588 The user resized a column by dragging it. Processes a
3589 @c wxEVT_GRID_COL_SIZE event type.
3590 @event{EVT_GRID_ROW_SIZE(func)}
3591 The user resized a row by dragging it. Processes a
3592 @c wxEVT_GRID_ROW_SIZE event type.
3593 @event{EVT_GRID_CMD_COL_SIZE(id, func)}
3594 The user resized a column by dragging it; variant taking a window
3595 identifier. Processes a @c wxEVT_GRID_COL_SIZE event type.
3596 @event{EVT_GRID_CMD_ROW_SIZE(id, func)}
3597 The user resized a row by dragging it; variant taking a window
3598 identifier. Processes a @c wxEVT_GRID_ROW_SIZE event type.
3599 @endEventTable
3600
3601 @library{wxadv}
87638422 3602 @category{grid,events}
8b9ef005
BP
3603*/
3604class wxGridSizeEvent : public wxNotifyEvent
3605{
3606public:
3607 /**
3608 Default constructor.
23324ae1 3609 */
8b9ef005 3610 wxGridSizeEvent();
23324ae1 3611 /**
8b9ef005 3612 Constructor for initializing all event attributes.
23324ae1 3613 */
8b9ef005
BP
3614 wxGridSizeEvent(int id, wxEventType type, wxObject* obj,
3615 int rowOrCol = -1, int x = -1, int y = -1,
ccf39540 3616 const wxKeyboardState& kbd = wxKeyboardState());
23324ae1
FM
3617
3618 /**
8b9ef005 3619 Returns @true if the Alt key was down at the time of the event.
23324ae1 3620 */
8b9ef005 3621 bool AltDown() const;
23324ae1
FM
3622
3623 /**
8b9ef005 3624 Returns @true if the Control key was down at the time of the event.
23324ae1 3625 */
8b9ef005 3626 bool ControlDown() const;
23324ae1
FM
3627
3628 /**
8b9ef005 3629 Position in pixels at which the event occurred.
23324ae1 3630 */
8b9ef005 3631 wxPoint GetPosition();
23324ae1
FM
3632
3633 /**
8b9ef005 3634 Row or column at that was resized.
23324ae1 3635 */
8b9ef005 3636 int GetRowOrCol();
23324ae1
FM
3637
3638 /**
8b9ef005 3639 Returns @true if the Meta key was down at the time of the event.
23324ae1 3640 */
8b9ef005 3641 bool MetaDown() const;
23324ae1
FM
3642
3643 /**
8b9ef005 3644 Returns @true if the Shift key was down at the time of the event.
23324ae1 3645 */
8b9ef005
BP
3646 bool ShiftDown() const;
3647};
23324ae1 3648
3c4f71cc 3649
23324ae1 3650
8b9ef005
BP
3651/**
3652 @class wxGridRangeSelectEvent
08dd9b5a 3653
8b9ef005
BP
3654 @beginEventTable{wxGridRangeSelectEvent}
3655 @event{EVT_GRID_RANGE_SELECT(func)}
3656 The user selected a group of contiguous cells. Processes a
3657 @c wxEVT_GRID_RANGE_SELECT event type.
3658 @event{EVT_GRID_CMD_RANGE_SELECT(id, func)}
3659 The user selected a group of contiguous cells; variant taking a window
3660 identifier. Processes a @c wxEVT_GRID_RANGE_SELECT event type.
3661 @endEventTable
08dd9b5a 3662
8b9ef005 3663 @library{wxadv}
87638422 3664 @category{grid,events}
8b9ef005
BP
3665*/
3666class wxGridRangeSelectEvent : public wxNotifyEvent
3667{
3668public:
3669 /**
3670 Default constructor.
23324ae1 3671 */
8b9ef005 3672 wxGridRangeSelectEvent();
23324ae1 3673 /**
8b9ef005 3674 Constructor for initializing all event attributes.
23324ae1 3675 */
8b9ef005
BP
3676 wxGridRangeSelectEvent(int id, wxEventType type,
3677 wxObject* obj,
3678 const wxGridCellCoords& topLeft,
3679 const wxGridCellCoords& bottomRight,
ccf39540 3680 bool sel = true, const wxKeyboardState& kbd = wxKeyboardState());
23324ae1
FM
3681
3682 /**
8b9ef005 3683 Returns @true if the Alt key was down at the time of the event.
23324ae1 3684 */
8b9ef005 3685 bool AltDown() const;
23324ae1
FM
3686
3687 /**
8b9ef005 3688 Returns @true if the Control key was down at the time of the event.
23324ae1 3689 */
8b9ef005 3690 bool ControlDown() const;
23324ae1
FM
3691
3692 /**
8b9ef005 3693 Top left corner of the rectangular area that was (de)selected.
23324ae1 3694 */
8b9ef005 3695 wxGridCellCoords GetBottomRightCoords();
23324ae1 3696
8a3e536c 3697 /**
8b9ef005
BP
3698 Bottom row of the rectangular area that was (de)selected.
3699 */
3700 int GetBottomRow();
8a3e536c 3701
23324ae1 3702 /**
8b9ef005 3703 Left column of the rectangular area that was (de)selected.
23324ae1 3704 */
8b9ef005 3705 int GetLeftCol();
23324ae1
FM
3706
3707 /**
8b9ef005 3708 Right column of the rectangular area that was (de)selected.
23324ae1 3709 */
8b9ef005 3710 int GetRightCol();
5e6e278d 3711
5e6e278d 3712 /**
8b9ef005 3713 Top left corner of the rectangular area that was (de)selected.
5e6e278d 3714 */
8b9ef005 3715 wxGridCellCoords GetTopLeftCoords();
5e6e278d
FM
3716
3717 /**
8b9ef005 3718 Top row of the rectangular area that was (de)selected.
5e6e278d 3719 */
8b9ef005 3720 int GetTopRow();
5e6e278d
FM
3721
3722 /**
8b9ef005 3723 Returns @true if the Meta key was down at the time of the event.
5e6e278d 3724 */
8b9ef005 3725 bool MetaDown() const;
5e6e278d
FM
3726
3727 /**
8b9ef005 3728 Returns @true if the area was selected, @false otherwise.
5e6e278d 3729 */
8b9ef005 3730 bool Selecting();
5e6e278d
FM
3731
3732 /**
8b9ef005 3733 Returns @true if the Shift key was down at the time of the event.
5e6e278d 3734 */
8b9ef005 3735 bool ShiftDown() const;
23324ae1
FM
3736};
3737
3738
e54c96f1 3739
23324ae1 3740/**
8b9ef005 3741 @class wxGridEditorCreatedEvent
7c913512 3742
8b9ef005
BP
3743 @beginEventTable{wxGridEditorCreatedEvent}
3744 @event{EVT_GRID_EDITOR_CREATED(func)}
3745 The editor for a cell was created. Processes a
3746 @c wxEVT_GRID_EDITOR_CREATED event type.
3747 @event{EVT_GRID_CMD_EDITOR_CREATED(id, func)}
3748 The editor for a cell was created; variant taking a window identifier.
3749 Processes a @c wxEVT_GRID_EDITOR_CREATED event type.
3750 @endEventTable
7c913512 3751
23324ae1 3752 @library{wxadv}
87638422 3753 @category{grid,events}
23324ae1 3754*/
8b9ef005 3755class wxGridEditorCreatedEvent : public wxCommandEvent
23324ae1
FM
3756{
3757public:
3758 /**
3759 Default constructor.
3760 */
8b9ef005 3761 wxGridEditorCreatedEvent();
23324ae1 3762 /**
8b9ef005 3763 Constructor for initializing all event attributes.
23324ae1 3764 */
8b9ef005
BP
3765 wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
3766 int row, int col, wxControl* ctrl);
23324ae1
FM
3767
3768 /**
8b9ef005 3769 Returns the column at which the event occurred.
23324ae1 3770 */
8b9ef005 3771 int GetCol();
7c913512 3772
8b9ef005
BP
3773 /**
3774 Returns the edit control.
3775 */
3776 wxControl* GetControl();
7c913512 3777
8b9ef005
BP
3778 /**
3779 Returns the row at which the event occurred.
3780 */
3781 int GetRow();
7c913512 3782
23324ae1 3783 /**
8b9ef005 3784 Sets the column at which the event occurred.
23324ae1 3785 */
8b9ef005 3786 void SetCol(int col);
23324ae1
FM
3787
3788 /**
8b9ef005 3789 Sets the edit control.
23324ae1 3790 */
8b9ef005 3791 void SetControl(wxControl* ctrl);
23324ae1
FM
3792
3793 /**
8b9ef005 3794 Sets the row at which the event occurred.
23324ae1 3795 */
8b9ef005 3796 void SetRow(int row);
23324ae1 3797};
e54c96f1 3798