1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxGrid and related classes
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxGridCellRenderer
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.
21 @see wxGridCellAutoWrapStringRenderer, wxGridCellBoolRenderer,
22 wxGridCellDateTimeRenderer, wxGridCellEnumRenderer,
23 wxGridCellFloatRenderer, wxGridCellNumberRenderer,
24 wxGridCellStringRenderer
26 class wxGridCellRenderer
: public wxClientDataContainer
, public wxRefCounter
32 This function must be implemented in derived classes to return a copy
35 virtual wxGridCellRenderer
* Clone() const = 0;
38 Draw the given cell on the provided DC inside the given rectangle using
39 the style specified by the attribute and the default or selected state
40 corresponding to the isSelected value.
42 This pure virtual function has a default implementation which will
43 prepare the DC using the given attribute: it will draw the rectangle
44 with the background colour from attr and set the text colour and font.
46 virtual void Draw(wxGrid
& grid
, wxGridCellAttr
& attr
, wxDC
& dc
,
47 const wxRect
& rect
, int row
, int col
,
51 Get the preferred size of the cell for its contents.
53 virtual wxSize
GetBestSize(wxGrid
& grid
, wxGridCellAttr
& attr
, wxDC
& dc
,
54 int row
, int col
) = 0;
58 The destructor is private because only DecRef() can delete us.
60 virtual ~wxGridCellRenderer();
64 @class wxGridCellAutoWrapStringRenderer
66 This class may be used to format string data in a cell. The too
67 long lines are wrapped to be shown entirely at word boundaries.
72 @see wxGridCellRenderer, wxGridCellBoolRenderer,
73 wxGridCellDateTimeRenderer, wxGridCellEnumRenderer,
74 wxGridCellFloatRenderer, wxGridCellNumberRenderer,
75 wxGridCellStringRenderer
78 class wxGridCellAutoWrapStringRenderer
: public wxGridCellStringRenderer
84 wxGridCellAutoWrapStringRenderer();
89 @class wxGridCellBoolRenderer
91 This class may be used to format boolean data in a cell.
96 @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
97 wxGridCellDateTimeRenderer, wxGridCellEnumRenderer,
98 wxGridCellFloatRenderer, wxGridCellNumberRenderer,
99 wxGridCellStringRenderer
101 class wxGridCellBoolRenderer
: public wxGridCellRenderer
107 wxGridCellBoolRenderer();
111 @class wxGridCellDateTimeRenderer
113 This class may be used to format a date/time data in a cell.
114 The class wxDateTime is used internally to display the local date/time
115 or to parse the string date entered in the cell thanks to the defined format.
120 @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
121 wxGridCellBoolRenderer, wxGridCellEnumRenderer,
122 wxGridCellFloatRenderer, wxGridCellNumberRenderer,
123 wxGridCellStringRenderer
125 class wxGridCellDateTimeRenderer
: public wxGridCellStringRenderer
129 Date/time renderer constructor.
132 strptime()-like format string used the parse the output date/time.
134 strptime()-like format string used to parse the string entered in the cell.
136 wxGridCellDateTimeRenderer(const wxString
& outformat
= wxDefaultDateTimeFormat
,
137 const wxString
& informat
= wxDefaultDateTimeFormat
);
141 Sets the strptime()-like format string which will be used to parse
145 strptime()-like format string used to parse the date/time.
147 virtual void SetParameters(const wxString
& params
);
151 @class wxGridCellEnumRenderer
153 This class may be used to render in a cell a number as a textual
156 The corresponding text strings are specified as comma-separated items in
157 the string passed to this renderer ctor or SetParameters() method. For
158 example, if this string is @c "John,Fred,Bob" the cell will be rendered as
159 "John", "Fred" or "Bob" if its contents is 0, 1 or 2 respectively.
164 @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
165 wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
166 wxGridCellFloatRenderer, wxGridCellNumberRenderer,
167 wxGridCellStringRenderer
169 class wxGridCellEnumRenderer
: public wxGridCellStringRenderer
176 Comma separated string parameters "item1[,item2[...,itemN]]".
178 wxGridCellEnumRenderer( const wxString
& choices
= wxEmptyString
);
181 Sets the comma separated string content of the enum.
184 Comma separated string parameters "item1[,item2[...,itemN]]".
186 virtual void SetParameters(const wxString
& params
);
190 Specifier used to format the data to string for the numbers handled by
191 wxGridCellFloatRenderer and wxGridCellFloatEditor.
195 enum wxGridCellFloatFormat
197 /// Decimal floating point (%f).
198 wxGRID_FLOAT_FORMAT_FIXED
= 0x0010,
200 /// Scientific notation (mantise/exponent) using e character (%e).
201 wxGRID_FLOAT_FORMAT_SCIENTIFIC
= 0x0020,
203 /// Use the shorter of %e or %f (%g).
204 wxGRID_FLOAT_FORMAT_COMPACT
= 0x0040,
206 /// To use in combination with one of the above formats for the upper
207 /// case version (%F/%E/%G)
208 wxGRID_FLOAT_FORMAT_UPPER
= 0x0080,
210 /// The format used by default (wxGRID_FLOAT_FORMAT_FIXED).
211 wxGRID_FLOAT_FORMAT_DEFAULT
= wxGRID_FLOAT_FORMAT_FIXED
215 @class wxGridCellFloatRenderer
217 This class may be used to format floating point data in a cell.
222 @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
223 wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
224 wxGridCellEnumRenderer, wxGridCellNumberRenderer,
225 wxGridCellStringRenderer
227 class wxGridCellFloatRenderer
: public wxGridCellStringRenderer
231 Float cell renderer ctor.
234 Minimum number of characters to be shown.
236 Number of digits after the decimal dot.
238 The format used to display the string, must be a combination of
239 ::wxGridCellFloatFormat enum elements. This parameter is only
240 available since wxWidgets 2.9.3.
242 wxGridCellFloatRenderer(int width
= -1, int precision
= -1,
243 int format
= wxGRID_FLOAT_FORMAT_DEFAULT
);
246 Returns the specifier used to format the data to string.
248 The returned value is a combination of ::wxGridCellFloatFormat elements.
252 int GetFormat() const;
255 Returns the precision.
257 int GetPrecision() const;
262 int GetWidth() const;
265 Set the format to use for display the number.
268 Must be a combination of ::wxGridCellFloatFormat enum elements.
272 void SetFormat(int format
);
275 The parameters string format is "width[,precision[,format]]" where
276 @c format should be chosen between f|e|g|E|G (f is used by default)
278 virtual void SetParameters(const wxString
& params
);
283 void SetPrecision(int precision
);
288 void SetWidth(int width
);
292 @class wxGridCellNumberRenderer
294 This class may be used to format integer data in a cell.
299 @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
300 wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
301 wxGridCellEnumRenderer, wxGridCellFloatRenderer,
302 wxGridCellStringRenderer
304 class wxGridCellNumberRenderer
: public wxGridCellStringRenderer
310 wxGridCellNumberRenderer();
314 @class wxGridCellStringRenderer
316 This class may be used to format string data in a cell; it is the default
322 @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
323 wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
324 wxGridCellEnumRenderer, wxGridCellFloatRenderer,
325 wxGridCellNumberRenderer
327 class wxGridCellStringRenderer
: public wxGridCellRenderer
333 wxGridCellStringRenderer();
338 @class wxGridCellEditor
340 This class is responsible for providing and manipulating the in-place edit
341 controls for the grid. Instances of wxGridCellEditor (actually, instances
342 of derived classes since it is an abstract class) can be associated with
343 the cell attributes for individual cells, rows, columns, or even for the
349 @see wxGridCellAutoWrapStringEditor, wxGridCellBoolEditor,
350 wxGridCellChoiceEditor, wxGridCellEnumEditor,
351 wxGridCellFloatEditor, wxGridCellNumberEditor,
354 class wxGridCellEditor
: public wxClientDataContainer
, public wxRefCounter
363 Fetch the value from the table and prepare the edit control to begin
366 This function should save the original value of the grid cell at the
367 given @a row and @a col and show the control allowing the user to
372 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
) = 0;
375 Create a new object which is the copy of this one.
377 virtual wxGridCellEditor
* Clone() const = 0;
380 Creates the actual edit control.
382 virtual void Create(wxWindow
* parent
, wxWindowID id
,
383 wxEvtHandler
* evtHandler
) = 0;
388 virtual void Destroy();
391 End editing the cell.
393 This function must check if the current value of the editing control is
394 valid and different from the original value (available as @a oldval in
395 its string form and possibly saved internally using its real type by
396 BeginEdit()). If it isn't, it just returns @false, otherwise it must do
398 # Save the new value internally so that ApplyEdit() could apply it.
399 # Fill @a newval (which is never @NULL) with the string
400 representation of the new value.
403 Notice that it must @em not modify the grid as the change could still
406 If the user-defined wxEVT_GRID_CELL_CHANGING event handler doesn't veto
407 this change, ApplyEdit() will be called next.
409 virtual bool EndEdit(int row
, int col
, const wxGrid
* grid
,
410 const wxString
& oldval
, wxString
* newval
) = 0;
413 Effectively save the changes in the grid.
415 This function should save the value of the control in the grid. It is
416 called only after EndEdit() returns @true.
418 virtual void ApplyEdit(int row
, int col
, wxGrid
* grid
) = 0;
421 Some types of controls on some platforms may need some help with the
424 virtual void HandleReturn(wxKeyEvent
& event
);
427 Returns @true if the edit control has been created.
432 Draws the part of the cell not occupied by the control: the base class
433 version just fills it with background colour from the attribute.
435 virtual void PaintBackground(wxDC
& dc
, const wxRect
& rectCell
, wxGridCellAttr
& attr
);
438 Reset the value in the control back to its starting value.
440 virtual void Reset() = 0;
443 Size and position the edit control.
445 virtual void SetSize(const wxRect
& rect
);
448 Show or hide the edit control, use the specified attributes to set
449 colours/fonts for it.
451 virtual void Show(bool show
, wxGridCellAttr
* attr
= NULL
);
454 If the editor is enabled by clicking on the cell, this method will be
457 virtual void StartingClick();
460 If the editor is enabled by pressing keys on the grid, this will be
461 called to let the editor do something about that first key if desired.
463 virtual void StartingKey(wxKeyEvent
& event
);
466 Returns the value currently in the editor control.
468 virtual wxString
GetValue() const = 0;
473 The destructor is private because only DecRef() can delete us.
475 virtual ~wxGridCellEditor();
479 @class wxGridCellAutoWrapStringEditor
481 Grid cell editor for wrappable string/text data.
486 @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor,
487 wxGridCellEnumEditor, wxGridCellFloatEditor,
488 wxGridCellNumberEditor, wxGridCellTextEditor
490 class wxGridCellAutoWrapStringEditor
: public wxGridCellTextEditor
493 wxGridCellAutoWrapStringEditor();
497 @class wxGridCellBoolEditor
499 Grid cell editor for boolean data.
504 @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
505 wxGridCellChoiceEditor, wxGridCellEnumEditor,
506 wxGridCellFloatEditor, wxGridCellNumberEditor,
509 class wxGridCellBoolEditor
: public wxGridCellEditor
515 wxGridCellBoolEditor();
518 Returns @true if the given @a value is equal to the string
519 representation of the truth value we currently use (see
522 static bool IsTrueValue(const wxString
& value
);
525 This method allows you to customize the values returned by GetValue()
526 for the cell using this editor. By default, the default values of the
527 arguments are used, i.e. @c "1" is returned if the cell is checked and
528 an empty string otherwise.
530 static void UseStringValues(const wxString
& valueTrue
= "1",
531 const wxString
& valueFalse
= wxEmptyString
);
535 @class wxGridCellChoiceEditor
537 Grid cell editor for string data providing the user a choice from a list of
543 @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
544 wxGridCellBoolEditor, wxGridCellEnumEditor,
545 wxGridCellFloatEditor, wxGridCellNumberEditor,
548 class wxGridCellChoiceEditor
: public wxGridCellEditor
552 Choice cell renderer ctor.
555 Number of strings from which the user can choose.
557 An array of strings from which the user can choose.
559 If allowOthers is @true, the user can type a string not in choices
562 wxGridCellChoiceEditor(size_t count
= 0,
563 const wxString choices
[] = NULL
,
564 bool allowOthers
= false);
567 Choice cell renderer ctor.
570 An array of strings from which the user can choose.
572 If allowOthers is @true, the user can type a string not in choices
575 wxGridCellChoiceEditor(const wxArrayString
& choices
,
576 bool allowOthers
= false);
579 Parameters string format is "item1[,item2[...,itemN]]"
581 virtual void SetParameters(const wxString
& params
);
585 @class wxGridCellEnumEditor
587 Grid cell editor which displays an enum number as a textual equivalent
588 (eg. data in cell is 0,1,2 ... n the cell could be displayed as
589 "John","Fred"..."Bob" in the combo choice box).
594 @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
595 wxGridCellBoolEditor, wxGridCellChoiceEditor,
596 wxGridCellTextEditor, wxGridCellFloatEditor,
597 wxGridCellNumberEditor
599 class wxGridCellEnumEditor
: public wxGridCellChoiceEditor
603 Enum cell editor ctor.
606 Comma separated choice parameters "item1[,item2[...,itemN]]".
608 wxGridCellEnumEditor( const wxString
& choices
= wxEmptyString
);
612 @class wxGridCellTextEditor
614 Grid cell editor for string/text data.
619 @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
620 wxGridCellBoolEditor, wxGridCellChoiceEditor,
621 wxGridCellEnumEditor, wxGridCellFloatEditor,
622 wxGridCellNumberEditor
624 class wxGridCellTextEditor
: public wxGridCellEditor
630 wxGridCellTextEditor();
633 The parameters string format is "n" where n is a number representing
636 virtual void SetParameters(const wxString
& params
);
640 @class wxGridCellFloatEditor
642 The editor for floating point numbers data.
647 @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
648 wxGridCellBoolEditor, wxGridCellChoiceEditor,
649 wxGridCellEnumEditor, wxGridCellNumberEditor,
652 class wxGridCellFloatEditor
: public wxGridCellTextEditor
656 Float cell editor ctor.
659 Minimum number of characters to be shown.
661 Number of digits after the decimal dot.
663 The format to use for displaying the number, a combination of
664 ::wxGridCellFloatFormat enum elements. This parameter is only
665 available since wxWidgets 2.9.3.
667 wxGridCellFloatEditor(int width
= -1, int precision
= -1,
668 int format
= wxGRID_FLOAT_FORMAT_DEFAULT
);
671 The parameters string format is "width[,precision[,format]]" where
672 @c format should be chosen between f|e|g|E|G (f is used by default)
674 virtual void SetParameters(const wxString
& params
);
678 @class wxGridCellNumberEditor
680 Grid cell editor for numeric integer data.
685 @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
686 wxGridCellBoolEditor, wxGridCellChoiceEditor,
687 wxGridCellEnumEditor, wxGridCellFloatEditor,
690 class wxGridCellNumberEditor
: public wxGridCellTextEditor
694 Allows you to specify the range for acceptable data. Values equal to
695 -1 for both @a min and @a max indicate that no range checking should be
698 wxGridCellNumberEditor(int min
= -1, int max
= -1);
702 Parameters string format is "min,max".
704 virtual void SetParameters(const wxString
& params
);
709 If the return value is @true, the editor uses a wxSpinCtrl to get user
710 input, otherwise it uses a wxTextCtrl.
712 bool HasRange() const;
715 String representation of the value.
717 wxString
GetString() const;
723 @class wxGridCellAttr
725 This class can be used to alter the cells' appearance in the grid by
726 changing their attributes from the defaults. An object of this class may be
727 returned by wxGridTableBase::GetAttr().
732 class wxGridCellAttr
: public wxClientDataContainer
, public wxRefCounter
736 Kind of the attribute to retrieve.
738 @see wxGridCellAttrProvider::GetAttr(), wxGridTableBase::GetAttr()
742 /// Return the combined effective attribute for the cell.
745 /// Return the attribute explicitly set for this cell.
748 /// Return the attribute set for this cells row.
751 /// Return the attribute set for this cells column.
758 wxGridCellAttr(wxGridCellAttr
* attrDefault
= NULL
);
760 Constructor specifying some of the often used attributes.
762 wxGridCellAttr(const wxColour
& colText
, const wxColour
& colBack
,
763 const wxFont
& font
, int hAlign
, int vAlign
);
766 Creates a new copy of this object.
768 wxGridCellAttr
* Clone() const;
771 This class is reference counted: it is created with ref count of 1, so
772 calling DecRef() once will delete it. Calling IncRef() allows to lock
773 it until the matching DecRef() is called.
778 Get the alignment to use for the cell with the given attribute.
780 If this attribute doesn't specify any alignment, the default attribute
781 alignment is used (which can be changed using
782 wxGrid::SetDefaultCellAlignment() but is left and top by default).
784 Notice that @a hAlign and @a vAlign values are always overwritten by
785 this function, use GetNonDefaultAlignment() if this is not desirable.
788 Horizontal alignment is returned here if this argument is non-@NULL.
789 It is one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT.
791 Vertical alignment is returned here if this argument is non-@NULL.
792 It is one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM.
794 void GetAlignment(int* hAlign
, int* vAlign
) const;
797 Returns the background colour.
799 const wxColour
& GetBackgroundColour() const;
802 Returns the cell editor.
804 wxGridCellEditor
* GetEditor(const wxGrid
* grid
, int row
, int col
) const;
809 const wxFont
& GetFont() const;
812 Get the alignment defined by this attribute.
814 Unlike GetAlignment() this function only modifies @a hAlign and @a
815 vAlign if this attribute does define a non-default alignment. This
816 means that they must be initialized before calling this function and
817 that their values will be preserved unchanged if they are different
818 from wxALIGN_INVALID.
820 For example, the following fragment can be used to use the cell
821 alignment if one is defined but right-align its contents by default
822 (instead of left-aligning it by default) while still using the default
825 int hAlign = wxALIGN_RIGHT,
826 vAlign = wxALIGN_INVALID;
827 attr.GetNonDefaultAlignment(&hAlign, &vAlign);
832 void GetNonDefaultAlignment(int *hAlign
, int *vAlign
) const;
835 Returns the cell renderer.
837 wxGridCellRenderer
* GetRenderer(const wxGrid
* grid
, int row
, int col
) const;
840 Returns the text colour.
842 const wxColour
& GetTextColour() const;
845 Returns @true if this attribute has a valid alignment set.
847 bool HasAlignment() const;
850 Returns @true if this attribute has a valid background colour set.
852 bool HasBackgroundColour() const;
855 Returns @true if this attribute has a valid cell editor set.
857 bool HasEditor() const;
860 Returns @true if this attribute has a valid font set.
862 bool HasFont() const;
865 Returns @true if this attribute has a valid cell renderer set.
867 bool HasRenderer() const;
870 Returns @true if this attribute has a valid text colour set.
872 bool HasTextColour() const;
875 This class is reference counted: it is created with ref count of 1, so
876 calling DecRef() once will delete it. Calling IncRef() allows to lock
877 it until the matching DecRef() is called.
882 Returns @true if this cell is set as read-only.
884 bool IsReadOnly() const;
887 Sets the alignment. @a hAlign can be one of @c wxALIGN_LEFT,
888 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT and @a vAlign can be one of
889 @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
891 void SetAlignment(int hAlign
, int vAlign
);
894 Sets the background colour.
896 void SetBackgroundColour(const wxColour
& colBack
);
899 @todo Needs documentation.
901 void SetDefAttr(wxGridCellAttr
* defAttr
);
904 Sets the editor to be used with the cells with this attribute.
906 void SetEditor(wxGridCellEditor
* editor
);
911 void SetFont(const wxFont
& font
);
914 Sets the cell as read-only.
916 void SetReadOnly(bool isReadOnly
= true);
919 Sets the renderer to be used for cells with this attribute. Takes
920 ownership of the pointer.
922 void SetRenderer(wxGridCellRenderer
* renderer
);
925 Sets the text colour.
927 void SetTextColour(const wxColour
& colText
);
932 The destructor is private because only DecRef() can delete us.
934 virtual ~wxGridCellAttr();
938 Base class for corner window renderer.
940 This is the simplest of all header renderers and only has a single
943 @see wxGridCellAttrProvider::GetCornerRenderer()
947 class wxGridCornerHeaderRenderer
951 Called by the grid to draw the corner window border.
953 This method is responsible for drawing the border inside the given @a
954 rect and adjusting the rectangle size to correspond to the area inside
955 the border, i.e. usually call wxRect::Deflate() to account for the
959 The grid whose corner window is being drawn.
961 The device context to use for drawing.
963 Input/output parameter which contains the border rectangle on input
964 and should be updated to contain the area inside the border on
967 virtual void DrawBorder(const wxGrid
& grid
,
969 wxRect
& rect
) const = 0;
972 Common base class for row and column headers renderers.
974 @see wxGridColumnHeaderRenderer, wxGridRowHeaderRenderer
978 class wxGridHeaderLabelsRenderer
: public wxGridCornerHeaderRenderer
982 Called by the grid to draw the specified label.
984 Notice that the base class DrawBorder() method is called before this
987 The default implementation uses wxGrid::GetLabelTextColour() and
988 wxGrid::GetLabelFont() to draw the label.
990 virtual void DrawLabel(const wxGrid
& grid
,
992 const wxString
& value
,
996 int textOrientation
) const;
1000 Base class for row headers renderer.
1002 This is the same as wxGridHeaderLabelsRenderer currently but we still use a
1003 separate class for it to distinguish it from wxGridColumnHeaderRenderer.
1005 @see wxGridRowHeaderRendererDefault
1007 @see wxGridCellAttrProvider::GetRowHeaderRenderer()
1011 class wxGridRowHeaderRenderer
: public wxGridHeaderLabelsRenderer
1016 Base class for column headers renderer.
1018 This is the same as wxGridHeaderLabelsRenderer currently but we still use a
1019 separate class for it to distinguish it from wxGridRowHeaderRenderer.
1021 @see wxGridColumnHeaderRendererDefault
1023 @see wxGridCellAttrProvider::GetColumnHeaderRenderer()
1027 class wxGridColumnHeaderRenderer
: public wxGridHeaderLabelsRenderer
1032 Default row header renderer.
1034 You may derive from this class if you need to only override one of its
1035 methods (i.e. either DrawLabel() or DrawBorder()) but continue to use the
1036 default implementation for the other one.
1038 @see wxGridColumnHeaderRendererDefault
1042 class wxGridRowHeaderRendererDefault
: public wxGridRowHeaderRenderer
1045 /// Implement border drawing for the row labels.
1046 virtual void DrawBorder(const wxGrid
& grid
,
1048 wxRect
& rect
) const;
1052 Default column header renderer.
1054 @see wxGridRowHeaderRendererDefault
1058 class wxGridColumnHeaderRendererDefault
: public wxGridColumnHeaderRenderer
1061 /// Implement border drawing for the column labels.
1062 virtual void DrawBorder(const wxGrid
& grid
,
1064 wxRect
& rect
) const;
1068 Default corner window renderer.
1070 @see wxGridColumnHeaderRendererDefault, wxGridRowHeaderRendererDefault
1074 class wxGridCornerHeaderRendererDefault
: public wxGridCornerHeaderRenderer
1077 /// Implement border drawing for the corner window.
1078 virtual void DrawBorder(const wxGrid
& grid
,
1080 wxRect
& rect
) const;
1084 Class providing attributes to be used for the grid cells.
1086 This class both defines an interface which grid cell attributes providers
1087 should implement -- and which can be implemented differently in derived
1088 classes -- and a default implementation of this interface which is often
1089 good enough to be used without modification, especially with not very large
1090 grids for which the efficiency of attributes storage hardly matters (see
1091 the discussion below).
1093 An object of this class can be associated with a wxGrid using
1094 wxGridTableBase::SetAttrProvider() but it's not necessary to call it if you
1095 intend to use the default provider as it is used by wxGridTableBase by
1098 Notice that while attributes provided by this class can be set for
1099 individual cells using SetAttr() or the entire rows or columns using
1100 SetRowAttr() and SetColAttr() they are always retrieved using GetAttr()
1104 The default implementation of this class stores the attributes passed to
1105 its SetAttr(), SetRowAttr() and SetColAttr() in a straightforward way. A
1106 derived class may use its knowledge about how the attributes are used in
1107 your program to implement it much more efficiently: for example, using a
1108 special background colour for all even-numbered rows can be implemented by
1109 simply returning the same attribute from GetAttr() if the row number is
1110 even instead of having to store N/2 row attributes where N is the total
1111 number of rows in the grid.
1113 Notice that objects of this class can't be copied.
1115 class wxGridCellAttrProvider
: public wxClientDataContainer
1118 /// Trivial default constructor.
1119 wxGridCellAttrProvider();
1121 /// Destructor releases any attributes held by this class.
1122 virtual ~wxGridCellAttrProvider();
1125 Get the attribute to use for the specified cell.
1127 If wxGridCellAttr::Any is used as @a kind value, this function combines
1128 the attributes set for this cell using SetAttr() and those for its row
1129 or column (set with SetRowAttr() or SetColAttr() respectively), with
1130 the cell attribute having the highest precedence.
1132 Notice that the caller must call DecRef() on the returned pointer if it
1136 The row of the cell.
1138 The column of the cell.
1140 The kind of the attribute to return.
1142 The attribute to use which should be DecRef()'d by caller or @NULL
1143 if no attributes are defined for this cell.
1145 virtual wxGridCellAttr
*GetAttr(int row
, int col
,
1146 wxGridCellAttr::wxAttrKind kind
) const;
1151 All these functions take ownership of the attribute passed to them,
1152 i.e. will call DecRef() on it themselves later and so it should not be
1153 destroyed by the caller. And the attribute can be @NULL to reset a
1154 previously set value.
1158 /// Set attribute for the specified cell.
1159 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
1161 /// Set attribute for the specified row.
1162 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
1164 /// Set attribute for the specified column.
1165 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
1170 Getting header renderers.
1172 These functions return the renderers for the given row or column header
1173 label and the corner window. Unlike cell attributes, these objects are
1174 not reference counted and are never @NULL so they are returned by
1175 reference and not pointer and DecRef() shouldn't (and can't) be called
1178 All these functions were added in wxWidgets 2.9.1.
1183 Return the renderer used for drawing column headers.
1185 By default wxGridColumnHeaderRendererDefault is returned.
1187 @see wxGrid::SetUseNativeColLabels(), wxGrid::UseNativeColHeader()
1191 virtual const wxGridColumnHeaderRenderer
& GetColumnHeaderRenderer(int col
);
1194 Return the renderer used for drawing row headers.
1196 By default wxGridRowHeaderRendererDefault is returned.
1200 virtual const wxGridRowHeaderRenderer
& GetRowHeaderRenderer(int row
);
1203 Return the renderer used for drawing the corner window.
1205 By default wxGridCornerHeaderRendererDefault is returned.
1209 virtual const wxGridCornerHeaderRenderer
& GetCornerRenderer();
1215 Represents coordinates of a grid cell.
1217 An object of this class is simply a (row, column) pair.
1219 class wxGridCellCoords
1223 Default constructor initializes the object to invalid state.
1225 Initially the row and column are both invalid (-1) and so operator!()
1226 for an uninitialized wxGridCellCoords returns false.
1231 Constructor taking a row and a column.
1233 wxGridCellCoords(int row
, int col
);
1236 Return the row of the coordinate.
1241 Set the row of the coordinate.
1246 Return the column of the coordinate.
1251 Set the column of the coordinate.
1256 Set the row and column of the coordinate.
1258 void Set(int row
, int col
);
1261 Assignment operator for coordinate types.
1263 wxGridCellCoords
& operator=(const wxGridCellCoords
& other
);
1268 bool operator==(const wxGridCellCoords
& other
) const;
1271 Inequality operator.
1273 bool operator!=(const wxGridCellCoords
& other
) const;
1276 Checks whether the coordinates are invalid.
1278 Returns false only if both row and column are -1. Notice that if either
1279 row or column (but not both) are -1, this method returns true even if
1280 the object is invalid. This is done because objects in such state
1281 should actually never exist, i.e. either both coordinates should be -1
1282 or none of them should be -1.
1284 bool operator!() const;
1288 @class wxGridTableBase
1290 The almost abstract base class for grid tables.
1292 A grid table is responsible for storing the grid data and, indirectly, grid
1293 cell attributes. The data can be stored in the way most convenient for the
1294 application but has to be provided in string form to wxGrid. It is also
1295 possible to provide cells values in other formats if appropriate, e.g. as
1298 This base class is not quite abstract as it implements a trivial strategy
1299 for storing the attributes by forwarding it to wxGridCellAttrProvider and
1300 also provides stubs for some other functions. However it does have a number
1301 of pure virtual methods which must be implemented in the derived classes.
1303 @see wxGridStringTable
1308 class wxGridTableBase
: public wxObject
1312 Default constructor.
1317 Destructor frees the attribute provider if it was created.
1319 virtual ~wxGridTableBase();
1322 Must be overridden to return the number of rows in the table.
1324 For backwards compatibility reasons, this method is not const.
1325 Use GetRowsCount() instead of it in const methods of derived table
1328 virtual int GetNumberRows() = 0;
1331 Must be overridden to return the number of columns in the table.
1333 For backwards compatibility reasons, this method is not const.
1334 Use GetColsCount() instead of it in const methods of derived table
1337 virtual int GetNumberCols() = 0;
1340 Return the number of rows in the table.
1342 This method is not virtual and is only provided as a convenience for
1343 the derived classes which can't call GetNumberRows() without a
1344 @c const_cast from their const methods.
1346 int GetRowsCount() const;
1349 Return the number of columns in the table.
1351 This method is not virtual and is only provided as a convenience for
1352 the derived classes which can't call GetNumberCols() without a
1353 @c const_cast from their const methods.
1355 int GetColsCount() const;
1359 @name Table Cell Accessors
1364 May be overridden to implement testing for empty cells.
1366 This method is used by the grid to test if the given cell is not used
1367 and so whether a neighbouring cell may overflow into it. By default it
1368 only returns true if the value of the given cell, as returned by
1369 GetValue(), is empty.
1371 virtual bool IsEmptyCell(int row
, int col
);
1374 Same as IsEmptyCell() but taking wxGridCellCoords.
1376 Notice that this method is not virtual, only IsEmptyCell() should be
1379 bool IsEmpty(const wxGridCellCoords
& coords
);
1382 Must be overridden to implement accessing the table values as text.
1384 virtual wxString
GetValue(int row
, int col
) = 0;
1387 Must be overridden to implement setting the table values as text.
1389 virtual void SetValue(int row
, int col
, const wxString
& value
) = 0;
1392 Returns the type of the value in the given cell.
1394 By default all cells are strings and this method returns
1395 @c wxGRID_VALUE_STRING.
1397 virtual wxString
GetTypeName(int row
, int col
);
1400 Returns true if the value of the given cell can be accessed as if it
1401 were of the specified type.
1403 By default the cells can only be accessed as strings. Note that a cell
1404 could be accessible in different ways, e.g. a numeric cell may return
1405 @true for @c wxGRID_VALUE_NUMBER but also for @c wxGRID_VALUE_STRING
1406 indicating that the value can be coerced to a string form.
1408 virtual bool CanGetValueAs(int row
, int col
, const wxString
& typeName
);
1411 Returns true if the value of the given cell can be set as if it were of
1414 @see CanGetValueAs()
1416 virtual bool CanSetValueAs(int row
, int col
, const wxString
& typeName
);
1419 Returns the value of the given cell as a long.
1421 This should only be called if CanGetValueAs() returns @true when called
1422 with @c wxGRID_VALUE_NUMBER argument. Default implementation always
1425 virtual long GetValueAsLong(int row
, int col
);
1428 Returns the value of the given cell as a double.
1430 This should only be called if CanGetValueAs() returns @true when called
1431 with @c wxGRID_VALUE_FLOAT argument. Default implementation always
1434 virtual double GetValueAsDouble(int row
, int col
);
1437 Returns the value of the given cell as a boolean.
1439 This should only be called if CanGetValueAs() returns @true when called
1440 with @c wxGRID_VALUE_BOOL argument. Default implementation always
1443 virtual bool GetValueAsBool(int row
, int col
);
1446 Returns the value of the given cell as a user-defined type.
1448 This should only be called if CanGetValueAs() returns @true when called
1449 with @a typeName. Default implementation always return @NULL.
1451 virtual void *GetValueAsCustom(int row
, int col
, const wxString
& typeName
);
1454 Sets the value of the given cell as a long.
1456 This should only be called if CanSetValueAs() returns @true when called
1457 with @c wxGRID_VALUE_NUMBER argument. Default implementation doesn't do
1460 virtual void SetValueAsLong(int row
, int col
, long value
);
1463 Sets the value of the given cell as a double.
1465 This should only be called if CanSetValueAs() returns @true when called
1466 with @c wxGRID_VALUE_FLOAT argument. Default implementation doesn't do
1469 virtual void SetValueAsDouble(int row
, int col
, double value
);
1472 Sets the value of the given cell as a boolean.
1474 This should only be called if CanSetValueAs() returns @true when called
1475 with @c wxGRID_VALUE_BOOL argument. Default implementation doesn't do
1478 virtual void SetValueAsBool( int row
, int col
, bool value
);
1481 Sets the value of the given cell as a user-defined type.
1483 This should only be called if CanSetValueAs() returns @true when called
1484 with @a typeName. Default implementation doesn't do anything.
1486 virtual void SetValueAsCustom(int row
, int col
, const wxString
& typeName
,
1493 Called by the grid when the table is associated with it.
1495 The default implementation stores the pointer and returns it from its
1496 GetView() and so only makes sense if the table cannot be associated
1497 with more than one grid at a time.
1499 virtual void SetView(wxGrid
*grid
);
1502 Returns the last grid passed to SetView().
1504 virtual wxGrid
*GetView() const;
1508 @name Table Structure Modifiers
1510 Notice that none of these functions are pure virtual as they don't have
1511 to be implemented if the table structure is never modified after
1512 creation, i.e. neither rows nor columns are never added or deleted but
1513 that you do need to implement them if they are called, i.e. if your
1514 code either calls them directly or uses the matching wxGrid methods, as
1515 by default they simply do nothing which is definitely inappropriate.
1520 Clear the table contents.
1522 This method is used by wxGrid::ClearGrid().
1524 virtual void Clear();
1527 Insert additional rows into the table.
1530 The position of the first new row.
1532 The number of rows to insert.
1534 virtual bool InsertRows(size_t pos
= 0, size_t numRows
= 1);
1537 Append additional rows at the end of the table.
1539 This method is provided in addition to InsertRows() as some data models
1540 may only support appending rows to them but not inserting them at
1541 arbitrary locations. In such case you may implement this method only
1542 and leave InsertRows() unimplemented.
1545 The number of rows to add.
1547 virtual bool AppendRows(size_t numRows
= 1);
1550 Delete rows from the table.
1552 Notice that currently deleting a row intersecting a multi-cell (see
1553 SetCellSize()) is not supported and will result in a crash.
1556 The first row to delete.
1558 The number of rows to delete.
1560 virtual bool DeleteRows(size_t pos
= 0, size_t numRows
= 1);
1563 Exactly the same as InsertRows() but for columns.
1565 virtual bool InsertCols(size_t pos
= 0, size_t numCols
= 1);
1568 Exactly the same as AppendRows() but for columns.
1570 virtual bool AppendCols(size_t numCols
= 1);
1573 Exactly the same as DeleteRows() but for columns.
1575 virtual bool DeleteCols(size_t pos
= 0, size_t numCols
= 1);
1580 @name Table Row and Column Labels
1582 By default the numbers are used for labeling rows and Latin letters for
1583 labeling columns. If the table has more than 26 columns, the pairs of
1584 letters are used starting from the 27-th one and so on, i.e. the
1585 sequence of labels is A, B, ..., Z, AA, AB, ..., AZ, BA, ..., ..., ZZ,
1591 Return the label of the specified row.
1593 virtual wxString
GetRowLabelValue(int row
);
1596 Return the label of the specified column.
1598 virtual wxString
GetColLabelValue(int col
);
1601 Set the given label for the specified row.
1603 The default version does nothing, i.e. the label is not stored. You
1604 must override this method in your derived class if you wish
1605 wxGrid::SetRowLabelValue() to work.
1607 virtual void SetRowLabelValue(int row
, const wxString
& label
);
1610 Exactly the same as SetRowLabelValue() but for columns.
1612 virtual void SetColLabelValue(int col
, const wxString
& label
);
1618 @name Attributes Management
1620 By default the attributes management is delegated to
1621 wxGridCellAttrProvider class. You may override the methods in this
1622 section to handle the attributes directly if, for example, they can be
1623 computed from the cell values.
1628 Associate this attributes provider with the table.
1630 The table takes ownership of @a attrProvider pointer and will delete it
1631 when it doesn't need it any more. The pointer can be @NULL, however
1632 this won't disable attributes management in the table but will just
1633 result in a default attributes being recreated the next time any of the
1634 other functions in this section is called. To completely disable the
1635 attributes support, should this be needed, you need to override
1636 CanHaveAttributes() to return @false.
1638 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
1641 Returns the attribute provider currently being used.
1643 This function may return @NULL if the attribute provider hasn't been
1644 neither associated with this table by SetAttrProvider() nor created on
1645 demand by any other methods.
1647 wxGridCellAttrProvider
*GetAttrProvider() const;
1650 Return the attribute for the given cell.
1652 By default this function is simply forwarded to
1653 wxGridCellAttrProvider::GetAttr() but it may be overridden to handle
1654 attributes directly in the table.
1656 virtual wxGridCellAttr
*GetAttr(int row
, int col
,
1657 wxGridCellAttr::wxAttrKind kind
);
1660 Set attribute of the specified cell.
1662 By default this function is simply forwarded to
1663 wxGridCellAttrProvider::SetAttr().
1665 The table takes ownership of @a attr, i.e. will call DecRef() on it.
1667 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
1670 Set attribute of the specified row.
1672 By default this function is simply forwarded to
1673 wxGridCellAttrProvider::SetRowAttr().
1675 The table takes ownership of @a attr, i.e. will call DecRef() on it.
1677 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
1680 Set attribute of the specified column.
1682 By default this function is simply forwarded to
1683 wxGridCellAttrProvider::SetColAttr().
1685 The table takes ownership of @a attr, i.e. will call DecRef() on it.
1687 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
1692 Returns true if this table supports attributes or false otherwise.
1694 By default, the table automatically creates a wxGridCellAttrProvider
1695 when this function is called if it had no attribute provider before and
1698 virtual bool CanHaveAttributes();
1702 @class wxGridSizesInfo
1704 wxGridSizesInfo stores information about sizes of all wxGrid rows or
1707 It assumes that most of the rows or columns (which are both called elements
1708 here as the difference between them doesn't matter at this class level)
1709 have the default size and so stores it separately. And it uses a wxHashMap
1710 to store the sizes of all elements which have the non-default size.
1712 This structure is particularly useful for serializing the sizes of all
1713 wxGrid elements at once.
1718 struct wxGridSizesInfo
1721 Default constructor.
1723 m_sizeDefault and m_customSizes must be initialized later.
1730 This constructor is used by wxGrid::GetRowSizes() and GetColSizes()
1731 methods. User code will usually use the default constructor instead.
1734 The default element size.
1736 Array containing the sizes of @em all elements, including those
1737 which have the default size.
1739 wxGridSizesInfo(int defSize
, const wxArrayInt
& allSizes
);
1742 Get the element size.
1745 The index of the element.
1747 The size for this element, using m_customSizes if @a pos is in it
1748 or m_sizeDefault otherwise.
1750 int GetSize(unsigned pos
) const;
1757 Map with element indices as keys and their sizes as values.
1759 This map only contains the elements with non-default size.
1761 wxUnsignedToIntHashMap m_customSizes
;
1767 Rendering styles supported by wxGrid::Render() method.
1771 enum wxGridRenderStyle
1773 /// Draw grid row header labels.
1774 wxGRID_DRAW_ROWS_HEADER
= 0x001,
1776 /// Draw grid column header labels.
1777 wxGRID_DRAW_COLS_HEADER
= 0x002,
1779 /// Draw grid cell border lines.
1780 wxGRID_DRAW_CELL_LINES
= 0x004,
1783 Draw a bounding rectangle around the rendered cell area.
1785 Useful where row or column headers are not drawn or where there is
1786 multi row or column cell clipping and therefore no cell border at
1787 the rendered outer boundary.
1789 wxGRID_DRAW_BOX_RECT
= 0x008,
1792 Draw the grid cell selection highlight if a selection is present.
1794 At present the highlight colour drawn depends on whether the grid
1795 window loses focus before drawing begins.
1797 wxGRID_DRAW_SELECTION
= 0x010,
1800 The default render style.
1802 Includes all except wxGRID_DRAW_SELECTION.
1804 wxGRID_DRAW_DEFAULT
= wxGRID_DRAW_ROWS_HEADER
|
1805 wxGRID_DRAW_COLS_HEADER
|
1806 wxGRID_DRAW_CELL_LINES
|
1807 wxGRID_DRAW_BOX_RECT
1815 wxGrid and its related classes are used for displaying and editing tabular
1816 data. They provide a rich set of features for display, editing, and
1817 interacting with a variety of data sources. For simple applications, and to
1818 help you get started, wxGrid is the only class you need to refer to
1819 directly. It will set up default instances of the other classes and manage
1820 them for you. For more complex applications you can derive your own classes
1821 for custom grid views, grid data tables, cell editors and renderers. The
1822 @ref overview_grid has examples of simple and more complex applications,
1823 explains the relationship between the various grid classes and has a
1824 summary of the keyboard shortcuts and mouse functions provided by wxGrid.
1826 A wxGridTableBase class holds the actual data to be displayed by a wxGrid
1827 class. One or more wxGrid classes may act as a view for one table class.
1828 The default table class is called wxGridStringTable and holds an array of
1829 strings. An instance of such a class is created by CreateGrid().
1831 wxGridCellRenderer is the abstract base class for rendering contents in a
1832 cell. The following renderers are predefined:
1834 - wxGridCellBoolRenderer
1835 - wxGridCellFloatRenderer
1836 - wxGridCellNumberRenderer
1837 - wxGridCellStringRenderer
1839 The look of a cell can be further defined using wxGridCellAttr. An object
1840 of this type may be returned by wxGridTableBase::GetAttr().
1842 wxGridCellEditor is the abstract base class for editing the value of a
1843 cell. The following editors are predefined:
1845 - wxGridCellBoolEditor
1846 - wxGridCellChoiceEditor
1847 - wxGridCellFloatEditor
1848 - wxGridCellNumberEditor
1849 - wxGridCellTextEditor
1851 Please see wxGridEvent, wxGridSizeEvent, wxGridRangeSelectEvent, and
1852 wxGridEditorCreatedEvent for the documentation of all event types you can
1858 @see @ref overview_grid, wxGridUpdateLocker
1860 class wxGrid
: public wxScrolledWindow
1865 Different selection modes supported by the grid.
1867 enum wxGridSelectionModes
1870 The default selection mode allowing selection of the individual
1871 cells as well as of the entire rows and columns.
1876 The selection mode allowing the selection of the entire rows only.
1878 The user won't be able to select any cells or columns in this mode.
1883 The selection mode allowing the selection of the entire columns only.
1885 The user won't be able to select any cells or rows in this mode.
1887 wxGridSelectColumns
,
1890 The selection mode allowing the user to select either the entire
1891 columns or the entire rows but not individual cells nor blocks.
1893 Notice that while this constant is defined as @code
1894 wxGridSelectColumns | wxGridSelectRows @endcode this doesn't mean
1895 that all the other combinations are valid -- at least currently
1900 wxGridSelectRowsOrColumns
1904 Return values for GetCellSize().
1910 /// This cell is inside a span covered by another cell.
1911 CellSpan_Inside
= -1,
1913 /// This is a normal, non-spanning cell.
1916 /// This cell spans several physical wxGrid cells.
1921 Constants defining different support built-in TAB handling behaviours.
1923 The elements of this enum determine what happens when TAB is pressed
1924 when the cursor is in the rightmost column (or Shift-TAB is pressed
1925 when the cursor is in the leftmost one).
1927 @see SetTabBehaviour(), @c wxEVT_GRID_TABBING
1933 /// Do nothing, this is default.
1936 /// Move to the beginning of the next (or the end of the previous) row.
1939 /// Move to the next (or the previous) control after the grid.
1944 @name Constructors and Initialization
1949 Default constructor.
1951 You must call Create() to really create the grid window and also call
1952 CreateGrid() or SetTable() to initialize the grid contents.
1956 Constructor creating the grid window.
1958 You must call either CreateGrid() or SetTable() to initialize the grid
1959 contents before using it.
1961 wxGrid(wxWindow
* parent
, wxWindowID id
,
1962 const wxPoint
& pos
= wxDefaultPosition
,
1963 const wxSize
& size
= wxDefaultSize
,
1964 long style
= wxWANTS_CHARS
,
1965 const wxString
& name
= wxGridNameStr
);
1970 This will also destroy the associated grid table unless you passed a
1971 table object to the grid and specified that the grid should not take
1972 ownership of the table (see SetTable()).
1977 Creates the grid window for an object initialized using the default
1980 You must call either CreateGrid() or SetTable() to initialize the grid
1981 contents before using it.
1983 bool Create(wxWindow
* parent
, wxWindowID id
,
1984 const wxPoint
& pos
= wxDefaultPosition
,
1985 const wxSize
& size
= wxDefaultSize
,
1986 long style
= wxWANTS_CHARS
,
1987 const wxString
& name
= wxGridNameStr
);
1990 Creates a grid with the specified initial number of rows and columns.
1992 Call this directly after the grid constructor. When you use this
1993 function wxGrid will create and manage a simple table of string values
1994 for you. All of the grid data will be stored in memory.
1996 For applications with more complex data types or relationships, or for
1997 dealing with very large datasets, you should derive your own grid table
1998 class and pass a table object to the grid with SetTable().
2000 bool CreateGrid(int numRows
, int numCols
,
2001 wxGridSelectionModes selmode
= wxGridSelectCells
);
2004 Passes a pointer to a custom grid table to be used by the grid.
2006 This should be called after the grid constructor and before using the
2007 grid object. If @a takeOwnership is set to @true then the table will be
2008 deleted by the wxGrid destructor.
2010 Use this function instead of CreateGrid() when your application
2011 involves complex or non-string data or data sets that are too large to
2012 fit wholly in memory.
2014 bool SetTable(wxGridTableBase
* table
, bool takeOwnership
= false,
2015 wxGridSelectionModes selmode
= wxGridSelectCells
);
2021 @name Grid Line Formatting
2026 Turns the drawing of grid lines on or off.
2028 void EnableGridLines(bool enable
= true);
2031 Returns the pen used for vertical grid lines.
2033 This virtual function may be overridden in derived classes in order to
2034 change the appearance of individual grid lines for the given column
2037 See GetRowGridLinePen() for an example.
2039 virtual wxPen
GetColGridLinePen(int col
);
2042 Returns the pen used for grid lines.
2044 This virtual function may be overridden in derived classes in order to
2045 change the appearance of grid lines. Note that currently the pen width
2048 @see GetColGridLinePen(), GetRowGridLinePen()
2050 virtual wxPen
GetDefaultGridLinePen();
2053 Returns the colour used for grid lines.
2055 @see GetDefaultGridLinePen()
2057 wxColour
GetGridLineColour() const;
2060 Returns the pen used for horizontal grid lines.
2062 This virtual function may be overridden in derived classes in order to
2063 change the appearance of individual grid line for the given @a row.
2067 // in a grid displaying music notation, use a solid black pen between
2068 // octaves (C0=row 127, C1=row 115 etc.)
2069 wxPen MidiGrid::GetRowGridLinePen(int row)
2071 if ( row % 12 == 7 )
2072 return wxPen(*wxBLACK, 1, wxSOLID);
2074 return GetDefaultGridLinePen();
2078 virtual wxPen
GetRowGridLinePen(int row
);
2081 Returns @true if drawing of grid lines is turned on, @false otherwise.
2083 bool GridLinesEnabled() const;
2086 Sets the colour used to draw grid lines.
2088 void SetGridLineColour(const wxColour
& colour
);
2094 @name Label Values and Formatting
2099 Sets the arguments to the current column label alignment values.
2101 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
2102 or @c wxALIGN_RIGHT.
2104 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
2107 void GetColLabelAlignment(int* horiz
, int* vert
) const;
2110 Returns the orientation of the column labels (either @c wxHORIZONTAL or
2113 int GetColLabelTextOrientation() const;
2116 Returns the specified column label.
2118 The default grid table class provides column labels of the form
2119 A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can
2120 override wxGridTableBase::GetColLabelValue() to provide your own
2123 wxString
GetColLabelValue(int col
) const;
2126 Returns the colour used for the background of row and column labels.
2128 wxColour
GetLabelBackgroundColour() const;
2131 Returns the font used for row and column labels.
2133 wxFont
GetLabelFont() const;
2136 Returns the colour used for row and column label text.
2138 wxColour
GetLabelTextColour() const;
2141 Returns the alignment used for row labels.
2143 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
2144 or @c wxALIGN_RIGHT.
2146 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
2149 void GetRowLabelAlignment(int* horiz
, int* vert
) const;
2152 Returns the specified row label.
2154 The default grid table class provides numeric row labels. If you are
2155 using a custom grid table you can override
2156 wxGridTableBase::GetRowLabelValue() to provide your own labels.
2158 wxString
GetRowLabelValue(int row
) const;
2161 Hides the column labels by calling SetColLabelSize() with a size of 0.
2162 Show labels again by calling that method with a width greater than 0.
2164 void HideColLabels();
2167 Hides the row labels by calling SetRowLabelSize() with a size of 0.
2169 The labels can be shown again by calling SetRowLabelSize() with a width
2172 void HideRowLabels();
2175 Sets the horizontal and vertical alignment of column label text.
2177 Horizontal alignment should be one of @c wxALIGN_LEFT,
2178 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one
2179 of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
2181 void SetColLabelAlignment(int horiz
, int vert
);
2184 Sets the orientation of the column labels (either @c wxHORIZONTAL or
2187 void SetColLabelTextOrientation(int textOrientation
);
2190 Set the value for the given column label.
2192 If you are using a custom grid table you must override
2193 wxGridTableBase::SetColLabelValue() for this to have any effect.
2195 void SetColLabelValue(int col
, const wxString
& value
);
2198 Sets the background colour for row and column labels.
2200 void SetLabelBackgroundColour(const wxColour
& colour
);
2203 Sets the font for row and column labels.
2205 void SetLabelFont(const wxFont
& font
);
2208 Sets the colour for row and column label text.
2210 void SetLabelTextColour(const wxColour
& colour
);
2213 Sets the horizontal and vertical alignment of row label text.
2215 Horizontal alignment should be one of @c wxALIGN_LEFT,
2216 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one
2217 of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
2219 void SetRowLabelAlignment(int horiz
, int vert
);
2222 Sets the value for the given row label.
2224 If you are using a derived grid table you must override
2225 wxGridTableBase::SetRowLabelValue() for this to have any effect.
2227 void SetRowLabelValue(int row
, const wxString
& value
);
2230 Call this in order to make the column labels use a native look by using
2231 wxRendererNative::DrawHeaderButton() internally.
2233 There is no equivalent method for drawing row columns as there is not
2234 native look for that. This option is useful when using wxGrid for
2235 displaying tables and not as a spread-sheet.
2237 @see UseNativeColHeader()
2239 void SetUseNativeColLabels(bool native
= true);
2242 Enable the use of native header window for column labels.
2244 If this function is called with @true argument, a wxHeaderCtrl is used
2245 instead to display the column labels instead of drawing them in wxGrid
2246 code itself. This has the advantage of making the grid look and feel
2247 perfectly the same as native applications (using SetUseNativeColLabels()
2248 the grid can be made to look more natively but it still doesn't feel
2249 natively, notably the column resizing and dragging still works slightly
2250 differently as it is implemented in wxWidgets itself) but results in
2251 different behaviour for column and row headers, for which there is no
2252 equivalent function, and, most importantly, is unsuitable for grids
2253 with huge numbers of columns as wxHeaderCtrl doesn't support virtual
2254 mode. Because of this, by default the grid does not use the native
2255 header control but you should call this function to enable it if you
2256 are using the grid to display tabular data and don't have thousands of
2259 Another difference between the default behaviour and the native header
2260 behaviour is that the latter provides the user with a context menu
2261 (which appears on right clicking the header) allowing to rearrange the
2262 grid columns if CanDragColMove() returns @true. If you want to prevent
2263 this from happening for some reason, you need to define a handler for
2264 @c wxEVT_GRID_LABEL_RIGHT_CLICK event which simply does nothing (in
2265 particular doesn't skip the event) as this will prevent the default
2266 right click handling from working.
2268 Also note that currently @c wxEVT_GRID_LABEL_RIGHT_DCLICK event is not
2269 generated for the column labels if the native columns header is used
2270 (but this limitation could possibly be lifted in the future).
2272 void UseNativeColHeader(bool native
= true);
2278 @name Cell Formatting
2280 Note that wxGridCellAttr can be used alternatively to most of these
2281 methods. See the "Attributes Management" of wxGridTableBase.
2286 Sets the arguments to the horizontal and vertical text alignment values
2287 for the grid cell at the specified location.
2289 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
2290 or @c wxALIGN_RIGHT.
2292 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
2295 void GetCellAlignment(int row
, int col
, int* horiz
, int* vert
) const;
2298 Returns the background colour of the cell at the specified location.
2300 wxColour
GetCellBackgroundColour(int row
, int col
) const;
2303 Returns the font for text in the grid cell at the specified location.
2305 wxFont
GetCellFont(int row
, int col
) const;
2308 Returns the text colour for the grid cell at the specified location.
2310 wxColour
GetCellTextColour(int row
, int col
) const;
2313 Returns the default cell alignment.
2315 Horizontal alignment will be one of @c wxALIGN_LEFT, @c wxALIGN_CENTRE
2316 or @c wxALIGN_RIGHT.
2318 Vertical alignment will be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE or
2321 @see SetDefaultCellAlignment()
2323 void GetDefaultCellAlignment(int* horiz
, int* vert
) const;
2326 Returns the current default background colour for grid cells.
2328 wxColour
GetDefaultCellBackgroundColour() const;
2331 Returns the current default font for grid cell text.
2333 wxFont
GetDefaultCellFont() const;
2336 Returns the current default colour for grid cell text.
2338 wxColour
GetDefaultCellTextColour() const;
2341 Sets the horizontal and vertical alignment for grid cell text at the
2344 Horizontal alignment should be one of @c wxALIGN_LEFT,
2345 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT.
2347 Vertical alignment should be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE
2348 or @c wxALIGN_BOTTOM.
2350 void SetCellAlignment(int row
, int col
, int horiz
, int vert
);
2352 Sets the horizontal and vertical alignment for grid cell text at the
2355 Horizontal alignment should be one of @c wxALIGN_LEFT,
2356 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT.
2358 Vertical alignment should be one of @c wxALIGN_TOP, @c wxALIGN_CENTRE
2359 or @c wxALIGN_BOTTOM.
2361 void SetCellAlignment(int align
, int row
, int col
);
2364 Set the background colour for the given cell or all cells by default.
2366 void SetCellBackgroundColour(int row
, int col
, const wxColour
& colour
);
2369 Sets the font for text in the grid cell at the specified location.
2371 void SetCellFont(int row
, int col
, const wxFont
& font
);
2374 Sets the text colour for the given cell.
2376 void SetCellTextColour(int row
, int col
, const wxColour
& colour
);
2378 Sets the text colour for the given cell.
2380 void SetCellTextColour(const wxColour
& val
, int row
, int col
);
2382 Sets the text colour for all cells by default.
2384 void SetCellTextColour(const wxColour
& colour
);
2387 Sets the default horizontal and vertical alignment for grid cell text.
2389 Horizontal alignment should be one of @c wxALIGN_LEFT,
2390 @c wxALIGN_CENTRE or @c wxALIGN_RIGHT. Vertical alignment should be one
2391 of @c wxALIGN_TOP, @c wxALIGN_CENTRE or @c wxALIGN_BOTTOM.
2393 void SetDefaultCellAlignment(int horiz
, int vert
);
2396 Sets the default background colour for grid cells.
2398 void SetDefaultCellBackgroundColour(const wxColour
& colour
);
2401 Sets the default font to be used for grid cell text.
2403 void SetDefaultCellFont(const wxFont
& font
);
2406 Sets the current default colour for grid cell text.
2408 void SetDefaultCellTextColour(const wxColour
& colour
);
2414 @name Cell Values, Editors, and Renderers
2416 Note that wxGridCellAttr can be used alternatively to most of these
2417 methods. See the "Attributes Management" of wxGridTableBase.
2422 Returns @true if the in-place edit control for the current grid cell
2423 can be used and @false otherwise.
2425 This function always returns @false for the read-only cells.
2427 bool CanEnableCellControl() const;
2430 Disables in-place editing of grid cells.
2432 Equivalent to calling EnableCellEditControl(@false).
2434 void DisableCellEditControl();
2437 Enables or disables in-place editing of grid cell data.
2439 The grid will issue either a @c wxEVT_GRID_EDITOR_SHOWN or
2440 @c wxEVT_GRID_EDITOR_HIDDEN event.
2442 void EnableCellEditControl(bool enable
= true);
2445 Makes the grid globally editable or read-only.
2447 If the edit argument is @false this function sets the whole grid as
2448 read-only. If the argument is @true the grid is set to the default
2449 state where cells may be editable. In the default state you can set
2450 single grid cells and whole rows and columns to be editable or
2451 read-only via wxGridCellAttr::SetReadOnly(). For single cells you
2452 can also use the shortcut function SetReadOnly().
2454 For more information about controlling grid cell attributes see the
2455 wxGridCellAttr class and the @ref overview_grid.
2457 void EnableEditing(bool edit
);
2460 Returns a pointer to the editor for the cell at the specified location.
2462 See wxGridCellEditor and the @ref overview_grid for more information
2463 about cell editors and renderers.
2465 The caller must call DecRef() on the returned pointer.
2467 wxGridCellEditor
* GetCellEditor(int row
, int col
) const;
2470 Returns a pointer to the renderer for the grid cell at the specified
2473 See wxGridCellRenderer and the @ref overview_grid for more information
2474 about cell editors and renderers.
2476 The caller must call DecRef() on the returned pointer.
2478 wxGridCellRenderer
* GetCellRenderer(int row
, int col
) const;
2481 Returns the string contained in the cell at the specified location.
2483 For simple applications where a grid object automatically uses a
2484 default grid table of string values you use this function together with
2485 SetCellValue() to access cell values. For more complex applications
2486 where you have derived your own grid table class that contains various
2487 data types (e.g. numeric, boolean or user-defined custom types) then
2488 you only use this function for those cells that contain string values.
2490 See wxGridTableBase::CanGetValueAs() and the @ref overview_grid for
2493 wxString
GetCellValue(int row
, int col
) const;
2495 Returns the string contained in the cell at the specified location.
2497 For simple applications where a grid object automatically uses a
2498 default grid table of string values you use this function together with
2499 SetCellValue() to access cell values. For more complex applications
2500 where you have derived your own grid table class that contains various
2501 data types (e.g. numeric, boolean or user-defined custom types) then
2502 you only use this function for those cells that contain string values.
2504 See wxGridTableBase::CanGetValueAs() and the @ref overview_grid for
2507 wxString
GetCellValue(const wxGridCellCoords
& coords
) const;
2510 Returns a pointer to the current default grid cell editor.
2512 See wxGridCellEditor and the @ref overview_grid for more information
2513 about cell editors and renderers.
2515 wxGridCellEditor
* GetDefaultEditor() const;
2518 Returns the default editor for the specified cell.
2520 The base class version returns the editor appropriate for the current
2521 cell type but this method may be overridden in the derived classes to
2522 use custom editors for some cells by default.
2524 Notice that the same may be achieved in a usually simpler way by
2525 associating a custom editor with the given cell or cells.
2527 The caller must call DecRef() on the returned pointer.
2529 virtual wxGridCellEditor
* GetDefaultEditorForCell(int row
, int col
) const;
2531 Returns the default editor for the specified cell.
2533 The base class version returns the editor appropriate for the current
2534 cell type but this method may be overridden in the derived classes to
2535 use custom editors for some cells by default.
2537 Notice that the same may be achieved in a usually simpler way by
2538 associating a custom editor with the given cell or cells.
2540 The caller must call DecRef() on the returned pointer.
2542 wxGridCellEditor
* GetDefaultEditorForCell(const wxGridCellCoords
& c
) const;
2545 Returns the default editor for the cells containing values of the given
2548 The base class version returns the editor which was associated with the
2549 specified @a typeName when it was registered RegisterDataType() but
2550 this function may be overridden to return something different. This
2551 allows to override an editor used for one of the standard types.
2553 The caller must call DecRef() on the returned pointer.
2555 virtual wxGridCellEditor
* GetDefaultEditorForType(const wxString
& typeName
) const;
2558 Returns a pointer to the current default grid cell renderer.
2560 See wxGridCellRenderer and the @ref overview_grid for more information
2561 about cell editors and renderers.
2563 The caller must call DecRef() on the returned pointer.
2565 wxGridCellRenderer
* GetDefaultRenderer() const;
2568 Returns the default renderer for the given cell.
2570 The base class version returns the renderer appropriate for the current
2571 cell type but this method may be overridden in the derived classes to
2572 use custom renderers for some cells by default.
2574 The caller must call DecRef() on the returned pointer.
2576 virtual wxGridCellRenderer
* GetDefaultRendererForCell(int row
, int col
) const;
2579 Returns the default renderer for the cell containing values of the
2582 @see GetDefaultEditorForType()
2584 virtual wxGridCellRenderer
* GetDefaultRendererForType(const wxString
& typeName
) const;
2587 Hides the in-place cell edit control.
2589 void HideCellEditControl();
2592 Returns @true if the in-place edit control is currently enabled.
2594 bool IsCellEditControlEnabled() const;
2597 Returns @true if the current cell is read-only.
2599 @see SetReadOnly(), IsReadOnly()
2601 bool IsCurrentCellReadOnly() const;
2604 Returns @false if the whole grid has been set as read-only or @true
2607 See EnableEditing() for more information about controlling the editing
2608 status of grid cells.
2610 bool IsEditable() const;
2613 Returns @true if the cell at the specified location can't be edited.
2615 @see SetReadOnly(), IsCurrentCellReadOnly()
2617 bool IsReadOnly(int row
, int col
) const;
2620 Register a new data type.
2622 The data types allow to naturally associate specific renderers and
2623 editors to the cells containing values of the given type. For example,
2624 the grid automatically registers a data type with the name
2625 @c wxGRID_VALUE_STRING which uses wxGridCellStringRenderer and
2626 wxGridCellTextEditor as its renderer and editor respectively -- this is
2627 the data type used by all the cells of the default wxGridStringTable,
2628 so this renderer and editor are used by default for all grid cells.
2630 However if a custom table returns @c wxGRID_VALUE_BOOL from its
2631 wxGridTableBase::GetTypeName() method, then wxGridCellBoolRenderer and
2632 wxGridCellBoolEditor are used for it because the grid also registers a
2633 boolean data type with this name.
2635 And as this mechanism is completely generic, you may register your own
2636 data types using your own custom renderers and editors. Just remember
2637 that the table must identify a cell as being of the given type for them
2638 to be used for this cell.
2641 Name of the new type. May be any string, but if the type name is
2642 the same as the name of an already registered type, including one
2643 of the standard ones (which are @c wxGRID_VALUE_STRING, @c
2644 wxGRID_VALUE_BOOL, @c wxGRID_VALUE_NUMBER, @c wxGRID_VALUE_FLOAT
2645 and @c wxGRID_VALUE_CHOICE), then the new registration information
2646 replaces the previously used renderer and editor.
2648 The renderer to use for the cells of this type. Its ownership is
2649 taken by the grid, i.e. it will call DecRef() on this pointer when
2650 it doesn't need it any longer.
2652 The editor to use for the cells of this type. Its ownership is also
2655 void RegisterDataType(const wxString
& typeName
,
2656 wxGridCellRenderer
* renderer
,
2657 wxGridCellEditor
* editor
);
2660 Sets the value of the current grid cell to the current in-place edit
2663 This is called automatically when the grid cursor moves from the
2664 current cell to a new cell. It is also a good idea to call this
2665 function when closing a grid since any edits to the final cell location
2666 will not be saved otherwise.
2668 void SaveEditControlValue();
2671 Sets the editor for the grid cell at the specified location.
2673 The grid will take ownership of the pointer.
2675 See wxGridCellEditor and the @ref overview_grid for more information
2676 about cell editors and renderers.
2678 void SetCellEditor(int row
, int col
, wxGridCellEditor
* editor
);
2681 Sets the renderer for the grid cell at the specified location.
2683 The grid will take ownership of the pointer.
2685 See wxGridCellRenderer and the @ref overview_grid for more information
2686 about cell editors and renderers.
2688 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
* renderer
);
2691 Sets the string value for the cell at the specified location.
2693 For simple applications where a grid object automatically uses a
2694 default grid table of string values you use this function together with
2695 GetCellValue() to access cell values. For more complex applications
2696 where you have derived your own grid table class that contains various
2697 data types (e.g. numeric, boolean or user-defined custom types) then
2698 you only use this function for those cells that contain string values.
2700 See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for
2703 void SetCellValue(int row
, int col
, const wxString
& s
);
2705 Sets the string value for the cell at the specified location.
2707 For simple applications where a grid object automatically uses a
2708 default grid table of string values you use this function together with
2709 GetCellValue() to access cell values. For more complex applications
2710 where you have derived your own grid table class that contains various
2711 data types (e.g. numeric, boolean or user-defined custom types) then
2712 you only use this function for those cells that contain string values.
2714 See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for
2717 void SetCellValue(const wxGridCellCoords
& coords
, const wxString
& s
);
2719 @deprecated Please use SetCellValue(int,int,const wxString&) or
2720 SetCellValue(const wxGridCellCoords&,const wxString&)
2723 Sets the string value for the cell at the specified location.
2725 For simple applications where a grid object automatically uses a
2726 default grid table of string values you use this function together with
2727 GetCellValue() to access cell values. For more complex applications
2728 where you have derived your own grid table class that contains various
2729 data types (e.g. numeric, boolean or user-defined custom types) then
2730 you only use this function for those cells that contain string values.
2732 See wxGridTableBase::CanSetValueAs() and the @ref overview_grid for
2735 void SetCellValue(const wxString
& val
, int row
, int col
);
2738 Sets the specified column to display boolean values.
2740 @see SetColFormatCustom()
2742 void SetColFormatBool(int col
);
2745 Sets the specified column to display data in a custom format.
2747 This method provides an alternative to defining a custom grid table
2748 which would return @a typeName from its GetTypeName() method for the
2749 cells in this column: while it doesn't really change the type of the
2750 cells in this column, it does associate the renderer and editor used
2751 for the cells of the specified type with them.
2753 See the @ref overview_grid for more information on working with custom
2756 void SetColFormatCustom(int col
, const wxString
& typeName
);
2759 Sets the specified column to display floating point values with the
2760 given width and precision.
2762 @see SetColFormatCustom()
2764 void SetColFormatFloat(int col
, int width
= -1, int precision
= -1);
2767 Sets the specified column to display integer values.
2769 @see SetColFormatCustom()
2771 void SetColFormatNumber(int col
);
2774 Sets the default editor for grid cells.
2776 The grid will take ownership of the pointer.
2778 See wxGridCellEditor and the @ref overview_grid for more information
2779 about cell editors and renderers.
2781 void SetDefaultEditor(wxGridCellEditor
* editor
);
2784 Sets the default renderer for grid cells.
2786 The grid will take ownership of the pointer.
2788 See wxGridCellRenderer and the @ref overview_grid for more information
2789 about cell editors and renderers.
2791 void SetDefaultRenderer(wxGridCellRenderer
* renderer
);
2794 Makes the cell at the specified location read-only or editable.
2798 void SetReadOnly(int row
, int col
, bool isReadOnly
= true);
2801 Displays the in-place cell edit control for the current cell.
2803 void ShowCellEditControl();
2809 @name Column and Row Sizes
2811 @see @ref overview_grid_resizing
2816 Automatically sets the height and width of all rows and columns to fit
2822 Automatically adjusts width of the column to fit its label.
2824 void AutoSizeColLabelSize(int col
);
2827 Automatically sizes the column to fit its contents. If @a setAsMin is
2828 @true the calculated width will also be set as the minimal width for
2831 void AutoSizeColumn(int col
, bool setAsMin
= true);
2834 Automatically sizes all columns to fit their contents. If @a setAsMin
2835 is @true the calculated widths will also be set as the minimal widths
2838 void AutoSizeColumns(bool setAsMin
= true);
2841 Automatically sizes the row to fit its contents. If @a setAsMin is
2842 @true the calculated height will also be set as the minimal height for
2845 void AutoSizeRow(int row
, bool setAsMin
= true);
2848 Automatically adjusts height of the row to fit its label.
2850 void AutoSizeRowLabelSize(int col
);
2853 Automatically sizes all rows to fit their contents. If @a setAsMin is
2854 @true the calculated heights will also be set as the minimal heights
2857 void AutoSizeRows(bool setAsMin
= true);
2860 Returns @true if the cell value can overflow.
2862 A cell can overflow if the next cell in the row is empty.
2864 bool GetCellOverflow(int row
, int col
) const;
2867 Returns the current height of the column labels.
2869 int GetColLabelSize() const;
2872 Returns the minimal width to which a column may be resized.
2874 Use SetColMinimalAcceptableWidth() to change this value globally or
2875 SetColMinimalWidth() to do it for individual columns.
2877 @see GetRowMinimalAcceptableHeight()
2879 int GetColMinimalAcceptableWidth() const;
2882 Returns the width of the specified column.
2884 int GetColSize(int col
) const;
2887 Returns @true if the specified column is not currently hidden.
2889 bool IsColShown(int col
) const;
2892 Returns @true if the cells can overflow by default.
2894 bool GetDefaultCellOverflow() const;
2897 Returns the default height for column labels.
2899 int GetDefaultColLabelSize() const;
2902 Returns the current default width for grid columns.
2904 int GetDefaultColSize() const;
2907 Returns the default width for the row labels.
2909 int GetDefaultRowLabelSize() const;
2912 Returns the current default height for grid rows.
2914 int GetDefaultRowSize() const;
2917 Returns the minimal size to which rows can be resized.
2919 Use SetRowMinimalAcceptableHeight() to change this value globally or
2920 SetRowMinimalHeight() to do it for individual cells.
2922 @see GetColMinimalAcceptableWidth()
2924 int GetRowMinimalAcceptableHeight() const;
2927 Returns the current width of the row labels.
2929 int GetRowLabelSize() const;
2932 Returns the height of the specified row.
2934 int GetRowSize(int row
) const;
2937 Returns @true if the specified row is not currently hidden.
2939 bool IsRowShown(int row
) const;
2942 Sets the overflow permission of the cell.
2944 void SetCellOverflow(int row
, int col
, bool allow
);
2947 Sets the height of the column labels.
2949 If @a height equals to @c wxGRID_AUTOSIZE then height is calculated
2950 automatically so that no label is truncated. Note that this could be
2951 slow for a large table.
2953 void SetColLabelSize(int height
);
2956 Sets the minimal @a width to which the user can resize columns.
2958 @see GetColMinimalAcceptableWidth()
2960 void SetColMinimalAcceptableWidth(int width
);
2963 Sets the minimal @a width for the specified column @a col.
2965 It is usually best to call this method during grid creation as calling
2966 it later will not resize the column to the given minimal width even if
2967 it is currently narrower than it.
2969 @a width must be greater than the minimal acceptable column width as
2970 returned by GetColMinimalAcceptableWidth().
2972 void SetColMinimalWidth(int col
, int width
);
2975 Sets the width of the specified column.
2980 The new column width in pixels, 0 to hide the column or -1 to fit
2981 the column width to its label width.
2983 void SetColSize(int col
, int width
);
2986 Hides the specified column.
2988 To show the column later you need to call SetColSize() with non-0
2989 width or ShowCol() to restore the previous column width.
2991 Notice that this method shouldn't be called if the column is already
2997 void HideCol(int col
);
3000 Shows the previously hidden column by resizing it to non-0 size.
3002 The column is shown again with the same width that it had before
3005 Notice that this method shouldn't be called if the column is not
3008 @see HideCol(), SetColSize()
3010 void ShowCol(int col
);
3014 Sets the default overflow permission of the cells.
3016 void SetDefaultCellOverflow( bool allow
);
3019 Sets the default width for columns in the grid.
3021 This will only affect columns subsequently added to the grid unless
3022 @a resizeExistingCols is @true.
3024 If @a width is less than GetColMinimalAcceptableWidth(), then the
3025 minimal acceptable width is used instead of it.
3027 void SetDefaultColSize(int width
, bool resizeExistingCols
= false);
3030 Sets the default height for rows in the grid.
3032 This will only affect rows subsequently added to the grid unless
3033 @a resizeExistingRows is @true.
3035 If @a height is less than GetRowMinimalAcceptableHeight(), then the
3036 minimal acceptable height is used instead of it.
3038 void SetDefaultRowSize(int height
, bool resizeExistingRows
= false);
3041 Sets the width of the row labels.
3043 If @a width equals @c wxGRID_AUTOSIZE then width is calculated
3044 automatically so that no label is truncated. Note that this could be
3045 slow for a large table.
3047 void SetRowLabelSize(int width
);
3050 Sets the minimal row @a height used by default.
3052 See SetColMinimalAcceptableWidth() for more information.
3054 void SetRowMinimalAcceptableHeight(int height
);
3057 Sets the minimal @a height for the specified @a row.
3059 See SetColMinimalWidth() for more information.
3061 void SetRowMinimalHeight(int row
, int height
);
3064 Sets the height of the specified row.
3066 See SetColSize() for more information.
3068 void SetRowSize(int row
, int height
);
3071 Hides the specified row.
3073 To show the row later you need to call SetRowSize() with non-0
3074 width or ShowRow() to restore its original height.
3079 void HideRow(int col
);
3082 Shows the previously hidden row.
3084 The row is shown again with the same height that it had before
3087 @see HideRow(), SetRowSize()
3089 void ShowRow(int col
);
3092 Get size information for all columns at once.
3094 This method is useful when the information about all column widths
3095 needs to be saved. The widths can be later restored using
3098 @sa wxGridSizesInfo, GetRowSizes()
3100 wxGridSizesInfo
GetColSizes() const;
3103 Get size information for all row at once.
3105 @sa wxGridSizesInfo, GetColSizes()
3107 wxGridSizesInfo
GetRowSizes() const;
3110 Restore all columns sizes.
3112 This is usually called with wxGridSizesInfo object previously returned
3117 void SetColSizes(const wxGridSizesInfo
& sizeInfo
);
3120 Restore all rows sizes.
3124 void SetRowSizes(const wxGridSizesInfo
& sizeInfo
);
3127 Set the size of the cell.
3129 Specifying a value of more than 1 in @a num_rows or @a num_cols will
3130 make the cell at (@a row, @a col) span the block of the specified size,
3131 covering the other cells which would be normally shown in it. Passing 1
3132 for both arguments resets the cell to normal appearance.
3137 The row of the cell.
3139 The column of the cell.
3141 Number of rows to be occupied by this cell, must be >= 1.
3143 Number of columns to be occupied by this cell, must be >= 1.
3145 void SetCellSize(int row
, int col
, int num_rows
, int num_cols
);
3148 Get the size of the cell in number of cells covered by it.
3150 For normal cells, the function fills both @a num_rows and @a num_cols
3151 with 1 and returns CellSpan_None. For cells which span multiple cells, i.e.
3152 for which SetCellSize() had been called, the returned values are the
3153 same ones as were passed to SetCellSize() call and the function return
3154 value is CellSpan_Main.
3156 More unexpectedly, perhaps, the returned values may be @em negative for
3157 the cells which are inside a span covered by a cell occupying multiple
3158 rows or columns. They correspond to the offset of the main cell of the
3159 span from the cell passed to this functions and the function returns
3160 CellSpan_Inside value to indicate this.
3162 As an example, consider a 3*3 grid with the cell (1, 1) (the one in the
3163 middle) having a span of 2 rows and 2 columns, i.e. the grid looks like
3173 Then the function returns 2 and 2 in @a num_rows and @a num_cols for
3174 the cell (1, 1) itself and -1 and -1 for the cell (2, 2) as well as -1
3175 and 0 for the cell (2, 1).
3178 The row of the cell.
3180 The column of the cell.
3182 Pointer to variable receiving the number of rows, must not be @NULL.
3184 Pointer to variable receiving the number of columns, must not be
3187 The kind of this cell span (the return value is new in wxWidgets
3188 2.9.1, this function was void in previous wxWidgets versions).
3190 CellSpan
GetCellSize( int row
, int col
, int *num_rows
, int *num_cols
) const;
3193 Get the number of rows and columns allocated for this cell.
3195 This overload doesn't return a CellSpan value but the values returned
3196 may still be negative, see GetCellSize(int, int, int *, int *) for
3199 wxSize
GetCellSize(const wxGridCellCoords
& coords
);
3205 @name User-Resizing and Dragging
3207 Functions controlling various interactive mouse operations.
3209 By default, columns and rows can be resized by dragging the edges of
3210 their labels (this can be disabled using DisableDragColSize() and
3211 DisableDragRowSize() methods). And if grid line dragging is enabled with
3212 EnableDragGridSize() they can also be resized by dragging the right or
3213 bottom edge of the grid cells.
3215 Columns can also be moved to interactively change their order but this
3216 needs to be explicitly enabled with EnableDragColMove().
3221 Return @true if the dragging of cells is enabled or @false otherwise.
3223 bool CanDragCell() const;
3226 Returns @true if columns can be moved by dragging with the mouse.
3228 Columns can be moved by dragging on their labels.
3230 bool CanDragColMove() const;
3233 Returns @true if the given column can be resized by dragging with the
3236 This function returns @true if resizing the columns interactively is
3237 globally enabled, i.e. if DisableDragColSize() hadn't been called, and
3238 if this column wasn't explicitly marked as non-resizable with
3241 bool CanDragColSize(int col
) const;
3244 Return @true if the dragging of grid lines to resize rows and columns
3245 is enabled or @false otherwise.
3247 bool CanDragGridSize() const;
3250 Returns @true if the given row can be resized by dragging with the
3253 This is the same as CanDragColSize() but for rows.
3255 bool CanDragRowSize(int row
) const;
3258 Disable interactive resizing of the specified column.
3260 This method allows to disable resizing of an individual column in a
3261 grid where the columns are otherwise resizable (which is the case by
3264 Notice that currently there is no way to make some columns resizable in
3265 a grid where columns can't be resized by default as there doesn't seem
3266 to be any need for this in practice. There is also no way to make the
3267 column marked as fixed using this method resizable again because it is
3268 supposed that fixed columns are used for static parts of the grid and
3269 so should remain fixed during the entire grid lifetime.
3271 Also notice that disabling interactive column resizing will not prevent
3272 the program from changing the column size.
3274 @see EnableDragColSize()
3276 void DisableColResize(int col
);
3279 Disable interactive resizing of the specified row.
3281 This is the same as DisableColResize() but for rows.
3283 @see EnableDragRowSize()
3285 void DisableRowResize(int row
);
3288 Disables column moving by dragging with the mouse.
3290 Equivalent to passing @false to EnableDragColMove().
3292 void DisableDragColMove();
3295 Disables column sizing by dragging with the mouse.
3297 Equivalent to passing @false to EnableDragColSize().
3299 void DisableDragColSize();
3302 Disable mouse dragging of grid lines to resize rows and columns.
3304 Equivalent to passing @false to EnableDragGridSize()
3306 void DisableDragGridSize();
3309 Disables row sizing by dragging with the mouse.
3311 Equivalent to passing @false to EnableDragRowSize().
3313 void DisableDragRowSize();
3316 Enables or disables cell dragging with the mouse.
3318 void EnableDragCell(bool enable
= true);
3321 Enables or disables column moving by dragging with the mouse.
3323 void EnableDragColMove(bool enable
= true);
3326 Enables or disables column sizing by dragging with the mouse.
3328 @see DisableColResize()
3330 void EnableDragColSize(bool enable
= true);
3333 Enables or disables row and column resizing by dragging gridlines with
3336 void EnableDragGridSize(bool enable
= true);
3339 Enables or disables row sizing by dragging with the mouse.
3341 @see DisableRowResize()
3343 void EnableDragRowSize(bool enable
= true);
3346 Returns the column ID of the specified column position.
3348 int GetColAt(int colPos
) const;
3351 Returns the position of the specified column.
3353 int GetColPos(int colID
) const;
3356 Sets the position of the specified column.
3358 void SetColPos(int colID
, int newPos
);
3361 Sets the positions of all columns at once.
3363 This method takes an array containing the indices of the columns in
3364 their display order, i.e. uses the same convention as
3365 wxHeaderCtrl::SetColumnsOrder().
3367 void SetColumnsOrder(const wxArrayInt
& order
);
3370 Resets the position of the columns to the default.
3378 @name Cursor Movement
3383 Returns the current grid cell column position.
3385 int GetGridCursorCol() const;
3388 Returns the current grid cell row position.
3390 int GetGridCursorRow() const;
3393 Make the given cell current and ensure it is visible.
3395 This method is equivalent to calling MakeCellVisible() and
3396 SetGridCursor() and so, as with the latter, a @c wxEVT_GRID_SELECT_CELL
3397 event is generated by it and the selected cell doesn't change if the
3400 void GoToCell(int row
, int col
);
3402 Make the given cell current and ensure it is visible.
3404 This method is equivalent to calling MakeCellVisible() and
3405 SetGridCursor() and so, as with the latter, a @c wxEVT_GRID_SELECT_CELL
3406 event is generated by it and the selected cell doesn't change if the
3409 void GoToCell(const wxGridCellCoords
& coords
);
3412 Moves the grid cursor down by one row.
3414 If a block of cells was previously selected it will expand if the
3415 argument is @true or be cleared if the argument is @false.
3417 bool MoveCursorDown(bool expandSelection
);
3420 Moves the grid cursor down in the current column such that it skips to
3421 the beginning or end of a block of non-empty cells.
3423 If a block of cells was previously selected it will expand if the
3424 argument is @true or be cleared if the argument is @false.
3426 bool MoveCursorDownBlock(bool expandSelection
);
3429 Moves the grid cursor left by one column.
3431 If a block of cells was previously selected it will expand if the
3432 argument is @true or be cleared if the argument is @false.
3434 bool MoveCursorLeft(bool expandSelection
);
3437 Moves the grid cursor left in the current row such that it skips to the
3438 beginning or end of a block of non-empty cells.
3440 If a block of cells was previously selected it will expand if the
3441 argument is @true or be cleared if the argument is @false.
3443 bool MoveCursorLeftBlock(bool expandSelection
);
3446 Moves the grid cursor right by one column.
3448 If a block of cells was previously selected it will expand if the
3449 argument is @true or be cleared if the argument is @false.
3451 bool MoveCursorRight(bool expandSelection
);
3454 Moves the grid cursor right in the current row such that it skips to
3455 the beginning or end of a block of non-empty cells.
3457 If a block of cells was previously selected it will expand if the
3458 argument is @true or be cleared if the argument is @false.
3460 bool MoveCursorRightBlock(bool expandSelection
);
3463 Moves the grid cursor up by one row.
3465 If a block of cells was previously selected it will expand if the
3466 argument is @true or be cleared if the argument is @false.
3468 bool MoveCursorUp(bool expandSelection
);
3471 Moves the grid cursor up in the current column such that it skips to
3472 the beginning or end of a block of non-empty cells.
3474 If a block of cells was previously selected it will expand if the
3475 argument is @true or be cleared if the argument is @false.
3477 bool MoveCursorUpBlock(bool expandSelection
);
3480 Moves the grid cursor down by some number of rows so that the previous
3481 bottom visible row becomes the top visible row.
3483 bool MovePageDown();
3486 Moves the grid cursor up by some number of rows so that the previous
3487 top visible row becomes the bottom visible row.
3492 Set the grid cursor to the specified cell.
3494 The grid cursor indicates the current cell and can be moved by the user
3495 using the arrow keys or the mouse.
3497 Calling this function generates a @c wxEVT_GRID_SELECT_CELL event and
3498 if the event handler vetoes this event, the cursor is not moved.
3500 This function doesn't make the target call visible, use GoToCell() to
3503 void SetGridCursor(int row
, int col
);
3505 Set the grid cursor to the specified cell.
3507 The grid cursor indicates the current cell and can be moved by the user
3508 using the arrow keys or the mouse.
3510 Calling this function generates a @c wxEVT_GRID_SELECT_CELL event and
3511 if the event handler vetoes this event, the cursor is not moved.
3513 This function doesn't make the target call visible, use GoToCell() to
3516 void SetGridCursor(const wxGridCellCoords
& coords
);
3519 Set the grid's behaviour when the user presses the TAB key.
3521 Pressing the TAB key moves the grid cursor right in the current row, if
3522 there is a cell at the right and, similarly, Shift-TAB moves the cursor
3523 to the left in the current row if it's not in the first column.
3525 What happens if the cursor can't be moved because it it's already at
3526 the beginning or end of the row can be configured using this function,
3527 see wxGrid::TabBehaviour documentation for the detailed description.
3529 IF none of the standard behaviours is appropriate, you can always
3530 handle @c wxEVT_GRID_TABBING event directly to implement a custom
3535 void SetTabBehaviour(TabBehaviour behaviour
);
3541 @name User Selection
3546 Deselects all cells that are currently selected.
3548 void ClearSelection();
3551 Returns an array of individually selected cells.
3553 Notice that this array does @em not contain all the selected cells in
3554 general as it doesn't include the cells selected as part of column, row
3555 or block selection. You must use this method, GetSelectedCols(),
3556 GetSelectedRows() and GetSelectionBlockTopLeft() and
3557 GetSelectionBlockBottomRight() methods to obtain the entire selection
3560 Please notice this behaviour is by design and is needed in order to
3561 support grids of arbitrary size (when an entire column is selected in
3562 a grid with a million of columns, we don't want to create an array with
3563 a million of entries in this function, instead it returns an empty
3564 array and GetSelectedCols() returns an array containing one element).
3566 wxGridCellCoordsArray
GetSelectedCells() const;
3569 Returns an array of selected columns.
3571 Please notice that this method alone is not sufficient to find all the
3572 selected columns as it contains only the columns which were
3573 individually selected but not those being part of the block selection
3574 or being selected in virtue of all of their cells being selected
3575 individually, please see GetSelectedCells() for more details.
3577 wxArrayInt
GetSelectedCols() const;
3580 Returns an array of selected rows.
3582 Please notice that this method alone is not sufficient to find all the
3583 selected rows as it contains only the rows which were individually
3584 selected but not those being part of the block selection or being
3585 selected in virtue of all of their cells being selected individually,
3586 please see GetSelectedCells() for more details.
3588 wxArrayInt
GetSelectedRows() const;
3591 Returns the colour used for drawing the selection background.
3593 wxColour
GetSelectionBackground() const;
3596 Returns an array of the bottom right corners of blocks of selected
3599 Please see GetSelectedCells() for more information about the selection
3600 representation in wxGrid.
3602 @see GetSelectionBlockTopLeft()
3604 wxGridCellCoordsArray
GetSelectionBlockBottomRight() const;
3607 Returns an array of the top left corners of blocks of selected cells.
3609 Please see GetSelectedCells() for more information about the selection
3610 representation in wxGrid.
3612 @see GetSelectionBlockBottomRight()
3614 wxGridCellCoordsArray
GetSelectionBlockTopLeft() const;
3617 Returns the colour used for drawing the selection foreground.
3619 wxColour
GetSelectionForeground() const;
3622 Returns the current selection mode.
3624 @see SetSelectionMode().
3626 wxGridSelectionModes
GetSelectionMode() const;
3629 Returns @true if the given cell is selected.
3631 bool IsInSelection(int row
, int col
) const;
3633 Returns @true if the given cell is selected.
3635 bool IsInSelection(const wxGridCellCoords
& coords
) const;
3638 Returns @true if there are currently any selected cells, rows, columns
3641 bool IsSelection() const;
3644 Selects all cells in the grid.
3649 Selects a rectangular block of cells.
3651 If @a addToSelected is @false then any existing selection will be
3652 deselected; if @true the column will be added to the existing
3655 void SelectBlock(int topRow
, int leftCol
, int bottomRow
, int rightCol
,
3656 bool addToSelected
= false);
3658 Selects a rectangular block of cells.
3660 If @a addToSelected is @false then any existing selection will be
3661 deselected; if @true the column will be added to the existing
3664 void SelectBlock(const wxGridCellCoords
& topLeft
,
3665 const wxGridCellCoords
& bottomRight
,
3666 bool addToSelected
= false);
3669 Selects the specified column.
3671 If @a addToSelected is @false then any existing selection will be
3672 deselected; if @true the column will be added to the existing
3675 This method won't select anything if the current selection mode is
3678 void SelectCol(int col
, bool addToSelected
= false);
3681 Selects the specified row.
3683 If @a addToSelected is @false then any existing selection will be
3684 deselected; if @true the row will be added to the existing selection.
3686 This method won't select anything if the current selection mode is
3687 wxGridSelectColumns.
3689 void SelectRow(int row
, bool addToSelected
= false);
3692 Set the colour to be used for drawing the selection background.
3694 void SetSelectionBackground(const wxColour
& c
);
3697 Set the colour to be used for drawing the selection foreground.
3699 void SetSelectionForeground(const wxColour
& c
);
3702 Set the selection behaviour of the grid.
3704 The existing selection is converted to conform to the new mode if
3705 possible and discarded otherwise (e.g. any individual selected cells
3706 are deselected if the new mode allows only the selection of the entire
3709 void SetSelectionMode(wxGridSelectionModes selmode
);
3720 Returns the number of pixels per horizontal scroll increment.
3724 @see GetScrollLineY(), SetScrollLineX(), SetScrollLineY()
3726 int GetScrollLineX() const;
3729 Returns the number of pixels per vertical scroll increment.
3733 @see GetScrollLineX(), SetScrollLineX(), SetScrollLineY()
3735 int GetScrollLineY() const;
3738 Returns @true if a cell is either entirely or at least partially
3739 visible in the grid window.
3741 By default, the cell must be entirely visible for this function to
3742 return @true but if @a wholeCellVisible is @false, the function returns
3743 @true even if the cell is only partially visible.
3745 bool IsVisible(int row
, int col
, bool wholeCellVisible
= true) const;
3747 Returns @true if a cell is either entirely or at least partially
3748 visible in the grid window.
3750 By default, the cell must be entirely visible for this function to
3751 return @true but if @a wholeCellVisible is @false, the function returns
3752 @true even if the cell is only partially visible.
3754 bool IsVisible(const wxGridCellCoords
& coords
,
3755 bool wholeCellVisible
= true) const;
3758 Brings the specified cell into the visible grid cell area with minimal
3761 Does nothing if the cell is already visible.
3763 void MakeCellVisible(int row
, int col
);
3765 Brings the specified cell into the visible grid cell area with minimal
3768 Does nothing if the cell is already visible.
3770 void MakeCellVisible(const wxGridCellCoords
& coords
);
3773 Sets the number of pixels per horizontal scroll increment.
3777 @see GetScrollLineX(), GetScrollLineY(), SetScrollLineY()
3779 void SetScrollLineX(int x
);
3782 Sets the number of pixels per vertical scroll increment.
3786 @see GetScrollLineX(), GetScrollLineY(), SetScrollLineX()
3788 void SetScrollLineY(int y
);
3794 @name Cell and Device Coordinate Translation
3799 Convert grid cell coordinates to grid window pixel coordinates.
3801 This function returns the rectangle that encloses the block of cells
3802 limited by @a topLeft and @a bottomRight cell in device coords and
3803 clipped to the client size of the grid window.
3807 wxRect
BlockToDeviceRect(const wxGridCellCoords
& topLeft
,
3808 const wxGridCellCoords
& bottomRight
) const;
3811 Return the rectangle corresponding to the grid cell's size and position
3812 in logical coordinates.
3814 @see BlockToDeviceRect()
3816 wxRect
CellToRect(int row
, int col
) const;
3818 Return the rectangle corresponding to the grid cell's size and position
3819 in logical coordinates.
3821 @see BlockToDeviceRect()
3823 wxRect
CellToRect(const wxGridCellCoords
& coords
) const;
3826 Returns the column at the given pixel position.
3829 The x position to evaluate.
3831 If @true, rather than returning @c wxNOT_FOUND, it returns either
3832 the first or last column depending on whether @a x is too far to
3833 the left or right respectively.
3835 The column index or @c wxNOT_FOUND.
3837 int XToCol(int x
, bool clipToMinMax
= false) const;
3840 Returns the column whose right hand edge is close to the given logical
3843 If no column edge is near to this position @c wxNOT_FOUND is returned.
3845 int XToEdgeOfCol(int x
) const;
3848 Translates logical pixel coordinates to the grid cell coordinates.
3850 Notice that this function expects logical coordinates on input so if
3851 you use this function in a mouse event handler you need to translate
3852 the mouse position, which is expressed in device coordinates, to
3855 @see XToCol(), YToRow()
3857 wxGridCellCoords
XYToCell(int x
, int y
) const;
3859 Translates logical pixel coordinates to the grid cell coordinates.
3861 Notice that this function expects logical coordinates on input so if
3862 you use this function in a mouse event handler you need to translate
3863 the mouse position, which is expressed in device coordinates, to
3866 @see XToCol(), YToRow()
3868 wxGridCellCoords
XYToCell(const wxPoint
& pos
) const;
3869 // XYToCell(int, int, wxGridCellCoords&) overload is intentionally
3870 // undocumented, using it is ugly and non-const reference parameters are
3871 // not used in wxWidgets API
3874 Returns the row whose bottom edge is close to the given logical @a y
3877 If no row edge is near to this position @c wxNOT_FOUND is returned.
3879 int YToEdgeOfRow(int y
) const;
3882 Returns the grid row that corresponds to the logical @a y coordinate.
3884 Returns @c wxNOT_FOUND if there is no row at the @a y position.
3886 int YToRow(int y
, bool clipToMinMax
= false) const;
3892 @name Miscellaneous Functions
3897 Appends one or more new columns to the right of the grid.
3899 The @a updateLabels argument is not used at present. If you are using a
3900 derived grid table class you will need to override
3901 wxGridTableBase::AppendCols(). See InsertCols() for further
3904 @return @true on success or @false if appending columns failed.
3906 bool AppendCols(int numCols
= 1, bool updateLabels
= true);
3909 Appends one or more new rows to the bottom of the grid.
3911 The @a updateLabels argument is not used at present. If you are using a
3912 derived grid table class you will need to override
3913 wxGridTableBase::AppendRows(). See InsertRows() for further
3916 @return @true on success or @false if appending rows failed.
3918 bool AppendRows(int numRows
= 1, bool updateLabels
= true);
3921 Return @true if the horizontal grid lines stop at the last column
3922 boundary or @false if they continue to the end of the window.
3924 The default is to clip grid lines.
3926 @see ClipHorzGridLines(), AreVertGridLinesClipped()
3928 bool AreHorzGridLinesClipped() const;
3931 Return @true if the vertical grid lines stop at the last row
3932 boundary or @false if they continue to the end of the window.
3934 The default is to clip grid lines.
3936 @see ClipVertGridLines(), AreHorzGridLinesClipped()
3938 bool AreVertGridLinesClipped() const;
3941 Increments the grid's batch count.
3943 When the count is greater than zero repainting of the grid is
3944 suppressed. Each call to BeginBatch must be matched by a later call to
3945 EndBatch(). Code that does a lot of grid modification can be enclosed
3946 between BeginBatch() and EndBatch() calls to avoid screen flicker. The
3947 final EndBatch() call will cause the grid to be repainted.
3949 Notice that you should use wxGridUpdateLocker which ensures that there
3950 is always a matching EndBatch() call for this BeginBatch() if possible
3951 instead of calling this method directly.
3956 Clears all data in the underlying grid table and repaints the grid.
3958 The table is not deleted by this function. If you are using a derived
3959 table class then you need to override wxGridTableBase::Clear() for this
3960 function to have any effect.
3965 Change whether the horizontal grid lines are clipped by the end of the
3968 By default the grid lines are not drawn beyond the end of the last
3969 column but after calling this function with @a clip set to @false they
3970 will be drawn across the entire grid window.
3972 @see AreHorzGridLinesClipped(), ClipVertGridLines()
3974 void ClipHorzGridLines(bool clip
);
3977 Change whether the vertical grid lines are clipped by the end of the
3980 By default the grid lines are not drawn beyond the end of the last
3981 row but after calling this function with @a clip set to @false they
3982 will be drawn across the entire grid window.
3984 @see AreVertGridLinesClipped(), ClipHorzGridLines()
3986 void ClipVertGridLines(bool clip
);
3989 Deletes one or more columns from a grid starting at the specified
3992 The @a updateLabels argument is not used at present. If you are using a
3993 derived grid table class you will need to override
3994 wxGridTableBase::DeleteCols(). See InsertCols() for further
3997 @return @true on success or @false if deleting columns failed.
3999 bool DeleteCols(int pos
= 0, int numCols
= 1, bool updateLabels
= true);
4002 Deletes one or more rows from a grid starting at the specified
4005 The @a updateLabels argument is not used at present. If you are using a
4006 derived grid table class you will need to override
4007 wxGridTableBase::DeleteRows(). See InsertRows() for further
4010 @return @true on success or @false if appending rows failed.
4012 bool DeleteRows(int pos
= 0, int numRows
= 1, bool updateLabels
= true);
4015 Decrements the grid's batch count.
4017 When the count is greater than zero repainting of the grid is
4018 suppressed. Each previous call to BeginBatch() must be matched by a
4019 later call to EndBatch(). Code that does a lot of grid modification can
4020 be enclosed between BeginBatch() and EndBatch() calls to avoid screen
4021 flicker. The final EndBatch() will cause the grid to be repainted.
4023 @see wxGridUpdateLocker
4028 Overridden wxWindow method.
4033 Causes immediate repainting of the grid.
4035 Use this instead of the usual wxWindow::Refresh().
4037 void ForceRefresh();
4040 Returns the number of times that BeginBatch() has been called without
4041 (yet) matching calls to EndBatch(). While the grid's batch count is
4042 greater than zero the display will not be updated.
4044 int GetBatchCount();
4047 Returns the total number of grid columns.
4049 This is the same as the number of columns in the underlying grid table.
4051 int GetNumberCols() const;
4054 Returns the total number of grid rows.
4056 This is the same as the number of rows in the underlying grid table.
4058 int GetNumberRows() const;
4061 Returns the attribute for the given cell creating one if necessary.
4063 If the cell already has an attribute, it is returned. Otherwise a new
4064 attribute is created, associated with the cell and returned. In any
4065 case the caller must call DecRef() on the returned pointer.
4067 This function may only be called if CanHaveAttributes() returns @true.
4069 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
4072 Returns a base pointer to the current table object.
4074 The returned pointer is still owned by the grid.
4076 wxGridTableBase
*GetTable() const;
4079 Inserts one or more new columns into a grid with the first new column
4080 at the specified position.
4082 Notice that inserting the columns in the grid requires grid table
4083 cooperation: when this method is called, grid object begins by
4084 requesting the underlying grid table to insert new columns. If this is
4085 successful the table notifies the grid and the grid updates the
4086 display. For a default grid (one where you have called CreateGrid())
4087 this process is automatic. If you are using a custom grid table
4088 (specified with SetTable()) then you must override
4089 wxGridTableBase::InsertCols() in your derived table class.
4092 The position which the first newly inserted column will have.
4094 The number of columns to insert.
4098 @true if the columns were successfully inserted, @false if an error
4099 occurred (most likely the table couldn't be updated).
4101 bool InsertCols(int pos
= 0, int numCols
= 1, bool updateLabels
= true);
4104 Inserts one or more new rows into a grid with the first new row at the
4107 Notice that you must implement wxGridTableBase::InsertRows() if you use
4108 a grid with a custom table, please see InsertCols() for more
4112 The position which the first newly inserted row will have.
4114 The number of rows to insert.
4118 @true if the rows were successfully inserted, @false if an error
4119 occurred (most likely the table couldn't be updated).
4121 bool InsertRows(int pos
= 0, int numRows
= 1, bool updateLabels
= true);
4124 Invalidates the cached attribute for the given cell.
4126 For efficiency reasons, wxGrid may cache the recently used attributes
4127 (currently it caches only the single most recently used one, in fact)
4128 which can result in the cell appearance not being refreshed even when
4129 the attribute returned by your custom wxGridCellAttrProvider-derived
4130 class has changed. To force the grid to refresh the cell attribute,
4131 this function may be used. Notice that calling it will not result in
4132 actually redrawing the cell, you still need to call
4133 wxWindow::RefreshRect() to invalidate the area occupied by the cell in
4134 the window to do this. Also note that you don't need to call this
4135 function if you store the attributes in wxGrid itself, i.e. use its
4136 SetAttr() and similar methods, it is only useful when using a separate
4137 custom attributes provider.
4140 The row of the cell whose attribute needs to be queried again.
4142 The column of the cell whose attribute needs to be queried again.
4146 void RefreshAttr(int row
, int col
);
4149 Draws part or all of a wxGrid on a wxDC for printing or display.
4151 Pagination can be accomplished by using sequential Render() calls
4152 with appropriate values in wxGridCellCoords topLeft and bottomRight.
4155 The wxDC to be drawn on.
4157 The position on the wxDC where rendering should begin. If not
4158 specified drawing will begin at the wxDC MaxX() and MaxY().
4160 The size of the area on the wxDC that the rendered wxGrid should
4161 occupy. If not specified the drawing will be scaled to fit the
4162 available dc width or height. The wxGrid's aspect ratio is
4163 maintained whether or not size is specified.
4165 The top left cell of the block to be drawn. Defaults to ( 0, 0 ).
4167 The bottom right cell of the block to be drawn. Defaults to row and
4170 A combination of values from wxGridRenderStyle.
4174 void Render( wxDC
& dc
,
4175 const wxPoint
& pos
= wxDefaultPosition
,
4176 const wxSize
& size
= wxDefaultSize
,
4177 const wxGridCellCoords
& topLeft
= wxGridCellCoords( -1, -1 ),
4178 const wxGridCellCoords
& bottomRight
= wxGridCellCoords( -1, -1 ),
4179 int style
= wxGRID_DRAW_DEFAULT
);
4182 Sets the cell attributes for all cells in the specified column.
4184 For more information about controlling grid cell attributes see the
4185 wxGridCellAttr cell attribute class and the @ref overview_grid.
4187 void SetColAttr(int col
, wxGridCellAttr
* attr
);
4190 Sets the extra margins used around the grid area.
4192 A grid may occupy more space than needed for its data display and
4193 this function allows to set how big this extra space is
4195 void SetMargins(int extraWidth
, int extraHeight
);
4198 Sets the cell attributes for all cells in the specified row.
4200 The grid takes ownership of the attribute pointer.
4202 See the wxGridCellAttr class for more information about controlling
4205 void SetRowAttr(int row
, wxGridCellAttr
* attr
);
4211 @name Sorting support.
4213 wxGrid doesn't provide any support for sorting the data but it does
4214 generate events allowing the user code to sort it and supports
4215 displaying the sort indicator in the column used for sorting.
4217 To use wxGrid sorting support you need to handle wxEVT_GRID_COL_SORT
4218 event (and not veto it) and resort the data displayed in the grid. The
4219 grid will automatically update the sorting indicator on the column
4222 You can also call the functions in this section directly to update the
4223 sorting indicator. Once again, they don't do anything with the grid
4224 data, it remains your responsibility to actually sort it appropriately.
4229 Return the column in which the sorting indicator is currently
4232 Returns @c wxNOT_FOUND if sorting indicator is not currently displayed
4235 @see SetSortingColumn()
4237 int GetSortingColumn() const;
4240 Return @true if this column is currently used for sorting.
4242 @see GetSortingColumn()
4244 bool IsSortingBy(int col
) const;
4247 Return @true if the current sorting order is ascending or @false if it
4250 It only makes sense to call this function if GetSortingColumn() returns
4251 a valid column index and not @c wxNOT_FOUND.
4253 @see SetSortingColumn()
4255 bool IsSortOrderAscending() const;
4258 Set the column to display the sorting indicator in and its direction.
4261 The column to display the sorting indicator in or @c wxNOT_FOUND to
4262 remove any currently displayed sorting indicator.
4264 If @true, display the ascending sort indicator, otherwise display
4265 the descending sort indicator.
4267 @see GetSortingColumn(), IsSortOrderAscending()
4269 void SetSortingColumn(int col
, bool ascending
= true);
4272 Remove any currently shown sorting indicator.
4274 This is equivalent to calling SetSortingColumn() with @c wxNOT_FOUND
4277 void UnsetSortingColumn();
4282 @name Accessors for component windows.
4284 Return the various child windows of wxGrid.
4286 wxGrid is an empty parent window for 4 children representing the column
4287 labels window (top), the row labels window (left), the corner window
4288 (top left) and the main grid window. It may be necessary to use these
4289 individual windows and not the wxGrid window itself if you need to
4290 handle events for them (this can be done using wxEvtHandler::Connect()
4291 or wxWindow::PushEventHandler()) or do something else requiring the use
4292 of the correct window pointer. Notice that you should not, however,
4293 change these windows (e.g. reposition them or draw over them) because
4294 they are managed by wxGrid itself.
4299 Return the main grid window containing the grid cells.
4301 This window is always shown.
4303 wxWindow
*GetGridWindow() const;
4306 Return the row labels window.
4308 This window is not shown if the row labels were hidden using
4311 wxWindow
*GetGridRowLabelWindow() const;
4314 Return the column labels window.
4316 This window is not shown if the columns labels were hidden using
4319 Depending on whether UseNativeColHeader() was called or not this can be
4320 either a wxHeaderCtrl or a plain wxWindow. This function returns a valid
4321 window pointer in either case but in the former case you can also use
4322 GetGridColHeader() to access it if you need wxHeaderCtrl-specific
4325 wxWindow
*GetGridColLabelWindow() const;
4328 Return the window in the top left grid corner.
4330 This window is shown only of both columns and row labels are shown and
4331 normally doesn't contain anything. Clicking on it is handled by wxGrid
4332 however and can be used to select the entire grid.
4334 wxWindow
*GetGridCornerLabelWindow() const;
4337 Return the header control used for column labels display.
4339 This function can only be called if UseNativeColHeader() had been
4342 wxHeaderCtrl
*GetGridColHeader() const;
4348 Returns @true if this grid has support for cell attributes.
4350 The grid supports attributes if it has the associated table which, in
4351 turn, has attributes support, i.e. wxGridTableBase::CanHaveAttributes()
4354 bool CanHaveAttributes() const;
4357 Get the minimal width of the given column/row.
4359 The value returned by this function may be different than that returned
4360 by GetColMinimalAcceptableWidth() if SetColMinimalWidth() had been
4361 called for this column.
4363 int GetColMinimalWidth(int col
) const;
4366 Returns the coordinate of the right border specified column.
4368 int GetColRight(int col
) const;
4371 Returns the coordinate of the left border specified column.
4373 int GetColLeft(int col
) const;
4376 Returns the minimal size for the given column.
4378 The value returned by this function may be different than that returned
4379 by GetRowMinimalAcceptableHeight() if SetRowMinimalHeight() had been
4380 called for this row.
4382 int GetRowMinimalHeight(int col
) const;
4388 @class wxGridUpdateLocker
4390 This small class can be used to prevent wxGrid from redrawing during its
4391 lifetime by calling wxGrid::BeginBatch() in its constructor and
4392 wxGrid::EndBatch() in its destructor. It is typically used in a function
4393 performing several operations with a grid which would otherwise result in
4394 flicker. For example:
4399 m_grid = new wxGrid(this, ...);
4401 wxGridUpdateLocker noUpdates(m_grid);
4402 m_grid-AppendColumn();
4403 // ... many other operations with m_grid ...
4406 // destructor called, grid refreshed
4410 Using this class is easier and safer than calling wxGrid::BeginBatch() and
4411 wxGrid::EndBatch() because you don't risk missing the call the latter (due
4412 to an exception for example).
4417 class wxGridUpdateLocker
4421 Creates an object preventing the updates of the specified @a grid. The
4422 parameter could be @NULL in which case nothing is done. If @a grid is
4423 non-@NULL then the grid must exist for longer than this
4424 wxGridUpdateLocker object itself.
4426 The default constructor could be followed by a call to Create() to set
4427 the grid object later.
4429 wxGridUpdateLocker(wxGrid
* grid
= NULL
);
4432 Destructor reenables updates for the grid this object is associated
4435 ~wxGridUpdateLocker();
4438 This method can be called if the object had been constructed using the
4439 default constructor. It must not be called more than once.
4441 void Create(wxGrid
* grid
);
4449 This event class contains information about various grid events.
4451 Notice that all grid event table macros are available in two versions:
4452 @c EVT_GRID_XXX and @c EVT_GRID_CMD_XXX. The only difference between the
4453 two is that the former doesn't allow to specify the grid window identifier
4454 and so takes a single parameter, the event handler, but is not suitable if
4455 there is more than one grid control in the window where the event table is
4456 used (as it would catch the events from all the grids). The version with @c
4457 CMD takes the id as first argument and the event handler as the second one
4458 and so can be used with multiple grids as well. Otherwise there are no
4459 difference between the two and only the versions without the id are
4460 documented below for brevity.
4462 @beginEventTable{wxGridEvent}
4463 @event{EVT_GRID_CELL_CHANGING(func)}
4464 The user is about to change the data in a cell. The new cell value as
4465 string is available from GetString() event object method. This event
4466 can be vetoed if the change is not allowed.
4467 Processes a @c wxEVT_GRID_CELL_CHANGING event type.
4468 @event{EVT_GRID_CELL_CHANGED(func)}
4469 The user changed the data in a cell. The old cell value as string is
4470 available from GetString() event object method. Notice that vetoing
4471 this event still works for backwards compatibility reasons but any new
4472 code should only veto EVT_GRID_CELL_CHANGING event and not this one.
4473 Processes a @c wxEVT_GRID_CELL_CHANGED event type.
4474 @event{EVT_GRID_CELL_LEFT_CLICK(func)}
4475 The user clicked a cell with the left mouse button. Processes a
4476 @c wxEVT_GRID_CELL_LEFT_CLICK event type.
4477 @event{EVT_GRID_CELL_LEFT_DCLICK(func)}
4478 The user double-clicked a cell with the left mouse button. Processes a
4479 @c wxEVT_GRID_CELL_LEFT_DCLICK event type.
4480 @event{EVT_GRID_CELL_RIGHT_CLICK(func)}
4481 The user clicked a cell with the right mouse button. Processes a
4482 @c wxEVT_GRID_CELL_RIGHT_CLICK event type.
4483 @event{EVT_GRID_CELL_RIGHT_DCLICK(func)}
4484 The user double-clicked a cell with the right mouse button. Processes a
4485 @c wxEVT_GRID_CELL_RIGHT_DCLICK event type.
4486 @event{EVT_GRID_EDITOR_HIDDEN(func)}
4487 The editor for a cell was hidden. Processes a
4488 @c wxEVT_GRID_EDITOR_HIDDEN event type.
4489 @event{EVT_GRID_EDITOR_SHOWN(func)}
4490 The editor for a cell was shown. Processes a
4491 @c wxEVT_GRID_EDITOR_SHOWN event type.
4492 @event{EVT_GRID_LABEL_LEFT_CLICK(func)}
4493 The user clicked a label with the left mouse button. Processes a
4494 @c wxEVT_GRID_LABEL_LEFT_CLICK event type.
4495 @event{EVT_GRID_LABEL_LEFT_DCLICK(func)}
4496 The user double-clicked a label with the left mouse button. Processes a
4497 @c wxEVT_GRID_LABEL_LEFT_DCLICK event type.
4498 @event{EVT_GRID_LABEL_RIGHT_CLICK(func)}
4499 The user clicked a label with the right mouse button. Processes a
4500 @c wxEVT_GRID_LABEL_RIGHT_CLICK event type.
4501 @event{EVT_GRID_LABEL_RIGHT_DCLICK(func)}
4502 The user double-clicked a label with the right mouse button. Processes
4503 a @c wxEVT_GRID_LABEL_RIGHT_DCLICK event type.
4504 @event{EVT_GRID_SELECT_CELL(func)}
4505 The given cell was made current, either by user or by the program via a
4506 call to SetGridCursor() or GoToCell(). Processes a
4507 @c wxEVT_GRID_SELECT_CELL event type.
4508 @event{EVT_GRID_COL_MOVE(func)}
4509 The user tries to change the order of the columns in the grid by
4510 dragging the column specified by GetCol(). This event can be vetoed to
4511 either prevent the user from reordering the column change completely
4512 (but notice that if you don't want to allow it at all, you simply
4513 shouldn't call wxGrid::EnableDragColMove() in the first place), vetoed
4514 but handled in some way in the handler, e.g. by really moving the
4515 column to the new position at the associated table level, or allowed to
4516 proceed in which case wxGrid::SetColPos() is used to reorder the
4517 columns display order without affecting the use of the column indices
4519 This event macro corresponds to @c wxEVT_GRID_COL_MOVE event type.
4520 @event{EVT_GRID_COL_SORT(func)}
4521 This event is generated when a column is clicked by the user and its
4522 name is explained by the fact that the custom reaction to a click on a
4523 column is to sort the grid contents by this column. However the grid
4524 itself has no special support for sorting and it's up to the handler of
4525 this event to update the associated table. But if the event is handled
4526 (and not vetoed) the grid supposes that the table was indeed resorted
4527 and updates the column to indicate the new sort order and refreshes
4529 This event macro corresponds to @c wxEVT_GRID_COL_SORT event type.
4530 @event{EVT_GRID_TABBING(func)}
4531 This event is generated when the user presses TAB or Shift-TAB in the
4532 grid. It can be used to customize the simple default TAB handling
4533 logic, e.g. to go to the next non-empty cell instead of just the next
4534 cell. See also wxGrid::SetTabBehaviour(). This event is new since
4539 @category{grid,events}
4541 class wxGridEvent
: public wxNotifyEvent
4545 Default constructor.
4549 Constructor for initializing all event attributes.
4551 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
4552 int row
= -1, int col
= -1, int x
= -1, int y
= -1,
4553 bool sel
= true, const wxKeyboardState
& kbd
= wxKeyboardState());
4556 Returns @true if the Alt key was down at the time of the event.
4558 bool AltDown() const;
4561 Returns @true if the Control key was down at the time of the event.
4563 bool ControlDown() const;
4566 Column at which the event occurred.
4568 Notice that for a @c wxEVT_GRID_SELECT_CELL event this column is the
4569 column of the newly selected cell while the previously selected cell
4570 can be retrieved using wxGrid::GetGridCursorCol().
4572 virtual int GetCol();
4575 Position in pixels at which the event occurred.
4577 wxPoint
GetPosition();
4580 Row at which the event occurred.
4582 Notice that for a @c wxEVT_GRID_SELECT_CELL event this row is the row
4583 of the newly selected cell while the previously selected cell can be
4584 retrieved using wxGrid::GetGridCursorRow().
4586 virtual int GetRow();
4589 Returns @true if the Meta key was down at the time of the event.
4591 bool MetaDown() const;
4594 Returns @true if the user is selecting grid cells, or @false if
4600 Returns @true if the Shift key was down at the time of the event.
4602 bool ShiftDown() const;
4608 @class wxGridSizeEvent
4610 This event class contains information about a row/column resize event.
4612 @beginEventTable{wxGridSizeEvent}
4613 @event{EVT_GRID_CMD_COL_SIZE(id, func)}
4614 The user resized a column, corresponds to @c wxEVT_GRID_COL_SIZE event
4616 @event{EVT_GRID_CMD_ROW_SIZE(id, func)}
4617 The user resized a row, corresponds to @c wxEVT_GRID_ROW_SIZE event
4619 @event{EVT_GRID_COL_SIZE(func)}
4620 Same as EVT_GRID_CMD_COL_SIZE() but uses `wxID_ANY` id.
4621 @event{EVT_GRID_ROW_SIZE(func)}
4622 Same as EVT_GRID_CMD_ROW_SIZE() but uses `wxID_ANY` id.
4626 @category{grid,events}
4628 class wxGridSizeEvent
: public wxNotifyEvent
4632 Default constructor.
4636 Constructor for initializing all event attributes.
4638 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
4639 int rowOrCol
= -1, int x
= -1, int y
= -1,
4640 const wxKeyboardState
& kbd
= wxKeyboardState());
4643 Returns @true if the Alt key was down at the time of the event.
4645 bool AltDown() const;
4648 Returns @true if the Control key was down at the time of the event.
4650 bool ControlDown() const;
4653 Position in pixels at which the event occurred.
4655 wxPoint
GetPosition();
4658 Row or column at that was resized.
4663 Returns @true if the Meta key was down at the time of the event.
4665 bool MetaDown() const;
4668 Returns @true if the Shift key was down at the time of the event.
4670 bool ShiftDown() const;
4676 @class wxGridRangeSelectEvent
4678 @beginEventTable{wxGridRangeSelectEvent}
4679 @event{EVT_GRID_RANGE_SELECT(func)}
4680 The user selected a group of contiguous cells. Processes a
4681 @c wxEVT_GRID_RANGE_SELECT event type.
4682 @event{EVT_GRID_CMD_RANGE_SELECT(id, func)}
4683 The user selected a group of contiguous cells; variant taking a window
4684 identifier. Processes a @c wxEVT_GRID_RANGE_SELECT event type.
4688 @category{grid,events}
4690 class wxGridRangeSelectEvent
: public wxNotifyEvent
4694 Default constructor.
4696 wxGridRangeSelectEvent();
4698 Constructor for initializing all event attributes.
4700 wxGridRangeSelectEvent(int id
, wxEventType type
,
4702 const wxGridCellCoords
& topLeft
,
4703 const wxGridCellCoords
& bottomRight
,
4704 bool sel
= true, const wxKeyboardState
& kbd
= wxKeyboardState());
4707 Returns @true if the Alt key was down at the time of the event.
4709 bool AltDown() const;
4712 Returns @true if the Control key was down at the time of the event.
4714 bool ControlDown() const;
4717 Top left corner of the rectangular area that was (de)selected.
4719 wxGridCellCoords
GetBottomRightCoords();
4722 Bottom row of the rectangular area that was (de)selected.
4727 Left column of the rectangular area that was (de)selected.
4732 Right column of the rectangular area that was (de)selected.
4737 Top left corner of the rectangular area that was (de)selected.
4739 wxGridCellCoords
GetTopLeftCoords();
4742 Top row of the rectangular area that was (de)selected.
4747 Returns @true if the Meta key was down at the time of the event.
4749 bool MetaDown() const;
4752 Returns @true if the area was selected, @false otherwise.
4757 Returns @true if the Shift key was down at the time of the event.
4759 bool ShiftDown() const;
4765 @class wxGridEditorCreatedEvent
4767 @beginEventTable{wxGridEditorCreatedEvent}
4768 @event{EVT_GRID_EDITOR_CREATED(func)}
4769 The editor for a cell was created. Processes a
4770 @c wxEVT_GRID_EDITOR_CREATED event type.
4771 @event{EVT_GRID_CMD_EDITOR_CREATED(id, func)}
4772 The editor for a cell was created; variant taking a window identifier.
4773 Processes a @c wxEVT_GRID_EDITOR_CREATED event type.
4777 @category{grid,events}
4779 class wxGridEditorCreatedEvent
: public wxCommandEvent
4783 Default constructor.
4785 wxGridEditorCreatedEvent();
4787 Constructor for initializing all event attributes.
4789 wxGridEditorCreatedEvent(int id
, wxEventType type
, wxObject
* obj
,
4790 int row
, int col
, wxControl
* ctrl
);
4793 Returns the column at which the event occurred.
4798 Returns the edit control.
4800 wxControl
* GetControl();
4803 Returns the row at which the event occurred.
4808 Sets the column at which the event occurred.
4810 void SetCol(int col
);
4813 Sets the edit control.
4815 void SetControl(wxControl
* ctrl
);
4818 Sets the row at which the event occurred.
4820 void SetRow(int row
);