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