]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/grid.tex
removed deprecated calls from wxImage example (bug #688438)
[wxWidgets.git] / docs / latex / wx / grid.tex
... / ...
CommitLineData
1\section{\class{wxGrid}}\label{wxgrid}
2
3wxGrid and its related classes are used for displaying and editing tabular
4data. They provide a rich set of features for display, editing, and
5interacting with a variety of data sources. For simple applications, and to
6help you get started, wxGrid is the only class you need to refer to
7directly. It will set up default instances of the other classes and manage
8them for you. For more complex applications you can derive your own
9classes for custom grid views, grid data tables, cell editors and
10renderers. The \helpref{wxGrid classes overview}{gridoverview} has
11examples of simple and more complex applications, explains the
12relationship between the various grid classes and has a summary of the
13keyboard shortcuts and mouse functions provided by wxGrid.
14
15wxGrid has been greatly expanded and redesigned for wxWindows 2.2
16onwards. If you have been using the old wxGrid class you will probably
17want to have a look at the \helpref{wxGrid classes overview}{gridoverview} to see
18how things have changed. The new grid classes are reasonably backward-compatible
19but there are some exceptions. There are also easier ways of doing many things compared to
20the previous implementation.
21
22\wxheading{Derived from}
23
24\helpref{wxScrolledWindow}{wxscrolledwindow}\\
25\helpref{wxWindow}{wxwindow}\\
26\helpref{wxEvtHandler}{wxevthandler}\\
27\helpref{wxObject}{wxobject}
28
29\wxheading{Include files}
30
31<wx/grid.h>
32
33\wxheading{Window styles}
34
35There are presently no specific window styles for wxGrid.
36
37\wxheading{Event handling}
38
39\input gridevt.inc
40
41The event handler for the following functions takes a
42 \helpref{wxGridSizeEvent}{wxgridsizeevent} parameter.
43
44\twocolwidtha{7cm}
45\begin{twocollist}\itemsep=0pt
46\twocolitem{{\bf EVT\_GRID\_COL\_SIZE(func)}}{The user resized a column by dragging it. Processes a wxEVT\_GRID\_COL\_SIZE.}
47\twocolitem{{\bf EVT\_GRID\_ROW\_SIZE(func)}}{The user resized a row by dragging it. Processes a wxEVT\_GRID\_ROW\_SIZE.}
48\end{twocollist}%
49
50The event handler for the following functions takes a
51 \helpref{wxGridRangeSelectEvent}{wxgridrangeselectevent} parameter.
52
53\twocolwidtha{7cm}
54\begin{twocollist}\itemsep=0pt
55\twocolitem{{\bf EVT\_GRID\_RANGE\_SELECT(func)}}{The user selected a group of contiguous cells. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
56\end{twocollist}%
57
58The event handler for the following functions takes a
59 \helpref{wxGridEditorCreatedEvent}{wxgrideditorcreatedevent} parameter.
60
61\twocolwidtha{7cm}
62\begin{twocollist}\itemsep=0pt
63\twocolitem{{\bf EVT\_GRID\_EDITOR\_CREATED(func)}}{The editor for a cell was created. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
64\end{twocollist}%
65
66\wxheading{See also}
67
68\helpref{wxGrid overview}{gridoverview}
69
70%%%%%%%%%%% FUNCTION GROUPS %%%%%%%%%%%%%
71\latexignore{\rtfignore{\wxheading{Function groups}}}
72
73\membersection{Constructors and initialization}
74
75\helpref{wxGrid}{wxgridctor}\\
76\helpref{\destruct{wxGrid}}{wxgriddtor}\\
77\helpref{CreateGrid}{wxgridcreategrid}\\
78\helpref{SetTable}{wxgridsettable}
79
80\membersection{Display format}
81
82\membersection{Selection functions}
83
84\helpref{wxGrid::ClearSelection}{wxgridclearselection}\\
85\helpref{wxGrid::IsSelection}{wxgridisselection}\\
86\helpref{wxGrid::SelectAll}{wxgridselectall}\\
87\helpref{wxGrid::SelectBlock}{wxgridselectblock}\\
88\helpref{wxGrid::SelectCol}{wxgridselectcol}\\
89\helpref{wxGrid::SelectRow}{wxgridselectrow}
90
91%%%%%%%%% MEMBER FUNCTIONS %%%%%%%%%%
92\helponly{\insertatlevel{2}{
93
94\wxheading{Members}
95
96}}
97
98\membersection{wxGrid::wxGrid}\label{wxgridctor}
99
100\func{}{wxGrid}{\void}
101
102Default constructor
103
104\func{}{wxGrid}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxWANTS\_CHARS}, \param{const wxString\& }{name = wxPanelNameStr}}
105
106Constructor to create a grid object. Call either \helpref{wxGrid::CreateGrid}{wxgridcreategrid} or
107\helpref{wxGrid::SetTable}{wxgridsettable} directly after this to initialize the grid before using
108it.
109
110\membersection{wxGrid::\destruct{wxGrid}}\label{wxgriddtor}
111
112\func{}{\destruct{wxGrid}}{\void}
113
114Destructor. This will also destroy the associated grid table unless you passed a table
115object to the grid and specified that the grid should not take ownership of the
116table (see \helpref{wxGrid::SetTable}{wxgridsettable}).
117
118\membersection{wxGrid::AppendCols}\label{wxgridappendcols}
119
120\func{bool}{AppendCols}{\param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
121
122Appends one or more new columns to the right of the grid and returns true if
123successful. The updateLabels argument is not used at present.
124
125If you are using a derived grid table class you will need to override
126\helpref{wxGridTableBase::AppendCols}{wxgridtablebaseappendcols}. See
127\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
128
129\membersection{wxGrid::AppendRows}\label{wxgridappendrows}
130
131\func{bool}{AppendRows}{\param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
132
133Appends one or more new rows to the bottom of the grid and returns true if
134successful. The updateLabels argument is not used at present.
135
136If you are using a derived grid table class you will need to override
137\helpref{wxGridTableBase::AppendRows}{wxgridtablebaseappendrows}. See
138\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
139
140\membersection{wxGrid::AutoSize}\label{wxgridautosize}
141
142\func{void}{AutoSize}{\void}
143
144Automatically sets the height and width of all rows and columns to fit their contents.
145
146\wxheading{Note}\\
147wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
148The memory requirements for this could become prohibitive if your grid is very large.
149
150\membersection{wxGrid::AutoSizeColumn}\label{wxgridautosizecolumn}
151
152\func{void}{AutoSizeColumn}{\param{int }{col}, \param{bool }{setAsMin = true}}
153
154Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
155also be set as the minimal width for the column.
156
157\wxheading{Note}\\
158wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
159The memory requirements for this could become prohibitive if your grid is very large.
160
161\membersection{wxGrid::AutoSizeColumns}\label{wxgridautosizecolumns}
162
163\func{void}{AutoSizeColumns}{\param{bool }{setAsMin = true}}
164
165Automatically sizes all columns to fit their contents. If setAsMin is true the calculated widths will
166also be set as the minimal widths for the columns.
167
168\wxheading{Note}\\
169wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
170The memory requirements for this could become prohibitive if your grid is very large.
171
172\membersection{wxGrid::AutoSizeRow}\label{wxgridautosizerow}
173
174\func{void}{AutoSizeRow}{\param{int }{row}, \param{bool }{setAsMin = true}}
175
176Automatically sizes the row to fit its contents. If setAsMin is true the calculated height will
177also be set as the minimal height for the row.
178
179\wxheading{Note}\\
180wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
181The memory requirements for this could become prohibitive if your grid is very large.
182
183\membersection{wxGrid::AutoSizeRows}\label{wxgridautosizerows}
184
185\func{void}{AutoSizeRows}{\param{bool }{setAsMin = true}}
186
187Automatically sizes all rows to fit their contents. If setAsMin is true the calculated heights will
188also be set as the minimal heights for the rows.
189
190\wxheading{Note}\\
191wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
192The memory requirements for this could become prohibitive if your grid is very large.
193
194\membersection{wxGrid::BeginBatch}\label{wxgridbeginbatch}
195
196\func{void}{BeginBatch}{\void}
197
198Increments the grid's batch count. When the count is greater than zero repainting of
199the grid is suppressed. Each call to BeginBatch must be matched by a later call to
200\helpref{wxGrid::EndBatch}{wxgridendbatch}. Code that does a lot of grid
201modification can be enclosed between BeginBatch and EndBatch calls to avoid
202screen flicker. The final EndBatch will cause the grid to be repainted.
203
204\membersection{wxGrid::CanDragColSize}\label{wxgridcandragcolsize}
205
206\func{bool}{CanDragColSize}{\void}
207
208Returns true if columns can be resized by dragging with the mouse. Columns can be resized
209by dragging the edges of their labels. If grid line dragging is enabled they can also be
210resized by dragging the right edge of the column in the grid cell area
211(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
212
213\membersection{wxGrid::CanDragRowSize}\label{wxgridcandragrowsize}
214
215\func{bool}{CanDragRowSize}{\void}
216
217Returns true if rows can be resized by dragging with the mouse. Rows can be resized
218by dragging the edges of their labels. If grid line dragging is enabled they can also be
219resized by dragging the lower edge of the row in the grid cell area
220(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
221
222\membersection{wxGrid::CanDragGridSize}\label{wxgridcandraggridsize}
223
224\func{bool}{CanDragGridSize}{\void}
225
226Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise.
227
228\membersection{wxGrid::CanEnableCellControl}\label{wxgridcanenablecellcontrol}
229
230\constfunc{bool}{CanEnableCellControl}{\void}
231
232Returns true if the in-place edit control for the current grid cell can be used and
233false otherwise (e.g. if the current cell is read-only).
234
235\membersection{wxGrid::CellToRect}\label{wxgridcelltorect}
236
237\func{wxRect}{CellToRect}{\param{int }{row}, \param{int }{col}}
238
239\func{wxRect}{CellToRect}{\param{const wxGridCellCoords\& }{coords}}
240
241Return the rectangle corresponding to the grid cell's size and position in logical
242coordinates.
243
244\membersection{wxGrid::ClearGrid}\label{wxgridcleargrid}
245
246\func{void}{ClearGrid}{\void}
247
248Clears all data in the underlying grid table and repaints the grid. The table is not deleted by
249this function. If you are using a derived table class then you need to override
250\helpref{wxGridTableBase::Clear}{wxgridtablebaseclear} for this function to have any effect.
251
252\membersection{wxGrid::ClearSelection}\label{wxgridclearselection}
253
254\func{void}{ClearSelection}{\void}
255
256Deselects all cells that are currently selected.
257
258\membersection{wxGrid::CreateGrid}\label{wxgridcreategrid}
259
260\func{bool}{CreateGrid}{\param{int }{numRows}, \param{int }{numCols}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
261
262Creates a grid with the specified initial number of rows and columns.
263Call this directly after the grid constructor. When you use this
264function wxGrid will create and manage a simple table of string values
265for you. All of the grid data will be stored in memory.
266
267For applications with more complex data types or relationships, or for
268dealing with very large datasets, you should derive your own grid table
269class and pass a table object to the grid with \helpref{wxGrid::SetTable}{wxgridsettable}.
270
271\membersection{wxGrid::DeleteCols}\label{wxgriddeletecols}
272
273\func{bool}{DeleteCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
274
275Deletes one or more columns from a grid starting at the specified position and returns
276true if successful. The updateLabels argument is not used at present.
277
278If you are using a derived grid table class you will need to override
279\helpref{wxGridTableBase::DeleteCols}{wxgridtablebasedeletecols}. See
280\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
281
282\membersection{wxGrid::DeleteRows}\label{wxgriddeleterows}
283
284\func{bool}{DeleteRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
285
286Deletes one or more rows from a grid starting at the specified position and returns
287true if successful. The updateLabels argument is not used at present.
288
289If you are using a derived grid table class you will need to override
290\helpref{wxGridTableBase::DeleteRows}{wxgridtablebasedeleterows}. See
291\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
292
293\membersection{wxGrid::DisableCellEditControl}\label{wxgriddisablecelleditcontrol}
294
295\func{void}{DisableCellEditControl}{\void}
296
297Disables in-place editing of grid cells.
298Equivalent to calling EnableCellEditControl(false).
299
300\membersection{wxGrid::DisableDragColSize}\label{wxgriddisabledragcolsize}
301
302\func{void}{DisableDragColSize}{\void}
303
304Disables column sizing by dragging with the mouse. Equivalent to passing false to
305\helpref{wxGrid::EnableDragColSize}{wxgridenabledragcolsize}.
306
307\membersection{wxGrid::DisableDragGridSize}\label{wxgriddisabledraggridsize}
308
309\func{void}{DisableDragGridSize}{\void}
310
311Disable mouse dragging of grid lines to resize rows and columns. Equivalent to passing
312false to \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}
313
314\membersection{wxGrid::DisableDragRowSize}\label{wxgriddisabledragrowsize}
315
316\func{void}{DisableDragRowSize}{\void}
317
318Disables row sizing by dragging with the mouse. Equivalent to passing false to
319\helpref{wxGrid::EnableDragRowSize}{wxgridenabledragrowsize}.
320
321\membersection{wxGrid::EnableCellEditControl}\label{wxgridenablecelleditcontrol}
322
323\func{void}{EnableCellEditControl}{\param{bool }{enable = true}}
324
325Enables or disables in-place editing of grid cell data. The grid will issue either a
326wxEVT\_GRID\_EDITOR\_SHOWN or wxEVT\_GRID\_EDITOR\_HIDDEN event.
327
328\membersection{wxGrid::EnableDragColSize}\label{wxgridenabledragcolsize}
329
330\func{void}{EnableDragColSize}{\param{bool }{enable = true}}
331
332Enables or disables column sizing by dragging with the mouse.
333
334\membersection{wxGrid::EnableDragGridSize}\label{wxgridenabledraggridsize}
335
336\func{void}{EnableDragGridSize}{\param{bool }{enable = true}}
337
338Enables or disables row and column resizing by dragging gridlines with the mouse.
339
340\membersection{wxGrid::EnableDragRowSize}\label{wxgridenabledragrowsize}
341
342\func{void}{EnableDragRowSize}{\param{bool }{enable = true}}
343
344Enables or disables row sizing by dragging with the mouse.
345
346\membersection{wxGrid::EnableEditing}\label{wxgridenableediting}
347
348\func{void}{EnableEditing}{\param{bool }{edit}}
349
350If the edit argument is false this function sets the whole grid as read-only. If the
351argument is true the grid is set to the default state where cells may be editable. In the
352default state you can set single grid cells and whole rows and columns to be editable or
353read-only via
354\helpref{wxGridCellAttribute::SetReadOnly}{wxgridcellattrsetreadonly}. For single
355cells you can also use the shortcut function
356\helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}.
357
358For more information about controlling grid cell attributes see the
359\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
360\helpref{wxGrid classes overview}{gridoverview}.
361
362\membersection{wxGrid::EnableGridLines}\label{wxgridenablegridlines}
363
364\func{void}{EnableGridLines}{\param{bool }{enable = true}}
365
366Turns the drawing of grid lines on or off.
367
368\membersection{wxGrid::EndBatch}\label{wxgridendbatch}
369
370\func{void}{EndBatch}{\void}
371
372Decrements the grid's batch count. When the count is greater than zero repainting of
373the grid is suppressed. Each previous call to
374\helpref{wxGrid::BeginBatch}{wxgridbeginbatch} must be matched by a later call to
375EndBatch. Code that does a lot of grid modification can be enclosed between
376BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will
377cause the grid to be repainted.
378
379\membersection{wxGrid::ForceRefresh}\label{wxgridforcerefresh}
380
381\func{void}{ForceRefresh}{\void}
382
383Causes immediate repainting of the grid. Use this instead of the usual wxWindow::Refresh.
384
385\membersection{wxGrid::GetBatchCount}\label{wxgridgetbatchcount}
386
387\func{int}{GetBatchCount}{\void}
388
389Returns the number of times that \helpref{wxGrid::BeginBatch}{wxgridbeginbatch} has been called
390without (yet) matching calls to \helpref{wxGrid::EndBatch}{wxgridendbatch}. While
391the grid's batch count is greater than zero the display will not be updated.
392
393\membersection{wxGrid::GetCellAlignment}\label{wxgridgetcellalignment}
394
395\func{void}{GetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int* }{horiz}, \param{int* }{vert}}
396
397Sets the arguments to the horizontal and vertical text alignment values for the
398grid cell at the specified location.
399
400Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
401Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
402
403\perlnote{This method only takes the parameters {\tt row} and {\tt col} and
404returns a 2-element list {\tt ( horiz, vert )}.}
405
406\membersection{wxGrid::GetCellBackgroundColour}\label{wxgridgetcellbackgroundcolour}
407
408\func{wxColour}{GetCellBackgroundColour}{\param{int }{row}, \param{int }{col}}
409
410Returns the background colour of the cell at the specified location.
411
412\membersection{wxGrid::GetCellEditor}\label{wxgridgetcelleditor}
413
414\func{wxGridCellEditor*}{GetCellEditor}{\param{int }{row}, \param{int }{col}}
415
416Returns a pointer to the editor for the cell at the specified location.
417
418See \helpref{wxGridCellEditor}{wxgridcelleditor} and
419the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
420
421\membersection{wxGrid::GetCellFont}\label{wxgridgetcellfont}
422
423\func{wxFont}{GetCellFont}{\param{int }{row}, \param{int }{col}}
424
425Returns the font for text in the grid cell at the specified location.
426
427\membersection{wxGrid::GetCellRenderer}\label{wxgridgetcellrenderer}
428
429\func{wxGridCellRenderer*}{GetCellRenderer}{\param{int }{row}, \param{int }{col}}
430
431Returns a pointer to the renderer for the grid cell at the specified location.
432
433See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
434the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
435
436\membersection{wxGrid::GetCellTextColour}\label{wxgridgetcelltextcolour}
437
438\func{wxColour}{GetCellTextColour}{\param{int }{row}, \param{int }{col}}
439
440Returns the text colour for the grid cell at the specified location.
441
442\membersection{wxGrid::GetCellValue}\label{wxgridgetcellvalue}
443
444\func{wxString}{GetCellValue}{\param{int }{row}, \param{int }{col}}
445
446\func{wxString}{GetCellValue}{\param{const wxGridCellCoords\&}{coords}}
447
448Returns the string contained in the cell at the specified location. For simple applications where a
449grid object automatically uses a default grid table of string values you use this function together
450with \helpref{wxGrid::SetCellValue}{wxgridsetcellvalue} to access cell values.
451
452For more complex applications where you have derived your own grid table class that contains
453various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
454function for those cells that contain string values.
455
456See \helpref{wxGridTableBase::CanGetValueAs}{wxgridtablebasecangetvalueas}
457and the \helpref{wxGrid overview}{gridoverview} for more information.
458
459\membersection{wxGrid::GetColLabelAlignment}\label{wxgridgetcollabelalignment}
460
461\func{void}{GetColLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
462
463Sets the arguments to the current column label alignment values.
464
465Horizontal alignment will be one of wxLEFT, wxCENTRE or wxRIGHT. \\
466Vertical alignment will be one of wxTOP, wxCENTRE or wxBOTTOM.
467
468\perlnote{This method takes no parameters and
469returns a 2-element list {\tt ( horiz, vert )}.}
470
471\membersection{wxGrid::GetColLabelSize}\label{wxgridgetcollabelsize}
472
473\func{int}{GetColLabelSize}{\void}
474
475Returns the current height of the column labels.
476
477\membersection{wxGrid::GetColLabelValue}\label{wxgridgetcollabelvalue}
478
479\func{wxString}{GetColLabelValue}{\param{int }{col}}
480
481Returns the specified column label. The default grid table class provides column labels of
482the form A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can override
483\helpref{wxGridTableBase::GetColLabelValue}{wxgridtablebasegetcollabelvalue} to provide
484your own labels.
485
486\membersection{wxGrid::GetColSize}\label{wxgridgetcolsize}
487
488\func{int}{GetColSize}{\param{int }{col}}
489
490Returns the width of the specified column.
491
492\membersection{wxGrid::GetDefaultCellAlignment}\label{wxgridgetdefaultcellalignment}
493
494\func{void}{GetDefaultCellAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
495
496Sets the arguments to the current default horizontal and vertical text alignment
497values.
498
499Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
500Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
501
502\membersection{wxGrid::GetDefaultCellBackgroundColour}\label{wxgridgetdefaultcellbackgroundcolour}
503
504\func{wxColour}{GetDefaultCellBackgroundColour}{\void}
505
506Returns the current default background colour for grid cells.
507
508\membersection{wxGrid::GetDefaultCellFont}\label{wxgridgetdefaultcellfont}
509
510\func{wxFont}{GetDefaultCellFont}{\void}
511
512Returns the current default font for grid cell text.
513
514\membersection{wxGrid::GetDefaultCellTextColour}\label{wxgridgetdefaultcelltextcolour}
515
516\func{wxColour}{GetDefaultCellTextColour}{\void}
517
518Returns the current default colour for grid cell text.
519
520\membersection{wxGrid::GetDefaultColLabelSize}\label{wxgridgetdefaultcollabelsize}
521
522\func{int}{GetDefaultColLabelSize}{\void}
523
524Returns the default height for column labels.
525
526\membersection{wxGrid::GetDefaultColSize}\label{wxgridgetdefaultcolsize}
527
528\func{int}{GetDefaultColSize}{\void}
529
530Returns the current default width for grid columns.
531
532\membersection{wxGrid::GetDefaultEditor}\label{wxgridgetdefaulteditor}
533
534\constfunc{wxGridCellEditor*}{GetDefaultEditor}{\void}
535
536Returns a pointer to the current default grid cell editor.
537
538See \helpref{wxGridCellEditor}{wxgridcelleditor} and
539the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
540
541\membersection{wxGrid::GetDefaultRenderer}\label{wxgridgetdefaultrenderer}
542
543\constfunc{wxGridCellRenderer*}{GetDefaultRenderer}{\void}
544
545Returns a pointer to the current default grid cell renderer.
546
547See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
548the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
549
550\membersection{wxGrid::GetDefaultRowLabelSize}\label{wxgridgetdefaultrowlabelsize}
551
552\func{int}{GetDefaultRowLabelSize}{\void}
553
554Returns the default width for the row labels.
555
556\membersection{wxGrid::GetDefaultRowSize}\label{wxgridgetdefaultrowsize}
557
558\func{int}{GetDefaultRowSize}{\void}
559
560Returns the current default height for grid rows.
561
562\membersection{wxGrid::GetGridCursorCol}\label{wxgridgetgridcursorcol}
563
564\func{int}{GetGridCursorCol}{\void}
565
566Returns the current grid cell column position.
567
568\membersection{wxGrid::GetGridCursorRow}\label{wxgridgetgridcursorrow}
569
570\func{int}{GetGridCursorRow}{\void}
571
572Returns the current grid cell row position.
573
574\membersection{wxGrid::GetGridLineColour}\label{wxgridgetgridlinecolour}
575
576\func{wxColour}{GetGridLineColour}{\void}
577
578Returns the colour used for grid lines.
579
580\membersection{wxGrid::GridLinesEnabled}\label{wxgridgridlinesenabled}
581
582\func{bool}{GridLinesEnabled}{\void}
583
584Returns true if drawing of grid lines is turned on, false otherwise.
585
586\membersection{wxGrid::GetLabelBackgroundColour}\label{wxgridgetlabelbackgroundcolour}
587
588\func{wxColour}{GetLabelBackgroundColour}{\void}
589
590Returns the colour used for the background of row and column labels.
591
592\membersection{wxGrid::GetLabelFont}\label{wxgridgetlabelfont}
593
594\func{wxFont}{GetLabelFont}{\void}
595
596Returns the font used for row and column labels.
597
598\membersection{wxGrid::GetLabelTextColour}\label{wxgridgetlabeltextcolour}
599
600\func{wxColour}{GetLabelTextColour}{\void}
601
602Returns the colour used for row and column label text.
603
604\membersection{wxGrid::GetNumberCols}\label{wxgridgetnumbercols}
605
606\func{int}{GetNumberCols}{\void}
607
608Returns the total number of grid columns (actually the number of columns in the underlying grid
609table).
610
611\membersection{wxGrid::GetNumberRows}\label{wxgridgetnumberrows}
612
613\func{int}{GetNumberRows}{\void}
614
615Returns the total number of grid rows (actually the number of rows in the underlying grid table).
616
617\membersection{wxGrid::GetRowLabelAlignment}\label{wxgridgetrowlabelalignment}
618
619\func{void}{GetRowLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
620
621Sets the arguments to the current row label alignment values.
622
623Horizontal alignment will be one of wxLEFT, wxCENTRE or wxRIGHT. \\
624Vertical alignment will be one of wxTOP, wxCENTRE or wxBOTTOM.
625
626\perlnote{This method takes no parameters and
627returns a 2-element list {\tt ( horiz, vert )}.}
628
629\membersection{wxGrid::GetRowLabelSize}\label{wxgridgetrowlabelsize}
630
631\func{int}{GetRowLabelSize}{\void}
632
633Returns the current width of the row labels.
634
635\membersection{wxGrid::GetRowLabelValue}\label{wxgridgetrowlabelvalue}
636
637\func{wxString}{GetRowLabelValue}{\param{int }{row}}
638
639Returns the specified row label. The default grid table class provides numeric row labels.
640If you are using a custom grid table you can override
641\helpref{wxGridTableBase::GetRowLabelValue}{wxgridtablebasegetcollabelvalue} to provide
642your own labels.
643
644\membersection{wxGrid::GetRowSize}\label{wxgridgetrowsize}
645
646\func{int}{GetRowSize}{\param{int }{row}}
647
648Returns the height of the specified row.
649
650\membersection{wxGrid::GetSelectionMode}\label{wxgridgetselectionmode}
651
652\constfunc{wxGrid::wxGridSelectionModes}{GetSelectionMode}{\void}
653
654Returns the current selection mode, see \helpref{wxGrid::SetSelectionMode}{wxgridsetselectionmode}.
655
656\membersection{wxGrid::GetSelectedCells}\label{wxgridgetselectedcells}
657
658\constfunc{wxGridCellCoordsArray}{GetSelectedCells}{\void}
659
660Returns an array of singly selected cells.
661
662\membersection{wxGrid::GetSelectedCols}\label{wxgridgetselectedcols}
663
664\constfunc{wxArrayInt}{GetSelectedCols}{\void}
665
666Returns an array of selected cols.
667
668\membersection{wxGrid::GetSelectedRows}\label{wxgridgetselectedrows}
669
670\constfunc{wxArrayInt}{GetSelectedRows}{\void}
671
672Returns an array of selected rows.
673
674\membersection{wxGrid::GetSelectionBlockTopLeft}\label{wxgridgetselectionblocktopleft}
675
676\constfunc{wxGridCellCoordsArray}{GetSelectionBlockTopLeft}{\void}
677
678Returns an array of the top left corners of blocks of selected cells,
679see \helpref{wxGrid::GetSelectionBlockBottomRight}{wxgridgetselectionblockbottomright}.
680
681\membersection{wxGrid::GetSelectionBlockBottomRight}\label{wxgridgetselectionblockbottomright}
682
683\constfunc{wxGridCellCoordsArray}{GetSelectionBlockBottomRight}{\void}
684
685Returns an array of the bottom right corners of blocks of selected cells,
686see \helpref{wxGrid::GetSelectionBlockTopLeft}{wxgridgetselectionblocktopleft}.
687
688\membersection{wxGrid::GetTable}\label{wxgridgettable}
689
690\constfunc{wxGridTableBase *}{GetTable}{\void}
691
692Returns a base pointer to the current table object.
693
694\membersection{wxGrid::HideCellEditControl}\label{wxgridhidecelleditcontrol}
695
696\func{void}{HideCellEditControl}{\void}
697
698Hides the in-place cell edit control.
699
700\membersection{wxGrid::InsertCols}\label{wxgridinsertcols}
701
702\func{bool}{InsertCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
703
704Inserts one or more new columns into a grid with the first new column at the
705specified position and returns true if successful. The updateLabels argument is not
706used at present.
707
708The sequence of actions begins with the grid object requesting the underlying grid
709table to insert new columns. If this is successful the table notifies the grid and the
710grid updates the display. For a default grid (one where you have called
711\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
712using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
713then you must override
714\helpref{wxGridTableBase::InsertCols}{wxgridtablebaseinsertcols} in your derived
715table class.
716
717\membersection{wxGrid::InsertRows}\label{wxgridinsertrows}
718
719\func{bool}{InsertRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
720
721Inserts one or more new rows into a grid with the first new row at the specified
722position and returns true if successful. The updateLabels argument is not used at
723present.
724
725The sequence of actions begins with the grid object requesting the underlying grid
726table to insert new rows. If this is successful the table notifies the grid and the
727grid updates the display. For a default grid (one where you have called
728\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
729using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
730then you must override
731\helpref{wxGridTableBase::InsertRows}{wxgridtablebaseinsertrows} in your derived
732table class.
733
734\membersection{wxGrid::IsCellEditControlEnabled}\label{wxgridiscelleditcontrolenabled}
735
736\constfunc{bool}{IsCellEditControlEnabled}{\void}
737
738Returns true if the in-place edit control is currently enabled.
739
740\membersection{wxGrid::IsCurrentCellReadOnly}\label{wxgridiscurrentcellreadonly}
741
742\constfunc{bool}{IsCurrentCellReadOnly}{\void}
743
744Returns true if the current cell has been set to read-only
745(see \helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}).
746
747\membersection{wxGrid::IsEditable}\label{wxgridiseditable}
748
749\func{bool}{IsEditable}{\void}
750
751Returns false if the whole grid has been set as read-only or true otherwise.
752See \helpref{wxGrid::EnableEditing}{wxgridenableediting} for more information about
753controlling the editing status of grid cells.
754
755\membersection{wxGrid::IsInSelection}\label{wxgridisinselection}
756
757\constfunc{bool}{IsInSelection}{\param{int }{row}, \param{int }{col}}
758
759\constfunc{bool}{IsInSelection}{\param{const wxGridCellCoords\& }{coords}}
760
761Is this cell currently selected.
762
763\membersection{wxGrid::IsReadOnly}\label{wxgridisreadonly}
764
765\constfunc{bool}{IsReadOnly}{\param{int }{row}, \param{int }{col}}
766
767Returns true if the cell at the specified location can't be edited.
768See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
769
770\membersection{wxGrid::IsSelection}\label{wxgridisselection}
771
772\func{bool}{IsSelection}{\void}
773
774Returns true if there are currently rows, columns or blocks of cells selected.
775
776\membersection{wxGrid::IsVisible}\label{wxgridisvisible}
777
778\func{bool}{IsVisible}{\param{int }{row}, \param{int }{col}, \param{bool }{wholeCellVisible = true}}
779
780\func{bool}{IsVisible}{\param{const wxGridCellCoords\& }{coords}, \param{bool }{wholeCellVisible = true}}
781
782Returns true if a cell is either wholly visible (the default) or at least partially
783visible in the grid window.
784
785\membersection{wxGrid::MakeCellVisible}\label{wxgridmakecellvisible}
786
787\func{void}{MakeCellVisible}{\param{int }{row}, \param{int }{col}}
788
789\func{void}{MakeCellVisible}{\param{const wxGridCellCoords\& }{coords}}
790
791Brings the specified cell into the visible grid cell area with minimal scrolling. Does
792nothing if the cell is already visible.
793
794\membersection{wxGrid::MoveCursorDown}\label{wxgridmovecursordown}
795
796\func{bool}{MoveCursorDown}{\param{bool }{expandSelection}}
797
798Moves the grid cursor down by one row. If a block of cells was previously selected it
799will expand if the argument is true or be cleared if the argument is false.
800
801\wxheading{Keyboard}\\
802This function is called for Down cursor key presses or Shift+Down to expand a selection.
803
804\membersection{wxGrid::MoveCursorLeft}\label{wxgridmovecursorleft}
805
806\func{bool}{MoveCursorLeft}{\param{bool }{expandSelection}}
807
808Moves the grid cursor left by one column. If a block of cells was previously selected it
809will expand if the argument is true or be cleared if the argument is false.
810
811\wxheading{Keyboard}\\
812This function is called for Left cursor key presses or Shift+Left to expand a selection.
813
814\membersection{wxGrid::MoveCursorRight}\label{wxgridmovecursorright}
815
816\func{bool}{MoveCursorRight}{\param{bool }{expandSelection}}
817
818Moves the grid cursor right by one column. If a block of cells was previously selected it
819will expand if the argument is true or be cleared if the argument is false.
820
821\wxheading{Keyboard}\\
822This function is called for Right cursor key presses or Shift+Right to expand a selection.
823
824\membersection{wxGrid::MoveCursorUp}\label{wxgridmovecursorup}
825
826\func{bool}{MoveCursorUp}{\param{bool }{expandSelection}}
827
828Moves the grid cursor up by one row. If a block of cells was previously selected it
829will expand if the argument is true or be cleared if the argument is false.
830
831\wxheading{Keyboard}\\
832This function is called for Up cursor key presses or Shift+Up to expand a selection.
833
834\membersection{wxGrid::MoveCursorDownBlock}\label{wxgridmovecursordownblock}
835
836\func{bool}{MoveCursorDownBlock}{\param{bool }{expandSelection}}
837
838Moves the grid cursor down in the current column such that it skips to the beginning or
839end of a block of non-empty cells. If a block of cells was previously selected it
840will expand if the argument is true or be cleared if the argument is false.
841
842\wxheading{Keyboard}\\
843This function is called for the Ctrl+Down key combination. Shift+Ctrl+Down expands a selection.
844
845\membersection{wxGrid::MoveCursorLeftBlock}\label{wxgridmovecursorleftblock}
846
847\func{bool}{MoveCursorLeftBlock}{\param{bool }{expandSelection}}
848
849Moves the grid cursor left in the current row such that it skips to the beginning or
850end of a block of non-empty cells. If a block of cells was previously selected it
851will expand if the argument is true or be cleared if the argument is false.
852
853\wxheading{Keyboard}\\
854This function is called for the Ctrl+Left key combination. Shift+Ctrl+left expands a selection.
855
856\membersection{wxGrid::MoveCursorRightBlock}\label{wxgridmovecursorrightblock}
857
858\func{bool}{MoveCursorRightBlock}{\param{bool }{expandSelection}}
859
860Moves the grid cursor right in the current row such that it skips to the beginning or
861end of a block of non-empty cells. If a block of cells was previously selected it
862will expand if the argument is true or be cleared if the argument is false.
863
864\wxheading{Keyboard}\\
865This function is called for the Ctrl+Right key combination. Shift+Ctrl+Right expands a selection.
866
867\membersection{wxGrid::MoveCursorUpBlock}\label{wxgridmovecursorupblock}
868
869\func{bool}{MoveCursorUpBlock}{\param{bool }{expandSelection}}
870
871Moves the grid cursor up in the current column such that it skips to the beginning or
872end of a block of non-empty cells. If a block of cells was previously selected it
873will expand if the argument is true or be cleared if the argument is false.
874
875\wxheading{Keyboard}\\
876This function is called for the Ctrl+Up key combination. Shift+Ctrl+Up expands a selection.
877
878\membersection{wxGrid::MovePageDown}\label{wxgridmovepagedown}
879
880\func{bool}{MovePageDown}{\void}
881
882Moves the grid cursor down by some number of rows so that the previous bottom visible row
883becomes the top visible row.
884
885\wxheading{Keyboard}\\
886This function is called for PgDn keypresses.
887
888\membersection{wxGrid::MovePageUp}\label{wxgridmovepageup}
889
890\func{bool}{MovePageUp}{\void}
891
892Moves the grid cursor up by some number of rows so that the previous top visible row
893becomes the bottom visible row.
894
895\wxheading{Keyboard}\\
896This function is called for PgUp keypresses.
897
898\membersection{wxGrid::SaveEditControlValue}\label{wxgridsaveeditcontrolvalue}
899
900\func{void}{SaveEditControlValue}{\void}
901
902Sets the value of the current grid cell to the current in-place edit control value.
903This is called automatically when the grid cursor moves from the current cell to a
904new cell. It is also a good idea to call this function when closing a grid since
905any edits to the final cell location will not be saved otherwise.
906
907\membersection{wxGrid::SelectAll}\label{wxgridselectall}
908
909\func{void}{SelectAll}{\void}
910
911Selects all cells in the grid.
912
913\membersection{wxGrid::SelectBlock}\label{wxgridselectblock}
914
915\func{void}{SelectBlock}{\param{int }{topRow}, \param{int }{leftCol},
916\param{int }{bottomRow}, \param{int }{rightCol}, \param{bool }{addToSelected = false}}
917
918\func{void}{SelectBlock}{\param{const wxGridCellCoords\& }{topLeft},
919\param{const wxGridCellCoords\& }{bottomRight}, \param{bool }{addToSelected = false}}
920
921Selects a rectangular block of cells. If addToSelected is false then any existing selection will be
922deselected; if true the column will be added to the existing selection.
923
924\membersection{wxGrid::SelectCol}\label{wxgridselectcol}
925
926\func{void}{SelectCol}{\param{int }{col}, \param{bool }{addToSelected = false}}
927
928Selects the specified column. If addToSelected is false then any existing selection will be
929deselected; if true the column will be added to the existing selection.
930
931\membersection{wxGrid::SelectRow}\label{wxgridselectrow}
932
933\func{void}{SelectRow}{\param{int }{row}, \param{bool }{addToSelected = false}}
934
935Selects the specified row. If addToSelected is false then any existing selection will be
936deselected; if true the row will be added to the existing selection.
937
938\membersection{wxGrid::SetCellAlignment}\label{wxgridsetcellalignment}
939
940\func{void}{SetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int }{horiz}, \param{int }{vert}}
941
942\func{void}{SetCellAlignment}{\param{int }{align}, \param{int }{row}, \param{int }{col}}
943
944\func{void}{SetCellAlignment}{\param{int }{align}}
945
946Sets the horizontal and vertical alignment for grid cell text at the specified location.
947
948Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
949Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
950
951\membersection{wxGrid::SetCellEditor}\label{wxgridsetcelleditor}
952
953\func{void}{SetCellEditor}{\param{int }{row}, \param{int }{col}, \param{wxGridCellEditor* }{editor}}
954
955Sets the editor for the grid cell at the specified location.
956The grid will take ownership of the pointer.
957
958See \helpref{wxGridCellEditor}{wxgridcelleditor} and
959the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
960
961\membersection{wxGrid::SetCellFont}\label{wxgridsetcellfont}
962
963\func{void}{SetCellFont}{\param{int }{row}, \param{int }{col}, \param{const wxFont\&}{ font}}
964
965Sets the font for text in the grid cell at the specified location.
966
967\membersection{wxGrid::SetCellRenderer}\label{wxgridsetcellrenderer}
968
969\func{void}{SetCellRenderer}{\param{int }{row}, \param{int }{col}, \param{wxGridCellRenderer* }{renderer}}
970
971Sets the renderer for the grid cell at the specified location.
972The grid will take ownership of the pointer.
973
974See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
975the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
976
977\membersection{wxGrid::SetCellTextColour}\label{wxgridsetcelltextcolour}
978
979\func{void}{SetCellTextColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
980
981\func{void}{SetCellTextColour}{\param{const wxColour\& }{val}, \param{int }{row}, \param{int }{col}}
982
983\func{void}{SetCellTextColour}{\param{const wxColour\& }{colour}}
984
985Sets the text colour for the grid cell at the specified location.
986
987\membersection{wxGrid::SetCellValue}\label{wxgridsetcellvalue}
988
989\func{void}{SetCellValue}{\param{int }{row}, \param{int }{col}, \param{const wxString\& }{s}}
990
991\func{void}{SetCellValue}{\param{const wxGridCellCoords\& }{coords}, \param{const wxString\& }{s}}
992
993\func{void}{SetCellValue}{\param{const wxString\& }{val}, \param{int }{row}, \param{int }{col}}
994
995Sets the string value for the cell at the specified location. For simple applications where a
996grid object automatically uses a default grid table of string values you use this function together
997with \helpref{wxGrid::GetCellValue}{wxgridgetcellvalue} to access cell values.
998
999For more complex applications where you have derived your own grid table class that contains
1000various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
1001function for those cells that contain string values.
1002
1003The last form is for backward compatibility only.
1004
1005See \helpref{wxGridTableBase::CanSetValueAs}{wxgridtablebasecangetvalueas}
1006and the \helpref{wxGrid overview}{gridoverview} for more information.
1007
1008\membersection{wxGrid::SetColAttr}\label{wxgridsetcolattr}
1009
1010\func{void}{SetColAttr}{\param{int }{col}, \param{wxGridCellAttr* }{attr}}
1011
1012Sets the cell attributes for all cells in the specified column.
1013
1014For more information about controlling grid cell attributes see the
1015\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
1016\helpref{wxGrid classes overview}{gridoverview}.
1017
1018\membersection{wxGrid::SetColFormatBool}\label{wxgridsetcolformatbool}
1019
1020\func{void}{SetColFormatBool}{\param{int }{col}}
1021
1022Sets the specified column to display boolean values. wxGrid displays boolean values with a checkbox.
1023
1024\membersection{wxGrid::SetColFormatNumber}\label{wxgridsetcolformatnumber}
1025
1026\func{void}{SetColFormatNumber}{\param{int }{col}}
1027
1028Sets the specified column to display integer values.
1029
1030\membersection{wxGrid::SetColFormatFloat}\label{wxgridsetcolformatfloat}
1031
1032\func{void}{SetColFormatFloat}{\param{int }{col}, \param{int }{width = -1}, \param{int }{precision = -1}}
1033
1034Sets the specified column to display floating point values with the given width and precision.
1035
1036\membersection{wxGrid::SetColFormatCustom}\label{wxgridsetcolformatcustom}
1037
1038\func{void}{SetColFormatCustom}{\param{int }{col}, \param{const wxString\& }{typeName}}
1039
1040Sets the specified column to display data in a custom format.
1041See the \helpref{wxGrid overview}{gridoverview} for more information on working
1042with custom data types.
1043
1044\membersection{wxGrid::SetColLabelAlignment}\label{wxgridsetcollabelalignment}
1045
1046\func{void}{SetColLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
1047
1048Sets the horizontal and vertical alignment of column label text.
1049
1050Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
1051
1052Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1053
1054\membersection{wxGrid::SetColLabelSize}\label{wxgridsetcollabelsize}
1055
1056\func{void}{SetColLabelSize}{\param{int }{height}}
1057
1058Sets the height of the column labels.
1059
1060\membersection{wxGrid::SetColLabelValue}\label{wxgridsetcollabelvalue}
1061
1062\func{void}{SetColLabelValue}{\param{int }{col}, \param{const wxString\&}{ value}}
1063
1064Set the value for the given column label. If you are using a derived grid table you must
1065override \helpref{wxGridTableBase::SetColLabelValue}{wxgridtablebasesetcollabelvalue}
1066for this to have any effect.
1067
1068\membersection{wxGrid::SetColMinimalWidth}\label{wxgridsetcolminimalwidth}
1069
1070\func{void}{SetColMinimalWidth}{\param{int }{col}, \param{int }{width}}
1071
1072Sets the minimal width for the specified column. This should normally be called when creating the grid
1073because it will not resize a column that is already narrower than the minimal width.
1074
1075\membersection{wxGrid::SetColSize}\label{wxgridsetcolsize}
1076
1077\func{void}{SetColSize}{\param{int }{col}, \param{int }{width}}
1078
1079Sets the width of the specified column.
1080
1081This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
1082block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
1083
1084Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
1085also be set as the minimal width for the column.
1086
1087\wxheading{Note}\\
1088wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
1089The memory requirements for this could become prohibitive if your grid is very large.
1090
1091\membersection{wxGrid::SetDefaultCellAlignment}\label{wxgridsetdefaultcellalignment}
1092
1093\func{void}{SetDefaultCellAlignment}{\param{int }{horiz}, \param{int }{vert}}
1094
1095Sets the default horizontal and vertical alignment for grid cell text.
1096
1097Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
1098
1099Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1100
1101\membersection{wxGrid::SetDefaultCellBackgroundColour}\label{wxgridsetdefaultcellbackgroundcolour}
1102
1103\func{void}{SetDefaultCellBackgroundColour}{\param{const wxColour\&}{ colour}}
1104
1105Sets the default background colour for grid cells.
1106
1107\membersection{wxGrid::SetDefaultCellFont}\label{wxgridsetdefaultcellfont}
1108
1109\func{void}{SetDefaultCellFont}{\param{const wxFont\&}{ font}}
1110
1111Sets the default font to be used for grid cell text.
1112
1113\membersection{wxGrid::SetDefaultEditor}\label{wxgridsetdefaulteditor}
1114
1115\func{void}{SetDefaultEditor}{\param{wxGridCellEditor* }{editor}}
1116
1117Sets the default editor for grid cells. The grid will take ownership of the pointer.
1118
1119See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1120the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1121
1122\membersection{wxGrid::SetDefaultRenderer}\label{wxgridsetdefaultrenderer}
1123
1124\func{void}{SetDefaultRenderer}{\param{wxGridCellRenderer* }{renderer}}
1125
1126Sets the default renderer for grid cells. The grid will take ownership of the pointer.
1127
1128See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1129the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1130
1131\membersection{wxGrid::SetDefaultColSize}\label{wxgridsetdefaultcolsize}
1132
1133\func{void}{SetDefaultColSize}{\param{int }{width}, \param{bool }{resizeExistingCols = false}}
1134
1135Sets the default width for columns in the grid. This will only affect columns subsequently added to
1136the grid unless resizeExistingCols is true.
1137
1138\membersection{wxGrid::SetDefaultRowSize}\label{wxgridsetdefaultrowsize}
1139
1140\func{void}{SetDefaultRowSize}{\param{int }{height}, \param{bool }{resizeExistingRows = false}}
1141
1142Sets the default height for rows in the grid. This will only affect rows subsequently added
1143to the grid unless resizeExistingRows is true.
1144
1145\membersection{wxGrid::SetGridCursor}\label{wxgridsetgridcursor}
1146
1147\func{void}{SetGridCursor}{\param{int }{row}, \param{int }{col}}
1148
1149Set the grid cursor to the specified cell.
1150This function calls \helpref{wxGrid::MakeCellVisible}{wxgridmakecellvisible}.
1151
1152\membersection{wxGrid::SetGridLineColour}\label{wxgridsetgridlinecolour}
1153
1154\func{void}{SetGridLineColour}{\param{const wxColour\&}{colour}}
1155
1156Sets the colour used to draw grid lines.
1157
1158\membersection{wxGrid::SetLabelBackgroundColour}\label{wxgridsetlabelbackgroundcolour}
1159
1160\func{void}{SetLabelBackgroundColour}{\param{const wxColour\&}{ colour}}
1161
1162Sets the background colour for row and column labels.
1163
1164\membersection{wxGrid::SetLabelFont}\label{wxgridsetlabelfont}
1165
1166\func{void}{SetLabelFont}{\param{const wxFont\&}{ font}}
1167
1168Sets the font for row and column labels.
1169
1170\membersection{wxGrid::SetLabelTextColour}\label{wxgridsetlabeltextcolour}
1171
1172\func{void}{SetLabelTextColour}{\param{const wxColour\&}{ colour}}
1173
1174Sets the colour for row and column label text.
1175
1176\membersection{wxGrid::SetReadOnly}\label{wxgridsetreadonly}
1177
1178\func{void}{SetReadOnly}{\param{int }{row}, \param{int }{col}, \param{bool }{isReadOnly = true}}
1179
1180Makes the cell at the specified location read-only or editable.
1181See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
1182
1183\membersection{wxGrid::SetRowAttr}\label{wxgridsetrowattr}
1184
1185\func{void}{SetRowAttr}{\param{int }{row}, \param{wxGridCellAttr* }{attr}}
1186
1187Sets the cell attributes for all cells in the specified row.
1188See the \helpref{wxGridCellAttr}{wxgridcellattr} class for more information
1189about controlling cell attributes.
1190
1191\membersection{wxGrid::SetRowLabelAlignment}\label{wxgridsetrowlabelalignment}
1192
1193\func{void}{SetRowLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
1194
1195Sets the horizontal and vertical alignment of row label text.
1196
1197Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
1198
1199Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1200
1201\membersection{wxGrid::SetRowLabelSize}\label{wxgridsetrowlabelsize}
1202
1203\func{void}{SetRowLabelSize}{\param{int }{width}}
1204
1205Sets the width of the row labels.
1206
1207\membersection{wxGrid::SetRowLabelValue}\label{wxgridsetrowlabelvalue}
1208
1209\func{void}{SetRowLabelValue}{\param{int }{row}, \param{const wxString\&}{ value}}
1210
1211Set the value for the given row label. If you are using a derived grid table you must
1212override \helpref{wxGridTableBase::SetRowLabelValue}{wxgridtablebasesetrowlabelvalue}
1213for this to have any effect.
1214
1215\membersection{wxGrid::SetRowMinimalHeight}\label{wxgridsetrowminimalheight}
1216
1217\func{void}{SetRowMinimalHeight}{\param{int }{row}, \param{int }{width}}
1218
1219Sets the minimal height for the specified row. This should normally be called when creating the grid
1220because it will not resize a row that is already shorter than the minimal height.
1221
1222\membersection{wxGrid::SetRowSize}\label{wxgridsetrowsize}
1223
1224\func{void}{SetRowSize}{\param{int }{row}, \param{int }{height}}
1225
1226Sets the height of the specified row.
1227
1228This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
1229block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
1230
1231Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
1232also be set as the minimal width for the column.
1233
1234\wxheading{Note}
1235
1236wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
1237The memory requirements for this could become prohibitive if your grid is very large.
1238
1239\membersection{wxGrid::SetSelectionMode}\label{wxgridsetselectionmode}
1240
1241\func{void}{SetSelectionMode}{\param{wxGrid::wxGridSelectionModes}{ selmode}}
1242
1243Set the selection behaviour of the grid.
1244
1245\wxheading{Parameters}
1246
1247\docparam{wxGrid::wxGridSelectCells}{The default mode where individual cells are selected.}
1248
1249\docparam{wxGrid::wxGridSelectRows}{Selections will consist of whole rows.}
1250
1251\docparam{wxGrid::wxGridSelectionColumns}{Selections will consist of whole columns.}
1252
1253\membersection{wxGrid::SetTable}\label{wxgridsettable}
1254
1255\func{bool}{SetTable}{\param{wxGridTableBase* }{table}, \param{bool }{takeOwnership = false}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
1256
1257Passes a pointer to a custom grid table to be used by the grid. This should be called
1258after the grid constructor and before using the grid object. If takeOwnership is set to
1259true then the table will be deleted by the wxGrid destructor.
1260
1261Use this function instead of \helpref{wxGrid::CreateGrid}{wxgridcreategrid} when your
1262application involves complex or non-string data or data sets that are too large to fit
1263wholly in memory.
1264
1265\membersection{wxGrid::ShowCellEditControl}\label{wxgridshowcelleditcontrol}
1266
1267\func{void}{ShowCellEditControl}{\void}
1268
1269Displays the in-place cell edit control for the current cell.
1270
1271\membersection{wxGrid::XToCol}\label{wxgridxtocol}
1272
1273\func{int}{XToCol}{\param{int }{x}}
1274
1275Returns the grid column that corresponds to the logical x coordinate. Returns
1276wxNOT\_FOUND if there is no column at the x position.
1277
1278\membersection{wxGrid::XToEdgeOfCol}\label{wxgridxtoedgeofcol}
1279
1280\func{int}{XToEdgeOfCol}{\param{int }{x}}
1281
1282Returns the column whose right hand edge is close to the given logical x position.
1283If no column edge is near to this position wxNOT\_FOUND is returned.
1284
1285\membersection{wxGrid::YToEdgeOfRow}\label{wxgridytoedgeofrow}
1286
1287\func{int}{YToEdgeOfRow}{\param{int }{y}}
1288
1289Returns the row whose bottom edge is close to the given logical y position.
1290If no row edge is near to this position wxNOT\_FOUND is returned.
1291
1292\membersection{wxGrid::YToRow}\label{wxgridytorow}
1293
1294\func{int}{YToRow}{\param{int }{y}}
1295
1296Returns the grid row that corresponds to the logical y coordinate. Returns
1297wxNOT\_FOUND if there is no row at the y position.
1298
1299
1300\membersection{wxGrid::BlockToDeviceRect}\label{wxgridblocktodevicerect}
1301
1302\func{wxRect}{BlockToDeviceRect}{\param{const wxGridCellCoords \& }{topLeft}, \param{const wxGridCellCoords \& }{bottomRight}}
1303
1304This function returns the rectangle that encloses the block of cells
1305limited by TopLeft and BottomRight cell in device coords and clipped
1306to the client size of the grid window.
1307
1308
1309\membersection{wxGrid::SelectionToDeviceRect}\label{wxgridselectiontodevicerect}
1310
1311\func{wxRect}{SelectionToDeviceRect}{\void}
1312
1313This function returns the rectangle that encloses the selected cells
1314in device coords and clipped to the client size of the grid window.
1315
1316
1317\membersection{wxGrid::GetSelectionBackground}\label{wxgridgetselectionbackground}
1318
1319\constfunc{wxColour}{GetSelectionBackground}{\void}
1320
1321Access or update the selection fore/back colours
1322
1323
1324\membersection{wxGrid::GetSelectionForeground}\label{wxgridgetselectionforeground}
1325
1326\constfunc{wxColour}{GetSelectionForeground}{\void}
1327
1328
1329\membersection{wxGrid::SetSelectionBackground}\label{wxgridsetselectionbackground}
1330
1331\func{void}{SetSelectionBackground}{\param{const wxColour\& }{c}}
1332
1333
1334\membersection{wxGrid::SetSelectionForeground}\label{wxgridsetselectionforeground}
1335
1336\func{void}{SetSelectionForeground}{\param{const wxColour\& }{c}}
1337
1338
1339\membersection{wxGrid::RegisterDataType}\label{wxgridregisterdatatype}
1340
1341\func{void}{RegisterDataType}{\param{const wxString\& }{typeName}, \param{wxGridCellRenderer* }{renderer}, \param{wxGridCellEditor* }{editor}}
1342
1343Methods for a registry for mapping data types to Renderers/Editors
1344
1345\membersection{wxGrid::GetDefaultEditorForCell}\label{wxgridgetdefaulteditorforcell}
1346
1347\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{int }{row}, \param{int }{col}}
1348
1349\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{const wxGridCellCoords\& }{c}}
1350
1351
1352\membersection{wxGrid::GetDefaultRendererForCell}\label{wxgridgetdefaultrendererforcell}
1353
1354\constfunc{wxGridCellRenderer*}{GetDefaultRendererForCell}{\param{int }{row}, \param{int }{col}}
1355
1356
1357\membersection{wxGrid::GetDefaultEditorForType}\label{wxgridgetdefaulteditorfortype}
1358
1359\constfunc{wxGridCellEditor*}{GetDefaultEditorForType}{\param{const wxString\& }{typeName}}
1360
1361
1362\membersection{wxGrid::GetDefaultRendererForType}\label{wxgridgetdefaultrendererfortype}
1363
1364\constfunc{wxGridCellRenderer*}{GetDefaultRendererForType}{\param{const wxString\& }{typeName}}
1365
1366
1367\membersection{wxGrid::SetMargins}\label{wxgridsetmargins}
1368
1369\func{void}{SetMargins}{\param{int }{extraWidth}, \param{int }{extraHeight}}
1370
1371A grid may occupy more space than needed for its rows/columns. This
1372function allows to set how big this extra space is
1373
1374\membersection{wxGrid::wxGrid}\label{wxgridwxgrid}
1375
1376\func{}{wxGrid}{\param{wxWindow* }{parent}, \param{int }{x}, \param{int }{y}, \param{int }{w = -1}, \param{int }{h = -1}, \param{long }{style = wxWANTS\_CHARS}, \param{const wxString\& }{name = wxPanelNameStr}}
1377
1378Backward compatibility.
1379
1380\membersection{wxGrid::UpdateDimensions}\label{wxgridupdatedimensions}
1381
1382\func{void}{UpdateDimensions}{\void}
1383
1384Backward compatibility.
1385
1386\membersection{wxGrid::GetRows}\label{wxgridgetrows}
1387
1388\func{int}{GetRows}{\void}
1389
1390Backward compatibility.
1391
1392\membersection{wxGrid::GetCols}\label{wxgridgetcols}
1393
1394\func{int}{GetCols}{\void}
1395
1396Backward compatibility.
1397
1398\membersection{wxGrid::GetCursorRow}\label{wxgridgetcursorrow}
1399
1400\func{int}{GetCursorRow}{\void}
1401
1402Backward compatibility.
1403
1404\membersection{wxGrid::GetCursorColumn}\label{wxgridgetcursorcolumn}
1405
1406\func{int}{GetCursorColumn}{\void}
1407
1408Backward compatibility.
1409
1410\membersection{wxGrid::GetScrollPosX}\label{wxgridgetscrollposx}
1411
1412\func{int}{GetScrollPosX}{\void}
1413
1414Backward compatibility.
1415
1416\membersection{wxGrid::GetScrollPosY}\label{wxgridgetscrollposy}
1417
1418\func{int}{GetScrollPosY}{\void}
1419
1420Backward compatibility.
1421
1422\membersection{wxGrid::SetScrollX}\label{wxgridsetscrollx}
1423
1424\func{void}{SetScrollX}{\param{int }{x}}
1425
1426Backward compatibility.
1427
1428\membersection{wxGrid::SetScrollY}\label{wxgridsetscrolly}
1429
1430\func{void}{SetScrollY}{\param{int }{y}}
1431
1432Backward compatibility.
1433
1434\membersection{wxGrid::SetColumnWidth}\label{wxgridsetcolumnwidth}
1435
1436\func{void}{SetColumnWidth}{\param{int }{col}, \param{int }{width}}
1437
1438Backward compatibility.
1439
1440\membersection{wxGrid::GetColumnWidth}\label{wxgridgetcolumnwidth}
1441
1442\func{int}{GetColumnWidth}{\param{int }{col}}
1443
1444Backward compatibility.
1445
1446\membersection{wxGrid::SetRowHeight}\label{wxgridsetrowheight}
1447
1448\func{void}{SetRowHeight}{\param{int }{row}, \param{int }{height}}
1449
1450Backward compatibility.
1451
1452\membersection{wxGrid::GetViewHeight}\label{wxgridgetviewheight}
1453
1454\func{int}{GetViewHeight}{\void}
1455
1456Backward compatibility.
1457
1458\membersection{wxGrid::GetViewWidth}\label{wxgridgetviewwidth}
1459
1460\func{int}{GetViewWidth}{\void}
1461
1462Returned number of whole cols visible.
1463
1464\membersection{wxGrid::SetLabelSize}\label{wxgridsetlabelsize}
1465
1466\func{void}{SetLabelSize}{\param{int }{orientation}, \param{int }{sz}}
1467
1468
1469\membersection{wxGrid::GetLabelSize}\label{wxgridgetlabelsize}
1470
1471\func{int}{GetLabelSize}{\param{int }{orientation}}
1472
1473
1474\membersection{wxGrid::SetLabelAlignment}\label{wxgridsetlabelalignment}
1475
1476\func{void}{SetLabelAlignment}{\param{int }{orientation}, \param{int }{align}}
1477
1478
1479\membersection{wxGrid::GetLabelAlignment}\label{wxgridgetlabelalignment}
1480
1481\func{int}{GetLabelAlignment}{\param{int }{orientation}, \param{int }{align}}
1482
1483
1484\membersection{wxGrid::SetLabelValue}\label{wxgridsetlabelvalue}
1485
1486\func{void}{SetLabelValue}{\param{int }{orientation}, \param{const wxString\& }{val}, \param{int }{pos}}
1487
1488
1489\membersection{wxGrid::GetLabelValue}\label{wxgridgetlabelvalue}
1490
1491\func{wxString}{GetLabelValue}{\param{int }{orientation}, \param{int }{pos}}
1492
1493
1494\membersection{wxGrid::GetCellTextFont}\label{wxgridgetcelltextfont}
1495
1496\constfunc{wxFont}{GetCellTextFont}{\void}
1497
1498\constfunc{wxFont}{GetCellTextFont}{\param{int }{row}, \param{int }{col}}
1499
1500
1501\membersection{wxGrid::SetCellTextFont}\label{wxgridsetcelltextfont}
1502
1503\func{void}{SetCellTextFont}{\param{const wxFont\& }{fnt}}
1504
1505\func{void}{SetCellTextFont}{\param{const wxFont\& }{fnt}, \param{int }{row}, \param{int }{col}}
1506
1507
1508\membersection{wxGrid::SetCellBackgroundColour}\label{wxgridsetcellbackgroundcolour}
1509
1510\func{void}{SetCellBackgroundColour}{\param{const wxColour\& }{col}}
1511
1512\func{void}{SetCellBackgroundColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
1513
1514\func{void}{SetCellBackgroundColour}{\param{const wxColour\& }{colour}, \param{int }{row}, \param{int }{col}}
1515
1516
1517\membersection{wxGrid::GetEditable}\label{wxgridgeteditable}
1518
1519\func{bool}{GetEditable}{\void}
1520
1521
1522\membersection{wxGrid::SetEditable}\label{wxgridseteditable}
1523
1524\func{void}{SetEditable}{\param{bool }{edit = true}}
1525
1526
1527\membersection{wxGrid::GetEditInPlace}\label{wxgridgeteditinplace}
1528
1529\func{bool}{GetEditInPlace}{\void}
1530
1531
1532\membersection{wxGrid::SetEditInPlace}\label{wxgridseteditinplace}
1533
1534\func{void}{SetEditInPlace}{\param{bool }{edit = true}}
1535
1536
1537\membersection{wxGrid::SetCellBitmap}\label{wxgridsetcellbitmap}
1538
1539\func{void}{SetCellBitmap}{\param{wxBitmap* }{bitmap}, \param{int }{row}, \param{int }{col}}
1540
1541
1542\membersection{wxGrid::SetDividerPen}\label{wxgridsetdividerpen}
1543
1544\func{void}{SetDividerPen}{\param{const wxPen\& }{pen}}
1545
1546
1547\membersection{wxGrid::GetDividerPen}\label{wxgridgetdividerpen}
1548
1549\constfunc{wxPen\&}{GetDividerPen}{\void}
1550
1551
1552\membersection{wxGrid::OnActivate}\label{wxgridonactivate}
1553
1554\func{void}{OnActivate}{\param{bool }{active}}
1555
1556\membersection{wxGrid::Fit}\label{wxgridfit}
1557
1558\func{void}{Fit}{\void}
1559
1560Overridden wxWindow methods
1561
1562\membersection{wxGrid::DoGetBestSize}\label{wxgriddogetbestsize}
1563
1564\constfunc{wxSize}{DoGetBestSize}{\void}
1565
1566\membersection{wxGrid::InitRowHeights}\label{wxgridinitrowheights}
1567
1568\func{void}{InitRowHeights}{\void}
1569
1570NB: {\it never} access m\_row/col arrays directly because they are created
1571on demand, {\it always} use accessor functions instead!
1572
1573Init the m\_rowHeights/Bottoms arrays with default values.
1574
1575\membersection{wxGrid::InitColWidths}\label{wxgridinitcolwidths}
1576
1577\func{void}{InitColWidths}{\void}
1578
1579Init the m\_colWidths/Rights arrays
1580
1581
1582\membersection{wxGrid::GetColWidth}\label{wxgridgetcolwidth}
1583
1584\constfunc{int}{GetColWidth}{\param{int }{col}}
1585
1586Get the col/row coords
1587
1588
1589\membersection{wxGrid::GetColLeft}\label{wxgridgetcolleft}
1590
1591\constfunc{int}{GetColLeft}{\param{int }{col}}
1592
1593
1594\membersection{wxGrid::GetColRight}\label{wxgridgetcolright}
1595
1596\constfunc{int}{GetColRight}{\param{int }{col}}
1597
1598
1599\membersection{wxGrid::GetRowHeight}\label{wxgridgetrowheight}
1600
1601\constfunc{int}{GetRowHeight}{\param{int }{row}}
1602
1603This function must be public for compatibility.
1604
1605\membersection{wxGrid::GetRowTop}\label{wxgridgetrowtop}
1606
1607\constfunc{int}{GetRowTop}{\param{int }{row}}
1608
1609
1610\membersection{wxGrid::GetRowBottom}\label{wxgridgetrowbottom}
1611
1612\constfunc{int}{GetRowBottom}{\param{int }{row}}
1613
1614
1615\membersection{wxGrid::SetOrCalcColumnSizes}\label{wxgridsetorcalccolumnsizes}
1616
1617\func{int}{SetOrCalcColumnSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1618
1619Common part of AutoSizeColumn/Row() and GetBestSize()
1620
1621\membersection{wxGrid::SetOrCalcRowSizes}\label{wxgridsetorcalcrowsizes}
1622
1623\func{int}{SetOrCalcRowSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1624
1625\membersection{wxGrid::AutoSizeColOrRow}\label{wxgridautosizecolorrow}
1626
1627\func{void}{AutoSizeColOrRow}{\param{int }{n}, \param{bool }{setAsMin}, \param{bool }{column}}
1628
1629Common part of AutoSizeColumn/Row() or row?
1630
1631\membersection{wxGrid::GetColMinimalWidth}\label{wxgridgetcolminimalwidth}
1632
1633\constfunc{int}{GetColMinimalWidth}{\param{int }{col}}
1634
1635get the minimal width of the given column/row
1636
1637\membersection{wxGrid::GetRowMinimalHeight}\label{wxgridgetrowminimalheight}
1638
1639\constfunc{int}{GetRowMinimalHeight}{\param{int }{col}}
1640
1641\membersection{wxGrid::CanHaveAttributes}\label{wxgridcanhaveattributes}
1642
1643\func{bool}{CanHaveAttributes}{\void}
1644
1645Do we have some place to store attributes in?
1646
1647\membersection{wxGrid::GetOrCreateCellAttr}\label{wxgridgetorcreatecellattr}
1648
1649\constfunc{wxGridCellAttr*}{GetOrCreateCellAttr}{\param{int }{row}, \param{int }{col}}
1650