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
,
127 wxEvtHandler
* evtHandler
) = 0;
129 // Size and position the edit control
130 virtual void SetSize(const wxRect
& rect
);
132 // Show or hide the edit control
133 virtual void Show(bool show
);
135 // Fetch the value from the table and prepare the edit control
136 // to begin editing. Set the focus to the edit control.
137 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
,
138 wxGridCellAttr
* attr
) = 0;
140 // Complete the editing of the current cell. If saveValue is
141 // true then send the new value back to the table. Returns true
142 // if the value has changed. If necessary, the control may be
144 virtual bool EndEdit(int row
, int col
, bool saveValue
,
145 wxGrid
* grid
, wxGridCellAttr
* attr
) = 0;
147 // Reset the value in the control back to its starting value
148 virtual void Reset() = 0;
150 // Some types of controls on some platforms may need some help
151 // with the Return key.
152 virtual void HandleReturn(wxKeyEvent
& event
);
155 virtual void Destroy();
158 wxControl
* m_control
;
162 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
165 wxGridCellTextEditor();
167 virtual void Create(wxWindow
* parent
,
171 wxEvtHandler
* evtHandler
);
173 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
,
174 wxGridCellAttr
* attr
);
176 virtual bool EndEdit(int row
, int col
, bool saveValue
,
177 wxGrid
* grid
, wxGridCellAttr
* attr
);
179 virtual void Reset();
180 virtual void HandleReturn(wxKeyEvent
& event
);
184 wxString m_startValue
;
187 // ----------------------------------------------------------------------------
188 // wxGridCellAttr: this class can be used to alter the cells appearance in
189 // the grid by changing their colour/font/... from default. An object of this
190 // class may be returned by wxGridTable::GetAttr().
191 // ----------------------------------------------------------------------------
193 class WXDLLEXPORT wxGridCellAttr
203 wxGridCellAttr(const wxColour
& colText
,
204 const wxColour
& colBack
,
208 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
211 SetAlignment(hAlign
, vAlign
);
214 // default copy ctor ok
216 // this class is ref counted: it is created with ref count of 1, so
217 // calling DecRef() once will delete it. Calling IncRef() allows to lock
218 // it until the matching DecRef() is called
219 void IncRef() { m_nRef
++; }
220 void DecRef() { if ( !--m_nRef
) delete this; }
221 void SafeIncRef() { if ( this ) IncRef(); }
222 void SafeDecRef() { if ( this ) DecRef(); }
225 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
226 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
227 void SetFont(const wxFont
& font
) { m_font
= font
; }
228 void SetAlignment(int hAlign
, int vAlign
)
234 // takes ownership of the pointer
235 void SetRenderer(wxGridCellRenderer
*renderer
)
236 { delete m_renderer
; m_renderer
= renderer
; }
239 bool HasTextColour() const { return m_colText
.Ok(); }
240 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
241 bool HasFont() const { return m_font
.Ok(); }
242 bool HasAlignment() const { return m_hAlign
|| m_vAlign
; }
243 bool HasRenderer() const { return m_renderer
!= NULL
; }
245 const wxColour
& GetTextColour() const;
246 const wxColour
& GetBackgroundColour() const;
247 const wxFont
& GetFont() const;
248 void GetAlignment(int *hAlign
, int *vAlign
) const;
249 wxGridCellRenderer
*GetRenderer() const;
251 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
254 // the common part of all ctors
255 void Init() { m_nRef
= 1; m_renderer
= (wxGridCellRenderer
*)NULL
; }
257 // the dtor is private because only DecRef() can delete us
258 ~wxGridCellAttr() { delete m_renderer
; }
260 // the ref count - when it goes to 0, we die
269 wxGridCellRenderer
*m_renderer
;
270 wxGridCellAttr
* m_defGridAttr
;
272 // suppress the stupid gcc warning about the class having private dtor and
274 friend class wxGridCellAttrDummyFriend
;
277 // ----------------------------------------------------------------------------
278 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
280 // ----------------------------------------------------------------------------
282 // implementation note: we separate it from wxGridTableBase because we wish to
283 // avoid deriving a new table class if possible, and sometimes it will be
284 // enough to just derive another wxGridCellAttrProvider instead
286 // the default implementation is reasonably efficient for the generic case,
287 // but you might still wish to implement your own for some specific situations
288 // if you have performance problems with the stock one
289 class WXDLLEXPORT wxGridCellAttrProvider
292 wxGridCellAttrProvider();
293 virtual ~wxGridCellAttrProvider();
295 // DecRef() must be called on the returned pointer
296 virtual wxGridCellAttr
*GetAttr(int row
, int col
) const;
298 // all these functions take ownership of the pointer, don't call DecRef()
300 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
301 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
302 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
307 wxGridCellAttrProviderData
*m_data
;
310 //////////////////////////////////////////////////////////////////////
312 // Grid table classes
314 //////////////////////////////////////////////////////////////////////
317 class WXDLLEXPORT wxGridTableBase
: public wxObject
321 virtual ~wxGridTableBase();
323 // You must override these functions in a derived table class
325 virtual long GetNumberRows() = 0;
326 virtual long GetNumberCols() = 0;
327 virtual wxString
GetValue( int row
, int col
) = 0;
328 virtual void SetValue( int row
, int col
, const wxString
& s
) = 0;
329 virtual bool IsEmptyCell( int row
, int col
) = 0;
331 // Overriding these is optional
333 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
334 virtual wxGrid
* GetView() const { return m_view
; }
336 virtual void Clear() {}
337 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
338 virtual bool AppendRows( size_t numRows
= 1 );
339 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
340 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
341 virtual bool AppendCols( size_t numCols
= 1 );
342 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
344 virtual wxString
GetRowLabelValue( int row
);
345 virtual wxString
GetColLabelValue( int col
);
346 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
347 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
349 // Attribute handling
352 // give us the attr provider to use - we take ownership of the pointer
353 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
355 // get the currently used attr provider (may be NULL)
356 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
358 // by default forwarded to wxGridCellAttrProvider if any. May be
359 // overridden to handle attributes directly in this class.
360 virtual wxGridCellAttr
*GetAttr( int row
, int col
);
362 // these functions take ownership of the pointer
363 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
364 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
365 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
369 wxGridCellAttrProvider
*m_attrProvider
;
371 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
375 // ----------------------------------------------------------------------------
376 // wxGridTableMessage
377 // ----------------------------------------------------------------------------
379 // IDs for messages sent from grid table to view
381 enum wxGridTableRequest
383 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
384 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
385 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
386 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
387 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
388 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
389 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
390 wxGRIDTABLE_NOTIFY_COLS_DELETED
393 class WXDLLEXPORT wxGridTableMessage
396 wxGridTableMessage();
397 wxGridTableMessage( wxGridTableBase
*table
, int id
,
401 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
402 wxGridTableBase
* GetTableObject() const { return m_table
; }
403 void SetId( int id
) { m_id
= id
; }
404 int GetId() { return m_id
; }
405 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
406 int GetCommandInt() { return m_comInt1
; }
407 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
408 int GetCommandInt2() { return m_comInt2
; }
411 wxGridTableBase
*m_table
;
419 // ------ wxGridStringArray
420 // A 2-dimensional array of strings for data values
423 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
427 // ------ wxGridStringTable
429 // Simplest type of data table for a grid for small tables of strings
430 // that are stored in memory
433 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
437 wxGridStringTable( int numRows
, int numCols
);
438 ~wxGridStringTable();
440 // these are pure virtual in wxGridTableBase
442 long GetNumberRows();
443 long GetNumberCols();
444 wxString
GetValue( int row
, int col
);
445 void SetValue( int row
, int col
, const wxString
& s
);
446 bool IsEmptyCell( int row
, int col
);
448 // overridden functions from wxGridTableBase
451 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
452 bool AppendRows( size_t numRows
= 1 );
453 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
454 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
455 bool AppendCols( size_t numCols
= 1 );
456 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
458 void SetRowLabelValue( int row
, const wxString
& );
459 void SetColLabelValue( int col
, const wxString
& );
460 wxString
GetRowLabelValue( int row
);
461 wxString
GetColLabelValue( int col
);
464 wxGridStringArray m_data
;
466 // These only get used if you set your own labels, otherwise the
467 // GetRow/ColLabelValue functions return wxGridTableBase defaults
469 wxArrayString m_rowLabels
;
470 wxArrayString m_colLabels
;
472 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
477 //////////////////////////////////////////////////////////////////////
481 //////////////////////////////////////////////////////////////////////
483 class WXDLLEXPORT wxGridCellCoords
486 wxGridCellCoords() { m_row
= m_col
= -1; }
487 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
489 // default copy ctor is ok
491 long GetRow() const { return m_row
; }
492 void SetRow( long n
) { m_row
= n
; }
493 long GetCol() const { return m_col
; }
494 void SetCol( long n
) { m_col
= n
; }
495 void Set( long row
, long col
) { m_row
= row
; m_col
= col
; }
497 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
499 if ( &other
!= this )
507 bool operator==( const wxGridCellCoords
& other
)
509 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
512 bool operator!=( const wxGridCellCoords
& other
)
514 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
519 return (m_row
== -1 && m_col
== -1 );
528 // For comparisons...
530 extern wxGridCellCoords wxGridNoCellCoords
;
531 extern wxRect wxGridNoCellRect
;
533 // An array of cell coords...
535 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
539 // This set of classes is to provide for the use of different types of
540 // cell edit controls in the grid while avoiding the wx class info
541 // system in deference to wxPython
543 class WXDLLEXPORT wxGridTextCtrl
: public wxTextCtrl
547 wxGridTextCtrl( wxWindow
*,
551 const wxString
& value
= wxEmptyString
,
552 const wxPoint
& pos
= wxDefaultPosition
,
553 const wxSize
& size
= wxDefaultSize
,
556 void SetStartValue( const wxString
& );
557 wxString
GetStartValue() { return startValue
; }
562 // TRUE for controls placed over cells,
563 // FALSE for a control on a grid control panel
564 bool m_isCellControl
;
568 void OnKeyDown( wxKeyEvent
& );
570 DECLARE_DYNAMIC_CLASS( wxGridTextCtrl
)
571 DECLARE_EVENT_TABLE()
574 //-----------------------------------------------------------------------------
575 // wxGridEditTimer (internal)
576 //-----------------------------------------------------------------------------
578 class WXDLLEXPORT wxGridEditTimer
: public wxTimer
584 wxGridEditTimer( wxGrid
*owner
);
588 // ----------------------------------------------------------------------------
590 // ----------------------------------------------------------------------------
592 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
597 m_table
= (wxGridTableBase
*) NULL
;
598 m_gridWin
= (wxGridWindow
*) NULL
;
599 m_rowLabelWin
= (wxGridRowLabelWindow
*) NULL
;
600 m_colLabelWin
= (wxGridColLabelWindow
*) NULL
;
601 m_cornerLabelWin
= (wxGridCornerLabelWindow
*) NULL
;
602 m_cellEditCtrl
= (wxWindow
*) NULL
;
605 wxGrid( wxWindow
*parent
,
607 const wxPoint
& pos
= wxDefaultPosition
,
608 const wxSize
& size
= wxDefaultSize
,
610 const wxString
& name
= wxPanelNameStr
);
614 bool CreateGrid( int numRows
, int numCols
);
617 // ------ grid dimensions
619 int GetNumberRows() { return m_numRows
; }
620 int GetNumberCols() { return m_numCols
; }
623 // ------ display update functions
625 void CalcRowLabelsExposed( wxRegion
& reg
);
627 void CalcColLabelsExposed( wxRegion
& reg
);
628 void CalcCellsExposed( wxRegion
& reg
);
631 // ------ event handlers
633 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
634 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
635 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
636 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
637 bool ProcessTableMessage( wxGridTableMessage
& );
639 void DoEndDragResizeRow();
640 void DoEndDragResizeCol();
642 wxGridTableBase
* GetTable() const { return m_table
; }
643 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
);
646 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
647 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
648 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
649 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
650 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
651 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
653 void DrawGridCellArea( wxDC
& dc
);
654 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
655 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
656 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
658 void DrawRowLabels( wxDC
& dc
);
659 void DrawRowLabel( wxDC
& dc
, int row
);
661 void DrawColLabels( wxDC
& dc
);
662 void DrawColLabel( wxDC
& dc
, int col
);
665 // ------ Cell text drawing functions
667 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
668 int horizontalAlignment
= wxLEFT
,
669 int verticalAlignment
= wxTOP
);
671 // Split a string containing newline chararcters into an array of
672 // strings and return the number of lines
674 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
676 void GetTextBoxSize( wxDC
& dc
,
677 wxArrayString
& lines
,
678 long *width
, long *height
);
682 // Code that does a lot of grid modification can be enclosed
683 // between BeginBatch() and EndBatch() calls to avoid screen
686 void BeginBatch() { m_batchCount
++; }
687 void EndBatch() { if ( m_batchCount
> 0 ) m_batchCount
--; }
688 int GetBatchCount() { return m_batchCount
; }
691 // ------ edit control functions
693 bool IsEditable() { return m_editable
; }
694 void EnableEditing( bool edit
);
696 void EnableCellEditControl( bool enable
);
698 bool IsCellEditControlEnabled()
699 { return (m_cellEditCtrl
&& m_cellEditCtrlEnabled
); }
701 void ShowCellEditControl();
702 void HideCellEditControl();
703 void SetEditControlValue( const wxString
& s
= wxEmptyString
);
704 void SaveEditControlValue();
707 // ------ grid location functions
708 // Note that all of these functions work with the logical coordinates of
709 // grid cells and labels so you will need to convert from device
710 // coordinates for mouse events etc.
712 void XYToCell( int x
, int y
, wxGridCellCoords
& );
716 int YToEdgeOfRow( int y
);
717 int XToEdgeOfCol( int x
);
719 wxRect
CellToRect( int row
, int col
);
720 wxRect
CellToRect( const wxGridCellCoords
& coords
)
721 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
723 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
724 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
726 // check to see if a cell is either wholly visible (the default arg) or
727 // at least partially visible in the grid window
729 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
730 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
731 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
732 void MakeCellVisible( int row
, int col
);
733 void MakeCellVisible( const wxGridCellCoords
& coords
)
734 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
737 // ------ grid cursor movement functions
739 void SetGridCursor( int row
, int col
)
740 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
743 bool MoveCursorDown();
744 bool MoveCursorLeft();
745 bool MoveCursorRight();
748 bool MoveCursorUpBlock();
749 bool MoveCursorDownBlock();
750 bool MoveCursorLeftBlock();
751 bool MoveCursorRightBlock();
754 // ------ label and gridline formatting
756 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
757 int GetRowLabelSize() { return m_rowLabelWidth
; }
758 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
759 int GetColLabelSize() { return m_colLabelHeight
; }
760 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
761 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
762 wxFont
GetLabelFont() { return m_labelFont
; }
763 void GetRowLabelAlignment( int *horiz
, int *vert
);
764 void GetColLabelAlignment( int *horiz
, int *vert
);
765 wxString
GetRowLabelValue( int row
);
766 wxString
GetColLabelValue( int col
);
767 wxColour
GetGridLineColour() { return m_gridLineColour
; }
769 void SetRowLabelSize( int width
);
770 void SetColLabelSize( int height
);
771 void SetLabelBackgroundColour( const wxColour
& );
772 void SetLabelTextColour( const wxColour
& );
773 void SetLabelFont( const wxFont
& );
774 void SetRowLabelAlignment( int horiz
, int vert
);
775 void SetColLabelAlignment( int horiz
, int vert
);
776 void SetRowLabelValue( int row
, const wxString
& );
777 void SetColLabelValue( int col
, const wxString
& );
778 void SetGridLineColour( const wxColour
& );
780 // this sets the specified attribute for all cells in this row/col
781 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
782 void SetColAttr(int col
, wxGridCellAttr
*attr
);
784 void EnableGridLines( bool enable
= TRUE
);
785 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
787 // ------ row and col formatting
789 int GetDefaultRowSize();
790 int GetRowSize( int row
);
791 int GetDefaultColSize();
792 int GetColSize( int col
);
793 wxColour
GetDefaultCellBackgroundColour();
794 wxColour
GetCellBackgroundColour( int row
, int col
);
795 wxColour
GetDefaultCellTextColour();
796 wxColour
GetCellTextColour( int row
, int col
);
797 wxFont
GetDefaultCellFont();
798 wxFont
GetCellFont( int row
, int col
);
799 void GetDefaultCellAlignment( int *horiz
, int *vert
);
800 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
802 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
803 void SetRowSize( int row
, int height
);
804 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
806 void SetColSize( int col
, int width
);
807 void SetDefaultCellBackgroundColour( const wxColour
& );
808 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
809 void SetDefaultCellTextColour( const wxColour
& );
811 void SetCellTextColour( int row
, int col
, const wxColour
& );
812 void SetDefaultCellFont( const wxFont
& );
813 void SetCellFont( int row
, int col
, const wxFont
& );
814 void SetDefaultCellAlignment( int horiz
, int vert
);
815 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
817 // takes ownership of the pointer
818 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
819 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
820 wxGridCellRenderer
*GetDefaultRenderer() const;
821 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
824 // ------ cell value accessors
826 wxString
GetCellValue( int row
, int col
)
830 return m_table
->GetValue( row
, col
);
834 return wxEmptyString
;
838 wxString
GetCellValue( const wxGridCellCoords
& coords
)
839 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
841 void SetCellValue( int row
, int col
, const wxString
& s
);
842 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
843 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
847 // ------ selections of blocks of cells
849 void SelectRow( int row
, bool addToSelected
= FALSE
);
850 void SelectCol( int col
, bool addToSelected
= FALSE
);
852 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
854 void SelectBlock( const wxGridCellCoords
& topLeft
,
855 const wxGridCellCoords
& bottomRight
)
856 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
857 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
862 { return ( m_selectedTopLeft
!= wxGridNoCellCoords
&&
863 m_selectedBottomRight
!= wxGridNoCellCoords
);
866 void ClearSelection();
868 bool IsInSelection( int row
, int col
)
869 { return ( IsSelection() &&
870 row
>= m_selectedTopLeft
.GetRow() &&
871 col
>= m_selectedTopLeft
.GetCol() &&
872 row
<= m_selectedBottomRight
.GetRow() &&
873 col
<= m_selectedBottomRight
.GetCol() );
876 bool IsInSelection( const wxGridCellCoords
& coords
)
877 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
879 void GetSelection( int* topRow
, int* leftCol
, int* bottomRow
, int* rightCol
)
881 // these will all be -1 if there is no selected block
883 *topRow
= m_selectedTopLeft
.GetRow();
884 *leftCol
= m_selectedTopLeft
.GetCol();
885 *bottomRow
= m_selectedBottomRight
.GetRow();
886 *rightCol
= m_selectedBottomRight
.GetCol();
890 // This function returns the rectangle that encloses the block of cells
891 // limited by TopLeft and BottomRight cell in device coords and clipped
892 // to the client size of the grid window.
894 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
895 const wxGridCellCoords
& bottomRight
);
897 // This function returns the rectangle that encloses the selected cells
898 // in device coords and clipped to the client size of the grid window.
900 wxRect
SelectionToDeviceRect()
902 return BlockToDeviceRect( m_selectedTopLeft
,
903 m_selectedBottomRight
);
906 // Access or update the selection fore/back colours
907 wxColour
GetSelectionBackground() const
908 { return m_selectionBackground
; }
909 wxColour
GetSelectionForeground() const
910 { return m_selectionForeground
; }
912 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
913 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
917 // ------ For compatibility with previous wxGrid only...
919 // ************************************************
920 // ** Don't use these in new code because they **
921 // ** are liable to disappear in a future **
923 // ************************************************
926 wxGrid( wxWindow
*parent
,
927 int x
= -1, int y
= -1, int w
= -1, int h
= -1,
929 const wxString
& name
= wxPanelNameStr
)
930 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
), style
, name
)
935 void SetCellValue( const wxString
& val
, int row
, int col
)
936 { SetCellValue( row
, col
, val
); }
938 void UpdateDimensions()
939 { CalcDimensions(); }
941 int GetRows() { return GetNumberRows(); }
942 int GetCols() { return GetNumberCols(); }
943 int GetCursorRow() { return GetGridCursorRow(); }
944 int GetCursorColumn() { return GetGridCursorCol(); }
946 int GetScrollPosX() { return 0; }
947 int GetScrollPosY() { return 0; }
949 void SetScrollX( int x
) { }
950 void SetScrollY( int y
) { }
952 void SetColumnWidth( int col
, int width
)
953 { SetColSize( col
, width
); }
955 int GetColumnWidth( int col
)
956 { return GetColSize( col
); }
958 void SetRowHeight( int row
, int height
)
959 { SetRowSize( row
, height
); }
961 int GetRowHeight( int row
)
962 { return GetRowSize( row
); }
964 int GetViewHeight() // returned num whole rows visible
967 int GetViewWidth() // returned num whole cols visible
970 void SetLabelSize( int orientation
, int sz
)
972 if ( orientation
== wxHORIZONTAL
)
973 SetColLabelSize( sz
);
975 SetRowLabelSize( sz
);
978 int GetLabelSize( int orientation
)
980 if ( orientation
== wxHORIZONTAL
)
981 return GetColLabelSize();
983 return GetRowLabelSize();
986 void SetLabelAlignment( int orientation
, int align
)
988 if ( orientation
== wxHORIZONTAL
)
989 SetColLabelAlignment( align
, -1 );
991 SetRowLabelAlignment( align
, -1 );
994 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
997 if ( orientation
== wxHORIZONTAL
)
999 GetColLabelAlignment( &h
, &v
);
1004 GetRowLabelAlignment( &h
, &v
);
1009 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1011 if ( orientation
== wxHORIZONTAL
)
1012 SetColLabelValue( pos
, val
);
1014 SetRowLabelValue( pos
, val
);
1017 wxString
GetLabelValue( int orientation
, int pos
)
1019 if ( orientation
== wxHORIZONTAL
)
1020 return GetColLabelValue( pos
);
1022 return GetRowLabelValue( pos
);
1025 wxFont
GetCellTextFont() const
1026 { return m_defaultCellAttr
->GetFont(); }
1028 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1029 { return m_defaultCellAttr
->GetFont(); }
1031 void SetCellTextFont(const wxFont
& fnt
)
1032 { SetDefaultCellFont( fnt
); }
1034 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1035 { SetCellFont( row
, col
, fnt
); }
1037 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1038 { SetCellTextColour( row
, col
, val
); }
1040 void SetCellTextColour(const wxColour
& col
)
1041 { SetDefaultCellTextColour( col
); }
1043 void SetCellBackgroundColour(const wxColour
& col
)
1044 { SetDefaultCellBackgroundColour( col
); }
1046 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1047 { SetCellBackgroundColour( row
, col
, colour
); }
1049 bool GetEditable() { return IsEditable(); }
1050 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1051 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1053 void SetEditInPlace(bool edit
= TRUE
) { }
1055 void SetCellAlignment( int align
, int row
, int col
)
1056 { SetCellAlignment(row
, col
, align
, wxCENTER
); }
1057 void SetCellAlignment( int WXUNUSED(align
) ) {}
1058 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1060 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1061 wxPen
& GetDividerPen() const { return wxNullPen
; }
1062 void OnActivate(bool WXUNUSED(active
)) {}
1064 // ******** End of compatibility functions **********
1068 // ------ control IDs
1069 enum { wxGRID_CELLCTRL
= 2000,
1072 // ------ control types
1073 enum { wxGRID_TEXTCTRL
= 2100,
1082 wxGridWindow
*m_gridWin
;
1083 wxGridRowLabelWindow
*m_rowLabelWin
;
1084 wxGridColLabelWindow
*m_colLabelWin
;
1085 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1087 wxGridTableBase
*m_table
;
1098 wxGridCellCoords m_currentCellCoords
;
1100 wxGridCellCoords m_selectedTopLeft
;
1101 wxGridCellCoords m_selectedBottomRight
;
1102 wxColour m_selectionBackground
;
1103 wxColour m_selectionForeground
;
1105 int m_defaultRowHeight
;
1106 wxArrayInt m_rowHeights
;
1107 wxArrayInt m_rowBottoms
;
1109 int m_defaultColWidth
;
1110 wxArrayInt m_colWidths
;
1111 wxArrayInt m_colRights
;
1113 int m_rowLabelWidth
;
1114 int m_colLabelHeight
;
1116 wxColour m_labelBackgroundColour
;
1117 wxColour m_labelTextColour
;
1120 int m_rowLabelHorizAlign
;
1121 int m_rowLabelVertAlign
;
1122 int m_colLabelHorizAlign
;
1123 int m_colLabelVertAlign
;
1125 bool m_defaultRowLabelValues
;
1126 bool m_defaultColLabelValues
;
1128 wxColour m_gridLineColour
;
1129 bool m_gridLinesEnabled
;
1132 // do we have some place to store attributes in?
1133 bool CanHaveAttributes();
1135 // returns the attribute we may modify in place: a new one if this cell
1136 // doesn't have any yet or the existing one if it does
1138 // DecRef() must be called on the returned pointer, as usual
1139 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1141 // cell attribute cache (currently we only cache 1, may be will do
1142 // more/better later)
1146 wxGridCellAttr
*attr
;
1149 // invalidates the attribute cache
1150 void ClearAttrCache();
1152 // adds an attribute to cache
1153 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1155 // looks for an attr in cache, returns TRUE if found
1156 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1158 // looks for the attr in cache, if not found asks the table and caches the
1160 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1162 // the default cell attr object for cells that don't have their own
1163 wxGridCellAttr
* m_defaultCellAttr
;
1166 wxGridCellCoordsArray m_cellsExposed
;
1167 wxArrayInt m_rowsExposed
;
1168 wxArrayInt m_colsExposed
;
1169 wxArrayInt m_rowLabelsExposed
;
1170 wxArrayInt m_colLabelsExposed
;
1177 WXGRID_CURSOR_SELECT_CELL
,
1178 WXGRID_CURSOR_RESIZE_ROW
,
1179 WXGRID_CURSOR_RESIZE_COL
,
1180 WXGRID_CURSOR_SELECT_ROW
,
1181 WXGRID_CURSOR_SELECT_COL
1184 // this method not only sets m_cursorMode but also sets the correct cursor
1185 // for the given mode and, if captureMouse is not FALSE releases the mouse
1186 // if it was captured and captures it if it must be captured
1188 // for this to work, you should always use it and not set m_cursorMode
1190 void ChangeCursorMode(CursorMode mode
,
1191 wxWindow
*win
= (wxWindow
*)NULL
,
1192 bool captureMouse
= TRUE
);
1194 wxWindow
*m_winCapture
; // the window which captured the mouse
1195 CursorMode m_cursorMode
;
1201 wxTimer
*m_editTimer
;
1203 wxGridCellCoords m_selectionStart
;
1205 wxCursor m_rowResizeCursor
;
1206 wxCursor m_colResizeCursor
;
1208 bool m_editable
; // applies to whole grid
1209 int m_editCtrlType
; // for current cell
1210 wxWindow
* m_cellEditCtrl
;
1211 bool m_cellEditCtrlEnabled
;
1216 void CalcDimensions();
1217 void CalcWindowSizes();
1218 bool Redimension( wxGridTableMessage
& );
1221 bool SendEvent( const wxEventType
,
1225 bool SendEvent( const wxEventType
,
1229 void OnPaint( wxPaintEvent
& );
1230 void OnSize( wxSizeEvent
& );
1231 void OnKeyDown( wxKeyEvent
& );
1232 void OnEraseBackground( wxEraseEvent
& );
1235 void SetCurrentCell( const wxGridCellCoords
& coords
);
1236 void SetCurrentCell( int row
, int col
)
1237 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1240 // ------ functions to get/send data (see also public functions)
1242 bool GetModelValues();
1243 bool SetModelValues();
1246 DECLARE_DYNAMIC_CLASS( wxGrid
)
1247 DECLARE_EVENT_TABLE()
1255 // ------ Grid event class and event types
1258 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1262 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1263 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1267 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1268 int row
=-1, int col
=-1, int x
=-1, int y
=-1,
1269 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1271 virtual int GetRow() { return m_row
; }
1272 virtual int GetCol() { return m_col
; }
1273 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1274 bool ControlDown() { return m_control
; }
1275 bool MetaDown() { return m_meta
; }
1276 bool ShiftDown() { return m_shift
; }
1277 bool AltDown() { return m_alt
; }
1289 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1293 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1297 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1298 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1302 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1303 int rowOrCol
=-1, int x
=-1, int y
=-1,
1304 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1306 int GetRowOrCol() { return m_rowOrCol
; }
1307 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1308 bool ControlDown() { return m_control
; }
1309 bool MetaDown() { return m_meta
; }
1310 bool ShiftDown() { return m_shift
; }
1311 bool AltDown() { return m_alt
; }
1322 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1326 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1329 wxGridRangeSelectEvent()
1332 m_topLeft
= wxGridNoCellCoords
;
1333 m_bottomRight
= wxGridNoCellCoords
;
1340 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1341 const wxGridCellCoords
& topLeft
,
1342 const wxGridCellCoords
& bottomRight
,
1343 bool control
=FALSE
, bool shift
=FALSE
,
1344 bool alt
=FALSE
, bool meta
=FALSE
);
1346 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1347 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1348 int GetTopRow() { return m_topLeft
.GetRow(); }
1349 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1350 int GetLeftCol() { return m_topLeft
.GetCol(); }
1351 int GetRightCol() { return m_bottomRight
.GetCol(); }
1352 bool ControlDown() { return m_control
; }
1353 bool MetaDown() { return m_meta
; }
1354 bool ShiftDown() { return m_shift
; }
1355 bool AltDown() { return m_alt
; }
1358 wxGridCellCoords m_topLeft
;
1359 wxGridCellCoords m_bottomRight
;
1365 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1369 const wxEventType EVT_GRID_CELL_LEFT_CLICK
= wxEVT_FIRST
+ 1580;
1370 const wxEventType EVT_GRID_CELL_RIGHT_CLICK
= wxEVT_FIRST
+ 1581;
1371 const wxEventType EVT_GRID_CELL_LEFT_DCLICK
= wxEVT_FIRST
+ 1582;
1372 const wxEventType EVT_GRID_CELL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1583;
1373 const wxEventType EVT_GRID_LABEL_LEFT_CLICK
= wxEVT_FIRST
+ 1584;
1374 const wxEventType EVT_GRID_LABEL_RIGHT_CLICK
= wxEVT_FIRST
+ 1585;
1375 const wxEventType EVT_GRID_LABEL_LEFT_DCLICK
= wxEVT_FIRST
+ 1586;
1376 const wxEventType EVT_GRID_LABEL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1587;
1377 const wxEventType EVT_GRID_ROW_SIZE
= wxEVT_FIRST
+ 1588;
1378 const wxEventType EVT_GRID_COL_SIZE
= wxEVT_FIRST
+ 1589;
1379 const wxEventType EVT_GRID_RANGE_SELECT
= wxEVT_FIRST
+ 1590;
1380 const wxEventType EVT_GRID_CELL_CHANGE
= wxEVT_FIRST
+ 1591;
1381 const wxEventType EVT_GRID_SELECT_CELL
= wxEVT_FIRST
+ 1592;
1384 typedef void (wxEvtHandler::*wxGridEventFunction
)(wxGridEvent
&);
1385 typedef void (wxEvtHandler::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1386 typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1388 #define EVT_GRID_CELL_LEFT_CLICK(fn) { EVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1389 #define EVT_GRID_CELL_RIGHT_CLICK(fn) { EVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1390 #define EVT_GRID_CELL_LEFT_DCLICK(fn) { EVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1391 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) { EVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1392 #define EVT_GRID_LABEL_LEFT_CLICK(fn) { EVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1393 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) { EVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1394 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) { EVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1395 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { EVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1396 #define EVT_GRID_ROW_SIZE(fn) { EVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1397 #define EVT_GRID_COL_SIZE(fn) { EVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1398 #define EVT_GRID_RANGE_SELECT(fn) { EVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
1399 #define EVT_GRID_CELL_CHANGE(fn) { EVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1400 #define EVT_GRID_SELECT_CELL(fn) { EVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1403 #if 0 // TODO: implement these ? others ?
1405 const wxEventType EVT_GRID_CREATE_CELL
= wxEVT_FIRST
+ 1576;
1406 const wxEventType EVT_GRID_CHANGE_LABELS
= wxEVT_FIRST
+ 1577;
1407 const wxEventType EVT_GRID_CHANGE_SEL_LABEL
= wxEVT_FIRST
+ 1578;
1409 #define EVT_GRID_CREATE_CELL(fn) { EVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1410 #define EVT_GRID_CHANGE_LABELS(fn) { EVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1411 #define EVT_GRID_CHANGE_SEL_LABEL(fn) { EVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1415 #endif // #ifndef __WXGRID_H__
1417 #endif // ifndef wxUSE_NEW_GRID