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