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