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