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