]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/grid.tex
Correct wxObjectDataPtr<> assignment from *T to not increase the ref count
[wxWidgets.git] / docs / latex / wx / grid.tex
CommitLineData
4b39770c
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: grid.tex
3%% Purpose: wxGrid
4%% Author:
d4175745 5%% Modified by: Santiago Palacios
4b39770c
WS
6%% Created:
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
a660d684
KB
12\section{\class{wxGrid}}\label{wxgrid}
13
78c49c58 14wxGrid and its related classes are used for displaying and editing tabular
2eebb742 15data. They provide a rich set of features for display, editing, and
78c49c58
MB
16interacting with a variety of data sources. For simple applications, and to
17help you get started, wxGrid is the only class you need to refer to
2eebb742
JS
18directly. It will set up default instances of the other classes and manage
19them for you. For more complex applications you can derive your own
78c49c58 20classes for custom grid views, grid data tables, cell editors and
2eebb742 21renderers. The \helpref{wxGrid classes overview}{gridoverview} has
78c49c58
MB
22examples of simple and more complex applications, explains the
23relationship between the various grid classes and has a summary of the
24keyboard shortcuts and mouse functions provided by wxGrid.
25
fc2171bd 26wxGrid has been greatly expanded and redesigned for wxWidgets 2.2
3776eb6d 27onwards. The new grid classes are reasonably backward-compatible
2eebb742 28but there are some exceptions. There are also easier ways of doing many things compared to
4b39770c 29the previous implementation.
a660d684 30
3776eb6d
RR
31A \helpref{wxGridTableBase}{wxgridtablebase} class holds the actual
32data to be displayed by a wxGrid class. One or more wxGrid classes
33may act as a view for one table class.
34The default table class is called wxGridStringTable and
35holds an array of strings. An instance of such a class is created
36by \helpref{wxGrid::CreateGrid}{wxgridcreategrid}.
37
38\helpref{wxGridCellRenderer}{wxgridcellrenderer} is the abstract base
39class for rendereing contents in a cell. The following renderers are
40predefined:
41\helpref{wxGridCellStringRenderer}{wxgridcellstringrenderer},
42\helpref{wxGridCellBoolRenderer}{wxgridcellboolrenderer},
43\helpref{wxGridCellFloatRenderer}{wxgridcellfloatrenderer},
44\helpref{wxGridCellNumberRenderer}{wxgridcellnumberrenderer}. The
45look of a cell can be further defined using \helpref{wxGridCellAttr}{wxgridcellattr}.
46An object of this type may be returned by \helpref{wxGridTableBase::GetAttr}{wxgridtablebasegetattr}.
47
48\helpref{wxGridCellEditor}{wxgridcelleditor} is the abstract base
49class for editing the value of a cell. The following editors are
50predefined:
51\helpref{wxGridCellTextEditor}{wxgridcelltexteditor}
52\helpref{wxGridCellBoolEditor}{wxgridcellbooleditor}
53\helpref{wxGridCellChoiceEditor}{wxgridcellchoiceeditor}
54\helpref{wxGridCellNumberEditor}{wxgridcellnumbereditor}.
55
56
a660d684
KB
57\wxheading{Derived from}
58
78c49c58 59\helpref{wxScrolledWindow}{wxscrolledwindow}\\
7376079d 60\helpref{wxPanel}{wxpanel}\\
a660d684
KB
61\helpref{wxWindow}{wxwindow}\\
62\helpref{wxEvtHandler}{wxevthandler}\\
63\helpref{wxObject}{wxobject}
64
954b8ae6
JS
65\wxheading{Include files}
66
67<wx/grid.h>
68
a7af285d
VZ
69\wxheading{Library}
70
71\helpref{wxAdv}{librarieslist}
72
a660d684
KB
73\wxheading{Window styles}
74
78c49c58 75There are presently no specific window styles for wxGrid.
a660d684 76
78c49c58 77\wxheading{Event handling}
a660d684 78
cbc95b2c
MB
79\input gridevt.inc
80
4b39770c 81The event handler for the following functions takes a
cbc95b2c 82 \helpref{wxGridSizeEvent}{wxgridsizeevent} parameter.
24d70590 83The ...\_CMD\_... variants also take a window identifier.
cbc95b2c
MB
84
85\twocolwidtha{7cm}
86\begin{twocollist}\itemsep=0pt
87\twocolitem{{\bf EVT\_GRID\_COL\_SIZE(func)}}{The user resized a column by dragging it. Processes a wxEVT\_GRID\_COL\_SIZE.}
4d5a1b0a 88\twocolitem{{\bf EVT\_GRID\_COL\_MOVE(func)}}{The user moved a column by dragging it. Processes a wxEVT\_GRID\_COL\_MOVE.}
cbc95b2c 89\twocolitem{{\bf EVT\_GRID\_ROW\_SIZE(func)}}{The user resized a row by dragging it. Processes a wxEVT\_GRID\_ROW\_SIZE.}
24d70590 90\twocolitem{{\bf EVT\_GRID\_CMD\_COL\_SIZE(func)}}{The user resized a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_SIZE.}
4d5a1b0a 91\twocolitem{{\bf EVT\_GRID\_CMD\_COL\_MOVE(func)}}{The user moved a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_MOVE.}
24d70590 92\twocolitem{{\bf EVT\_GRID\_CMD\_ROW\_SIZE(func)}}{The user resized a row by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_ROW\_SIZE.}
cbc95b2c
MB
93\end{twocollist}%
94
4b39770c 95The event handler for the following functions takes a
cbc95b2c 96 \helpref{wxGridRangeSelectEvent}{wxgridrangeselectevent} parameter.
24d70590 97The ...\_CMD\_... variant also takes a window identifier.
cbc95b2c
MB
98
99\twocolwidtha{7cm}
100\begin{twocollist}\itemsep=0pt
101\twocolitem{{\bf EVT\_GRID\_RANGE\_SELECT(func)}}{The user selected a group of contiguous cells. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
24d70590 102\twocolitem{{\bf EVT\_GRID\_CMD\_RANGE\_SELECT(id, func)}}{The user selected a group of contiguous cells; variant taking a window identifier. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
cbc95b2c
MB
103\end{twocollist}%
104
4b39770c 105The event handler for the following functions takes a
cbc95b2c 106 \helpref{wxGridEditorCreatedEvent}{wxgrideditorcreatedevent} parameter.
24d70590 107The ...\_CMD\_... variant also takes a window identifier.
cbc95b2c
MB
108
109\twocolwidtha{7cm}
110\begin{twocollist}\itemsep=0pt
111\twocolitem{{\bf EVT\_GRID\_EDITOR\_CREATED(func)}}{The editor for a cell was created. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
24d70590 112\twocolitem{{\bf EVT\_GRID\_CMD\_EDITOR\_CREATED(id, func)}}{The editor for a cell was created; variant taking a window identifier. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
cbc95b2c
MB
113\end{twocollist}%
114
a660d684
KB
115\wxheading{See also}
116
78c49c58 117\helpref{wxGrid overview}{gridoverview}
a660d684 118
78c49c58
MB
119%%%%%%%%%%% FUNCTION GROUPS %%%%%%%%%%%%%
120\latexignore{\rtfignore{\wxheading{Function groups}}}
a660d684 121
4b39770c
WS
122
123
f0e8a2d0 124\membersection{Constructors and initialization}\label{wxgridconstructors}
a660d684 125
2eebb742
JS
126\helpref{wxGrid}{wxgridctor}\\
127\helpref{\destruct{wxGrid}}{wxgriddtor}\\
128\helpref{CreateGrid}{wxgridcreategrid}\\
78c49c58 129\helpref{SetTable}{wxgridsettable}
a660d684 130
4b39770c 131
57258eac
RR
132\membersection{Cursor movement}\label{wxgridcursormovement}
133
134\helpref{wxGrid::MoveCursorUp}{wxgridmovecursorup}\\
135\helpref{wxGrid::MoveCursorDown}{wxgridmovecursordown}\\
136\helpref{wxGrid::MoveCursorLeft}{wxgridmovecursorleft}\\
137\helpref{wxGrid::MoveCursorRight}{wxgridmovecursorright}\\
138\helpref{wxGrid::MoveCursorPageUp}{wxgridmovecursorup}\\
139\helpref{wxGrid::MoveCursorPageDown}{wxgridmovecursordown}\\
140\helpref{wxGrid::MoveCursorUpBlock}{wxgridmovecursorupblock}\\
141\helpref{wxGrid::MoveCursorDownBlock}{wxgridmovecursordownblock}\\
142\helpref{wxGrid::MoveCursorLeftBlock}{wxgridmovecursorleftblock}\\
143\helpref{wxGrid::MoveCursorRightBlock}{wxgridmovecursorrightblock}
144
145
146\membersection{Grid line formatting}\label{wxgridlineformatting}
147
148\helpref{wxGrid::EnableGridLines}{wxgridenablegridlines}\\
149\helpref{wxGrid::GridLinesEnabled}{wxgridgridlinesenabled}\\
150\helpref{wxGrid::SetGridLineColour}{wxgridsetgridlinecolour}\\
151\helpref{wxGrid::GetGridLineColour}{wxgridgetgridlinecolour}\\
152\helpref{wxGrid::GetDefaultGridLinePen}{wxgridgetdefaultgridlinepen}\\
153\helpref{wxGrid::GetRowGridLinePen}{wxgridgetrowgridlinepen}\\
154\helpref{wxGrid::GetColGridLinePen}{wxgridgetcolgridlinepen}
155
156\membersection{Row and column label value and format}\label{wxgridrowcoulmlabelformat}
157
158\helpref{wxGrid::SetRowLabelValue}{wxgridsetrowlabelvalue}\\
159\helpref{wxGrid::SetColLabelValue}{wxgridsetcollabelvalue}\\
160\helpref{wxGrid::GetRowLabelValue}{wxgridgetrowlabelvalue}\\
161\helpref{wxGrid::GetColLabelValue}{wxgridgetcollabelvalue}\\
162\helpref{wxGrid::SetUseNativeColLabels}{wxgridsetsenativecollabels}\\
163\helpref{wxGrid::HideColLabels}{wxgridhidecollabels}\\
164\helpref{wxGrid::HideRowLabels}{wxgridhiderowlabels}\\
165\helpref{wxGrid::SetRowLabelSize}{wxgridsetrowlabelsize}\\
166\helpref{wxGrid::SetColLabelSize}{wxgridsetcollabelsize}\\
167\helpref{wxGrid::GetRowLabelSize}{wxgridgetrowlabelsize}\\
168\helpref{wxGrid::GetColLabelSize}{wxgridgetcollabelsize}\\
169\helpref{wxGrid::AutoSizeRowLabelSize}{wxgridautosizerowlabelsize}\\
170\helpref{wxGrid::AutoSizeColLabelSize}{wxgridautosizecollabelsize}\\
171\helpref{wxGrid::GetDefaultRowLabelSize}{wxgridgetdefaultrowlabelsize}\\
172\helpref{wxGrid::GetDefaultColLabelSize}{wxgridgetdefaultcollabelsize}\\
173\helpref{wxGrid::SetRowLabelAlignment}{wxgridsetrowlabelalignment}\\
174\helpref{wxGrid::SetColLabelAlignment}{wxgridsetcollabelalignment}\\
175\helpref{wxGrid::GetRowLabelAlignment}{wxgridgetrowlabelalignment}\\
176\helpref{wxGrid::GetColLabelAlignment}{wxgridgetcollabelalignment}\\
177\helpref{wxGrid::SetLabelFont}{wxgridsetlabelfont}\\
178\helpref{wxGrid::SetLabelTextColour}{wxgridsetlabeltextcolour}\\
179\helpref{wxGrid::SetLabelBackgroundColour}{wxgridsetlabelbackgroundcolour}\\
180\helpref{wxGrid::GetLabelFont}{wxgridgetlabelfont}\\
181\helpref{wxGrid::GetLabelBackgroundColour}{wxgridgetlabelbackgroundcolour}\\
182\helpref{wxGrid::GetLabelTextColour}{wxgridgetlabeltextcolour}\\
183%\helpref{wxGrid::SetColLabelTextOrientation}{wxgridsetcollabeltextorientation}\\
184%\helpref{wxGrid::GetColLabelTextOrientation}{wxgridgetcollabeltextorientation}
185wxGrid::SetColLabelTextOrientation\\
186wxGrid::GetColLabelTextOrientation
187
188\membersection{Cell, row and column user-resizing and dragging}\label{wxgridcellrowcolresizing}
189
190\helpref{wxGrid::EnableDragRowSize}{wxgridenabledragrowsize}\\
191\helpref{wxGrid::EnableDragColSize}{wxgridenabledragcolsize}\\
192\helpref{wxGrid::CanDragRowSize}{wxgridcandragrowsize}\\
193\helpref{wxGrid::CanDragColSize}{wxgridcandragcolsize}\\
194\helpref{wxGrid::EnableDragColMove}{wxgridenabledragcolmove}\\
195\helpref{wxGrid::CanDragColMove}{wxgridcandragcolmove}\\
196\helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}\\
197\helpref{wxGrid::CanDragGridSize}{wxgridcandraggridsize}\\
198\helpref{wxGrid::GetColAt}{wxgridgetcolat}\\
199\helpref{wxGrid::SetColPos}{wxgridsetcolpos}\\
200\helpref{wxGrid::GetColPos}{wxgridgetcolpos}\\
201%\helpref{wxGrid::EnableDragCell}{wxgridenabledragcell}\\
202%\helpref{wxGrid::CanDragCell}{wxgridcandragcell}
203wxGrid::EnableDragCell\\
204wxGrid::CanDragCell
205
206\membersection{Autoresizing and cell size constraints}\label{wxgridautoresizingandcellconstriants}
207
208\helpref{wxGrid::AutoSizeColumn}{wxgridautosizecolumn}\\
209\helpref{wxGrid::AutoSizeRow}{wxgridautosizerow}\\
210\helpref{wxGrid::AutoSizeColumns}{wxgridautosizecolumns}\\
211\helpref{wxGrid::AutoSizeRows}{wxgridautosizerows}\\
212\helpref{wxGrid::AutoSize}{wxgridautosize}\\
213\helpref{wxGrid::SetColMinimalWidth}{wxgridsetcolminimalwidth}\\
214\helpref{wxGrid::SetRowMinimalHeight}{wxgridsetrowminimalheight}\\
215\helpref{wxGrid::SetColMinimalAcceptableWidth}{wxgridsetcolminimalacceptablewidth}\\
216\helpref{wxGrid::SetRowMinimalAcceptableHeight}{wxgridsetrowminimalacceptableheight}\\
217\helpref{wxGrid::GetColMinimalAcceptableWidth}{wxgridgetcolminimalacceptablewidth}\\
218\helpref{wxGrid::GetRowMinimalAcceptableHeight}{wxgridgetrowminimalacceptableheight}
4b39770c 219
f0e8a2d0 220\membersection{Selection functions}\label{wxgridselectionfunctions}
a660d684 221
2eebb742
JS
222\helpref{wxGrid::ClearSelection}{wxgridclearselection}\\
223\helpref{wxGrid::IsSelection}{wxgridisselection}\\
224\helpref{wxGrid::SelectAll}{wxgridselectall}\\
225\helpref{wxGrid::SelectBlock}{wxgridselectblock}\\
226\helpref{wxGrid::SelectCol}{wxgridselectcol}\\
5c69031c
MB
227\helpref{wxGrid::SelectRow}{wxgridselectrow}
228
78c49c58
MB
229%%%%%%%%% MEMBER FUNCTIONS %%%%%%%%%%
230\helponly{\insertatlevel{2}{
a660d684 231
78c49c58
MB
232\wxheading{Members}
233
234}}
235
4b39770c
WS
236
237
78c49c58
MB
238\membersection{wxGrid::wxGrid}\label{wxgridctor}
239
240\func{}{wxGrid}{\void}
241
242Default constructor
243
244\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}}
245
4b39770c 246Constructor to create a grid object. Call either \helpref{wxGrid::CreateGrid}{wxgridcreategrid} or
78c49c58 247\helpref{wxGrid::SetTable}{wxgridsettable} directly after this to initialize the grid before using
4b39770c
WS
248it.
249
250
78c49c58
MB
251
252\membersection{wxGrid::\destruct{wxGrid}}\label{wxgriddtor}
253
254\func{}{\destruct{wxGrid}}{\void}
255
256Destructor. This will also destroy the associated grid table unless you passed a table
257object to the grid and specified that the grid should not take ownership of the
4b39770c
WS
258table (see \helpref{wxGrid::SetTable}{wxgridsettable}).
259
260
a660d684
KB
261
262\membersection{wxGrid::AppendCols}\label{wxgridappendcols}
263
cc81d32f 264\func{bool}{AppendCols}{\param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
78c49c58 265
cc81d32f 266Appends one or more new columns to the right of the grid and returns true if
78c49c58 267successful. The updateLabels argument is not used at present.
a660d684 268
4b39770c
WS
269If you are using a derived grid table class you will need to override
270\helpref{wxGridTableBase::AppendCols}{wxgridtablebaseappendcols}. See
271\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
272
273
a660d684
KB
274
275\membersection{wxGrid::AppendRows}\label{wxgridappendrows}
276
cc81d32f 277\func{bool}{AppendRows}{\param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
78c49c58 278
cc81d32f 279Appends one or more new rows to the bottom of the grid and returns true if
78c49c58
MB
280successful. The updateLabels argument is not used at present.
281
4b39770c
WS
282If you are using a derived grid table class you will need to override
283\helpref{wxGridTableBase::AppendRows}{wxgridtablebaseappendrows}. See
284\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
285
286
78c49c58
MB
287
288\membersection{wxGrid::AutoSize}\label{wxgridautosize}
289
290\func{void}{AutoSize}{\void}
291
292Automatically sets the height and width of all rows and columns to fit their contents.
293
2eebb742 294\wxheading{Note}\\
78c49c58 295wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c
WS
296The memory requirements for this could become prohibitive if your grid is very large.
297
298
a660d684 299
733f486a 300\membersection{wxGrid::AutoSizeColLabelSize}\label{wxgridautosizecollabelsize}
608754c4 301
733f486a 302\func{void}{AutoSizeColLabelSize}{\param{int }{col}}
608754c4 303
733f486a 304Automatically adjusts width of the column to fit its label.
4b39770c
WS
305
306
608754c4 307
78c49c58
MB
308\membersection{wxGrid::AutoSizeColumn}\label{wxgridautosizecolumn}
309
cc81d32f 310\func{void}{AutoSizeColumn}{\param{int }{col}, \param{bool }{setAsMin = true}}
78c49c58 311
cc81d32f 312Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
78c49c58
MB
313also be set as the minimal width for the column.
314
2eebb742 315\wxheading{Note}\\
78c49c58 316wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c
WS
317The memory requirements for this could become prohibitive if your grid is very large.
318
319
78c49c58
MB
320
321\membersection{wxGrid::AutoSizeColumns}\label{wxgridautosizecolumns}
322
cc81d32f 323\func{void}{AutoSizeColumns}{\param{bool }{setAsMin = true}}
78c49c58 324
cc81d32f 325Automatically sizes all columns to fit their contents. If setAsMin is true the calculated widths will
78c49c58
MB
326also be set as the minimal widths for the columns.
327
2eebb742 328\wxheading{Note}\\
78c49c58 329wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c
WS
330The memory requirements for this could become prohibitive if your grid is very large.
331
332
78c49c58
MB
333
334\membersection{wxGrid::AutoSizeRow}\label{wxgridautosizerow}
335
cc81d32f 336\func{void}{AutoSizeRow}{\param{int }{row}, \param{bool }{setAsMin = true}}
78c49c58 337
cc81d32f 338Automatically sizes the row to fit its contents. If setAsMin is true the calculated height will
78c49c58
MB
339also be set as the minimal height for the row.
340
2eebb742 341\wxheading{Note}\\
78c49c58 342wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c
WS
343The memory requirements for this could become prohibitive if your grid is very large.
344
345
78c49c58 346
733f486a
VZ
347\membersection{wxGrid::AutoSizeRowLabelSize}\label{wxgridautosizerowlabelsize}
348
349\func{void}{AutoSizeRowLabelSize}{\param{int }{col}}
350
351Automatically adjusts height of the row to fit its label.
352
353
354
78c49c58
MB
355\membersection{wxGrid::AutoSizeRows}\label{wxgridautosizerows}
356
cc81d32f 357\func{void}{AutoSizeRows}{\param{bool }{setAsMin = true}}
78c49c58 358
cc81d32f 359Automatically sizes all rows to fit their contents. If setAsMin is true the calculated heights will
78c49c58
MB
360also be set as the minimal heights for the rows.
361
2eebb742 362\wxheading{Note}\\
78c49c58 363wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c
WS
364The memory requirements for this could become prohibitive if your grid is very large.
365
366
a660d684
KB
367
368\membersection{wxGrid::BeginBatch}\label{wxgridbeginbatch}
369
370\func{void}{BeginBatch}{\void}
371
78c49c58 372Increments the grid's batch count. When the count is greater than zero repainting of
4b39770c 373the grid is suppressed. Each call to BeginBatch must be matched by a later call to
78c49c58
MB
374\helpref{wxGrid::EndBatch}{wxgridendbatch}. Code that does a lot of grid
375modification can be enclosed between BeginBatch and EndBatch calls to avoid
376screen flicker. The final EndBatch will cause the grid to be repainted.
a660d684 377
b62f94ff
VZ
378\wxheading{See also}
379
380\helpref{wxGridUpdateLocker}{wxgridupdatelocker}
381
4b39770c
WS
382
383
608754c4
JS
384\membersection{wxGrid::BlockToDeviceRect}\label{wxgridblocktodevicerect}
385
ef316e23 386\constfunc{wxRect}{BlockToDeviceRect}{\param{const wxGridCellCoords \& }{topLeft}, \param{const wxGridCellCoords \& }{bottomRight}}
608754c4
JS
387
388This function returns the rectangle that encloses the block of cells
389limited by TopLeft and BottomRight cell in device coords and clipped
390to the client size of the grid window.
391
392
4b39770c 393
d4175745
VZ
394\membersection{wxGrid::CanDragColMove}\label{wxgridcandragcolmove}
395
ef316e23 396\constfunc{bool}{CanDragColMove}{\void}
d4175745
VZ
397
398Returns true if columns can be moved by dragging with the mouse. Columns can be moved
399by dragging on their labels.
400
401
402
78c49c58 403\membersection{wxGrid::CanDragColSize}\label{wxgridcandragcolsize}
a660d684 404
ef316e23 405\constfunc{bool}{CanDragColSize}{\void}
a660d684 406
cc81d32f 407Returns true if columns can be resized by dragging with the mouse. Columns can be resized
78c49c58 408by dragging the edges of their labels. If grid line dragging is enabled they can also be
4b39770c 409resized by dragging the right edge of the column in the grid cell area
78c49c58 410(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
a660d684 411
4b39770c
WS
412
413
78c49c58 414\membersection{wxGrid::CanDragRowSize}\label{wxgridcandragrowsize}
a660d684 415
ef316e23 416\constfunc{bool}{CanDragRowSize}{\void}
a660d684 417
cc81d32f 418Returns true if rows can be resized by dragging with the mouse. Rows can be resized
78c49c58 419by dragging the edges of their labels. If grid line dragging is enabled they can also be
4b39770c 420resized by dragging the lower edge of the row in the grid cell area
78c49c58 421(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
a660d684 422
4b39770c
WS
423
424
78c49c58 425\membersection{wxGrid::CanDragGridSize}\label{wxgridcandraggridsize}
a660d684 426
ef316e23 427\constfunc{bool}{CanDragGridSize}{\void}
a660d684 428
cc81d32f 429Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise.
21f280f4 430
4b39770c
WS
431
432
78c49c58 433\membersection{wxGrid::CanEnableCellControl}\label{wxgridcanenablecellcontrol}
a660d684 434
78c49c58 435\constfunc{bool}{CanEnableCellControl}{\void}
a660d684 436
cc81d32f
VS
437Returns true if the in-place edit control for the current grid cell can be used and
438false otherwise (e.g. if the current cell is read-only).
78c49c58 439
4b39770c
WS
440
441
608754c4
JS
442\membersection{wxGrid::CanHaveAttributes}\label{wxgridcanhaveattributes}
443
ef316e23 444\constfunc{bool}{CanHaveAttributes}{\void}
608754c4
JS
445
446Do we have some place to store attributes in?
447
4b39770c
WS
448
449
78c49c58
MB
450\membersection{wxGrid::CellToRect}\label{wxgridcelltorect}
451
ef316e23 452\constfunc{wxRect}{CellToRect}{\param{int }{row}, \param{int }{col}}
78c49c58 453
ef316e23 454\constfunc{wxRect}{CellToRect}{\param{const wxGridCellCoords\& }{coords}}
78c49c58
MB
455
456Return the rectangle corresponding to the grid cell's size and position in logical
457coordinates.
458
4b39770c
WS
459
460
78c49c58
MB
461\membersection{wxGrid::ClearGrid}\label{wxgridcleargrid}
462
463\func{void}{ClearGrid}{\void}
464
465Clears all data in the underlying grid table and repaints the grid. The table is not deleted by
4b39770c 466this function. If you are using a derived table class then you need to override
78c49c58
MB
467\helpref{wxGridTableBase::Clear}{wxgridtablebaseclear} for this function to have any effect.
468
4b39770c
WS
469
470
5c69031c
MB
471\membersection{wxGrid::ClearSelection}\label{wxgridclearselection}
472
473\func{void}{ClearSelection}{\void}
474
475Deselects all cells that are currently selected.
476
4b39770c
WS
477
478
78c49c58
MB
479\membersection{wxGrid::CreateGrid}\label{wxgridcreategrid}
480
481\func{bool}{CreateGrid}{\param{int }{numRows}, \param{int }{numCols}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
482
483Creates a grid with the specified initial number of rows and columns.
484Call this directly after the grid constructor. When you use this
485function wxGrid will create and manage a simple table of string values
486for you. All of the grid data will be stored in memory.
487
488For applications with more complex data types or relationships, or for
489dealing with very large datasets, you should derive your own grid table
4b39770c
WS
490class and pass a table object to the grid with \helpref{wxGrid::SetTable}{wxgridsettable}.
491
492
a660d684
KB
493
494\membersection{wxGrid::DeleteCols}\label{wxgriddeletecols}
495
cc81d32f 496\func{bool}{DeleteCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
a660d684 497
78c49c58 498Deletes one or more columns from a grid starting at the specified position and returns
cc81d32f 499true if successful. The updateLabels argument is not used at present.
78c49c58 500
4b39770c
WS
501If you are using a derived grid table class you will need to override
502\helpref{wxGridTableBase::DeleteCols}{wxgridtablebasedeletecols}. See
78c49c58 503\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
a660d684 504
4b39770c
WS
505
506
a660d684
KB
507\membersection{wxGrid::DeleteRows}\label{wxgriddeleterows}
508
cc81d32f 509\func{bool}{DeleteRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
78c49c58
MB
510
511Deletes one or more rows from a grid starting at the specified position and returns
cc81d32f 512true if successful. The updateLabels argument is not used at present.
78c49c58 513
4b39770c
WS
514If you are using a derived grid table class you will need to override
515\helpref{wxGridTableBase::DeleteRows}{wxgridtablebasedeleterows}. See
78c49c58
MB
516\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
517
4b39770c
WS
518
519
78c49c58
MB
520\membersection{wxGrid::DisableCellEditControl}\label{wxgriddisablecelleditcontrol}
521
522\func{void}{DisableCellEditControl}{\void}
523
4b39770c 524Disables in-place editing of grid cells.
cc81d32f 525Equivalent to calling EnableCellEditControl(false).
78c49c58 526
4b39770c
WS
527
528
d4175745
VZ
529\membersection{wxGrid::DisableDragColMove}\label{wxgriddisabledragcolmove}
530
531\func{void}{DisableDragColMove}{\void}
532
533Disables column moving by dragging with the mouse. Equivalent to passing false to
534\helpref{wxGrid::EnableDragColMove}{wxgridenabledragcolmove}.
535
536
537
78c49c58
MB
538\membersection{wxGrid::DisableDragColSize}\label{wxgriddisabledragcolsize}
539
540\func{void}{DisableDragColSize}{\void}
541
4b39770c
WS
542Disables column sizing by dragging with the mouse. Equivalent to passing false to
543\helpref{wxGrid::EnableDragColSize}{wxgridenabledragcolsize}.
544
545
78c49c58
MB
546
547\membersection{wxGrid::DisableDragGridSize}\label{wxgriddisabledraggridsize}
548
549\func{void}{DisableDragGridSize}{\void}
550
551Disable mouse dragging of grid lines to resize rows and columns. Equivalent to passing
cc81d32f 552false to \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}
78c49c58 553
4b39770c
WS
554
555
78c49c58
MB
556\membersection{wxGrid::DisableDragRowSize}\label{wxgriddisabledragrowsize}
557
558\func{void}{DisableDragRowSize}{\void}
559
4b39770c
WS
560Disables row sizing by dragging with the mouse. Equivalent to passing false to
561\helpref{wxGrid::EnableDragRowSize}{wxgridenabledragrowsize}.
562
563
78c49c58
MB
564
565\membersection{wxGrid::EnableCellEditControl}\label{wxgridenablecelleditcontrol}
566
cc81d32f 567\func{void}{EnableCellEditControl}{\param{bool }{enable = true}}
78c49c58
MB
568
569Enables or disables in-place editing of grid cell data. The grid will issue either a
e7240349 570wxEVT\_GRID\_EDITOR\_SHOWN or wxEVT\_GRID\_EDITOR\_HIDDEN event.
78c49c58 571
4b39770c
WS
572
573
78c49c58
MB
574\membersection{wxGrid::EnableDragColSize}\label{wxgridenabledragcolsize}
575
cc81d32f 576\func{void}{EnableDragColSize}{\param{bool }{enable = true}}
a660d684 577
78c49c58
MB
578Enables or disables column sizing by dragging with the mouse.
579
4b39770c
WS
580
581
d4175745
VZ
582\membersection{wxGrid::EnableDragColMove}\label{wxgridenabledragcolmove}
583
584\func{void}{EnableDragColMove}{\param{bool }{enable = true}}
585
586Enables or disables column moving by dragging with the mouse.
587
588
589
78c49c58
MB
590\membersection{wxGrid::EnableDragGridSize}\label{wxgridenabledraggridsize}
591
cc81d32f 592\func{void}{EnableDragGridSize}{\param{bool }{enable = true}}
78c49c58
MB
593
594Enables or disables row and column resizing by dragging gridlines with the mouse.
595
4b39770c
WS
596
597
78c49c58
MB
598\membersection{wxGrid::EnableDragRowSize}\label{wxgridenabledragrowsize}
599
cc81d32f 600\func{void}{EnableDragRowSize}{\param{bool }{enable = true}}
78c49c58
MB
601
602Enables or disables row sizing by dragging with the mouse.
603
4b39770c
WS
604
605
78c49c58
MB
606\membersection{wxGrid::EnableEditing}\label{wxgridenableediting}
607
608\func{void}{EnableEditing}{\param{bool }{edit}}
609
cc81d32f
VS
610If the edit argument is false this function sets the whole grid as read-only. If the
611argument is true the grid is set to the default state where cells may be editable. In the
78c49c58 612default state you can set single grid cells and whole rows and columns to be editable or
4b39770c 613read-only via
78c49c58 614\helpref{wxGridCellAttribute::SetReadOnly}{wxgridcellattrsetreadonly}. For single
4b39770c
WS
615cells you can also use the shortcut function
616\helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}.
78c49c58 617
4b39770c
WS
618For more information about controlling grid cell attributes see the
619\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
78c49c58
MB
620\helpref{wxGrid classes overview}{gridoverview}.
621
4b39770c
WS
622
623
78c49c58
MB
624\membersection{wxGrid::EnableGridLines}\label{wxgridenablegridlines}
625
cc81d32f 626\func{void}{EnableGridLines}{\param{bool }{enable = true}}
78c49c58
MB
627
628Turns the drawing of grid lines on or off.
a660d684 629
4b39770c
WS
630
631
a660d684
KB
632\membersection{wxGrid::EndBatch}\label{wxgridendbatch}
633
634\func{void}{EndBatch}{\void}
635
78c49c58 636Decrements the grid's batch count. When the count is greater than zero repainting of
4b39770c 637the grid is suppressed. Each previous call to
78c49c58
MB
638\helpref{wxGrid::BeginBatch}{wxgridbeginbatch} must be matched by a later call to
639EndBatch. Code that does a lot of grid modification can be enclosed between
640BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will
641cause the grid to be repainted.
642
b62f94ff
VZ
643\wxheading{See also}
644
645\helpref{wxGridUpdateLocker}{wxgridupdatelocker}
646
4b39770c
WS
647
648
608754c4
JS
649\membersection{wxGrid::Fit}\label{wxgridfit}
650
651\func{void}{Fit}{\void}
652
653Overridden wxWindow method.
654
4b39770c
WS
655
656
78c49c58 657\membersection{wxGrid::ForceRefresh}\label{wxgridforcerefresh}
a660d684 658
78c49c58
MB
659\func{void}{ForceRefresh}{\void}
660
661Causes immediate repainting of the grid. Use this instead of the usual wxWindow::Refresh.
a660d684 662
4b39770c
WS
663
664
a660d684
KB
665\membersection{wxGrid::GetBatchCount}\label{wxgridgetbatchcount}
666
ef316e23 667\constfunc{int}{GetBatchCount}{\void}
a660d684 668
78c49c58
MB
669Returns the number of times that \helpref{wxGrid::BeginBatch}{wxgridbeginbatch} has been called
670without (yet) matching calls to \helpref{wxGrid::EndBatch}{wxgridendbatch}. While
671the grid's batch count is greater than zero the display will not be updated.
a660d684 672
4b39770c
WS
673
674
78c49c58 675\membersection{wxGrid::GetCellAlignment}\label{wxgridgetcellalignment}
a660d684 676
ef316e23 677\constfunc{void}{GetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int* }{horiz}, \param{int* }{vert}}
a660d684 678
78c49c58
MB
679Sets the arguments to the horizontal and vertical text alignment values for the
680grid cell at the specified location.
a660d684 681
e7240349
GT
682Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
683Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 684
9722642d
MB
685\perlnote{This method only takes the parameters {\tt row} and {\tt col} and
686returns a 2-element list {\tt ( horiz, vert )}.}
687
4b39770c
WS
688
689
78c49c58 690\membersection{wxGrid::GetCellBackgroundColour}\label{wxgridgetcellbackgroundcolour}
a660d684 691
ef316e23 692\constfunc{wxColour}{GetCellBackgroundColour}{\param{int }{row}, \param{int }{col}}
a660d684 693
78c49c58 694Returns the background colour of the cell at the specified location.
a660d684 695
4b39770c
WS
696
697
78c49c58 698\membersection{wxGrid::GetCellEditor}\label{wxgridgetcelleditor}
a660d684 699
ef316e23 700\constfunc{wxGridCellEditor*}{GetCellEditor}{\param{int }{row}, \param{int }{col}}
a660d684 701
78c49c58 702Returns a pointer to the editor for the cell at the specified location.
21f280f4 703
78c49c58
MB
704See \helpref{wxGridCellEditor}{wxgridcelleditor} and
705the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
a660d684 706
4b39770c
WS
707
708
78c49c58 709\membersection{wxGrid::GetCellFont}\label{wxgridgetcellfont}
a660d684 710
ef316e23 711\constfunc{wxFont}{GetCellFont}{\param{int }{row}, \param{int }{col}}
a660d684 712
78c49c58 713Returns the font for text in the grid cell at the specified location.
a660d684 714
4b39770c
WS
715
716
78c49c58 717\membersection{wxGrid::GetCellRenderer}\label{wxgridgetcellrenderer}
21f280f4 718
ef316e23 719\constfunc{wxGridCellRenderer*}{GetCellRenderer}{\param{int }{row}, \param{int }{col}}
a660d684 720
78c49c58 721Returns a pointer to the renderer for the grid cell at the specified location.
a660d684 722
78c49c58
MB
723See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
724the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
a660d684 725
4b39770c
WS
726
727
a660d684
KB
728\membersection{wxGrid::GetCellTextColour}\label{wxgridgetcelltextcolour}
729
ef316e23 730\constfunc{wxColour}{GetCellTextColour}{\param{int }{row}, \param{int }{col}}
a660d684 731
78c49c58 732Returns the text colour for the grid cell at the specified location.
a660d684 733
4b39770c
WS
734
735
5c69031c
MB
736\membersection{wxGrid::GetCellValue}\label{wxgridgetcellvalue}
737
ef316e23 738\constfunc{wxString}{GetCellValue}{\param{int }{row}, \param{int }{col}}
5c69031c 739
ef316e23 740\constfunc{wxString}{GetCellValue}{\param{const wxGridCellCoords\&}{coords}}
5c69031c
MB
741
742Returns the string contained in the cell at the specified location. For simple applications where a
743grid object automatically uses a default grid table of string values you use this function together
4b39770c 744with \helpref{wxGrid::SetCellValue}{wxgridsetcellvalue} to access cell values.
5c69031c
MB
745
746For more complex applications where you have derived your own grid table class that contains
747various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
4b39770c 748function for those cells that contain string values.
5c69031c
MB
749
750See \helpref{wxGridTableBase::CanGetValueAs}{wxgridtablebasecangetvalueas}
751and the \helpref{wxGrid overview}{gridoverview} for more information.
752
608754c4 753
4b39770c 754
d4175745
VZ
755\membersection{wxGrid::GetColAt}\label{wxgridgetcolat}
756
757\constfunc{int}{GetColAt}{\param{int }{colPos}}
758
759Returns the column ID of the specified column position.
760
761
608754c4
JS
762\membersection{wxGrid::GetColLeft}\label{wxgridgetcolleft}
763
764\constfunc{int}{GetColLeft}{\param{int }{col}}
765
4b39770c
WS
766
767
78c49c58 768\membersection{wxGrid::GetColLabelAlignment}\label{wxgridgetcollabelalignment}
a660d684 769
ef316e23 770\constfunc{void}{GetColLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
21f280f4 771
78c49c58 772Sets the arguments to the current column label alignment values.
a660d684 773
ce994095
JS
774Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.\\
775Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 776
9722642d
MB
777\perlnote{This method takes no parameters and
778returns a 2-element list {\tt ( horiz, vert )}.}
779
4b39770c
WS
780
781
78c49c58 782\membersection{wxGrid::GetColLabelSize}\label{wxgridgetcollabelsize}
a660d684 783
ef316e23 784\constfunc{int}{GetColLabelSize}{\void}
a660d684 785
78c49c58 786Returns the current height of the column labels.
21f280f4 787
4b39770c
WS
788
789
78c49c58 790\membersection{wxGrid::GetColLabelValue}\label{wxgridgetcollabelvalue}
a660d684 791
ef316e23 792\constfunc{wxString}{GetColLabelValue}{\param{int }{col}}
a660d684 793
2edb0bde 794Returns the specified column label. The default grid table class provides column labels of
4b39770c 795the form A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can override
78c49c58 796\helpref{wxGridTableBase::GetColLabelValue}{wxgridtablebasegetcollabelvalue} to provide
4b39770c
WS
797your own labels.
798
799
a660d684 800
608754c4
JS
801\membersection{wxGrid::GetColMinimalAcceptableWidth}\label{wxgridgetcolminimalacceptablewidth}
802
ef316e23 803\constfunc{int}{GetColMinimalAcceptableWidth}{}
608754c4
JS
804
805This returns the value of the lowest column width that can be handled correctly. See
806member \helpref{SetColMinimalAcceptableWidth}{wxgridsetcolminimalacceptablewidth} for details.
807
4b39770c
WS
808
809
608754c4
JS
810\membersection{wxGrid::GetColMinimalWidth}\label{wxgridgetcolminimalwidth}
811
812\constfunc{int}{GetColMinimalWidth}{\param{int }{col}}
813
814Get the minimal width of the given column/row.
815
816
4b39770c 817
d4175745
VZ
818\membersection{wxGrid::GetColPos}\label{wxgridgetcolpos}
819
820\constfunc{int}{GetColPos}{\param{int }{colID}}
821
822Returns the position of the specified column.
823
824
825
608754c4
JS
826\membersection{wxGrid::GetColRight}\label{wxgridgetcolright}
827
828\constfunc{int}{GetColRight}{\param{int }{col}}
829
4b39770c
WS
830
831
78c49c58 832\membersection{wxGrid::GetColSize}\label{wxgridgetcolsize}
a660d684 833
ef316e23 834\constfunc{int}{GetColSize}{\param{int }{col}}
a660d684 835
78c49c58 836Returns the width of the specified column.
a660d684 837
4b39770c
WS
838
839
78c49c58 840\membersection{wxGrid::GetDefaultCellAlignment}\label{wxgridgetdefaultcellalignment}
a660d684 841
ef316e23 842\constfunc{void}{GetDefaultCellAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
a660d684 843
78c49c58
MB
844Sets the arguments to the current default horizontal and vertical text alignment
845values.
a660d684 846
2eebb742
JS
847Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
848Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 849
4b39770c
WS
850
851
78c49c58 852\membersection{wxGrid::GetDefaultCellBackgroundColour}\label{wxgridgetdefaultcellbackgroundcolour}
a660d684 853
ef316e23 854\constfunc{wxColour}{GetDefaultCellBackgroundColour}{\void}
a660d684 855
78c49c58 856Returns the current default background colour for grid cells.
a660d684 857
4b39770c
WS
858
859
78c49c58 860\membersection{wxGrid::GetDefaultCellFont}\label{wxgridgetdefaultcellfont}
a660d684 861
ef316e23 862\constfunc{wxFont}{GetDefaultCellFont}{\void}
a660d684 863
78c49c58 864Returns the current default font for grid cell text.
a660d684 865
4b39770c
WS
866
867
78c49c58 868\membersection{wxGrid::GetDefaultCellTextColour}\label{wxgridgetdefaultcelltextcolour}
a660d684 869
ef316e23 870\constfunc{wxColour}{GetDefaultCellTextColour}{\void}
a660d684 871
78c49c58 872Returns the current default colour for grid cell text.
a660d684 873
4b39770c
WS
874
875
78c49c58 876\membersection{wxGrid::GetDefaultColLabelSize}\label{wxgridgetdefaultcollabelsize}
a660d684 877
ef316e23 878\constfunc{int}{GetDefaultColLabelSize}{\void}
a660d684 879
78c49c58 880Returns the default height for column labels.
c0b042fc 881
4b39770c
WS
882
883
78c49c58 884\membersection{wxGrid::GetDefaultColSize}\label{wxgridgetdefaultcolsize}
c0b042fc 885
ef316e23 886\constfunc{int}{GetDefaultColSize}{\void}
c0b042fc 887
78c49c58 888Returns the current default width for grid columns.
a660d684 889
4b39770c
WS
890
891
78c49c58 892\membersection{wxGrid::GetDefaultEditor}\label{wxgridgetdefaulteditor}
a660d684 893
78c49c58 894\constfunc{wxGridCellEditor*}{GetDefaultEditor}{\void}
a660d684 895
78c49c58
MB
896Returns a pointer to the current default grid cell editor.
897
898See \helpref{wxGridCellEditor}{wxgridcelleditor} and
899the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
900
4b39770c
WS
901
902
608754c4
JS
903\membersection{wxGrid::GetDefaultEditorForCell}\label{wxgridgetdefaulteditorforcell}
904
905\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{int }{row}, \param{int }{col}}
906
907\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{const wxGridCellCoords\& }{c}}
908
909
4b39770c 910
608754c4
JS
911\membersection{wxGrid::GetDefaultEditorForType}\label{wxgridgetdefaulteditorfortype}
912
913\constfunc{wxGridCellEditor*}{GetDefaultEditorForType}{\param{const wxString\& }{typeName}}
914
915
4b39770c 916
78c49c58
MB
917\membersection{wxGrid::GetDefaultRenderer}\label{wxgridgetdefaultrenderer}
918
919\constfunc{wxGridCellRenderer*}{GetDefaultRenderer}{\void}
920
921Returns a pointer to the current default grid cell renderer.
922
923See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
924the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
a660d684 925
4b39770c
WS
926
927
608754c4
JS
928\membersection{wxGrid::GetDefaultRendererForCell}\label{wxgridgetdefaultrendererforcell}
929
930\constfunc{wxGridCellRenderer*}{GetDefaultRendererForCell}{\param{int }{row}, \param{int }{col}}
931
4b39770c
WS
932
933
608754c4
JS
934\membersection{wxGrid::GetDefaultRendererForType}\label{wxgridgetdefaultrendererfortype}
935
936\constfunc{wxGridCellRenderer*}{GetDefaultRendererForType}{\param{const wxString\& }{typeName}}
937
938
939
78c49c58 940\membersection{wxGrid::GetDefaultRowLabelSize}\label{wxgridgetdefaultrowlabelsize}
a660d684 941
ef316e23 942\constfunc{int}{GetDefaultRowLabelSize}{\void}
78c49c58
MB
943
944Returns the default width for the row labels.
945
4b39770c
WS
946
947
78c49c58
MB
948\membersection{wxGrid::GetDefaultRowSize}\label{wxgridgetdefaultrowsize}
949
ef316e23 950\constfunc{int}{GetDefaultRowSize}{\void}
78c49c58
MB
951
952Returns the current default height for grid rows.
953
4b39770c
WS
954
955
78c49c58
MB
956\membersection{wxGrid::GetGridCursorCol}\label{wxgridgetgridcursorcol}
957
ef316e23 958\constfunc{int}{GetGridCursorCol}{\void}
78c49c58
MB
959
960Returns the current grid cell column position.
961
4b39770c
WS
962
963
78c49c58
MB
964\membersection{wxGrid::GetGridCursorRow}\label{wxgridgetgridcursorrow}
965
ef316e23 966\constfunc{int}{GetGridCursorRow}{\void}
78c49c58
MB
967
968Returns the current grid cell row position.
969
4b39770c
WS
970
971
78c49c58
MB
972\membersection{wxGrid::GetGridLineColour}\label{wxgridgetgridlinecolour}
973
ef316e23 974\constfunc{wxColour}{GetGridLineColour}{\void}
78c49c58
MB
975
976Returns the colour used for grid lines.
977
3d3f3e37
VZ
978\wxheading{See also}
979
980\helpref{GetDefaultGridLinePen()}{wxgridgetdefaultgridlinepen}
981
982
983\membersection{wxGrid::GetDefaultGridLinePen}\label{wxgridgetdefaultgridlinepen}
984
985\func{wxPen}{GetDefaultGridLinePen}{\void}
986
987Returns the pen used for grid lines. This virtual function may be overridden in
988derived classes in order to change the appearance of grid lines. Note that
989currently the pen width must be $1$.
990
991\wxheading{See also}
992
993\helpref{GetColGridLinePen()}{wxgridgetcolgridlinepen},\\
994\helpref{GetRowGridLinePen()}{wxgridgetrowgridlinepen}
995
996
997
998
999\membersection{wxGrid::GetRowGridLinePen}\label{wxgridgetrowgridlinepen}
1000
1001\func{wxPen}{GetRowGridLinePen}{\param{int }{row}}
1002
1003Returns the pen used for horizontal grid lines. This virtual function may be
1004overridden in derived classes in order to change the appearance of individual
1005grid line for the given row \arg{row}.
1006
1007Example: \\
1008\\
1009\begin{verbatim}
1010 // in a grid displaying music notation, use a solid black pen between
1011 // octaves (C0=row 127, C1=row 115 etc.)
1012 wxPen MidiGrid::GetRowGridLinePen(int row)
1013 {
1014 if ( row%12 == 7 )
1015 return wxPen(*wxBLACK, 1, wxSOLID);
1016 else
1017 return GetDefaultGridLinePen();
1018 }
1019\end{verbatim}
1020
1021
1022
1023\membersection{wxGrid::GetColGridLinePen}\label{wxgridgetcolgridlinepen}
1024
1025\func{wxPen}{GetColGridLinePen}{\param{int }{col}}
1026
1027Returns the pen used for vertical grid lines. This virtual function may be
1028overridden in derived classes in order to change the appearance of individual
1029grid lines for the given column \arg{col}.
1030
1031See \helpref{GetRowGridLinePen()}{wxgridgetrowgridlinepen} for an example.
1032
1033
4b39770c
WS
1034
1035
78c49c58
MB
1036\membersection{wxGrid::GridLinesEnabled}\label{wxgridgridlinesenabled}
1037
ef316e23 1038\constfunc{bool}{GridLinesEnabled}{\void}
78c49c58 1039
cc81d32f 1040Returns true if drawing of grid lines is turned on, false otherwise.
a660d684 1041
4b39770c
WS
1042
1043
a660d684
KB
1044\membersection{wxGrid::GetLabelBackgroundColour}\label{wxgridgetlabelbackgroundcolour}
1045
ef316e23 1046\constfunc{wxColour}{GetLabelBackgroundColour}{\void}
a660d684 1047
78c49c58 1048Returns the colour used for the background of row and column labels.
a660d684 1049
4b39770c
WS
1050
1051
78c49c58 1052\membersection{wxGrid::GetLabelFont}\label{wxgridgetlabelfont}
a660d684 1053
ef316e23 1054\constfunc{wxFont}{GetLabelFont}{\void}
a660d684 1055
78c49c58 1056Returns the font used for row and column labels.
a660d684 1057
4b39770c
WS
1058
1059
a660d684
KB
1060\membersection{wxGrid::GetLabelTextColour}\label{wxgridgetlabeltextcolour}
1061
ef316e23 1062\constfunc{wxColour}{GetLabelTextColour}{\void}
a660d684 1063
78c49c58 1064Returns the colour used for row and column label text.
a660d684 1065
4b39770c
WS
1066
1067
78c49c58 1068\membersection{wxGrid::GetNumberCols}\label{wxgridgetnumbercols}
a660d684 1069
ef316e23 1070\constfunc{int}{GetNumberCols}{\void}
a660d684 1071
78c49c58
MB
1072Returns the total number of grid columns (actually the number of columns in the underlying grid
1073table).
a660d684 1074
4b39770c
WS
1075
1076
78c49c58 1077\membersection{wxGrid::GetNumberRows}\label{wxgridgetnumberrows}
a660d684 1078
ef316e23 1079\constfunc{int}{GetNumberRows}{\void}
a660d684 1080
78c49c58 1081Returns the total number of grid rows (actually the number of rows in the underlying grid table).
a660d684 1082
4b39770c
WS
1083
1084
608754c4
JS
1085\membersection{wxGrid::GetOrCreateCellAttr}\label{wxgridgetorcreatecellattr}
1086
1087\constfunc{wxGridCellAttr*}{GetOrCreateCellAttr}{\param{int }{row}, \param{int }{col}}
1088
4b39770c
WS
1089
1090
608754c4
JS
1091\membersection{wxGrid::GetRowMinimalAcceptableHeight}\label{wxgridgetrowminimalacceptableheight}
1092
ef316e23 1093\constfunc{int}{GetRowMinimalAcceptableHeight}{}
608754c4
JS
1094
1095This returns the value of the lowest row width that can be handled correctly. See
1096member \helpref{SetRowMinimalAcceptableHeight}{wxgridsetrowminimalacceptableheight} for details.
1097
1098
4b39770c 1099
608754c4
JS
1100\membersection{wxGrid::GetRowMinimalHeight}\label{wxgridgetrowminimalheight}
1101
1102\constfunc{int}{GetRowMinimalHeight}{\param{int }{col}}
1103
4b39770c
WS
1104
1105
78c49c58 1106\membersection{wxGrid::GetRowLabelAlignment}\label{wxgridgetrowlabelalignment}
a660d684 1107
ef316e23 1108\constfunc{void}{GetRowLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
a660d684 1109
78c49c58 1110Sets the arguments to the current row label alignment values.
a660d684 1111
78c49c58
MB
1112Horizontal alignment will be one of wxLEFT, wxCENTRE or wxRIGHT. \\
1113Vertical alignment will be one of wxTOP, wxCENTRE or wxBOTTOM.
a660d684 1114
9722642d
MB
1115\perlnote{This method takes no parameters and
1116returns a 2-element list {\tt ( horiz, vert )}.}
1117
4b39770c
WS
1118
1119
78c49c58 1120\membersection{wxGrid::GetRowLabelSize}\label{wxgridgetrowlabelsize}
a660d684 1121
ef316e23 1122\constfunc{int}{GetRowLabelSize}{\void}
a660d684 1123
78c49c58 1124Returns the current width of the row labels.
a660d684 1125
4b39770c
WS
1126
1127
78c49c58 1128\membersection{wxGrid::GetRowLabelValue}\label{wxgridgetrowlabelvalue}
a660d684 1129
ef316e23 1130\constfunc{wxString}{GetRowLabelValue}{\param{int }{row}}
a660d684 1131
2edb0bde 1132Returns the specified row label. The default grid table class provides numeric row labels.
4b39770c 1133If you are using a custom grid table you can override
78c49c58 1134\helpref{wxGridTableBase::GetRowLabelValue}{wxgridtablebasegetcollabelvalue} to provide
4b39770c
WS
1135your own labels.
1136
1137
a660d684 1138
78c49c58 1139\membersection{wxGrid::GetRowSize}\label{wxgridgetrowsize}
a660d684 1140
ef316e23 1141\constfunc{int}{GetRowSize}{\param{int }{row}}
a660d684 1142
78c49c58 1143Returns the height of the specified row.
a660d684 1144
608754c4 1145
4b39770c
WS
1146
1147\membersection{wxGrid::GetScrollLineX}\label{wxgridgetscrolllinex}
1148
1149\constfunc{int}{GetScrollLineX}{\void}
608754c4
JS
1150
1151Returns the number of pixels per horizontal scroll increment. The default is 15.
1152
4b39770c
WS
1153\wxheading{See also}
1154
1155\helpref{wxGrid::GetScrollLineY}{wxgridgetscrollliney},\rtfsp
1156\helpref{wxGrid::SetScrollLineX}{wxgridsetscrolllinex},\rtfsp
1157\helpref{wxGrid::SetScrollLineY}{wxgridsetscrollliney}
1158
608754c4 1159
4b39770c
WS
1160
1161\membersection{wxGrid::GetScrollLineY}\label{wxgridgetscrollliney}
1162
1163\constfunc{int}{GetScrollLineY}{\void}
608754c4
JS
1164
1165Returns the number of pixels per vertical scroll increment. The default is 15.
1166
4b39770c
WS
1167\wxheading{See also}
1168
1169\helpref{wxGrid::GetScrollLineX}{wxgridgetscrolllinex},\rtfsp
1170\helpref{wxGrid::SetScrollLineX}{wxgridsetscrolllinex},\rtfsp
1171\helpref{wxGrid::SetScrollLineY}{wxgridsetscrollliney}
1172
1173
1174
aa5b8857
SN
1175\membersection{wxGrid::GetSelectionMode}\label{wxgridgetselectionmode}
1176
1177\constfunc{wxGrid::wxGridSelectionModes}{GetSelectionMode}{\void}
1178
1179Returns the current selection mode, see \helpref{wxGrid::SetSelectionMode}{wxgridsetselectionmode}.
1180
4b39770c
WS
1181
1182
aa5b8857
SN
1183\membersection{wxGrid::GetSelectedCells}\label{wxgridgetselectedcells}
1184
1185\constfunc{wxGridCellCoordsArray}{GetSelectedCells}{\void}
1186
1187Returns an array of singly selected cells.
1188
4b39770c
WS
1189
1190
aa5b8857
SN
1191\membersection{wxGrid::GetSelectedCols}\label{wxgridgetselectedcols}
1192
1193\constfunc{wxArrayInt}{GetSelectedCols}{\void}
1194
1195Returns an array of selected cols.
1196
4b39770c
WS
1197
1198
aa5b8857
SN
1199\membersection{wxGrid::GetSelectedRows}\label{wxgridgetselectedrows}
1200
1201\constfunc{wxArrayInt}{GetSelectedRows}{\void}
1202
1203Returns an array of selected rows.
1204
4b39770c
WS
1205
1206
608754c4
JS
1207\membersection{wxGrid::GetSelectionBackground}\label{wxgridgetselectionbackground}
1208
1209\constfunc{wxColour}{GetSelectionBackground}{\void}
1210
1211Access or update the selection fore/back colours
1212
1213
4b39770c 1214
aa5b8857
SN
1215\membersection{wxGrid::GetSelectionBlockTopLeft}\label{wxgridgetselectionblocktopleft}
1216
1217\constfunc{wxGridCellCoordsArray}{GetSelectionBlockTopLeft}{\void}
1218
4b39770c 1219Returns an array of the top left corners of blocks of selected cells,
aa5b8857
SN
1220see \helpref{wxGrid::GetSelectionBlockBottomRight}{wxgridgetselectionblockbottomright}.
1221
4b39770c
WS
1222
1223
aa5b8857
SN
1224\membersection{wxGrid::GetSelectionBlockBottomRight}\label{wxgridgetselectionblockbottomright}
1225
1226\constfunc{wxGridCellCoordsArray}{GetSelectionBlockBottomRight}{\void}
1227
1228Returns an array of the bottom right corners of blocks of selected cells,
1229see \helpref{wxGrid::GetSelectionBlockTopLeft}{wxgridgetselectionblocktopleft}.
1230
4b39770c
WS
1231
1232
608754c4
JS
1233\membersection{wxGrid::GetSelectionForeground}\label{wxgridgetselectionforeground}
1234
1235\constfunc{wxColour}{GetSelectionForeground}{\void}
1236
1237
4b39770c 1238
78c49c58 1239\membersection{wxGrid::GetTable}\label{wxgridgettable}
a660d684 1240
78c49c58 1241\constfunc{wxGridTableBase *}{GetTable}{\void}
a660d684 1242
78c49c58 1243Returns a base pointer to the current table object.
a660d684 1244
4b39770c
WS
1245
1246
608754c4
JS
1247\membersection{wxGrid::GetViewWidth}\label{wxgridgetviewwidth}
1248
ef316e23 1249\constfunc{int}{GetViewWidth}{\void}
608754c4
JS
1250
1251Returned number of whole cols visible.
1252
4b39770c
WS
1253
1254
78c49c58 1255\membersection{wxGrid::HideCellEditControl}\label{wxgridhidecelleditcontrol}
a660d684 1256
78c49c58
MB
1257\func{void}{HideCellEditControl}{\void}
1258
1259Hides the in-place cell edit control.
a660d684 1260
4b39770c 1261
57258eac
RR
1262\membersection{wxGrid::HideColLabels}\label{wxgridhidecollabels}
1263
1264\func{void}{HideColLabels}{\void}
1265
1266Hides the column labels by calling \helpref{SetColLabelSize}{wxgridsetcollabelsize}
1267with a size of 0. Show labels again by calling that method with
1268a width greater than 0.
1269
1270
1271\membersection{wxGrid::HideRowLabels}\label{wxgridhiderowlabels}
1272
1273\func{void}{HideRowLabels}{\void}
1274
1275Hides the row labels by calling \helpref{SetRowLabelSize}{wxgridsetrowlabelsize}
1276with a size of 0. Show labels again by calling that method with
1277a width greater than 0.
1278
4b39770c 1279
608754c4
JS
1280\membersection{wxGrid::InitColWidths}\label{wxgridinitcolwidths}
1281
1282\func{void}{InitColWidths}{\void}
1283
1284Init the m\_colWidths/Rights arrays
1285
4b39770c
WS
1286
1287
608754c4
JS
1288\membersection{wxGrid::InitRowHeights}\label{wxgridinitrowheights}
1289
1290\func{void}{InitRowHeights}{\void}
1291
1292NB: {\it never} access m\_row/col arrays directly because they are created
1293on demand, {\it always} use accessor functions instead!
1294
1295Init the m\_rowHeights/Bottoms arrays with default values.
1296
4b39770c
WS
1297
1298
a660d684
KB
1299\membersection{wxGrid::InsertCols}\label{wxgridinsertcols}
1300
cc81d32f 1301\func{bool}{InsertCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
78c49c58
MB
1302
1303Inserts one or more new columns into a grid with the first new column at the
cc81d32f 1304specified position and returns true if successful. The updateLabels argument is not
4b39770c 1305used at present.
a660d684 1306
78c49c58
MB
1307The sequence of actions begins with the grid object requesting the underlying grid
1308table to insert new columns. If this is successful the table notifies the grid and the
d4175745 1309grid updates the display. For a default grid (one where you have called
78c49c58 1310\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
4b39770c 1311using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
d4175745 1312then you must override
78c49c58
MB
1313\helpref{wxGridTableBase::InsertCols}{wxgridtablebaseinsertcols} in your derived
1314table class.
a660d684 1315
4b39770c
WS
1316
1317
a660d684
KB
1318\membersection{wxGrid::InsertRows}\label{wxgridinsertrows}
1319
cc81d32f 1320\func{bool}{InsertRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
a660d684 1321
78c49c58 1322Inserts one or more new rows into a grid with the first new row at the specified
cc81d32f 1323position and returns true if successful. The updateLabels argument is not used at
4b39770c 1324present.
a660d684 1325
78c49c58
MB
1326The sequence of actions begins with the grid object requesting the underlying grid
1327table to insert new rows. If this is successful the table notifies the grid and the
d4175745 1328grid updates the display. For a default grid (one where you have called
78c49c58 1329\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
4b39770c 1330using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
d4175745 1331then you must override
78c49c58
MB
1332\helpref{wxGridTableBase::InsertRows}{wxgridtablebaseinsertrows} in your derived
1333table class.
1334
4b39770c
WS
1335
1336
78c49c58
MB
1337\membersection{wxGrid::IsCellEditControlEnabled}\label{wxgridiscelleditcontrolenabled}
1338
1339\constfunc{bool}{IsCellEditControlEnabled}{\void}
1340
cc81d32f 1341Returns true if the in-place edit control is currently enabled.
78c49c58 1342
4b39770c
WS
1343
1344
78c49c58
MB
1345\membersection{wxGrid::IsCurrentCellReadOnly}\label{wxgridiscurrentcellreadonly}
1346
1347\constfunc{bool}{IsCurrentCellReadOnly}{\void}
1348
cc81d32f 1349Returns true if the current cell has been set to read-only
78c49c58
MB
1350(see \helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}).
1351
4b39770c
WS
1352
1353
78c49c58 1354\membersection{wxGrid::IsEditable}\label{wxgridiseditable}
a660d684 1355
ef316e23 1356\constfunc{bool}{IsEditable}{\void}
a660d684 1357
cc81d32f 1358Returns false if the whole grid has been set as read-only or true otherwise.
78c49c58
MB
1359See \helpref{wxGrid::EnableEditing}{wxgridenableediting} for more information about
1360controlling the editing status of grid cells.
a660d684 1361
4b39770c
WS
1362
1363
aa5b8857
SN
1364\membersection{wxGrid::IsInSelection}\label{wxgridisinselection}
1365
1366\constfunc{bool}{IsInSelection}{\param{int }{row}, \param{int }{col}}
1367
1368\constfunc{bool}{IsInSelection}{\param{const wxGridCellCoords\& }{coords}}
1369
1370Is this cell currently selected.
1371
4b39770c
WS
1372
1373
5c69031c
MB
1374\membersection{wxGrid::IsReadOnly}\label{wxgridisreadonly}
1375
1376\constfunc{bool}{IsReadOnly}{\param{int }{row}, \param{int }{col}}
1377
cc81d32f 1378Returns true if the cell at the specified location can't be edited.
5c69031c
MB
1379See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
1380
4b39770c
WS
1381
1382
5c69031c
MB
1383\membersection{wxGrid::IsSelection}\label{wxgridisselection}
1384
ef316e23 1385\constfunc{bool}{IsSelection}{\void}
5c69031c 1386
cc81d32f 1387Returns true if there are currently rows, columns or blocks of cells selected.
5c69031c 1388
4b39770c
WS
1389
1390
78c49c58 1391\membersection{wxGrid::IsVisible}\label{wxgridisvisible}
a660d684 1392
ef316e23 1393\constfunc{bool}{IsVisible}{\param{int }{row}, \param{int }{col}, \param{bool }{wholeCellVisible = true}}
a660d684 1394
ef316e23 1395\constfunc{bool}{IsVisible}{\param{const wxGridCellCoords\& }{coords}, \param{bool }{wholeCellVisible = true}}
a660d684 1396
cc81d32f 1397Returns true if a cell is either wholly visible (the default) or at least partially
78c49c58 1398visible in the grid window.
a660d684 1399
4b39770c
WS
1400
1401
78c49c58 1402\membersection{wxGrid::MakeCellVisible}\label{wxgridmakecellvisible}
a660d684 1403
78c49c58 1404\func{void}{MakeCellVisible}{\param{int }{row}, \param{int }{col}}
a660d684 1405
78c49c58 1406\func{void}{MakeCellVisible}{\param{const wxGridCellCoords\& }{coords}}
a660d684 1407
78c49c58 1408Brings the specified cell into the visible grid cell area with minimal scrolling. Does
4b39770c
WS
1409nothing if the cell is already visible.
1410
1411
a660d684 1412
78c49c58 1413\membersection{wxGrid::MoveCursorDown}\label{wxgridmovecursordown}
a660d684 1414
78c49c58 1415\func{bool}{MoveCursorDown}{\param{bool }{expandSelection}}
a660d684 1416
2eebb742 1417Moves the grid cursor down by one row. If a block of cells was previously selected it
cc81d32f 1418will expand if the argument is true or be cleared if the argument is false.
a660d684 1419
78c49c58
MB
1420\wxheading{Keyboard}\\
1421This function is called for Down cursor key presses or Shift+Down to expand a selection.
a660d684 1422
4b39770c
WS
1423
1424
78c49c58 1425\membersection{wxGrid::MoveCursorLeft}\label{wxgridmovecursorleft}
a660d684 1426
78c49c58 1427\func{bool}{MoveCursorLeft}{\param{bool }{expandSelection}}
a660d684 1428
78c49c58 1429Moves the grid cursor left by one column. If a block of cells was previously selected it
cc81d32f 1430will expand if the argument is true or be cleared if the argument is false.
a660d684 1431
78c49c58
MB
1432\wxheading{Keyboard}\\
1433This function is called for Left cursor key presses or Shift+Left to expand a selection.
a660d684 1434
4b39770c
WS
1435
1436
78c49c58 1437\membersection{wxGrid::MoveCursorRight}\label{wxgridmovecursorright}
a660d684 1438
78c49c58 1439\func{bool}{MoveCursorRight}{\param{bool }{expandSelection}}
a660d684 1440
78c49c58 1441Moves the grid cursor right by one column. If a block of cells was previously selected it
cc81d32f 1442will expand if the argument is true or be cleared if the argument is false.
a660d684 1443
78c49c58
MB
1444\wxheading{Keyboard}\\
1445This function is called for Right cursor key presses or Shift+Right to expand a selection.
a660d684 1446
4b39770c
WS
1447
1448
78c49c58 1449\membersection{wxGrid::MoveCursorUp}\label{wxgridmovecursorup}
a660d684 1450
78c49c58 1451\func{bool}{MoveCursorUp}{\param{bool }{expandSelection}}
a660d684 1452
78c49c58 1453Moves the grid cursor up by one row. If a block of cells was previously selected it
cc81d32f 1454will expand if the argument is true or be cleared if the argument is false.
a660d684 1455
78c49c58
MB
1456\wxheading{Keyboard}\\
1457This function is called for Up cursor key presses or Shift+Up to expand a selection.
a660d684 1458
4b39770c
WS
1459
1460
78c49c58 1461\membersection{wxGrid::MoveCursorDownBlock}\label{wxgridmovecursordownblock}
a660d684 1462
78c49c58 1463\func{bool}{MoveCursorDownBlock}{\param{bool }{expandSelection}}
a660d684 1464
78c49c58
MB
1465Moves the grid cursor down in the current column such that it skips to the beginning or
1466end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1467will expand if the argument is true or be cleared if the argument is false.
a660d684 1468
78c49c58
MB
1469\wxheading{Keyboard}\\
1470This function is called for the Ctrl+Down key combination. Shift+Ctrl+Down expands a selection.
a660d684 1471
4b39770c
WS
1472
1473
78c49c58 1474\membersection{wxGrid::MoveCursorLeftBlock}\label{wxgridmovecursorleftblock}
a660d684 1475
78c49c58 1476\func{bool}{MoveCursorLeftBlock}{\param{bool }{expandSelection}}
a660d684 1477
78c49c58
MB
1478Moves the grid cursor left in the current row such that it skips to the beginning or
1479end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1480will expand if the argument is true or be cleared if the argument is false.
a660d684 1481
78c49c58
MB
1482\wxheading{Keyboard}\\
1483This function is called for the Ctrl+Left key combination. Shift+Ctrl+left expands a selection.
a660d684 1484
4b39770c
WS
1485
1486
78c49c58
MB
1487\membersection{wxGrid::MoveCursorRightBlock}\label{wxgridmovecursorrightblock}
1488
1489\func{bool}{MoveCursorRightBlock}{\param{bool }{expandSelection}}
1490
1491Moves the grid cursor right in the current row such that it skips to the beginning or
1492end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1493will expand if the argument is true or be cleared if the argument is false.
78c49c58
MB
1494
1495\wxheading{Keyboard}\\
1496This function is called for the Ctrl+Right key combination. Shift+Ctrl+Right expands a selection.
1497
4b39770c
WS
1498
1499
78c49c58
MB
1500\membersection{wxGrid::MoveCursorUpBlock}\label{wxgridmovecursorupblock}
1501
1502\func{bool}{MoveCursorUpBlock}{\param{bool }{expandSelection}}
1503
1504Moves the grid cursor up in the current column such that it skips to the beginning or
1505end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1506will expand if the argument is true or be cleared if the argument is false.
78c49c58
MB
1507
1508\wxheading{Keyboard}\\
1509This function is called for the Ctrl+Up key combination. Shift+Ctrl+Up expands a selection.
1510
4b39770c
WS
1511
1512
78c49c58
MB
1513\membersection{wxGrid::MovePageDown}\label{wxgridmovepagedown}
1514
1515\func{bool}{MovePageDown}{\void}
1516
1517Moves the grid cursor down by some number of rows so that the previous bottom visible row
1518becomes the top visible row.
1519
1520\wxheading{Keyboard}\\
1521This function is called for PgDn keypresses.
1522
4b39770c
WS
1523
1524
78c49c58
MB
1525\membersection{wxGrid::MovePageUp}\label{wxgridmovepageup}
1526
1527\func{bool}{MovePageUp}{\void}
1528
1529Moves the grid cursor up by some number of rows so that the previous top visible row
1530becomes the bottom visible row.
1531
1532\wxheading{Keyboard}\\
1533This function is called for PgUp keypresses.
1534
4b39770c
WS
1535
1536
608754c4
JS
1537\membersection{wxGrid::RegisterDataType}\label{wxgridregisterdatatype}
1538
1539\func{void}{RegisterDataType}{\param{const wxString\& }{typeName}, \param{wxGridCellRenderer* }{renderer}, \param{wxGridCellEditor* }{editor}}
1540
1541Methods for a registry for mapping data types to Renderers/Editors
1542
4b39770c
WS
1543
1544
78c49c58
MB
1545\membersection{wxGrid::SaveEditControlValue}\label{wxgridsaveeditcontrolvalue}
1546
1547\func{void}{SaveEditControlValue}{\void}
1548
1549Sets the value of the current grid cell to the current in-place edit control value.
1550This is called automatically when the grid cursor moves from the current cell to a
1551new cell. It is also a good idea to call this function when closing a grid since
1552any edits to the final cell location will not be saved otherwise.
a660d684 1553
4b39770c
WS
1554
1555
5c69031c
MB
1556\membersection{wxGrid::SelectAll}\label{wxgridselectall}
1557
1558\func{void}{SelectAll}{\void}
1559
1560Selects all cells in the grid.
1561
4b39770c
WS
1562
1563
5c69031c
MB
1564\membersection{wxGrid::SelectBlock}\label{wxgridselectblock}
1565
4b39770c 1566\func{void}{SelectBlock}{\param{int }{topRow}, \param{int }{leftCol},
cc81d32f 1567\param{int }{bottomRow}, \param{int }{rightCol}, \param{bool }{addToSelected = false}}
5c69031c 1568
4b39770c 1569\func{void}{SelectBlock}{\param{const wxGridCellCoords\& }{topLeft},
cc81d32f 1570\param{const wxGridCellCoords\& }{bottomRight}, \param{bool }{addToSelected = false}}
5c69031c 1571
cc81d32f 1572Selects a rectangular block of cells. If addToSelected is false then any existing selection will be
4b39770c
WS
1573deselected; if true the column will be added to the existing selection.
1574
1575
5c69031c
MB
1576
1577\membersection{wxGrid::SelectCol}\label{wxgridselectcol}
1578
cc81d32f 1579\func{void}{SelectCol}{\param{int }{col}, \param{bool }{addToSelected = false}}
5c69031c 1580
cc81d32f
VS
1581Selects the specified column. If addToSelected is false then any existing selection will be
1582deselected; if true the column will be added to the existing selection.
5c69031c 1583
4b39770c
WS
1584
1585
608754c4
JS
1586\membersection{wxGrid::SelectionToDeviceRect}\label{wxgridselectiontodevicerect}
1587
ef316e23 1588\constfunc{wxRect}{SelectionToDeviceRect}{\void}
608754c4
JS
1589
1590This function returns the rectangle that encloses the selected cells
1591in device coords and clipped to the client size of the grid window.
1592
1593
4b39770c 1594
5c69031c
MB
1595\membersection{wxGrid::SelectRow}\label{wxgridselectrow}
1596
cc81d32f 1597\func{void}{SelectRow}{\param{int }{row}, \param{bool }{addToSelected = false}}
5c69031c 1598
cc81d32f
VS
1599Selects the specified row. If addToSelected is false then any existing selection will be
1600deselected; if true the row will be added to the existing selection.
5c69031c 1601
4b39770c
WS
1602
1603
a660d684
KB
1604\membersection{wxGrid::SetCellAlignment}\label{wxgridsetcellalignment}
1605
78c49c58 1606\func{void}{SetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int }{horiz}, \param{int }{vert}}
a660d684 1607
2eebb742
JS
1608\func{void}{SetCellAlignment}{\param{int }{align}, \param{int }{row}, \param{int }{col}}
1609
2edb0bde 1610Sets the horizontal and vertical alignment for grid cell text at the specified location.
a660d684 1611
e7240349
GT
1612Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
1613Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 1614
4b39770c
WS
1615
1616
608754c4
JS
1617\membersection{wxGrid::SetCellBackgroundColour}\label{wxgridsetcellbackgroundcolour}
1618
1619\func{void}{SetCellBackgroundColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
1620
1621
4b39770c 1622
78c49c58 1623\membersection{wxGrid::SetCellEditor}\label{wxgridsetcelleditor}
21f280f4 1624
78c49c58
MB
1625\func{void}{SetCellEditor}{\param{int }{row}, \param{int }{col}, \param{wxGridCellEditor* }{editor}}
1626
4b39770c 1627Sets the editor for the grid cell at the specified location.
78c49c58
MB
1628The grid will take ownership of the pointer.
1629
1630See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1631the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1632
4b39770c
WS
1633
1634
78c49c58
MB
1635\membersection{wxGrid::SetCellFont}\label{wxgridsetcellfont}
1636
deea56b1 1637\func{void}{SetCellFont}{\param{int }{row}, \param{int }{col}, \param{const wxFont\&}{ font}}
78c49c58
MB
1638
1639Sets the font for text in the grid cell at the specified location.
a660d684 1640
4b39770c
WS
1641
1642
78c49c58 1643\membersection{wxGrid::SetCellRenderer}\label{wxgridsetcellrenderer}
a660d684 1644
78c49c58 1645\func{void}{SetCellRenderer}{\param{int }{row}, \param{int }{col}, \param{wxGridCellRenderer* }{renderer}}
a660d684 1646
4b39770c 1647Sets the renderer for the grid cell at the specified location.
78c49c58 1648The grid will take ownership of the pointer.
a660d684 1649
78c49c58
MB
1650See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1651the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
21f280f4 1652
4b39770c
WS
1653
1654
a660d684
KB
1655\membersection{wxGrid::SetCellTextColour}\label{wxgridsetcelltextcolour}
1656
68f30f26 1657\func{void}{SetCellTextColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
a660d684 1658
2eebb742
JS
1659\func{void}{SetCellTextColour}{\param{const wxColour\& }{val}, \param{int }{row}, \param{int }{col}}
1660
deea56b1 1661\func{void}{SetCellTextColour}{\param{const wxColour\& }{colour}}
2eebb742 1662
78c49c58 1663Sets the text colour for the grid cell at the specified location.
a660d684 1664
4b39770c
WS
1665
1666
5c69031c
MB
1667\membersection{wxGrid::SetCellValue}\label{wxgridsetcellvalue}
1668
1669\func{void}{SetCellValue}{\param{int }{row}, \param{int }{col}, \param{const wxString\& }{s}}
1670
1671\func{void}{SetCellValue}{\param{const wxGridCellCoords\& }{coords}, \param{const wxString\& }{s}}
1672
2eebb742
JS
1673\func{void}{SetCellValue}{\param{const wxString\& }{val}, \param{int }{row}, \param{int }{col}}
1674
5c69031c
MB
1675Sets the string value for the cell at the specified location. For simple applications where a
1676grid object automatically uses a default grid table of string values you use this function together
4b39770c 1677with \helpref{wxGrid::GetCellValue}{wxgridgetcellvalue} to access cell values.
5c69031c
MB
1678
1679For more complex applications where you have derived your own grid table class that contains
1680various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
2eebb742
JS
1681function for those cells that contain string values.
1682
1683The last form is for backward compatibility only.
5c69031c 1684
d4175745 1685See \helpref{wxGridTableBase::CanSetValueAs}{wxgridtablebasecangetvalueas}
5c69031c
MB
1686and the \helpref{wxGrid overview}{gridoverview} for more information.
1687
4b39770c
WS
1688
1689
78c49c58 1690\membersection{wxGrid::SetColAttr}\label{wxgridsetcolattr}
a660d684 1691
78c49c58 1692\func{void}{SetColAttr}{\param{int }{col}, \param{wxGridCellAttr* }{attr}}
21f280f4 1693
78c49c58 1694Sets the cell attributes for all cells in the specified column.
a660d684 1695
d4175745
VZ
1696For more information about controlling grid cell attributes see the
1697\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
78c49c58 1698\helpref{wxGrid classes overview}{gridoverview}.
a660d684 1699
4b39770c
WS
1700
1701
78c49c58 1702\membersection{wxGrid::SetColFormatBool}\label{wxgridsetcolformatbool}
a660d684 1703
78c49c58 1704\func{void}{SetColFormatBool}{\param{int }{col}}
a660d684 1705
78c49c58 1706Sets the specified column to display boolean values. wxGrid displays boolean values with a checkbox.
21f280f4 1707
4b39770c
WS
1708
1709
78c49c58 1710\membersection{wxGrid::SetColFormatNumber}\label{wxgridsetcolformatnumber}
a660d684 1711
78c49c58 1712\func{void}{SetColFormatNumber}{\param{int }{col}}
a660d684 1713
78c49c58 1714Sets the specified column to display integer values.
a660d684 1715
4b39770c
WS
1716
1717
78c49c58 1718\membersection{wxGrid::SetColFormatFloat}\label{wxgridsetcolformatfloat}
a660d684 1719
78c49c58 1720\func{void}{SetColFormatFloat}{\param{int }{col}, \param{int }{width = -1}, \param{int }{precision = -1}}
a660d684 1721
78c49c58 1722Sets the specified column to display floating point values with the given width and precision.
a660d684 1723
4b39770c
WS
1724
1725
78c49c58 1726\membersection{wxGrid::SetColFormatCustom}\label{wxgridsetcolformatcustom}
a660d684 1727
78c49c58 1728\func{void}{SetColFormatCustom}{\param{int }{col}, \param{const wxString\& }{typeName}}
a660d684 1729
78c49c58
MB
1730Sets the specified column to display data in a custom format.
1731See the \helpref{wxGrid overview}{gridoverview} for more information on working
1732with custom data types.
a660d684 1733
4b39770c
WS
1734
1735
78c49c58 1736\membersection{wxGrid::SetColLabelAlignment}\label{wxgridsetcollabelalignment}
a660d684 1737
78c49c58 1738\func{void}{SetColLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
a660d684 1739
78c49c58 1740Sets the horizontal and vertical alignment of column label text.
a660d684 1741
e7240349 1742Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
deea56b1 1743
e7240349 1744Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
78c49c58 1745
4b39770c
WS
1746
1747
78c49c58
MB
1748\membersection{wxGrid::SetColLabelSize}\label{wxgridsetcollabelsize}
1749
1750\func{void}{SetColLabelSize}{\param{int }{height}}
1751
1752Sets the height of the column labels.
1753
c76f52c9 1754If \arg{height} equals to \texttt{wxGRID\_AUTOSIZE} then height is calculated automatically
733f486a
VZ
1755so that no label is truncated. Note that this could be slow for a large table.
1756
4b39770c
WS
1757
1758
78c49c58
MB
1759\membersection{wxGrid::SetColLabelValue}\label{wxgridsetcollabelvalue}
1760
deea56b1 1761\func{void}{SetColLabelValue}{\param{int }{col}, \param{const wxString\&}{ value}}
78c49c58 1762
4b39770c 1763Set the value for the given column label. If you are using a derived grid table you must
78c49c58
MB
1764override \helpref{wxGridTableBase::SetColLabelValue}{wxgridtablebasesetcollabelvalue}
1765for this to have any effect.
1766
4b39770c
WS
1767
1768
78c49c58
MB
1769\membersection{wxGrid::SetColMinimalWidth}\label{wxgridsetcolminimalwidth}
1770
1771\func{void}{SetColMinimalWidth}{\param{int }{col}, \param{int }{width}}
1772
1773Sets the minimal width for the specified column. This should normally be called when creating the grid
1774because it will not resize a column that is already narrower than the minimal width.
b8d24d4e
RG
1775The width argument must be higher than the minimimal acceptable column width, see
1776\helpref{wxGrid::GetColMinimalAcceptableWidth}{wxgridgetcolminimalacceptablewidth}.
1777
4b39770c
WS
1778
1779
b8d24d4e
RG
1780\membersection{wxGrid::SetColMinimalAcceptableWidth}\label{wxgridsetcolminimalacceptablewidth}
1781
1782\func{void}{SetColMinimalAcceptableWidth}{\param{int }{width}}
1783
1784This modifies the minimum column width that can be handled correctly. Specifying a low value here
1785allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
1786than the actual minimum size will incur a performance penalty in the functions which perform
1787grid cell index lookup on the basis of screen coordinates.
1788This should normally be called when creating the grid because it will not resize existing columns
4b39770c
WS
1789with sizes smaller than the value specified here.
1790
1791
b8d24d4e 1792
d4175745
VZ
1793\membersection{wxGrid::SetColPos}\label{wxgridsetcolpos}
1794
1795\func{void}{SetColPos}{\param{int }{colID}, \param{int }{newPos}}
1796
1797Sets the position of the specified column.
1798
1799
1800
78c49c58
MB
1801\membersection{wxGrid::SetColSize}\label{wxgridsetcolsize}
1802
1803\func{void}{SetColSize}{\param{int }{col}, \param{int }{width}}
1804
4b39770c 1805Sets the width of the specified column.
78c49c58
MB
1806
1807This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
4b39770c 1808block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
78c49c58 1809
cc81d32f 1810Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
78c49c58
MB
1811also be set as the minimal width for the column.
1812
2eebb742 1813\wxheading{Note}\\
78c49c58 1814wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c
WS
1815The memory requirements for this could become prohibitive if your grid is very large.
1816
1817
78c49c58
MB
1818
1819\membersection{wxGrid::SetDefaultCellAlignment}\label{wxgridsetdefaultcellalignment}
1820
1821\func{void}{SetDefaultCellAlignment}{\param{int }{horiz}, \param{int }{vert}}
1822
2edb0bde 1823Sets the default horizontal and vertical alignment for grid cell text.
78c49c58 1824
e7240349 1825Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
deea56b1 1826
e7240349 1827Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
78c49c58 1828
4b39770c
WS
1829
1830
78c49c58
MB
1831\membersection{wxGrid::SetDefaultCellBackgroundColour}\label{wxgridsetdefaultcellbackgroundcolour}
1832
deea56b1 1833\func{void}{SetDefaultCellBackgroundColour}{\param{const wxColour\&}{ colour}}
78c49c58
MB
1834
1835Sets the default background colour for grid cells.
1836
4b39770c
WS
1837
1838
78c49c58
MB
1839\membersection{wxGrid::SetDefaultCellFont}\label{wxgridsetdefaultcellfont}
1840
deea56b1 1841\func{void}{SetDefaultCellFont}{\param{const wxFont\&}{ font}}
78c49c58
MB
1842
1843Sets the default font to be used for grid cell text.
1844
4b39770c
WS
1845
1846
f6bb64a6
JS
1847\membersection{wxGrid::SetDefaultCellTextColour}\label{wxgridsetdefaultcelltextcolour}
1848
1849\func{void}{SetDefaultCellTextColour}{\param{const wxColour\&}{ colour}}
1850
1851Sets the current default colour for grid cell text.
1852
4b39770c
WS
1853
1854
78c49c58
MB
1855\membersection{wxGrid::SetDefaultEditor}\label{wxgridsetdefaulteditor}
1856
1857\func{void}{SetDefaultEditor}{\param{wxGridCellEditor* }{editor}}
1858
1859Sets the default editor for grid cells. The grid will take ownership of the pointer.
1860
1861See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1862the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1863
4b39770c
WS
1864
1865
78c49c58
MB
1866\membersection{wxGrid::SetDefaultRenderer}\label{wxgridsetdefaultrenderer}
1867
1868\func{void}{SetDefaultRenderer}{\param{wxGridCellRenderer* }{renderer}}
1869
1870Sets the default renderer for grid cells. The grid will take ownership of the pointer.
1871
1872See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1873the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1874
4b39770c
WS
1875
1876
78c49c58 1877\membersection{wxGrid::SetDefaultColSize}\label{wxgridsetdefaultcolsize}
c0b042fc 1878
cc81d32f 1879\func{void}{SetDefaultColSize}{\param{int }{width}, \param{bool }{resizeExistingCols = false}}
c0b042fc 1880
78c49c58 1881Sets the default width for columns in the grid. This will only affect columns subsequently added to
4b39770c
WS
1882the grid unless resizeExistingCols is true.
1883
1884
78c49c58
MB
1885
1886\membersection{wxGrid::SetDefaultRowSize}\label{wxgridsetdefaultrowsize}
1887
cc81d32f 1888\func{void}{SetDefaultRowSize}{\param{int }{height}, \param{bool }{resizeExistingRows = false}}
78c49c58
MB
1889
1890Sets the default height for rows in the grid. This will only affect rows subsequently added
cc81d32f 1891to the grid unless resizeExistingRows is true.
c0b042fc 1892
4b39770c
WS
1893
1894
a660d684
KB
1895\membersection{wxGrid::SetGridCursor}\label{wxgridsetgridcursor}
1896
78c49c58 1897\func{void}{SetGridCursor}{\param{int }{row}, \param{int }{col}}
a660d684 1898
4b39770c 1899Set the grid cursor to the specified cell.
78c49c58 1900This function calls \helpref{wxGrid::MakeCellVisible}{wxgridmakecellvisible}.
a660d684 1901
4b39770c
WS
1902
1903
78c49c58 1904\membersection{wxGrid::SetGridLineColour}\label{wxgridsetgridlinecolour}
a660d684 1905
deea56b1 1906\func{void}{SetGridLineColour}{\param{const wxColour\&}{colour}}
a660d684 1907
78c49c58 1908Sets the colour used to draw grid lines.
a660d684 1909
4b39770c
WS
1910
1911
a660d684
KB
1912\membersection{wxGrid::SetLabelBackgroundColour}\label{wxgridsetlabelbackgroundcolour}
1913
deea56b1 1914\func{void}{SetLabelBackgroundColour}{\param{const wxColour\&}{ colour}}
a660d684 1915
78c49c58 1916Sets the background colour for row and column labels.
a660d684 1917
4b39770c
WS
1918
1919
78c49c58 1920\membersection{wxGrid::SetLabelFont}\label{wxgridsetlabelfont}
a660d684 1921
deea56b1 1922\func{void}{SetLabelFont}{\param{const wxFont\&}{ font}}
a660d684 1923
78c49c58 1924Sets the font for row and column labels.
a660d684 1925
4b39770c
WS
1926
1927
a660d684
KB
1928\membersection{wxGrid::SetLabelTextColour}\label{wxgridsetlabeltextcolour}
1929
deea56b1 1930\func{void}{SetLabelTextColour}{\param{const wxColour\&}{ colour}}
a660d684 1931
78c49c58 1932Sets the colour for row and column label text.
a660d684 1933
4b39770c
WS
1934
1935
608754c4
JS
1936\membersection{wxGrid::SetMargins}\label{wxgridsetmargins}
1937
1938\func{void}{SetMargins}{\param{int }{extraWidth}, \param{int }{extraHeight}}
1939
1940A grid may occupy more space than needed for its rows/columns. This
1941function allows to set how big this extra space is
1942
4b39770c
WS
1943
1944
608754c4
JS
1945\membersection{wxGrid::SetOrCalcColumnSizes}\label{wxgridsetorcalccolumnsizes}
1946
1947\func{int}{SetOrCalcColumnSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1948
1949Common part of AutoSizeColumn/Row() and GetBestSize()
1950
4b39770c
WS
1951
1952
608754c4
JS
1953\membersection{wxGrid::SetOrCalcRowSizes}\label{wxgridsetorcalcrowsizes}
1954
1955\func{int}{SetOrCalcRowSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1956
4b39770c
WS
1957
1958
5c69031c
MB
1959\membersection{wxGrid::SetReadOnly}\label{wxgridsetreadonly}
1960
cc81d32f 1961\func{void}{SetReadOnly}{\param{int }{row}, \param{int }{col}, \param{bool }{isReadOnly = true}}
5c69031c
MB
1962
1963Makes the cell at the specified location read-only or editable.
1964See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
1965
4b39770c
WS
1966
1967
78c49c58 1968\membersection{wxGrid::SetRowAttr}\label{wxgridsetrowattr}
a660d684 1969
78c49c58 1970\func{void}{SetRowAttr}{\param{int }{row}, \param{wxGridCellAttr* }{attr}}
a660d684 1971
78c49c58
MB
1972Sets the cell attributes for all cells in the specified row.
1973See the \helpref{wxGridCellAttr}{wxgridcellattr} class for more information
1974about controlling cell attributes.
a660d684 1975
4b39770c
WS
1976
1977
78c49c58 1978\membersection{wxGrid::SetRowLabelAlignment}\label{wxgridsetrowlabelalignment}
a660d684 1979
78c49c58 1980\func{void}{SetRowLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
a660d684 1981
78c49c58 1982Sets the horizontal and vertical alignment of row label text.
a660d684 1983
e7240349 1984Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
deea56b1 1985
e7240349 1986Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 1987
4b39770c
WS
1988
1989
78c49c58 1990\membersection{wxGrid::SetRowLabelSize}\label{wxgridsetrowlabelsize}
a660d684 1991
78c49c58 1992\func{void}{SetRowLabelSize}{\param{int }{width}}
a660d684 1993
78c49c58
MB
1994Sets the width of the row labels.
1995
c76f52c9 1996If \arg{width} equals \texttt{wxGRID\_AUTOSIZE} then width is calculated automatically
733f486a
VZ
1997so that no label is truncated. Note that this could be slow for a large table.
1998
4b39770c
WS
1999
2000
78c49c58
MB
2001\membersection{wxGrid::SetRowLabelValue}\label{wxgridsetrowlabelvalue}
2002
deea56b1 2003\func{void}{SetRowLabelValue}{\param{int }{row}, \param{const wxString\&}{ value}}
78c49c58 2004
4b39770c
WS
2005Set the value for the given row label. If you are using a derived grid table you must
2006override \helpref{wxGridTableBase::SetRowLabelValue}{wxgridtablebasesetrowlabelvalue}
78c49c58
MB
2007for this to have any effect.
2008
4b39770c
WS
2009
2010
78c49c58
MB
2011\membersection{wxGrid::SetRowMinimalHeight}\label{wxgridsetrowminimalheight}
2012
b8d24d4e 2013\func{void}{SetRowMinimalHeight}{\param{int }{row}, \param{int }{height}}
78c49c58
MB
2014
2015Sets the minimal height for the specified row. This should normally be called when creating the grid
2016because it will not resize a row that is already shorter than the minimal height.
b8d24d4e
RG
2017The height argument must be higher than the minimimal acceptable row height, see
2018\helpref{wxGrid::GetRowMinimalAcceptableHeight}{wxgridgetrowminimalacceptableheight}.
2019
4b39770c
WS
2020
2021
b8d24d4e
RG
2022\membersection{wxGrid::SetRowMinimalAcceptableHeight}\label{wxgridsetrowminimalacceptableheight}
2023
2024\func{void}{SetRowMinimalAcceptableHeight}{\param{int }{height}}
2025
2026This modifies the minimum row width that can be handled correctly. Specifying a low value here
2027allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
2028than the actual minimum size will incur a performance penalty in the functions which perform
2029grid cell index lookup on the basis of screen coordinates.
2030This should normally be called when creating the grid because it will not resize existing rows
4b39770c
WS
2031with sizes smaller than the value specified here.
2032
2033
b8d24d4e 2034
78c49c58
MB
2035\membersection{wxGrid::SetRowSize}\label{wxgridsetrowsize}
2036
2037\func{void}{SetRowSize}{\param{int }{row}, \param{int }{height}}
2038
4b39770c 2039Sets the height of the specified row.
78c49c58
MB
2040
2041This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
4b39770c 2042block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
78c49c58 2043
cc81d32f 2044Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
78c49c58
MB
2045also be set as the minimal width for the column.
2046
deea56b1
JS
2047\wxheading{Note}
2048
78c49c58 2049wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
4b39770c 2050The memory requirements for this could become prohibitive if your grid is very large.
78c49c58 2051
608754c4 2052
4b39770c
WS
2053
2054\membersection{wxGrid::SetScrollLineX}\label{wxgridsetscrolllinex}
2055
2056\func{void}{SetScrollLineX}{\param{int }{x}}
608754c4
JS
2057
2058Sets the number of pixels per horizontal scroll increment. The default is 15.
2059Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding
2060errors: setting this to 1 can help.
2061
4b39770c
WS
2062\wxheading{See also}
2063
2064\helpref{wxGrid::GetScrollLineX}{wxgridgetscrolllinex},\rtfsp
2065\helpref{wxGrid::GetScrollLineY}{wxgridgetscrollliney},\rtfsp
2066\helpref{wxGrid::SetScrollLineY}{wxgridsetscrollliney}
2067
608754c4 2068
4b39770c
WS
2069
2070\membersection{wxGrid::SetScrollLineY}\label{wxgridsetscrollliney}
2071
2072\func{void}{SetScrollLineY}{\param{int }{y}}
608754c4
JS
2073
2074Sets the number of pixels per vertical scroll increment. The default is 15.
2075Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding
2076errors: setting this to 1 can help.
2077
4b39770c
WS
2078\wxheading{See also}
2079
2080\helpref{wxGrid::GetScrollLineX}{wxgridgetscrolllinex},\rtfsp
2081\helpref{wxGrid::GetScrollLineY}{wxgridgetscrollliney},\rtfsp
2082\helpref{wxGrid::SetScrollLineX}{wxgridsetscrolllinex}
2083
2084
2085
608754c4
JS
2086\membersection{wxGrid::SetSelectionBackground}\label{wxgridsetselectionbackground}
2087
2088\func{void}{SetSelectionBackground}{\param{const wxColour\& }{c}}
2089
2090
4b39770c 2091
608754c4
JS
2092\membersection{wxGrid::SetSelectionForeground}\label{wxgridsetselectionforeground}
2093
2094\func{void}{SetSelectionForeground}{\param{const wxColour\& }{c}}
2095
2096
4b39770c 2097
78c49c58
MB
2098\membersection{wxGrid::SetSelectionMode}\label{wxgridsetselectionmode}
2099
deea56b1 2100\func{void}{SetSelectionMode}{\param{wxGrid::wxGridSelectionModes}{ selmode}}
78c49c58
MB
2101
2102Set the selection behaviour of the grid.
2103
2104\wxheading{Parameters}
2105
2106\docparam{wxGrid::wxGridSelectCells}{The default mode where individual cells are selected.}
2107
deea56b1 2108\docparam{wxGrid::wxGridSelectRows}{Selections will consist of whole rows.}
78c49c58 2109
f6bb64a6 2110\docparam{wxGrid::wxGridSelectColumns}{Selections will consist of whole columns.}
78c49c58 2111
4b39770c
WS
2112
2113
78c49c58
MB
2114\membersection{wxGrid::SetTable}\label{wxgridsettable}
2115
cc81d32f 2116\func{bool}{SetTable}{\param{wxGridTableBase* }{table}, \param{bool }{takeOwnership = false}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
78c49c58 2117
2eebb742 2118Passes a pointer to a custom grid table to be used by the grid. This should be called
78c49c58 2119after the grid constructor and before using the grid object. If takeOwnership is set to
4b39770c 2120true then the table will be deleted by the wxGrid destructor.
78c49c58
MB
2121
2122Use this function instead of \helpref{wxGrid::CreateGrid}{wxgridcreategrid} when your
2123application involves complex or non-string data or data sets that are too large to fit
4b39770c
WS
2124wholly in memory.
2125
2126
57258eac
RR
2127\membersection{wxGrid::SetUseNativeColLabels}\label{wxgridsetsenativecollabels}
2128
2129\func{void}{SetUseNativeColLabels}{\param{bool }{native= true}}
2130
2131Call this in order to make the column labels use a native look by using
2132\helpref{wxRenderer::DrawHeaderButton}{wxrenderernativedrawheaderbutton}
2133internally. There is no equivalent method for drawing row columns as
2134there is not native look for that. This option is useful when using
2135wxGrid for displaying tables and not as a spread-sheet.
78c49c58
MB
2136
2137\membersection{wxGrid::ShowCellEditControl}\label{wxgridshowcelleditcontrol}
2138
2139\func{void}{ShowCellEditControl}{\void}
2140
2141Displays the in-place cell edit control for the current cell.
2142
4b39770c
WS
2143
2144
78c49c58
MB
2145\membersection{wxGrid::XToCol}\label{wxgridxtocol}
2146
ef316e23 2147\constfunc{int}{XToCol}{\param{int }{x}, \param{bool }{clipToMinMax = false}}
d4175745
VZ
2148
2149\wxheading{Parameters}
2150\docparam{x}{The x position to evaluate.}
2151\docparam{clipToMinMax}{If true, rather than returning wxNOT\_FOUND, it returns either the first or last column depending on whether x is too far to the left or right respectively.}
78c49c58 2152
d4175745
VZ
2153\wxheading{Return value}
2154The grid column that corresponds to the logical x coordinate. Returns
a8d08dbd 2155{\tt wxNOT\_FOUND} if there is no column at the x position.
78c49c58 2156
4b39770c
WS
2157
2158
78c49c58
MB
2159\membersection{wxGrid::XToEdgeOfCol}\label{wxgridxtoedgeofcol}
2160
ef316e23 2161\constfunc{int}{XToEdgeOfCol}{\param{int }{x}}
78c49c58
MB
2162
2163Returns the column whose right hand edge is close to the given logical x position.
a8d08dbd 2164If no column edge is near to this position {\tt wxNOT\_FOUND} is returned.
78c49c58 2165
4b39770c
WS
2166
2167
78c49c58
MB
2168\membersection{wxGrid::YToEdgeOfRow}\label{wxgridytoedgeofrow}
2169
ef316e23 2170\constfunc{int}{YToEdgeOfRow}{\param{int }{y}}
78c49c58
MB
2171
2172Returns the row whose bottom edge is close to the given logical y position.
a8d08dbd 2173If no row edge is near to this position {\tt wxNOT\_FOUND} is returned.
78c49c58 2174
4b39770c
WS
2175
2176
78c49c58
MB
2177\membersection{wxGrid::YToRow}\label{wxgridytorow}
2178
ef316e23 2179\constfunc{int}{YToRow}{\param{int }{y}}
78c49c58 2180
d4175745 2181Returns the grid row that corresponds to the logical y coordinate. Returns
a8d08dbd 2182{\tt wxNOT\_FOUND} if there is no row at the y position.
095e0f91 2183