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