]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/grid.h
Some BC++ 5.4 fixes
[wxWidgets.git] / include / wx / generic / grid.h
CommitLineData
f85afd4e
MB
1/////////////////////////////////////////////////////////////////////////////
2// Name: grid.h
3// Purpose: wxGrid and related classes
4// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
5// Modified by:
6// Created: 1/08/1999
7// RCS-ID: $Id$
8// Copyright: (c) Michael Bedward
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12
13#include "wx/defs.h"
14
15#if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
16#include "gridg.h"
17#else
18
19#ifndef __WXGRID_H__
20#define __WXGRID_H__
21
22#ifdef __GNUG__
23#pragma interface "grid.h"
24#endif
25
26#include "wx/panel.h"
2d66e025 27#include "wx/scrolwin.h"
f85afd4e
MB
28#include "wx/string.h"
29#include "wx/scrolbar.h"
30#include "wx/event.h"
31#include "wx/textctrl.h"
32#include "wx/combobox.h"
33#include "wx/dynarray.h"
34
35
36// Default parameters for wxGrid
37//
38#define WXGRID_DEFAULT_NUMBER_ROWS 10
39#define WXGRID_DEFAULT_NUMBER_COLS 10
40#ifdef __WXMSW__
41#define WXGRID_DEFAULT_ROW_HEIGHT 25
42#else
43#define WXGRID_DEFAULT_ROW_HEIGHT 30
44#endif // __WXMSW__
45#define WXGRID_DEFAULT_COL_WIDTH 80
46#define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32
47#define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82
48#define WXGRID_LABEL_EDGE_ZONE 5
49#define WXGRID_MIN_ROW_HEIGHT 15
50#define WXGRID_MIN_COL_WIDTH 15
51#define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16
f85afd4e 52
b99be8fb
VZ
53// ----------------------------------------------------------------------------
54// forward declarations
55// ----------------------------------------------------------------------------
56
57class WXDLLEXPORT wxGridCellAttrProviderData;
58class WXDLLEXPORT wxGridRowLabelWindow;
59class WXDLLEXPORT wxGridColLabelWindow;
60class WXDLLEXPORT wxGridCornerLabelWindow;
61class WXDLLEXPORT wxGridWindow;
6f4968e2 62class WXDLLEXPORT wxGrid;
f85afd4e 63
b99be8fb
VZ
64// ----------------------------------------------------------------------------
65// wxGridCellAttr: this class can be used to alter the cells appearance in
66// the grid by changing their colour/font/... from default. An object of this
67// class may be returned by wxGridTable::GetAttr().
68// ----------------------------------------------------------------------------
69
70class WXDLLEXPORT wxGridCellAttr
71{
72public:
73 // ctors
74 wxGridCellAttr()
75 {
76 SetAlignment(0, 0);
77 }
78
79 wxGridCellAttr(const wxColour& colText,
80 const wxColour& colBack,
81 const wxFont& font,
82 int hAlign,
83 int vAlign)
84 : m_colText(colText), m_colBack(colBack), m_font(font)
85 {
86 SetAlignment(hAlign, vAlign);
87 }
88
89 // default copy ctor ok
90
91 // setters
92 void SetTextColour(const wxColour& colText) { m_colText = colText; }
93 void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
94 void SetFont(const wxFont& font) { m_font = font; }
95 void SetAlignment(int hAlign, int vAlign)
96 {
97 m_hAlign = hAlign;
98 m_vAlign = vAlign;
99 }
100
101 // accessors
102 bool HasTextColour() const { return m_colText.Ok(); }
103 bool HasBackgroundColour() const { return m_colBack.Ok(); }
104 bool HasFont() const { return m_font.Ok(); }
105 bool HasAlignment() const { return m_hAlign || m_vAlign; }
106
107 const wxColour& GetTextColour() const { return m_colText; }
108 const wxColour& GetBackgroundColour() const { return m_colBack; }
109 const wxFont& GetFont() const { return m_font; }
110 void GetAlignment(int *hAlign, int *vAlign)
111 {
112 if ( hAlign ) *hAlign = m_hAlign;
113 if ( vAlign ) *vAlign = m_vAlign;
114 }
115
116private:
117 wxColour m_colText,
118 m_colBack;
119 wxFont m_font;
120 int m_hAlign,
121 m_vAlign;
122};
123
124// ----------------------------------------------------------------------------
125// wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
126// cell attributes.
127// ----------------------------------------------------------------------------
128
129// implementation note: we separate it from wxGridTableBase because we wish to
130// avoid deriving a new table class if possible, and sometimes it will be
131// enough to just derive another wxGridCellAttrProvider instead
132
133class WXDLLEXPORT wxGridCellAttrProvider
134{
135public:
136 wxGridCellAttrProvider();
137 virtual ~wxGridCellAttrProvider();
138
139 virtual wxGridCellAttr *GetAttr(int row, int col) const;
140 virtual void SetAttr(const wxGridCellAttr *attr, int row, int col);
141
142private:
143 void InitData();
144
145 wxGridCellAttrProviderData *m_data;
146};
f85afd4e
MB
147
148//////////////////////////////////////////////////////////////////////
149//
150// Grid table classes
151//
152//////////////////////////////////////////////////////////////////////
153
154
2d66e025 155class WXDLLEXPORT wxGridTableBase : public wxObject
f85afd4e 156{
60ff3b99 157public:
f85afd4e
MB
158 wxGridTableBase();
159 virtual ~wxGridTableBase();
160
161 // You must override these functions in a derived table class
162 //
163 virtual long GetNumberRows() = 0;
164 virtual long GetNumberCols() = 0;
165 virtual wxString GetValue( int row, int col ) = 0;
166 virtual void SetValue( int row, int col, const wxString& s ) = 0;
167 virtual bool IsEmptyCell( int row, int col ) = 0;
60ff3b99 168
f85afd4e
MB
169 // Overriding these is optional
170 //
171 virtual void SetView( wxGrid *grid ) { m_view = grid; }
172 virtual wxGrid * GetView() const { return m_view; }
173
174 virtual void Clear() {}
175 virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
176 virtual bool AppendRows( size_t numRows = 1 );
177 virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
178 virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
179 virtual bool AppendCols( size_t numCols = 1 );
180 virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
181
182 virtual wxString GetRowLabelValue( int row );
183 virtual wxString GetColLabelValue( int col );
af111fc3
JS
184 virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {}
185 virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {}
60ff3b99 186
b99be8fb
VZ
187 // Attribute handling
188 //
189
190 // give us the attr provider to use - we take ownership of the pointer
191 void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
192
193 // get the currently used attr provider (may be NULL)
194 wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; }
195
196 // by default forwarded to wxGridCellAttrProvider if any. May be
197 // overridden to handle attributes directly in this class.
198 virtual wxGridCellAttr *GetAttr( int row, int col );
199
200 // takes ownership of the pointer
201 virtual void SetAttr(const wxGridCellAttr *attr, int row, int col );
202
60ff3b99
VZ
203private:
204 wxGrid * m_view;
b99be8fb 205 wxGridCellAttrProvider *m_attrProvider;
60ff3b99 206
f85afd4e
MB
207 DECLARE_ABSTRACT_CLASS( wxGridTableBase );
208};
209
210
b99be8fb
VZ
211// ----------------------------------------------------------------------------
212// wxGridTableMessage
213// ----------------------------------------------------------------------------
f85afd4e
MB
214
215// IDs for messages sent from grid table to view
216//
60ff3b99
VZ
217enum wxGridTableRequest
218{
f85afd4e
MB
219 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
220 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
221 wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
222 wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
223 wxGRIDTABLE_NOTIFY_ROWS_DELETED,
224 wxGRIDTABLE_NOTIFY_COLS_INSERTED,
225 wxGRIDTABLE_NOTIFY_COLS_APPENDED,
226 wxGRIDTABLE_NOTIFY_COLS_DELETED
227};
228
2d66e025 229class WXDLLEXPORT wxGridTableMessage
f85afd4e 230{
60ff3b99 231public:
f85afd4e
MB
232 wxGridTableMessage();
233 wxGridTableMessage( wxGridTableBase *table, int id,
234 int comInt1 = -1,
235 int comInt2 = -1 );
236
237 void SetTableObject( wxGridTableBase *table ) { m_table = table; }
238 wxGridTableBase * GetTableObject() const { return m_table; }
239 void SetId( int id ) { m_id = id; }
240 int GetId() { return m_id; }
241 void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; }
242 int GetCommandInt() { return m_comInt1; }
243 void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; }
60ff3b99
VZ
244 int GetCommandInt2() { return m_comInt2; }
245
246private:
247 wxGridTableBase *m_table;
248 int m_id;
249 int m_comInt1;
250 int m_comInt2;
f85afd4e
MB
251};
252
253
254
255// ------ wxGridStringArray
256// A 2-dimensional array of strings for data values
257//
258
2d66e025
MB
259WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString, wxGridStringArray);
260
f85afd4e
MB
261
262
263// ------ wxGridStringTable
264//
265// Simplest type of data table for a grid for small tables of strings
266// that are stored in memory
267//
268
2d66e025 269class WXDLLEXPORT wxGridStringTable : public wxGridTableBase
f85afd4e 270{
60ff3b99 271public:
f85afd4e
MB
272 wxGridStringTable();
273 wxGridStringTable( int numRows, int numCols );
274 ~wxGridStringTable();
275
276 // these are pure virtual in wxGridTableBase
277 //
278 long GetNumberRows();
279 long GetNumberCols();
280 wxString GetValue( int row, int col );
281 void SetValue( int row, int col, const wxString& s );
282 bool IsEmptyCell( int row, int col );
60ff3b99 283
f85afd4e
MB
284 // overridden functions from wxGridTableBase
285 //
286 void Clear();
287 bool InsertRows( size_t pos = 0, size_t numRows = 1 );
288 bool AppendRows( size_t numRows = 1 );
289 bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
290 bool InsertCols( size_t pos = 0, size_t numCols = 1 );
291 bool AppendCols( size_t numCols = 1 );
292 bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
293
294 void SetRowLabelValue( int row, const wxString& );
295 void SetColLabelValue( int col, const wxString& );
296 wxString GetRowLabelValue( int row );
297 wxString GetColLabelValue( int col );
60ff3b99
VZ
298
299private:
300 wxGridStringArray m_data;
301
302 // These only get used if you set your own labels, otherwise the
303 // GetRow/ColLabelValue functions return wxGridTableBase defaults
304 //
305 wxArrayString m_rowLabels;
306 wxArrayString m_colLabels;
307
f85afd4e
MB
308 DECLARE_DYNAMIC_CLASS( wxGridStringTable )
309};
310
311
312
f85afd4e
MB
313//////////////////////////////////////////////////////////////////////
314//
315// Grid view classes
316//
317//////////////////////////////////////////////////////////////////////
318
2d66e025 319class WXDLLEXPORT wxGridCellCoords
f85afd4e 320{
60ff3b99 321public:
f85afd4e
MB
322 wxGridCellCoords() { m_row = m_col = -1; }
323 wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; }
324
325 // default copy ctor is ok
326
327 long GetRow() const { return m_row; }
328 void SetRow( long n ) { m_row = n; }
329 long GetCol() const { return m_col; }
330 void SetCol( long n ) { m_col = n; }
331 void Set( long row, long col ) { m_row = row; m_col = col; }
60ff3b99 332
f85afd4e
MB
333 wxGridCellCoords& operator=( const wxGridCellCoords& other )
334 {
335 if ( &other != this )
336 {
337 m_row=other.m_row;
338 m_col=other.m_col;
339 }
340 return *this;
341 }
342
343 bool operator==( const wxGridCellCoords& other )
344 {
345 return (m_row == other.m_row && m_col == other.m_col);
346 }
347
348 bool operator!=( const wxGridCellCoords& other )
349 {
350 return (m_row != other.m_row || m_col != other.m_col);
351 }
352
353 bool operator!()
354 {
355 return (m_row == -1 && m_col == -1 );
356 }
60ff3b99
VZ
357
358private:
359 long m_row;
360 long m_col;
f85afd4e
MB
361};
362
363
364// For comparisons...
365//
366extern wxGridCellCoords wxGridNoCellCoords;
367extern wxRect wxGridNoCellRect;
368
2d66e025
MB
369// An array of cell coords...
370//
371WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords, wxGridCellCoordsArray);
372
373
f85afd4e
MB
374
375// This set of classes is to provide for the use of different types of
60ff3b99 376// cell edit controls in the grid while avoiding the wx class info
f85afd4e
MB
377// system in deference to wxPython
378
2d66e025 379class WXDLLEXPORT wxGridTextCtrl : public wxTextCtrl
f85afd4e 380{
60ff3b99 381public:
f85afd4e
MB
382 wxGridTextCtrl() {}
383 wxGridTextCtrl( wxWindow *,
2d66e025 384 wxGrid *,
f85afd4e
MB
385 bool isCellControl,
386 wxWindowID id,
387 const wxString& value = wxEmptyString,
388 const wxPoint& pos = wxDefaultPosition,
389 const wxSize& size = wxDefaultSize,
390 long style = 0 );
391
392 void SetStartValue( const wxString& );
393 wxString GetStartValue() { return startValue; }
60ff3b99
VZ
394
395private:
396 wxGrid *m_grid;
397
398 // TRUE for controls placed over cells,
399 // FALSE for a control on a grid control panel
400 bool m_isCellControl;
401
402 wxString startValue;
403
404 void OnKeyDown( wxKeyEvent& );
405
f85afd4e
MB
406 DECLARE_DYNAMIC_CLASS( wxGridTextCtrl )
407 DECLARE_EVENT_TABLE()
408};
409
b99be8fb
VZ
410// ----------------------------------------------------------------------------
411// wxGrid
412// ----------------------------------------------------------------------------
f85afd4e 413
60ff3b99
VZ
414class WXDLLEXPORT wxGrid : public wxScrolledWindow
415{
416public:
f85afd4e 417 wxGrid()
b99be8fb 418 {
58dd5b3b
MB
419 m_table = (wxGridTableBase *) NULL;
420 m_gridWin = (wxGridWindow *) NULL;
421 m_rowLabelWin = (wxGridRowLabelWindow *) NULL;
422 m_colLabelWin = (wxGridColLabelWindow *) NULL;
423 m_cornerLabelWin = (wxGridCornerLabelWindow *) NULL;
424 m_cellEditCtrl = (wxWindow *) NULL;
425 }
60ff3b99 426
f85afd4e
MB
427 wxGrid( wxWindow *parent,
428 wxWindowID id,
429 const wxPoint& pos = wxDefaultPosition,
430 const wxSize& size = wxDefaultSize,
431 long style = 0,
2d66e025
MB
432 const wxString& name = wxPanelNameStr );
433
60ff3b99 434 ~wxGrid();
f85afd4e 435
2d66e025
MB
436 bool CreateGrid( int numRows, int numCols );
437
60ff3b99 438
2d66e025
MB
439 // ------ grid dimensions
440 //
441 int GetNumberRows() { return m_numRows; }
442 int GetNumberCols() { return m_numCols; }
443
60ff3b99 444
2d66e025
MB
445 // ------ display update functions
446 //
60ff3b99 447 void CalcRowLabelsExposed( wxRegion& reg );
8fb66724 448
60ff3b99
VZ
449 void CalcColLabelsExposed( wxRegion& reg );
450 void CalcCellsExposed( wxRegion& reg );
451
2d66e025 452
2d66e025
MB
453 // ------ event handlers
454 //
455 void ProcessRowLabelMouseEvent( wxMouseEvent& event );
456 void ProcessColLabelMouseEvent( wxMouseEvent& event );
457 void ProcessCornerLabelMouseEvent( wxMouseEvent& event );
60ff3b99 458 void ProcessGridCellMouseEvent( wxMouseEvent& event );
2d66e025 459 bool ProcessTableMessage( wxGridTableMessage& );
f85afd4e 460
6d004f67
MB
461 void DoEndDragResizeRow();
462 void DoEndDragResizeCol();
60ff3b99 463
f85afd4e
MB
464 wxGridTableBase * GetTable() const { return m_table; }
465 void SetTable( wxGridTableBase *table ) { m_table = table; }
466
467 void ClearGrid();
468 bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE );
469 bool AppendRows( int numRows = 1, bool updateLabels=TRUE );
470 bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE );
471 bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE );
472 bool AppendCols( int numCols = 1, bool updateLabels=TRUE );
60ff3b99 473 bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE );
f85afd4e 474
2d66e025
MB
475 void DrawGridCellArea( wxDC& dc );
476 void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
4634a5d6 477 void DrawAllGridLines( wxDC& dc, const wxRegion & reg );
2d66e025
MB
478 void DrawCell( wxDC& dc, const wxGridCellCoords& );
479 void DrawCellBackground( wxDC& dc, const wxGridCellCoords& );
480 void DrawCellValue( wxDC& dc, const wxGridCellCoords& );
1f1ce288 481
2d66e025
MB
482 void DrawRowLabels( wxDC& dc );
483 void DrawRowLabel( wxDC& dc, int row );
8fb66724 484
2d66e025
MB
485 void DrawColLabels( wxDC& dc );
486 void DrawColLabel( wxDC& dc, int col );
60ff3b99 487
f85afd4e 488
2d66e025 489 // ------ Cell text drawing functions
f85afd4e 490 //
2d66e025
MB
491 void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
492 int horizontalAlignment = wxLEFT,
493 int verticalAlignment = wxTOP );
f85afd4e 494
2d66e025
MB
495 // Split a string containing newline chararcters into an array of
496 // strings and return the number of lines
497 //
498 void StringToLines( const wxString& value, wxArrayString& lines );
60ff3b99 499
2d66e025
MB
500 void GetTextBoxSize( wxDC& dc,
501 wxArrayString& lines,
502 long *width, long *height );
60ff3b99 503
2d66e025 504
f85afd4e
MB
505 // ------
506 // Code that does a lot of grid modification can be enclosed
507 // between BeginBatch() and EndBatch() calls to avoid screen
508 // flicker
509 //
510 void BeginBatch() { m_batchCount++; }
511 void EndBatch() { if ( m_batchCount > 0 ) m_batchCount--; }
512 int GetBatchCount() { return m_batchCount; }
513
2d66e025
MB
514
515 // ------ edit control functions
516 //
517 bool IsEditable() { return m_editable; }
518 void EnableEditing( bool edit );
519
60ff3b99 520#if 0 // at the moment the cell edit control is always active
2d66e025 521 void EnableCellEditControl( bool enable );
1f1ce288 522#endif
2d66e025
MB
523
524 bool IsCellEditControlEnabled()
525 { return (m_cellEditCtrl && m_cellEditCtrlEnabled); }
526
2d66e025
MB
527 void ShowCellEditControl();
528 void HideCellEditControl();
529 void SetEditControlValue( const wxString& s = wxEmptyString );
530 void SaveEditControlValue();
531
60ff3b99 532
2d66e025 533 // ------ grid location functions
60ff3b99 534 // Note that all of these functions work with the logical coordinates of
2d66e025
MB
535 // grid cells and labels so you will need to convert from device
536 // coordinates for mouse events etc.
537 //
538 void XYToCell( int x, int y, wxGridCellCoords& );
539 int YToRow( int y );
540 int XToCol( int x );
541
542 int YToEdgeOfRow( int y );
543 int XToEdgeOfCol( int x );
544
545 wxRect CellToRect( int row, int col );
546 wxRect CellToRect( const wxGridCellCoords& coords )
547 { return CellToRect( coords.GetRow(), coords.GetCol() ); }
548
549 int GetGridCursorRow() { return m_currentCellCoords.GetRow(); }
550 int GetGridCursorCol() { return m_currentCellCoords.GetCol(); }
60ff3b99 551
2d66e025
MB
552 // check to see if a cell is either wholly visible (the default arg) or
553 // at least partially visible in the grid window
554 //
555 bool IsVisible( int row, int col, bool wholeCellVisible = TRUE );
556 bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = TRUE )
557 { return IsVisible( coords.GetRow(), coords.GetCol(), wholeCellVisible ); }
558 void MakeCellVisible( int row, int col );
559 void MakeCellVisible( const wxGridCellCoords& coords )
560 { MakeCellVisible( coords.GetRow(), coords.GetCol() ); }
561
60ff3b99 562
2d66e025
MB
563 // ------ grid cursor movement functions
564 //
dfaf42d2 565 void SetGridCursor( int row, int col )
b27f2615 566 { SetCurrentCell( wxGridCellCoords(row, col) ); }
dfaf42d2 567
2d66e025
MB
568 bool MoveCursorUp();
569 bool MoveCursorDown();
570 bool MoveCursorLeft();
571 bool MoveCursorRight();
572 bool MovePageDown();
573 bool MovePageUp();
574 bool MoveCursorUpBlock();
575 bool MoveCursorDownBlock();
576 bool MoveCursorLeftBlock();
577 bool MoveCursorRightBlock();
578
60ff3b99 579
f85afd4e
MB
580 // ------ label and gridline formatting
581 //
582 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH; }
583 int GetRowLabelSize() { return m_rowLabelWidth; }
60ff3b99 584 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT; }
f85afd4e
MB
585 int GetColLabelSize() { return m_colLabelHeight; }
586 wxColour GetLabelBackgroundColour() { return m_labelBackgroundColour; }
587 wxColour GetLabelTextColour() { return m_labelTextColour; }
588 wxFont GetLabelFont() { return m_labelFont; }
589 void GetRowLabelAlignment( int *horiz, int *vert );
590 void GetColLabelAlignment( int *horiz, int *vert );
591 wxString GetRowLabelValue( int row );
592 wxString GetColLabelValue( int col );
593 wxColour GetGridLineColour() { return m_gridLineColour; }
594
2d66e025 595 void SetRowLabelSize( int width );
f85afd4e
MB
596 void SetColLabelSize( int height );
597 void SetLabelBackgroundColour( const wxColour& );
598 void SetLabelTextColour( const wxColour& );
599 void SetLabelFont( const wxFont& );
600 void SetRowLabelAlignment( int horiz, int vert );
601 void SetColLabelAlignment( int horiz, int vert );
602 void SetRowLabelValue( int row, const wxString& );
603 void SetColLabelValue( int col, const wxString& );
604 void SetGridLineColour( const wxColour& );
605
606 void EnableGridLines( bool enable = TRUE );
607 bool GridLinesEnabled() { return m_gridLinesEnabled; }
608
2d66e025 609
f85afd4e
MB
610 // ------ row and col formatting
611 //
612 int GetDefaultRowSize();
613 int GetRowSize( int row );
614 int GetDefaultColSize();
615 int GetColSize( int col );
616 wxColour GetDefaultCellBackgroundColour();
617 wxColour GetCellBackgroundColour( int row, int col );
618 wxColour GetDefaultCellTextColour();
619 wxColour GetCellTextColour( int row, int col );
f85afd4e
MB
620 wxFont GetDefaultCellFont();
621 wxFont GetCellFont( int row, int col );
622 void GetDefaultCellAlignment( int *horiz, int *vert );
623 void GetCellAlignment( int row, int col, int *horiz, int *vert );
60ff3b99 624
f85afd4e
MB
625 void SetDefaultRowSize( int height, bool resizeExistingRows = FALSE );
626 void SetRowSize( int row, int height );
627 void SetDefaultColSize( int width, bool resizeExistingCols = FALSE );
8fb66724 628
f85afd4e
MB
629 void SetColSize( int col, int width );
630 void SetDefaultCellBackgroundColour( const wxColour& );
631 void SetCellBackgroundColour( int row, int col, const wxColour& );
632 void SetDefaultCellTextColour( const wxColour& );
8fb66724 633
f85afd4e 634 void SetCellTextColour( int row, int col, const wxColour& );
f85afd4e
MB
635 void SetDefaultCellFont( const wxFont& );
636 void SetCellFont( int row, int col, const wxFont& );
637 void SetDefaultCellAlignment( int horiz, int vert );
638 void SetCellAlignment( int row, int col, int horiz, int vert );
639
60a67569 640
f85afd4e
MB
641 // ------ cell value accessors
642 //
643 wxString GetCellValue( int row, int col )
644 {
645 if ( m_table )
646 {
647 return m_table->GetValue( row, col );
648 }
649 else
650 {
651 return wxEmptyString;
652 }
653 }
654
655 wxString GetCellValue( const wxGridCellCoords& coords )
656 { return GetCellValue( coords.GetRow(), coords.GetCol() ); }
60ff3b99 657
f85afd4e
MB
658 void SetCellValue( int row, int col, const wxString& s );
659 void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
660 { SetCellValue( coords.GetRow(), coords.GetCol(), s ); }
f85afd4e 661
60ff3b99 662
f85afd4e
MB
663
664 // ------ selections of blocks of cells
665 //
666 void SelectRow( int row, bool addToSelected = FALSE );
667 void SelectCol( int col, bool addToSelected = FALSE );
60ff3b99 668
f85afd4e
MB
669 void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol );
670
671 void SelectBlock( const wxGridCellCoords& topLeft,
672 const wxGridCellCoords& bottomRight )
673 { SelectBlock( topLeft.GetRow(), topLeft.GetCol(),
674 bottomRight.GetRow(), bottomRight.GetCol() ); }
675
676 void SelectAll();
60ff3b99 677
f85afd4e
MB
678 bool IsSelection()
679 { return ( m_selectedTopLeft != wxGridNoCellCoords &&
680 m_selectedBottomRight != wxGridNoCellCoords );
681 }
682
683 void ClearSelection();
684
685 bool IsInSelection( int row, int col )
686 { return ( IsSelection() &&
687 row >= m_selectedTopLeft.GetRow() &&
688 col >= m_selectedTopLeft.GetCol() &&
689 row <= m_selectedBottomRight.GetRow() &&
690 col <= m_selectedBottomRight.GetCol() );
691 }
692
693 bool IsInSelection( const wxGridCellCoords& coords )
694 { return IsInSelection( coords.GetRow(), coords.GetCol() ); }
695
696 void GetSelection( int* topRow, int* leftCol, int* bottomRow, int* rightCol )
697 {
698 // these will all be -1 if there is no selected block
699 //
700 *topRow = m_selectedTopLeft.GetRow();
701 *leftCol = m_selectedTopLeft.GetCol();
702 *bottomRow = m_selectedBottomRight.GetRow();
703 *rightCol = m_selectedBottomRight.GetCol();
704 }
705
c3baf426
SN
706
707 // This function returns the rectangle that encloses the block of cells
708 // limited by TopLeft and BottomRight cell in device coords and clipped
709 // to the client size of the grid window.
710 //
58dd5b3b 711 wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
b99be8fb 712 const wxGridCellCoords & bottomRight );
c3baf426 713
2d66e025
MB
714 // This function returns the rectangle that encloses the selected cells
715 // in device coords and clipped to the client size of the grid window.
f85afd4e 716 //
c3baf426
SN
717 wxRect SelectionToDeviceRect()
718 {
b99be8fb
VZ
719 return BlockToDeviceRect( m_selectedTopLeft,
720 m_selectedBottomRight );
721 }
60ff3b99 722
f85afd4e
MB
723
724 // ------ For compatibility with previous wxGrid only...
725 //
726 // ************************************************
727 // ** Don't use these in new code because they **
728 // ** are liable to disappear in a future **
729 // ** revision **
730 // ************************************************
731 //
732
733 wxGrid( wxWindow *parent,
734 int x = -1, int y = -1, int w = -1, int h = -1,
735 long style = 0,
736 const wxString& name = wxPanelNameStr )
2d66e025 737 : wxScrolledWindow( parent, -1, wxPoint(x,y), wxSize(w,h), style, name )
60ff3b99 738 {
f85afd4e 739 Create();
60ff3b99 740 }
f85afd4e
MB
741
742 void SetCellValue( const wxString& val, int row, int col )
743 { SetCellValue( row, col, val ); }
60ff3b99 744
f85afd4e
MB
745 void UpdateDimensions()
746 { CalcDimensions(); }
747
748 int GetRows() { return GetNumberRows(); }
749 int GetCols() { return GetNumberCols(); }
750 int GetCursorRow() { return GetGridCursorRow(); }
751 int GetCursorColumn() { return GetGridCursorCol(); }
60ff3b99 752
2d66e025
MB
753 int GetScrollPosX() { return 0; }
754 int GetScrollPosY() { return 0; }
60ff3b99 755
2d66e025
MB
756 void SetScrollX( int x ) { }
757 void SetScrollY( int y ) { }
f85afd4e
MB
758
759 void SetColumnWidth( int col, int width )
760 { SetColSize( col, width ); }
60ff3b99 761
f85afd4e
MB
762 int GetColumnWidth( int col )
763 { return GetColSize( col ); }
60ff3b99 764
f85afd4e
MB
765 void SetRowHeight( int row, int height )
766 { SetRowSize( row, height ); }
60ff3b99 767
f85afd4e
MB
768 int GetRowHeight( int row )
769 { return GetRowSize( row ); }
60ff3b99 770
2d66e025
MB
771 int GetViewHeight() // returned num whole rows visible
772 { return 0; }
60ff3b99 773
2d66e025
MB
774 int GetViewWidth() // returned num whole cols visible
775 { return 0; }
f85afd4e
MB
776
777 void SetLabelSize( int orientation, int sz )
778 {
779 if ( orientation == wxHORIZONTAL )
780 SetColLabelSize( sz );
781 else
782 SetRowLabelSize( sz );
783 }
784
785 int GetLabelSize( int orientation )
786 {
787 if ( orientation == wxHORIZONTAL )
788 return GetColLabelSize();
789 else
790 return GetRowLabelSize();
791 }
792
793 void SetLabelAlignment( int orientation, int align )
794 {
795 if ( orientation == wxHORIZONTAL )
796 SetColLabelAlignment( align, -1 );
797 else
798 SetRowLabelAlignment( align, -1 );
799 }
800
af111fc3 801 int GetLabelAlignment( int orientation, int WXUNUSED(align) )
f85afd4e
MB
802 {
803 int h, v;
804 if ( orientation == wxHORIZONTAL )
805 {
806 GetColLabelAlignment( &h, &v );
807 return h;
808 }
809 else
810 {
811 GetRowLabelAlignment( &h, &v );
812 return h;
813 }
814 }
815
816 void SetLabelValue( int orientation, const wxString& val, int pos )
817 {
818 if ( orientation == wxHORIZONTAL )
819 SetColLabelValue( pos, val );
820 else
821 SetRowLabelValue( pos, val );
822 }
60ff3b99 823
f85afd4e
MB
824 wxString GetLabelValue( int orientation, int pos)
825 {
826 if ( orientation == wxHORIZONTAL )
827 return GetColLabelValue( pos );
828 else
829 return GetRowLabelValue( pos );
830 }
831
60ff3b99 832 wxFont GetCellTextFont() const
f85afd4e 833 { return m_defaultCellFont; }
60ff3b99 834
af111fc3 835 wxFont GetCellTextFont(int WXUNUSED(row), int WXUNUSED(col)) const
f85afd4e 836 { return m_defaultCellFont; }
60ff3b99 837
f85afd4e
MB
838 void SetCellTextFont(const wxFont& fnt)
839 { SetDefaultCellFont( fnt ); }
60ff3b99 840
f85afd4e
MB
841 void SetCellTextFont(const wxFont& fnt, int row, int col)
842 { SetCellFont( row, col, fnt ); }
60ff3b99 843
f85afd4e
MB
844 void SetCellTextColour(const wxColour& val, int row, int col)
845 { SetCellTextColour( row, col, val ); }
60ff3b99 846
f85afd4e
MB
847 void SetCellTextColour(const wxColour& col)
848 { SetDefaultCellTextColour( col ); }
60ff3b99 849
f85afd4e
MB
850 void SetCellBackgroundColour(const wxColour& col)
851 { SetDefaultCellBackgroundColour( col ); }
60ff3b99 852
f85afd4e
MB
853 void SetCellBackgroundColour(const wxColour& colour, int row, int col)
854 { SetCellBackgroundColour( row, col, colour ); }
60ff3b99 855
f85afd4e
MB
856 bool GetEditable() { return IsEditable(); }
857 void SetEditable( bool edit = TRUE ) { EnableEditing( edit ); }
858 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
8fb66724 859
1f1ce288 860 void SetEditInPlace(bool edit = TRUE) { }
f85afd4e 861
60a67569
JS
862 void SetCellAlignment( int align, int row, int col)
863 { SetCellAlignment(row, col, align, wxCENTER); }
864 void SetCellAlignment( int WXUNUSED(align) ) {}
865 void SetCellBitmap(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(row), int WXUNUSED(col))
866 { }
867 void SetDividerPen(const wxPen& WXUNUSED(pen)) { }
868 wxPen& GetDividerPen() const { return wxNullPen; }
869 void OnActivate(bool WXUNUSED(active)) {}
60ff3b99 870
f85afd4e
MB
871 // ******** End of compatibility functions **********
872
2d66e025
MB
873
874
f85afd4e 875 // ------ control IDs
2d66e025 876 enum { wxGRID_CELLCTRL = 2000,
f85afd4e
MB
877 wxGRID_TOPCTRL };
878
879 // ------ control types
2d66e025 880 enum { wxGRID_TEXTCTRL = 2100,
f85afd4e
MB
881 wxGRID_CHECKBOX,
882 wxGRID_CHOICE,
883 wxGRID_COMBOBOX };
884
60ff3b99
VZ
885protected:
886 bool m_created;
4634a5d6 887 bool m_displayed;
60ff3b99
VZ
888
889 wxGridWindow *m_gridWin;
890 wxGridRowLabelWindow *m_rowLabelWin;
891 wxGridColLabelWindow *m_colLabelWin;
892 wxGridCornerLabelWindow *m_cornerLabelWin;
893
60ff3b99
VZ
894 wxGridTableBase *m_table;
895
896 int m_left;
897 int m_top;
898 int m_right;
899 int m_bottom;
900
901 int m_numRows;
902 int m_numCols;
903
904 wxGridCellCoords m_currentCellCoords;
905
906 wxGridCellCoords m_selectedTopLeft;
907 wxGridCellCoords m_selectedBottomRight;
908
909 int m_defaultRowHeight;
910 wxArrayInt m_rowHeights;
911 wxArrayInt m_rowBottoms;
912
913 int m_defaultColWidth;
914 wxArrayInt m_colWidths;
915 wxArrayInt m_colRights;
916
917 int m_rowLabelWidth;
918 int m_colLabelHeight;
919
920 wxColour m_labelBackgroundColour;
921 wxColour m_labelTextColour;
922 wxFont m_labelFont;
923
924 int m_rowLabelHorizAlign;
925 int m_rowLabelVertAlign;
926 int m_colLabelHorizAlign;
927 int m_colLabelVertAlign;
928
929 bool m_defaultRowLabelValues;
930 bool m_defaultColLabelValues;
931
932 wxColour m_gridLineColour;
933 bool m_gridLinesEnabled;
934
b99be8fb 935 // default cell attributes
60ff3b99 936 wxFont m_defaultCellFont;
b99be8fb
VZ
937 int m_defaultCellHAlign,
938 m_defaultCellVAlign;
939
940 // do we have some place to store attributes in?
941 bool CanHaveAttributes();
60ff3b99
VZ
942
943 wxGridCellCoordsArray m_cellsExposed;
944 wxArrayInt m_rowsExposed;
945 wxArrayInt m_colsExposed;
946 wxArrayInt m_rowLabelsExposed;
947 wxArrayInt m_colLabelsExposed;
948
949 bool m_inOnKeyDown;
950 int m_batchCount;
951
952 int m_cursorMode;
790cc417 953 enum { WXGRID_CURSOR_SELECT_CELL,
60ff3b99
VZ
954 WXGRID_CURSOR_RESIZE_ROW,
955 WXGRID_CURSOR_RESIZE_COL,
956 WXGRID_CURSOR_SELECT_ROW,
957 WXGRID_CURSOR_SELECT_COL
958 };
959
960 int m_dragLastPos;
961 int m_dragRowOrCol;
962 bool m_isDragging;
963
964 wxGridCellCoords m_selectionStart;
965
966 wxCursor m_rowResizeCursor;
967 wxCursor m_colResizeCursor;
968
969 bool m_editable; // applies to whole grid
970 int m_editCtrlType; // for current cell
971 wxWindow* m_cellEditCtrl;
972 bool m_cellEditCtrlEnabled;
973
974
975 void Create();
976 void Init();
977 void CalcDimensions();
7807d81c 978 void CalcWindowSizes();
60ff3b99
VZ
979 bool Redimension( wxGridTableMessage& );
980
981
982 bool SendEvent( const wxEventType,
983 int row, int col,
984 wxMouseEvent& );
985
986 bool SendEvent( const wxEventType,
987 int row, int col );
988
989
990 void OnPaint( wxPaintEvent& );
991 void OnSize( wxSizeEvent& );
992 void OnKeyDown( wxKeyEvent& );
993
994
995 void SetCurrentCell( const wxGridCellCoords& coords );
996 void SetCurrentCell( int row, int col )
997 { SetCurrentCell( wxGridCellCoords(row, col) ); }
998
999
1000 // ------ functions to get/send data (see also public functions)
1001 //
1002 bool GetModelValues();
1003 bool SetModelValues();
1004
1005
2d66e025 1006 DECLARE_DYNAMIC_CLASS( wxGrid )
f85afd4e
MB
1007 DECLARE_EVENT_TABLE()
1008};
1009
1010
1011
1012
1013
1014//
1015// ------ Grid event class and event types
1016//
1017
1018class WXDLLEXPORT wxGridEvent : public wxNotifyEvent
1019{
60ff3b99 1020public:
f85afd4e
MB
1021 wxGridEvent()
1022 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1023 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1024 {
1025 }
1026
1027 wxGridEvent(int id, wxEventType type, wxObject* obj,
1028 int row=-1, int col=-1, int x=-1, int y=-1,
1029 bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE);
1030
1031 virtual int GetRow() { return m_row; }
1032 virtual int GetCol() { return m_col; }
1033 wxPoint GetPosition() { return wxPoint( m_x, m_y ); }
1034 bool ControlDown() { return m_control; }
1035 bool MetaDown() { return m_meta; }
1036 bool ShiftDown() { return m_shift; }
1037 bool AltDown() { return m_alt; }
2d66e025 1038
60ff3b99
VZ
1039protected:
1040 int m_row;
1041 int m_col;
f85afd4e
MB
1042 int m_x;
1043 int m_y;
1044 bool m_control;
1045 bool m_meta;
1046 bool m_shift;
1047 bool m_alt;
60ff3b99
VZ
1048
1049 DECLARE_DYNAMIC_CLASS(wxGridEvent)
1050};
1051
1052
1053class WXDLLEXPORT wxGridSizeEvent : public wxNotifyEvent
1054{
1055public:
f85afd4e
MB
1056 wxGridSizeEvent()
1057 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1058 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1059 {
1060 }
1061
1062 wxGridSizeEvent(int id, wxEventType type, wxObject* obj,
1063 int rowOrCol=-1, int x=-1, int y=-1,
1064 bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE);
1065
1066 int GetRowOrCol() { return m_rowOrCol; }
1067 wxPoint GetPosition() { return wxPoint( m_x, m_y ); }
1068 bool ControlDown() { return m_control; }
1069 bool MetaDown() { return m_meta; }
1070 bool ShiftDown() { return m_shift; }
1071 bool AltDown() { return m_alt; }
2d66e025 1072
60ff3b99
VZ
1073protected:
1074 int m_rowOrCol;
1075 int m_x;
1076 int m_y;
1077 bool m_control;
1078 bool m_meta;
1079 bool m_shift;
1080 bool m_alt;
1081
2d66e025 1082 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent)
f85afd4e
MB
1083};
1084
1085
1086class WXDLLEXPORT wxGridRangeSelectEvent : public wxNotifyEvent
1087{
60ff3b99 1088public:
f85afd4e 1089 wxGridRangeSelectEvent()
60ff3b99
VZ
1090 : wxNotifyEvent()
1091 {
1092 m_topLeft = wxGridNoCellCoords;
1093 m_bottomRight = wxGridNoCellCoords;
1094 m_control = FALSE;
1095 m_meta = FALSE;
1096 m_shift = FALSE;
1097 m_alt = FALSE;
1098 }
f85afd4e
MB
1099
1100 wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj,
60ff3b99
VZ
1101 const wxGridCellCoords& topLeft,
1102 const wxGridCellCoords& bottomRight,
1103 bool control=FALSE, bool shift=FALSE,
1104 bool alt=FALSE, bool meta=FALSE);
f85afd4e
MB
1105
1106 wxGridCellCoords GetTopLeftCoords() { return m_topLeft; }
1107 wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; }
1108 int GetTopRow() { return m_topLeft.GetRow(); }
1109 int GetBottomRow() { return m_bottomRight.GetRow(); }
1110 int GetLeftCol() { return m_topLeft.GetCol(); }
1111 int GetRightCol() { return m_bottomRight.GetCol(); }
1112 bool ControlDown() { return m_control; }
1113 bool MetaDown() { return m_meta; }
1114 bool ShiftDown() { return m_shift; }
1115 bool AltDown() { return m_alt; }
2d66e025 1116
60ff3b99
VZ
1117protected:
1118 wxGridCellCoords m_topLeft;
1119 wxGridCellCoords m_bottomRight;
1120 bool m_control;
1121 bool m_meta;
1122 bool m_shift;
1123 bool m_alt;
1124
2d66e025 1125 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent)
f85afd4e
MB
1126};
1127
1128
b5f788a5
MB
1129const wxEventType EVT_GRID_CELL_LEFT_CLICK = wxEVT_FIRST + 1580;
1130const wxEventType EVT_GRID_CELL_RIGHT_CLICK = wxEVT_FIRST + 1581;
1131const wxEventType EVT_GRID_CELL_LEFT_DCLICK = wxEVT_FIRST + 1582;
1132const wxEventType EVT_GRID_CELL_RIGHT_DCLICK = wxEVT_FIRST + 1583;
1133const wxEventType EVT_GRID_LABEL_LEFT_CLICK = wxEVT_FIRST + 1584;
1134const wxEventType EVT_GRID_LABEL_RIGHT_CLICK = wxEVT_FIRST + 1585;
1135const wxEventType EVT_GRID_LABEL_LEFT_DCLICK = wxEVT_FIRST + 1586;
1136const wxEventType EVT_GRID_LABEL_RIGHT_DCLICK = wxEVT_FIRST + 1587;
1137const wxEventType EVT_GRID_ROW_SIZE = wxEVT_FIRST + 1588;
1138const wxEventType EVT_GRID_COL_SIZE = wxEVT_FIRST + 1589;
1139const wxEventType EVT_GRID_RANGE_SELECT = wxEVT_FIRST + 1590;
1140const wxEventType EVT_GRID_CELL_CHANGE = wxEVT_FIRST + 1591;
749692cc
MB
1141const wxEventType EVT_GRID_SELECT_CELL = wxEVT_FIRST + 1592;
1142
f85afd4e
MB
1143
1144typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&);
1145typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&);
1146typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&);
1147
b5f788a5
MB
1148#define EVT_GRID_CELL_LEFT_CLICK(fn) { EVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1149#define EVT_GRID_CELL_RIGHT_CLICK(fn) { EVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1150#define EVT_GRID_CELL_LEFT_DCLICK(fn) { EVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1151#define EVT_GRID_CELL_RIGHT_DCLICK(fn) { EVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1152#define EVT_GRID_LABEL_LEFT_CLICK(fn) { EVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1153#define EVT_GRID_LABEL_RIGHT_CLICK(fn) { EVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1154#define EVT_GRID_LABEL_LEFT_DCLICK(fn) { EVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1155#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { EVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1156#define EVT_GRID_ROW_SIZE(fn) { EVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1157#define EVT_GRID_COL_SIZE(fn) { EVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1158#define EVT_GRID_RANGE_SELECT(fn) { EVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
60ff3b99 1159#define EVT_GRID_CELL_CHANGE(fn) { EVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
749692cc 1160#define EVT_GRID_SELECT_CELL(fn) { EVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
f85afd4e
MB
1161
1162
1163#if 0 // TODO: implement these ? others ?
1164
b5f788a5
MB
1165const wxEventType EVT_GRID_CREATE_CELL = wxEVT_FIRST + 1576;
1166const wxEventType EVT_GRID_CHANGE_LABELS = wxEVT_FIRST + 1577;
1167const wxEventType EVT_GRID_CHANGE_SEL_LABEL = wxEVT_FIRST + 1578;
f85afd4e 1168
b5f788a5
MB
1169#define EVT_GRID_CREATE_CELL(fn) { EVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1170#define EVT_GRID_CHANGE_LABELS(fn) { EVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1171#define EVT_GRID_CHANGE_SEL_LABEL(fn) { EVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
f85afd4e
MB
1172
1173#endif
1174
1175#endif // #ifndef __WXGRID_H__
1176
1177#endif // ifndef wxUSE_NEW_GRID
8fb66724 1178