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