1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGrid and related classes
4 // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
8 // Copyright: (c) Michael Bedward
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
23 #pragma interface "grid.h"
27 #include "wx/scrolwin.h"
28 #include "wx/string.h"
29 #include "wx/scrolbar.h"
31 #include "wx/textctrl.h"
32 #include "wx/combobox.h"
33 #include "wx/dynarray.h"
36 // Default parameters for wxGrid
38 #define WXGRID_DEFAULT_NUMBER_ROWS 10
39 #define WXGRID_DEFAULT_NUMBER_COLS 10
41 #define WXGRID_DEFAULT_ROW_HEIGHT 25
43 #define WXGRID_DEFAULT_ROW_HEIGHT 30
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
53 // ----------------------------------------------------------------------------
54 // forward declarations
55 // ----------------------------------------------------------------------------
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
;
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 // ----------------------------------------------------------------------------
74 class WXDLLEXPORT wxGridCellRenderer
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.
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
,
92 // the default renderer for the cells containing string data
93 class WXDLLEXPORT wxGridCellStringRenderer
: public wxGridCellRenderer
97 virtual void Draw(wxGrid
& grid
,
106 // ----------------------------------------------------------------------------
107 // wxGridCellEditor: This class is responsible for providing and manipulating
108 // the in-place edit controls for the grid. Instances of wxGridCellEditor
109 // (actually, instances of derived classes since it is an ABC) can be
110 // associated with the cell attributes for individual cells, rows, columns, or
111 // even for the entire grid.
112 // ----------------------------------------------------------------------------
114 class WXDLLEXPORT wxGridCellEditor
118 virtual ~wxGridCellEditor();
120 bool IsCreated() { return m_control
!= NULL
; }
122 // Creates the actual edit control
123 virtual void Create(wxWindow
* parent
,
125 wxEvtHandler
* evtHandler
) = 0;
127 // Size and position the edit control
128 virtual void SetSize(const wxRect
& rect
);
130 // Show or hide the edit control, use the specified attributes to set
131 // colours/fonts for it
132 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
134 // Fetch the value from the table and prepare the edit control
135 // to begin editing. Set the focus to the edit control.
136 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
) = 0;
138 // Complete the editing of the current cell. If saveValue is
139 // true then send the new value back to the table. Returns true
140 // if the value has changed. If necessary, the control may be
142 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
) = 0;
144 // Reset the value in the control back to its starting value
145 virtual void Reset() = 0;
147 // If the editor is enabled by pressing keys on the grid,
148 // this will be called to let the editor do something about
149 // that first key if desired.
150 virtual void StartingKey(wxKeyEvent
& event
);
152 // Some types of controls on some platforms may need some help
153 // with the Return key.
154 virtual void HandleReturn(wxKeyEvent
& event
);
157 virtual void Destroy();
160 // the control we show on screen
161 wxControl
* m_control
;
163 // if we change the colours/font of the control from the default ones, we
164 // must restore the default later and we save them here between calls to
165 // Show(TRUE) and Show(FALSE)
172 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
175 wxGridCellTextEditor();
177 virtual void Create(wxWindow
* parent
,
179 wxEvtHandler
* evtHandler
);
181 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
182 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
184 virtual void Reset();
185 virtual void StartingKey(wxKeyEvent
& event
);
186 virtual void HandleReturn(wxKeyEvent
& event
);
190 wxString m_startValue
;
193 // ----------------------------------------------------------------------------
194 // wxGridCellAttr: this class can be used to alter the cells appearance in
195 // the grid by changing their colour/font/... from default. An object of this
196 // class may be returned by wxGridTable::GetAttr().
197 // ----------------------------------------------------------------------------
199 class WXDLLEXPORT wxGridCellAttr
209 // VZ: considering the number of members wxGridCellAttr has now, this ctor
210 // seems to be pretty useless... may be we should just remove it?
211 wxGridCellAttr(const wxColour
& colText
,
212 const wxColour
& colBack
,
216 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
219 SetAlignment(hAlign
, vAlign
);
222 // default copy ctor ok
224 // this class is ref counted: it is created with ref count of 1, so
225 // calling DecRef() once will delete it. Calling IncRef() allows to lock
226 // it until the matching DecRef() is called
227 void IncRef() { m_nRef
++; }
228 void DecRef() { if ( !--m_nRef
) delete this; }
229 void SafeIncRef() { if ( this ) IncRef(); }
230 void SafeDecRef() { if ( this ) DecRef(); }
233 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
234 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
235 void SetFont(const wxFont
& font
) { m_font
= font
; }
236 void SetAlignment(int hAlign
, int vAlign
)
241 void SetReadOnly(bool isReadOnly
= TRUE
) { m_isReadOnly
= isReadOnly
; }
243 // takes ownership of the pointer
244 void SetRenderer(wxGridCellRenderer
*renderer
)
245 { delete m_renderer
; m_renderer
= renderer
; }
246 void SetEditor(wxGridCellEditor
* editor
)
247 { delete m_editor
; m_editor
= editor
; }
250 bool HasTextColour() const { return m_colText
.Ok(); }
251 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
252 bool HasFont() const { return m_font
.Ok(); }
253 bool HasAlignment() const { return m_hAlign
|| m_vAlign
; }
254 bool HasRenderer() const { return m_renderer
!= NULL
; }
255 bool HasEditor() const { return m_editor
!= NULL
; }
257 const wxColour
& GetTextColour() const;
258 const wxColour
& GetBackgroundColour() const;
259 const wxFont
& GetFont() const;
260 void GetAlignment(int *hAlign
, int *vAlign
) const;
261 wxGridCellRenderer
*GetRenderer() const;
262 wxGridCellEditor
*GetEditor() const;
264 bool IsReadOnly() const { return m_isReadOnly
; }
266 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
269 // the common part of all ctors
274 m_isReadOnly
= FALSE
;
280 // the dtor is private because only DecRef() can delete us
281 ~wxGridCellAttr() { delete m_renderer
; delete m_editor
; }
283 // the ref count - when it goes to 0, we die
292 wxGridCellRenderer
* m_renderer
;
293 wxGridCellEditor
* m_editor
;
294 wxGridCellAttr
* m_defGridAttr
;
298 // suppress the stupid gcc warning about the class having private dtor and
300 friend class wxGridCellAttrDummyFriend
;
303 // ----------------------------------------------------------------------------
304 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
306 // ----------------------------------------------------------------------------
308 // implementation note: we separate it from wxGridTableBase because we wish to
309 // avoid deriving a new table class if possible, and sometimes it will be
310 // enough to just derive another wxGridCellAttrProvider instead
312 // the default implementation is reasonably efficient for the generic case,
313 // but you might still wish to implement your own for some specific situations
314 // if you have performance problems with the stock one
315 class WXDLLEXPORT wxGridCellAttrProvider
318 wxGridCellAttrProvider();
319 virtual ~wxGridCellAttrProvider();
321 // DecRef() must be called on the returned pointer
322 virtual wxGridCellAttr
*GetAttr(int row
, int col
) const;
324 // all these functions take ownership of the pointer, don't call DecRef()
326 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
327 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
328 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
330 // these functions must be called whenever some rows/cols are deleted
331 // because the internal data must be updated then
332 void UpdateAttrRows( size_t pos
, int numRows
);
333 void UpdateAttrCols( size_t pos
, int numCols
);
338 wxGridCellAttrProviderData
*m_data
;
341 //////////////////////////////////////////////////////////////////////
343 // Grid table classes
345 //////////////////////////////////////////////////////////////////////
348 class WXDLLEXPORT wxGridTableBase
: public wxObject
352 virtual ~wxGridTableBase();
354 // You must override these functions in a derived table class
356 virtual long GetNumberRows() = 0;
357 virtual long GetNumberCols() = 0;
358 virtual wxString
GetValue( int row
, int col
) = 0;
359 virtual void SetValue( int row
, int col
, const wxString
& s
) = 0;
360 virtual bool IsEmptyCell( int row
, int col
) = 0;
362 // Overriding these is optional
364 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
365 virtual wxGrid
* GetView() const { return m_view
; }
367 virtual void Clear() {}
368 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
369 virtual bool AppendRows( size_t numRows
= 1 );
370 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
371 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
372 virtual bool AppendCols( size_t numCols
= 1 );
373 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
375 virtual wxString
GetRowLabelValue( int row
);
376 virtual wxString
GetColLabelValue( int col
);
377 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
378 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
380 // Attribute handling
383 // give us the attr provider to use - we take ownership of the pointer
384 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
386 // get the currently used attr provider (may be NULL)
387 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
389 // change row/col number in attribute if needed
390 void UpdateAttrRows( size_t pos
, int numRows
);
391 void UpdateAttrCols( size_t pos
, int numCols
);
393 // by default forwarded to wxGridCellAttrProvider if any. May be
394 // overridden to handle attributes directly in this class.
395 virtual wxGridCellAttr
*GetAttr( int row
, int col
);
397 // these functions take ownership of the pointer
398 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
399 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
400 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
404 wxGridCellAttrProvider
*m_attrProvider
;
406 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
410 // ----------------------------------------------------------------------------
411 // wxGridTableMessage
412 // ----------------------------------------------------------------------------
414 // IDs for messages sent from grid table to view
416 enum wxGridTableRequest
418 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
419 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
420 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
421 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
422 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
423 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
424 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
425 wxGRIDTABLE_NOTIFY_COLS_DELETED
428 class WXDLLEXPORT wxGridTableMessage
431 wxGridTableMessage();
432 wxGridTableMessage( wxGridTableBase
*table
, int id
,
436 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
437 wxGridTableBase
* GetTableObject() const { return m_table
; }
438 void SetId( int id
) { m_id
= id
; }
439 int GetId() { return m_id
; }
440 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
441 int GetCommandInt() { return m_comInt1
; }
442 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
443 int GetCommandInt2() { return m_comInt2
; }
446 wxGridTableBase
*m_table
;
454 // ------ wxGridStringArray
455 // A 2-dimensional array of strings for data values
458 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
462 // ------ wxGridStringTable
464 // Simplest type of data table for a grid for small tables of strings
465 // that are stored in memory
468 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
472 wxGridStringTable( int numRows
, int numCols
);
473 ~wxGridStringTable();
475 // these are pure virtual in wxGridTableBase
477 long GetNumberRows();
478 long GetNumberCols();
479 wxString
GetValue( int row
, int col
);
480 void SetValue( int row
, int col
, const wxString
& s
);
481 bool IsEmptyCell( int row
, int col
);
483 // overridden functions from wxGridTableBase
486 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
487 bool AppendRows( size_t numRows
= 1 );
488 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
489 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
490 bool AppendCols( size_t numCols
= 1 );
491 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
493 void SetRowLabelValue( int row
, const wxString
& );
494 void SetColLabelValue( int col
, const wxString
& );
495 wxString
GetRowLabelValue( int row
);
496 wxString
GetColLabelValue( int col
);
499 wxGridStringArray m_data
;
501 // These only get used if you set your own labels, otherwise the
502 // GetRow/ColLabelValue functions return wxGridTableBase defaults
504 wxArrayString m_rowLabels
;
505 wxArrayString m_colLabels
;
507 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
512 //////////////////////////////////////////////////////////////////////
516 //////////////////////////////////////////////////////////////////////
518 class WXDLLEXPORT wxGridCellCoords
521 wxGridCellCoords() { m_row
= m_col
= -1; }
522 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
524 // default copy ctor is ok
526 long GetRow() const { return m_row
; }
527 void SetRow( long n
) { m_row
= n
; }
528 long GetCol() const { return m_col
; }
529 void SetCol( long n
) { m_col
= n
; }
530 void Set( long row
, long col
) { m_row
= row
; m_col
= col
; }
532 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
534 if ( &other
!= this )
542 bool operator==( const wxGridCellCoords
& other
)
544 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
547 bool operator!=( const wxGridCellCoords
& other
)
549 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
554 return (m_row
== -1 && m_col
== -1 );
563 // For comparisons...
565 extern wxGridCellCoords wxGridNoCellCoords
;
566 extern wxRect wxGridNoCellRect
;
568 // An array of cell coords...
570 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
574 // ----------------------------------------------------------------------------
576 // ----------------------------------------------------------------------------
578 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
586 wxGrid( wxWindow
*parent
,
588 const wxPoint
& pos
= wxDefaultPosition
,
589 const wxSize
& size
= wxDefaultSize
,
591 const wxString
& name
= wxPanelNameStr
);
595 bool CreateGrid( int numRows
, int numCols
);
598 // ------ grid dimensions
600 int GetNumberRows() { return m_numRows
; }
601 int GetNumberCols() { return m_numCols
; }
604 // ------ display update functions
606 void CalcRowLabelsExposed( wxRegion
& reg
);
608 void CalcColLabelsExposed( wxRegion
& reg
);
609 void CalcCellsExposed( wxRegion
& reg
);
612 // ------ event handlers
614 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
615 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
616 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
617 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
618 bool ProcessTableMessage( wxGridTableMessage
& );
620 void DoEndDragResizeRow();
621 void DoEndDragResizeCol();
623 wxGridTableBase
* GetTable() const { return m_table
; }
624 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
);
627 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
628 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
629 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
630 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
631 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
632 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
634 void DrawGridCellArea( wxDC
& dc
);
635 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
636 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
637 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
638 void DrawCellHighlight( wxDC
& dc
, const wxGridCellAttr
*attr
);
640 void DrawRowLabels( wxDC
& dc
);
641 void DrawRowLabel( wxDC
& dc
, int row
);
643 void DrawColLabels( wxDC
& dc
);
644 void DrawColLabel( wxDC
& dc
, int col
);
647 // ------ Cell text drawing functions
649 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
650 int horizontalAlignment
= wxLEFT
,
651 int verticalAlignment
= wxTOP
);
653 // Split a string containing newline chararcters into an array of
654 // strings and return the number of lines
656 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
658 void GetTextBoxSize( wxDC
& dc
,
659 wxArrayString
& lines
,
660 long *width
, long *height
);
664 // Code that does a lot of grid modification can be enclosed
665 // between BeginBatch() and EndBatch() calls to avoid screen
668 void BeginBatch() { m_batchCount
++; }
669 void EndBatch() { if ( m_batchCount
> 0 ) m_batchCount
--; }
670 int GetBatchCount() { return m_batchCount
; }
673 // ------ edit control functions
675 bool IsEditable() { return m_editable
; }
676 void EnableEditing( bool edit
);
678 void EnableCellEditControl( bool enable
);
680 bool IsCellEditControlEnabled();
682 void ShowCellEditControl();
683 void HideCellEditControl();
684 void SetEditControlValue( const wxString
& s
= wxEmptyString
);
685 void SaveEditControlValue();
688 // ------ grid location functions
689 // Note that all of these functions work with the logical coordinates of
690 // grid cells and labels so you will need to convert from device
691 // coordinates for mouse events etc.
693 void XYToCell( int x
, int y
, wxGridCellCoords
& );
697 int YToEdgeOfRow( int y
);
698 int XToEdgeOfCol( int x
);
700 wxRect
CellToRect( int row
, int col
);
701 wxRect
CellToRect( const wxGridCellCoords
& coords
)
702 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
704 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
705 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
707 // check to see if a cell is either wholly visible (the default arg) or
708 // at least partially visible in the grid window
710 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
711 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
712 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
713 void MakeCellVisible( int row
, int col
);
714 void MakeCellVisible( const wxGridCellCoords
& coords
)
715 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
718 // ------ grid cursor movement functions
720 void SetGridCursor( int row
, int col
)
721 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
724 bool MoveCursorDown();
725 bool MoveCursorLeft();
726 bool MoveCursorRight();
729 bool MoveCursorUpBlock();
730 bool MoveCursorDownBlock();
731 bool MoveCursorLeftBlock();
732 bool MoveCursorRightBlock();
735 // ------ label and gridline formatting
737 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
738 int GetRowLabelSize() { return m_rowLabelWidth
; }
739 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
740 int GetColLabelSize() { return m_colLabelHeight
; }
741 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
742 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
743 wxFont
GetLabelFont() { return m_labelFont
; }
744 void GetRowLabelAlignment( int *horiz
, int *vert
);
745 void GetColLabelAlignment( int *horiz
, int *vert
);
746 wxString
GetRowLabelValue( int row
);
747 wxString
GetColLabelValue( int col
);
748 wxColour
GetGridLineColour() { return m_gridLineColour
; }
750 void SetRowLabelSize( int width
);
751 void SetColLabelSize( int height
);
752 void SetLabelBackgroundColour( const wxColour
& );
753 void SetLabelTextColour( const wxColour
& );
754 void SetLabelFont( const wxFont
& );
755 void SetRowLabelAlignment( int horiz
, int vert
);
756 void SetColLabelAlignment( int horiz
, int vert
);
757 void SetRowLabelValue( int row
, const wxString
& );
758 void SetColLabelValue( int col
, const wxString
& );
759 void SetGridLineColour( const wxColour
& );
761 // this sets the specified attribute for all cells in this row/col
762 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
763 void SetColAttr(int col
, wxGridCellAttr
*attr
);
765 void EnableGridLines( bool enable
= TRUE
);
766 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
768 // ------ row and col formatting
770 int GetDefaultRowSize();
771 int GetRowSize( int row
);
772 int GetDefaultColSize();
773 int GetColSize( int col
);
774 wxColour
GetDefaultCellBackgroundColour();
775 wxColour
GetCellBackgroundColour( int row
, int col
);
776 wxColour
GetDefaultCellTextColour();
777 wxColour
GetCellTextColour( int row
, int col
);
778 wxFont
GetDefaultCellFont();
779 wxFont
GetCellFont( int row
, int col
);
780 void GetDefaultCellAlignment( int *horiz
, int *vert
);
781 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
783 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
784 void SetRowSize( int row
, int height
);
785 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
787 void SetColSize( int col
, int width
);
788 void SetDefaultCellBackgroundColour( const wxColour
& );
789 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
790 void SetDefaultCellTextColour( const wxColour
& );
792 void SetCellTextColour( int row
, int col
, const wxColour
& );
793 void SetDefaultCellFont( const wxFont
& );
794 void SetCellFont( int row
, int col
, const wxFont
& );
795 void SetDefaultCellAlignment( int horiz
, int vert
);
796 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
798 // takes ownership of the pointer
799 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
800 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
801 wxGridCellRenderer
*GetDefaultRenderer() const;
802 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
804 // takes ownership of the pointer
805 void SetDefaultEditor(wxGridCellEditor
*editor
);
806 void SetCellEditor(int row
, int col
, wxGridCellEditor
*editor
);
807 wxGridCellEditor
*GetDefaultEditor() const;
808 wxGridCellEditor
* GetCellEditor(int row
, int col
);
811 // ------ cell value accessors
813 wxString
GetCellValue( int row
, int col
)
817 return m_table
->GetValue( row
, col
);
821 return wxEmptyString
;
825 wxString
GetCellValue( const wxGridCellCoords
& coords
)
826 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
828 void SetCellValue( int row
, int col
, const wxString
& s
);
829 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
830 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
832 // returns TRUE if the cell can't be edited
833 bool IsReadOnly(int row
, int col
) const;
835 // make the cell editable/readonly
836 void SetReadOnly(int row
, int col
, bool isReadOnly
= TRUE
);
838 // ------ selections of blocks of cells
840 void SelectRow( int row
, bool addToSelected
= FALSE
);
841 void SelectCol( int col
, bool addToSelected
= FALSE
);
843 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
845 void SelectBlock( const wxGridCellCoords
& topLeft
,
846 const wxGridCellCoords
& bottomRight
)
847 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
848 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
853 { return ( m_selectedTopLeft
!= wxGridNoCellCoords
&&
854 m_selectedBottomRight
!= wxGridNoCellCoords
);
857 void ClearSelection();
859 bool IsInSelection( int row
, int col
)
860 { return ( IsSelection() &&
861 row
>= m_selectedTopLeft
.GetRow() &&
862 col
>= m_selectedTopLeft
.GetCol() &&
863 row
<= m_selectedBottomRight
.GetRow() &&
864 col
<= m_selectedBottomRight
.GetCol() );
867 bool IsInSelection( const wxGridCellCoords
& coords
)
868 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
870 void GetSelection( int* topRow
, int* leftCol
, int* bottomRow
, int* rightCol
)
872 // these will all be -1 if there is no selected block
874 *topRow
= m_selectedTopLeft
.GetRow();
875 *leftCol
= m_selectedTopLeft
.GetCol();
876 *bottomRow
= m_selectedBottomRight
.GetRow();
877 *rightCol
= m_selectedBottomRight
.GetCol();
881 // This function returns the rectangle that encloses the block of cells
882 // limited by TopLeft and BottomRight cell in device coords and clipped
883 // to the client size of the grid window.
885 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
886 const wxGridCellCoords
& bottomRight
);
888 // This function returns the rectangle that encloses the selected cells
889 // in device coords and clipped to the client size of the grid window.
891 wxRect
SelectionToDeviceRect()
893 return BlockToDeviceRect( m_selectedTopLeft
,
894 m_selectedBottomRight
);
897 // Access or update the selection fore/back colours
898 wxColour
GetSelectionBackground() const
899 { return m_selectionBackground
; }
900 wxColour
GetSelectionForeground() const
901 { return m_selectionForeground
; }
903 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
904 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
908 // ------ For compatibility with previous wxGrid only...
910 // ************************************************
911 // ** Don't use these in new code because they **
912 // ** are liable to disappear in a future **
914 // ************************************************
917 wxGrid( wxWindow
*parent
,
918 int x
= -1, int y
= -1, int w
= -1, int h
= -1,
920 const wxString
& name
= wxPanelNameStr
)
921 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
), style
, name
)
926 void SetCellValue( const wxString
& val
, int row
, int col
)
927 { SetCellValue( row
, col
, val
); }
929 void UpdateDimensions()
930 { CalcDimensions(); }
932 int GetRows() { return GetNumberRows(); }
933 int GetCols() { return GetNumberCols(); }
934 int GetCursorRow() { return GetGridCursorRow(); }
935 int GetCursorColumn() { return GetGridCursorCol(); }
937 int GetScrollPosX() { return 0; }
938 int GetScrollPosY() { return 0; }
940 void SetScrollX( int x
) { }
941 void SetScrollY( int y
) { }
943 void SetColumnWidth( int col
, int width
)
944 { SetColSize( col
, width
); }
946 int GetColumnWidth( int col
)
947 { return GetColSize( col
); }
949 void SetRowHeight( int row
, int height
)
950 { SetRowSize( row
, height
); }
952 int GetRowHeight( int row
)
953 { return GetRowSize( row
); }
955 int GetViewHeight() // returned num whole rows visible
958 int GetViewWidth() // returned num whole cols visible
961 void SetLabelSize( int orientation
, int sz
)
963 if ( orientation
== wxHORIZONTAL
)
964 SetColLabelSize( sz
);
966 SetRowLabelSize( sz
);
969 int GetLabelSize( int orientation
)
971 if ( orientation
== wxHORIZONTAL
)
972 return GetColLabelSize();
974 return GetRowLabelSize();
977 void SetLabelAlignment( int orientation
, int align
)
979 if ( orientation
== wxHORIZONTAL
)
980 SetColLabelAlignment( align
, -1 );
982 SetRowLabelAlignment( align
, -1 );
985 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
988 if ( orientation
== wxHORIZONTAL
)
990 GetColLabelAlignment( &h
, &v
);
995 GetRowLabelAlignment( &h
, &v
);
1000 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1002 if ( orientation
== wxHORIZONTAL
)
1003 SetColLabelValue( pos
, val
);
1005 SetRowLabelValue( pos
, val
);
1008 wxString
GetLabelValue( int orientation
, int pos
)
1010 if ( orientation
== wxHORIZONTAL
)
1011 return GetColLabelValue( pos
);
1013 return GetRowLabelValue( pos
);
1016 wxFont
GetCellTextFont() const
1017 { return m_defaultCellAttr
->GetFont(); }
1019 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1020 { return m_defaultCellAttr
->GetFont(); }
1022 void SetCellTextFont(const wxFont
& fnt
)
1023 { SetDefaultCellFont( fnt
); }
1025 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1026 { SetCellFont( row
, col
, fnt
); }
1028 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1029 { SetCellTextColour( row
, col
, val
); }
1031 void SetCellTextColour(const wxColour
& col
)
1032 { SetDefaultCellTextColour( col
); }
1034 void SetCellBackgroundColour(const wxColour
& col
)
1035 { SetDefaultCellBackgroundColour( col
); }
1037 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1038 { SetCellBackgroundColour( row
, col
, colour
); }
1040 bool GetEditable() { return IsEditable(); }
1041 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1042 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1044 void SetEditInPlace(bool edit
= TRUE
) { }
1046 void SetCellAlignment( int align
, int row
, int col
)
1047 { SetCellAlignment(row
, col
, align
, wxCENTER
); }
1048 void SetCellAlignment( int WXUNUSED(align
) ) {}
1049 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1051 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1052 wxPen
& GetDividerPen() const { return wxNullPen
; }
1053 void OnActivate(bool WXUNUSED(active
)) {}
1055 // ******** End of compatibility functions **********
1059 // ------ control IDs
1060 enum { wxGRID_CELLCTRL
= 2000,
1063 // ------ control types
1064 enum { wxGRID_TEXTCTRL
= 2100,
1073 wxGridWindow
*m_gridWin
;
1074 wxGridRowLabelWindow
*m_rowLabelWin
;
1075 wxGridColLabelWindow
*m_colLabelWin
;
1076 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1078 wxGridTableBase
*m_table
;
1089 wxGridCellCoords m_currentCellCoords
;
1091 wxGridCellCoords m_selectedTopLeft
;
1092 wxGridCellCoords m_selectedBottomRight
;
1093 wxColour m_selectionBackground
;
1094 wxColour m_selectionForeground
;
1096 int m_defaultRowHeight
;
1097 wxArrayInt m_rowHeights
;
1098 wxArrayInt m_rowBottoms
;
1100 int m_defaultColWidth
;
1101 wxArrayInt m_colWidths
;
1102 wxArrayInt m_colRights
;
1103 int m_rowLabelWidth
;
1104 int m_colLabelHeight
;
1106 wxColour m_labelBackgroundColour
;
1107 wxColour m_labelTextColour
;
1110 int m_rowLabelHorizAlign
;
1111 int m_rowLabelVertAlign
;
1112 int m_colLabelHorizAlign
;
1113 int m_colLabelVertAlign
;
1115 bool m_defaultRowLabelValues
;
1116 bool m_defaultColLabelValues
;
1118 wxColour m_gridLineColour
;
1119 bool m_gridLinesEnabled
;
1122 // do we have some place to store attributes in?
1123 bool CanHaveAttributes();
1125 // returns the attribute we may modify in place: a new one if this cell
1126 // doesn't have any yet or the existing one if it does
1128 // DecRef() must be called on the returned pointer, as usual
1129 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1131 // cell attribute cache (currently we only cache 1, may be will do
1132 // more/better later)
1136 wxGridCellAttr
*attr
;
1139 // invalidates the attribute cache
1140 void ClearAttrCache();
1142 // adds an attribute to cache
1143 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1145 // looks for an attr in cache, returns TRUE if found
1146 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1148 // looks for the attr in cache, if not found asks the table and caches the
1150 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1151 wxGridCellAttr
*GetCellAttr(const wxGridCellCoords
& coords
)
1152 { return GetCellAttr( coords
.GetRow(), coords
.GetCol() ); }
1154 // the default cell attr object for cells that don't have their own
1155 wxGridCellAttr
* m_defaultCellAttr
;
1158 wxGridCellCoordsArray m_cellsExposed
;
1159 wxArrayInt m_rowsExposed
;
1160 wxArrayInt m_colsExposed
;
1161 wxArrayInt m_rowLabelsExposed
;
1162 wxArrayInt m_colLabelsExposed
;
1169 WXGRID_CURSOR_SELECT_CELL
,
1170 WXGRID_CURSOR_RESIZE_ROW
,
1171 WXGRID_CURSOR_RESIZE_COL
,
1172 WXGRID_CURSOR_SELECT_ROW
,
1173 WXGRID_CURSOR_SELECT_COL
1176 // this method not only sets m_cursorMode but also sets the correct cursor
1177 // for the given mode and, if captureMouse is not FALSE releases the mouse
1178 // if it was captured and captures it if it must be captured
1180 // for this to work, you should always use it and not set m_cursorMode
1182 void ChangeCursorMode(CursorMode mode
,
1183 wxWindow
*win
= (wxWindow
*)NULL
,
1184 bool captureMouse
= TRUE
);
1186 wxWindow
*m_winCapture
; // the window which captured the mouse
1187 CursorMode m_cursorMode
;
1192 wxPoint m_startDragPos
;
1194 bool m_waitForSlowClick
;
1196 wxGridCellCoords m_selectionStart
;
1198 wxCursor m_rowResizeCursor
;
1199 wxCursor m_colResizeCursor
;
1201 bool m_editable
; // applies to whole grid
1202 bool m_cellEditCtrlEnabled
;
1207 void CalcDimensions();
1208 void CalcWindowSizes();
1209 bool Redimension( wxGridTableMessage
& );
1212 bool SendEvent( const wxEventType
,
1216 bool SendEvent( const wxEventType
,
1220 void OnPaint( wxPaintEvent
& );
1221 void OnSize( wxSizeEvent
& );
1222 void OnKeyDown( wxKeyEvent
& );
1223 void OnEraseBackground( wxEraseEvent
& );
1226 void SetCurrentCell( const wxGridCellCoords
& coords
);
1227 void SetCurrentCell( int row
, int col
)
1228 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1231 // ------ functions to get/send data (see also public functions)
1233 bool GetModelValues();
1234 bool SetModelValues();
1237 DECLARE_DYNAMIC_CLASS( wxGrid
)
1238 DECLARE_EVENT_TABLE()
1246 // ------ Grid event class and event types
1249 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1253 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1254 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1258 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1259 int row
=-1, int col
=-1, int x
=-1, int y
=-1,
1260 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1262 virtual int GetRow() { return m_row
; }
1263 virtual int GetCol() { return m_col
; }
1264 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1265 bool ControlDown() { return m_control
; }
1266 bool MetaDown() { return m_meta
; }
1267 bool ShiftDown() { return m_shift
; }
1268 bool AltDown() { return m_alt
; }
1280 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1284 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1288 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1289 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1293 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1294 int rowOrCol
=-1, int x
=-1, int y
=-1,
1295 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1297 int GetRowOrCol() { return m_rowOrCol
; }
1298 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1299 bool ControlDown() { return m_control
; }
1300 bool MetaDown() { return m_meta
; }
1301 bool ShiftDown() { return m_shift
; }
1302 bool AltDown() { return m_alt
; }
1313 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1317 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1320 wxGridRangeSelectEvent()
1323 m_topLeft
= wxGridNoCellCoords
;
1324 m_bottomRight
= wxGridNoCellCoords
;
1331 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1332 const wxGridCellCoords
& topLeft
,
1333 const wxGridCellCoords
& bottomRight
,
1334 bool control
=FALSE
, bool shift
=FALSE
,
1335 bool alt
=FALSE
, bool meta
=FALSE
);
1337 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1338 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1339 int GetTopRow() { return m_topLeft
.GetRow(); }
1340 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1341 int GetLeftCol() { return m_topLeft
.GetCol(); }
1342 int GetRightCol() { return m_bottomRight
.GetCol(); }
1343 bool ControlDown() { return m_control
; }
1344 bool MetaDown() { return m_meta
; }
1345 bool ShiftDown() { return m_shift
; }
1346 bool AltDown() { return m_alt
; }
1349 wxGridCellCoords m_topLeft
;
1350 wxGridCellCoords m_bottomRight
;
1356 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1360 const wxEventType EVT_GRID_CELL_LEFT_CLICK
= wxEVT_FIRST
+ 1580;
1361 const wxEventType EVT_GRID_CELL_RIGHT_CLICK
= wxEVT_FIRST
+ 1581;
1362 const wxEventType EVT_GRID_CELL_LEFT_DCLICK
= wxEVT_FIRST
+ 1582;
1363 const wxEventType EVT_GRID_CELL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1583;
1364 const wxEventType EVT_GRID_LABEL_LEFT_CLICK
= wxEVT_FIRST
+ 1584;
1365 const wxEventType EVT_GRID_LABEL_RIGHT_CLICK
= wxEVT_FIRST
+ 1585;
1366 const wxEventType EVT_GRID_LABEL_LEFT_DCLICK
= wxEVT_FIRST
+ 1586;
1367 const wxEventType EVT_GRID_LABEL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1587;
1368 const wxEventType EVT_GRID_ROW_SIZE
= wxEVT_FIRST
+ 1588;
1369 const wxEventType EVT_GRID_COL_SIZE
= wxEVT_FIRST
+ 1589;
1370 const wxEventType EVT_GRID_RANGE_SELECT
= wxEVT_FIRST
+ 1590;
1371 const wxEventType EVT_GRID_CELL_CHANGE
= wxEVT_FIRST
+ 1591;
1372 const wxEventType EVT_GRID_SELECT_CELL
= wxEVT_FIRST
+ 1592;
1375 typedef void (wxEvtHandler::*wxGridEventFunction
)(wxGridEvent
&);
1376 typedef void (wxEvtHandler::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1377 typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1379 #define EVT_GRID_CELL_LEFT_CLICK(fn) { EVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1380 #define EVT_GRID_CELL_RIGHT_CLICK(fn) { EVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1381 #define EVT_GRID_CELL_LEFT_DCLICK(fn) { EVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1382 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) { EVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1383 #define EVT_GRID_LABEL_LEFT_CLICK(fn) { EVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1384 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) { EVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1385 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) { EVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1386 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { EVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1387 #define EVT_GRID_ROW_SIZE(fn) { EVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1388 #define EVT_GRID_COL_SIZE(fn) { EVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1389 #define EVT_GRID_RANGE_SELECT(fn) { EVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
1390 #define EVT_GRID_CELL_CHANGE(fn) { EVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1391 #define EVT_GRID_SELECT_CELL(fn) { EVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1394 #if 0 // TODO: implement these ? others ?
1396 const wxEventType EVT_GRID_CREATE_CELL
= wxEVT_FIRST
+ 1576;
1397 const wxEventType EVT_GRID_CHANGE_LABELS
= wxEVT_FIRST
+ 1577;
1398 const wxEventType EVT_GRID_CHANGE_SEL_LABEL
= wxEVT_FIRST
+ 1578;
1400 #define EVT_GRID_CREATE_CELL(fn) { EVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1401 #define EVT_GRID_CHANGE_LABELS(fn) { EVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1402 #define EVT_GRID_CHANGE_SEL_LABEL(fn) { EVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1406 #endif // #ifndef __WXGRID_H__
1408 #endif // ifndef wxUSE_NEW_GRID