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 /////////////////////////////////////////////////////////////////////////////
14 #if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
22 #pragma interface "grid.h"
26 #include "wx/scrolwin.h"
27 #include "wx/string.h"
28 #include "wx/scrolbar.h"
30 #include "wx/combobox.h"
31 #include "wx/dynarray.h"
34 // Default parameters for wxGrid
36 #define WXGRID_DEFAULT_NUMBER_ROWS 10
37 #define WXGRID_DEFAULT_NUMBER_COLS 10
39 #define WXGRID_DEFAULT_ROW_HEIGHT 25
41 #define WXGRID_DEFAULT_ROW_HEIGHT 30
43 #define WXGRID_DEFAULT_COL_WIDTH 80
44 #define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32
45 #define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82
46 #define WXGRID_LABEL_EDGE_ZONE 5
47 #define WXGRID_MIN_ROW_HEIGHT 15
48 #define WXGRID_MIN_COL_WIDTH 15
49 #define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16
51 // ----------------------------------------------------------------------------
52 // forward declarations
53 // ----------------------------------------------------------------------------
55 class WXDLLEXPORT wxGrid
;
56 class WXDLLEXPORT wxGridCellAttr
;
57 class WXDLLEXPORT wxGridCellAttrProviderData
;
58 class WXDLLEXPORT wxGridColLabelWindow
;
59 class WXDLLEXPORT wxGridCornerLabelWindow
;
60 class WXDLLEXPORT wxGridRowLabelWindow
;
61 class WXDLLEXPORT wxGridTableBase
;
62 class WXDLLEXPORT wxGridWindow
;
64 class WXDLLEXPORT wxCheckBox
;
65 class WXDLLEXPORT wxTextCtrl
;
67 // ----------------------------------------------------------------------------
68 // wxGridCellRenderer: this class is responsible for actually drawing the cell
69 // in the grid. You may pass it to the wxGridCellAttr (below) to change the
70 // format of one given cell or to wxGrid::SetDefaultRenderer() to change the
71 // view of all cells. This is an ABC, you will normally use one of the
72 // predefined derived classes or derive oyur own class from it.
73 // ----------------------------------------------------------------------------
75 class WXDLLEXPORT wxGridCellRenderer
78 // draw the given cell on the provided DC inside the given rectangle
79 // using the style specified by the attribute and the default or selected
80 // state corresponding to the isSelected value.
82 // this pure virtual function has a default implementation which will
83 // prepare the DC using the given attribute: it will draw the rectangle
84 // with the bg colour from attr and set the text colour and font
85 virtual void Draw(wxGrid
& grid
,
93 // the default renderer for the cells containing string data
94 class WXDLLEXPORT wxGridCellStringRenderer
: public wxGridCellRenderer
98 virtual void Draw(wxGrid
& grid
,
106 // renderer for boolean fields
107 class WXDLLEXPORT wxGridCellBoolRenderer
: public wxGridCellRenderer
111 // draw a check mark or nothing
112 virtual void Draw(wxGrid
& grid
,
113 wxGridCellAttr
& attr
,
120 // ----------------------------------------------------------------------------
121 // wxGridCellEditor: This class is responsible for providing and manipulating
122 // the in-place edit controls for the grid. Instances of wxGridCellEditor
123 // (actually, instances of derived classes since it is an ABC) can be
124 // associated with the cell attributes for individual cells, rows, columns, or
125 // even for the entire grid.
126 // ----------------------------------------------------------------------------
128 class WXDLLEXPORT wxGridCellEditor
132 virtual ~wxGridCellEditor();
134 bool IsCreated() { return m_control
!= NULL
; }
136 // Creates the actual edit control
137 virtual void Create(wxWindow
* parent
,
139 wxEvtHandler
* evtHandler
) = 0;
141 // Size and position the edit control
142 virtual void SetSize(const wxRect
& rect
);
144 // Show or hide the edit control, use the specified attributes to set
145 // colours/fonts for it
146 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
148 // Draws the part of the cell not occupied by the control: the base class
149 // version just fills it with background colour from the attribute
150 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
152 // Fetch the value from the table and prepare the edit control
153 // to begin editing. Set the focus to the edit control.
154 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
) = 0;
156 // Complete the editing of the current cell. If saveValue is
157 // true then send the new value back to the table. Returns true
158 // if the value has changed. If necessary, the control may be
160 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
) = 0;
162 // Reset the value in the control back to its starting value
163 virtual void Reset() = 0;
165 // If the editor is enabled by pressing keys on the grid,
166 // this will be called to let the editor do something about
167 // that first key if desired.
168 virtual void StartingKey(wxKeyEvent
& event
);
170 // Some types of controls on some platforms may need some help
171 // with the Return key.
172 virtual void HandleReturn(wxKeyEvent
& event
);
175 virtual void Destroy();
178 // the control we show on screen
179 wxControl
* m_control
;
181 // if we change the colours/font of the control from the default ones, we
182 // must restore the default later and we save them here between calls to
183 // Show(TRUE) and Show(FALSE)
189 // the editor for string/text data
190 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
193 wxGridCellTextEditor();
195 virtual void Create(wxWindow
* parent
,
197 wxEvtHandler
* evtHandler
);
199 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
201 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
202 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
204 virtual void Reset();
205 virtual void StartingKey(wxKeyEvent
& event
);
206 virtual void HandleReturn(wxKeyEvent
& event
);
209 wxTextCtrl
*Text() const { return (wxTextCtrl
*)m_control
; }
212 wxString m_startValue
;
215 // the editor for boolean data
216 class WXDLLEXPORT wxGridCellBoolEditor
: public wxGridCellEditor
219 virtual void Create(wxWindow
* parent
,
221 wxEvtHandler
* evtHandler
);
223 virtual void SetSize(const wxRect
& rect
);
224 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
226 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
227 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
229 virtual void Reset();
230 virtual void StartingKey(wxKeyEvent
& event
);
233 wxCheckBox
*CBox() const { return (wxCheckBox
*)m_control
; }
239 // ----------------------------------------------------------------------------
240 // wxGridCellAttr: this class can be used to alter the cells appearance in
241 // the grid by changing their colour/font/... from default. An object of this
242 // class may be returned by wxGridTable::GetAttr().
243 // ----------------------------------------------------------------------------
245 class WXDLLEXPORT wxGridCellAttr
255 // VZ: considering the number of members wxGridCellAttr has now, this ctor
256 // seems to be pretty useless... may be we should just remove it?
257 wxGridCellAttr(const wxColour
& colText
,
258 const wxColour
& colBack
,
262 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
265 SetAlignment(hAlign
, vAlign
);
268 // default copy ctor ok
270 // this class is ref counted: it is created with ref count of 1, so
271 // calling DecRef() once will delete it. Calling IncRef() allows to lock
272 // it until the matching DecRef() is called
273 void IncRef() { m_nRef
++; }
274 void DecRef() { if ( !--m_nRef
) delete this; }
275 void SafeIncRef() { if ( this ) IncRef(); }
276 void SafeDecRef() { if ( this ) DecRef(); }
279 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
280 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
281 void SetFont(const wxFont
& font
) { m_font
= font
; }
282 void SetAlignment(int hAlign
, int vAlign
)
287 void SetReadOnly(bool isReadOnly
= TRUE
) { m_isReadOnly
= isReadOnly
; }
289 // takes ownership of the pointer
290 void SetRenderer(wxGridCellRenderer
*renderer
)
291 { delete m_renderer
; m_renderer
= renderer
; }
292 void SetEditor(wxGridCellEditor
* editor
)
293 { delete m_editor
; m_editor
= editor
; }
296 bool HasTextColour() const { return m_colText
.Ok(); }
297 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
298 bool HasFont() const { return m_font
.Ok(); }
299 bool HasAlignment() const { return m_hAlign
|| m_vAlign
; }
300 bool HasRenderer() const { return m_renderer
!= NULL
; }
301 bool HasEditor() const { return m_editor
!= NULL
; }
303 const wxColour
& GetTextColour() const;
304 const wxColour
& GetBackgroundColour() const;
305 const wxFont
& GetFont() const;
306 void GetAlignment(int *hAlign
, int *vAlign
) const;
307 wxGridCellRenderer
*GetRenderer() const;
308 wxGridCellEditor
*GetEditor() const;
310 bool IsReadOnly() const { return m_isReadOnly
; }
312 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
315 // the common part of all ctors
320 m_isReadOnly
= FALSE
;
326 // the dtor is private because only DecRef() can delete us
327 ~wxGridCellAttr() { delete m_renderer
; delete m_editor
; }
329 // the ref count - when it goes to 0, we die
338 wxGridCellRenderer
* m_renderer
;
339 wxGridCellEditor
* m_editor
;
340 wxGridCellAttr
* m_defGridAttr
;
344 // suppress the stupid gcc warning about the class having private dtor and
346 friend class wxGridCellAttrDummyFriend
;
349 // ----------------------------------------------------------------------------
350 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
352 // ----------------------------------------------------------------------------
354 // implementation note: we separate it from wxGridTableBase because we wish to
355 // avoid deriving a new table class if possible, and sometimes it will be
356 // enough to just derive another wxGridCellAttrProvider instead
358 // the default implementation is reasonably efficient for the generic case,
359 // but you might still wish to implement your own for some specific situations
360 // if you have performance problems with the stock one
361 class WXDLLEXPORT wxGridCellAttrProvider
364 wxGridCellAttrProvider();
365 virtual ~wxGridCellAttrProvider();
367 // DecRef() must be called on the returned pointer
368 virtual wxGridCellAttr
*GetAttr(int row
, int col
) const;
370 // all these functions take ownership of the pointer, don't call DecRef()
372 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
373 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
374 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
376 // these functions must be called whenever some rows/cols are deleted
377 // because the internal data must be updated then
378 void UpdateAttrRows( size_t pos
, int numRows
);
379 void UpdateAttrCols( size_t pos
, int numCols
);
384 wxGridCellAttrProviderData
*m_data
;
387 //////////////////////////////////////////////////////////////////////
389 // Grid table classes
391 //////////////////////////////////////////////////////////////////////
394 class WXDLLEXPORT wxGridTableBase
: public wxObject
398 virtual ~wxGridTableBase();
400 // You must override these functions in a derived table class
402 virtual long GetNumberRows() = 0;
403 virtual long GetNumberCols() = 0;
404 virtual wxString
GetValue( int row
, int col
) = 0;
405 virtual void SetValue( int row
, int col
, const wxString
& s
) = 0;
406 virtual bool IsEmptyCell( int row
, int col
) = 0;
408 // Overriding these is optional
410 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
411 virtual wxGrid
* GetView() const { return m_view
; }
413 virtual void Clear() {}
414 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
415 virtual bool AppendRows( size_t numRows
= 1 );
416 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
417 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
418 virtual bool AppendCols( size_t numCols
= 1 );
419 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
421 virtual wxString
GetRowLabelValue( int row
);
422 virtual wxString
GetColLabelValue( int col
);
423 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
424 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
426 // Attribute handling
429 // give us the attr provider to use - we take ownership of the pointer
430 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
432 // get the currently used attr provider (may be NULL)
433 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
435 // change row/col number in attribute if needed
436 void UpdateAttrRows( size_t pos
, int numRows
);
437 void UpdateAttrCols( size_t pos
, int numCols
);
439 // by default forwarded to wxGridCellAttrProvider if any. May be
440 // overridden to handle attributes directly in this class.
441 virtual wxGridCellAttr
*GetAttr( int row
, int col
);
443 // these functions take ownership of the pointer
444 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
445 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
446 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
450 wxGridCellAttrProvider
*m_attrProvider
;
452 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
456 // ----------------------------------------------------------------------------
457 // wxGridTableMessage
458 // ----------------------------------------------------------------------------
460 // IDs for messages sent from grid table to view
462 enum wxGridTableRequest
464 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
465 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
466 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
467 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
468 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
469 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
470 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
471 wxGRIDTABLE_NOTIFY_COLS_DELETED
474 class WXDLLEXPORT wxGridTableMessage
477 wxGridTableMessage();
478 wxGridTableMessage( wxGridTableBase
*table
, int id
,
482 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
483 wxGridTableBase
* GetTableObject() const { return m_table
; }
484 void SetId( int id
) { m_id
= id
; }
485 int GetId() { return m_id
; }
486 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
487 int GetCommandInt() { return m_comInt1
; }
488 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
489 int GetCommandInt2() { return m_comInt2
; }
492 wxGridTableBase
*m_table
;
500 // ------ wxGridStringArray
501 // A 2-dimensional array of strings for data values
504 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
508 // ------ wxGridStringTable
510 // Simplest type of data table for a grid for small tables of strings
511 // that are stored in memory
514 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
518 wxGridStringTable( int numRows
, int numCols
);
519 ~wxGridStringTable();
521 // these are pure virtual in wxGridTableBase
523 long GetNumberRows();
524 long GetNumberCols();
525 wxString
GetValue( int row
, int col
);
526 void SetValue( int row
, int col
, const wxString
& s
);
527 bool IsEmptyCell( int row
, int col
);
529 // overridden functions from wxGridTableBase
532 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
533 bool AppendRows( size_t numRows
= 1 );
534 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
535 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
536 bool AppendCols( size_t numCols
= 1 );
537 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
539 void SetRowLabelValue( int row
, const wxString
& );
540 void SetColLabelValue( int col
, const wxString
& );
541 wxString
GetRowLabelValue( int row
);
542 wxString
GetColLabelValue( int col
);
545 wxGridStringArray m_data
;
547 // These only get used if you set your own labels, otherwise the
548 // GetRow/ColLabelValue functions return wxGridTableBase defaults
550 wxArrayString m_rowLabels
;
551 wxArrayString m_colLabels
;
553 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
558 //////////////////////////////////////////////////////////////////////
562 //////////////////////////////////////////////////////////////////////
564 class WXDLLEXPORT wxGridCellCoords
567 wxGridCellCoords() { m_row
= m_col
= -1; }
568 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
570 // default copy ctor is ok
572 long GetRow() const { return m_row
; }
573 void SetRow( long n
) { m_row
= n
; }
574 long GetCol() const { return m_col
; }
575 void SetCol( long n
) { m_col
= n
; }
576 void Set( long row
, long col
) { m_row
= row
; m_col
= col
; }
578 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
580 if ( &other
!= this )
588 bool operator==( const wxGridCellCoords
& other
) const
590 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
593 bool operator!=( const wxGridCellCoords
& other
) const
595 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
598 bool operator!() const
600 return (m_row
== -1 && m_col
== -1 );
609 // For comparisons...
611 extern wxGridCellCoords wxGridNoCellCoords
;
612 extern wxRect wxGridNoCellRect
;
614 // An array of cell coords...
616 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
620 // ----------------------------------------------------------------------------
622 // ----------------------------------------------------------------------------
624 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
632 wxGrid( wxWindow
*parent
,
634 const wxPoint
& pos
= wxDefaultPosition
,
635 const wxSize
& size
= wxDefaultSize
,
637 const wxString
& name
= wxPanelNameStr
);
641 bool CreateGrid( int numRows
, int numCols
);
644 // ------ grid dimensions
646 int GetNumberRows() { return m_numRows
; }
647 int GetNumberCols() { return m_numCols
; }
650 // ------ display update functions
652 void CalcRowLabelsExposed( wxRegion
& reg
);
654 void CalcColLabelsExposed( wxRegion
& reg
);
655 void CalcCellsExposed( wxRegion
& reg
);
658 // ------ event handlers
660 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
661 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
662 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
663 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
664 bool ProcessTableMessage( wxGridTableMessage
& );
666 void DoEndDragResizeRow();
667 void DoEndDragResizeCol();
669 wxGridTableBase
* GetTable() const { return m_table
; }
670 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
);
673 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
674 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
675 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
676 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
677 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
678 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
680 void DrawGridCellArea( wxDC
& dc
);
681 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
682 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
683 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
684 void DrawCellHighlight( wxDC
& dc
, const wxGridCellAttr
*attr
);
686 void DrawRowLabels( wxDC
& dc
);
687 void DrawRowLabel( wxDC
& dc
, int row
);
689 void DrawColLabels( wxDC
& dc
);
690 void DrawColLabel( wxDC
& dc
, int col
);
693 // ------ Cell text drawing functions
695 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
696 int horizontalAlignment
= wxLEFT
,
697 int verticalAlignment
= wxTOP
);
699 // Split a string containing newline chararcters into an array of
700 // strings and return the number of lines
702 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
704 void GetTextBoxSize( wxDC
& dc
,
705 wxArrayString
& lines
,
706 long *width
, long *height
);
710 // Code that does a lot of grid modification can be enclosed
711 // between BeginBatch() and EndBatch() calls to avoid screen
714 void BeginBatch() { m_batchCount
++; }
715 void EndBatch() { if ( m_batchCount
> 0 ) m_batchCount
--; }
716 int GetBatchCount() { return m_batchCount
; }
719 // ------ edit control functions
721 bool IsEditable() { return m_editable
; }
722 void EnableEditing( bool edit
);
724 void EnableCellEditControl( bool enable
= TRUE
);
725 void DisableCellEditControl() { EnableCellEditControl(FALSE
); }
726 bool CanEnableCellControl() const;
727 bool IsCellEditControlEnabled() const;
729 bool IsCurrentCellReadOnly() const;
731 void ShowCellEditControl();
732 void HideCellEditControl();
733 void SetEditControlValue( const wxString
& s
= wxEmptyString
);
734 void SaveEditControlValue();
737 // ------ grid location functions
738 // Note that all of these functions work with the logical coordinates of
739 // grid cells and labels so you will need to convert from device
740 // coordinates for mouse events etc.
742 void XYToCell( int x
, int y
, wxGridCellCoords
& );
746 int YToEdgeOfRow( int y
);
747 int XToEdgeOfCol( int x
);
749 wxRect
CellToRect( int row
, int col
);
750 wxRect
CellToRect( const wxGridCellCoords
& coords
)
751 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
753 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
754 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
756 // check to see if a cell is either wholly visible (the default arg) or
757 // at least partially visible in the grid window
759 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
760 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
761 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
762 void MakeCellVisible( int row
, int col
);
763 void MakeCellVisible( const wxGridCellCoords
& coords
)
764 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
767 // ------ grid cursor movement functions
769 void SetGridCursor( int row
, int col
)
770 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
773 bool MoveCursorDown();
774 bool MoveCursorLeft();
775 bool MoveCursorRight();
778 bool MoveCursorUpBlock();
779 bool MoveCursorDownBlock();
780 bool MoveCursorLeftBlock();
781 bool MoveCursorRightBlock();
784 // ------ label and gridline formatting
786 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
787 int GetRowLabelSize() { return m_rowLabelWidth
; }
788 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
789 int GetColLabelSize() { return m_colLabelHeight
; }
790 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
791 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
792 wxFont
GetLabelFont() { return m_labelFont
; }
793 void GetRowLabelAlignment( int *horiz
, int *vert
);
794 void GetColLabelAlignment( int *horiz
, int *vert
);
795 wxString
GetRowLabelValue( int row
);
796 wxString
GetColLabelValue( int col
);
797 wxColour
GetGridLineColour() { return m_gridLineColour
; }
799 void SetRowLabelSize( int width
);
800 void SetColLabelSize( int height
);
801 void SetLabelBackgroundColour( const wxColour
& );
802 void SetLabelTextColour( const wxColour
& );
803 void SetLabelFont( const wxFont
& );
804 void SetRowLabelAlignment( int horiz
, int vert
);
805 void SetColLabelAlignment( int horiz
, int vert
);
806 void SetRowLabelValue( int row
, const wxString
& );
807 void SetColLabelValue( int col
, const wxString
& );
808 void SetGridLineColour( const wxColour
& );
810 // this sets the specified attribute for all cells in this row/col
811 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
812 void SetColAttr(int col
, wxGridCellAttr
*attr
);
814 void EnableGridLines( bool enable
= TRUE
);
815 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
817 // ------ row and col formatting
819 int GetDefaultRowSize();
820 int GetRowSize( int row
);
821 int GetDefaultColSize();
822 int GetColSize( int col
);
823 wxColour
GetDefaultCellBackgroundColour();
824 wxColour
GetCellBackgroundColour( int row
, int col
);
825 wxColour
GetDefaultCellTextColour();
826 wxColour
GetCellTextColour( int row
, int col
);
827 wxFont
GetDefaultCellFont();
828 wxFont
GetCellFont( int row
, int col
);
829 void GetDefaultCellAlignment( int *horiz
, int *vert
);
830 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
832 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
833 void SetRowSize( int row
, int height
);
834 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
836 void SetColSize( int col
, int width
);
837 void SetDefaultCellBackgroundColour( const wxColour
& );
838 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
839 void SetDefaultCellTextColour( const wxColour
& );
841 void SetCellTextColour( int row
, int col
, const wxColour
& );
842 void SetDefaultCellFont( const wxFont
& );
843 void SetCellFont( int row
, int col
, const wxFont
& );
844 void SetDefaultCellAlignment( int horiz
, int vert
);
845 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
847 // takes ownership of the pointer
848 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
849 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
850 wxGridCellRenderer
*GetDefaultRenderer() const;
851 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
853 // takes ownership of the pointer
854 void SetDefaultEditor(wxGridCellEditor
*editor
);
855 void SetCellEditor(int row
, int col
, wxGridCellEditor
*editor
);
856 wxGridCellEditor
*GetDefaultEditor() const;
857 wxGridCellEditor
* GetCellEditor(int row
, int col
);
860 // ------ cell value accessors
862 wxString
GetCellValue( int row
, int col
)
866 return m_table
->GetValue( row
, col
);
870 return wxEmptyString
;
874 wxString
GetCellValue( const wxGridCellCoords
& coords
)
875 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
877 void SetCellValue( int row
, int col
, const wxString
& s
);
878 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
879 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
881 // returns TRUE if the cell can't be edited
882 bool IsReadOnly(int row
, int col
) const;
884 // make the cell editable/readonly
885 void SetReadOnly(int row
, int col
, bool isReadOnly
= TRUE
);
887 // ------ selections of blocks of cells
889 void SelectRow( int row
, bool addToSelected
= FALSE
);
890 void SelectCol( int col
, bool addToSelected
= FALSE
);
892 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
894 void SelectBlock( const wxGridCellCoords
& topLeft
,
895 const wxGridCellCoords
& bottomRight
)
896 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
897 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
902 { return ( m_selectedTopLeft
!= wxGridNoCellCoords
&&
903 m_selectedBottomRight
!= wxGridNoCellCoords
);
906 void ClearSelection();
908 bool IsInSelection( int row
, int col
)
909 { return ( IsSelection() &&
910 row
>= m_selectedTopLeft
.GetRow() &&
911 col
>= m_selectedTopLeft
.GetCol() &&
912 row
<= m_selectedBottomRight
.GetRow() &&
913 col
<= m_selectedBottomRight
.GetCol() );
916 bool IsInSelection( const wxGridCellCoords
& coords
)
917 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
919 void GetSelection( int* topRow
, int* leftCol
, int* bottomRow
, int* rightCol
)
921 // these will all be -1 if there is no selected block
923 *topRow
= m_selectedTopLeft
.GetRow();
924 *leftCol
= m_selectedTopLeft
.GetCol();
925 *bottomRow
= m_selectedBottomRight
.GetRow();
926 *rightCol
= m_selectedBottomRight
.GetCol();
930 // This function returns the rectangle that encloses the block of cells
931 // limited by TopLeft and BottomRight cell in device coords and clipped
932 // to the client size of the grid window.
934 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
935 const wxGridCellCoords
& bottomRight
);
937 // This function returns the rectangle that encloses the selected cells
938 // in device coords and clipped to the client size of the grid window.
940 wxRect
SelectionToDeviceRect()
942 return BlockToDeviceRect( m_selectedTopLeft
,
943 m_selectedBottomRight
);
946 // Access or update the selection fore/back colours
947 wxColour
GetSelectionBackground() const
948 { return m_selectionBackground
; }
949 wxColour
GetSelectionForeground() const
950 { return m_selectionForeground
; }
952 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
953 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
957 // ------ For compatibility with previous wxGrid only...
959 // ************************************************
960 // ** Don't use these in new code because they **
961 // ** are liable to disappear in a future **
963 // ************************************************
966 wxGrid( wxWindow
*parent
,
967 int x
= -1, int y
= -1, int w
= -1, int h
= -1,
969 const wxString
& name
= wxPanelNameStr
)
970 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
), style
, name
)
975 void SetCellValue( const wxString
& val
, int row
, int col
)
976 { SetCellValue( row
, col
, val
); }
978 void UpdateDimensions()
979 { CalcDimensions(); }
981 int GetRows() { return GetNumberRows(); }
982 int GetCols() { return GetNumberCols(); }
983 int GetCursorRow() { return GetGridCursorRow(); }
984 int GetCursorColumn() { return GetGridCursorCol(); }
986 int GetScrollPosX() { return 0; }
987 int GetScrollPosY() { return 0; }
989 void SetScrollX( int x
) { }
990 void SetScrollY( int y
) { }
992 void SetColumnWidth( int col
, int width
)
993 { SetColSize( col
, width
); }
995 int GetColumnWidth( int col
)
996 { return GetColSize( col
); }
998 void SetRowHeight( int row
, int height
)
999 { SetRowSize( row
, height
); }
1001 int GetRowHeight( int row
)
1002 { return GetRowSize( row
); }
1004 int GetViewHeight() // returned num whole rows visible
1007 int GetViewWidth() // returned num whole cols visible
1010 void SetLabelSize( int orientation
, int sz
)
1012 if ( orientation
== wxHORIZONTAL
)
1013 SetColLabelSize( sz
);
1015 SetRowLabelSize( sz
);
1018 int GetLabelSize( int orientation
)
1020 if ( orientation
== wxHORIZONTAL
)
1021 return GetColLabelSize();
1023 return GetRowLabelSize();
1026 void SetLabelAlignment( int orientation
, int align
)
1028 if ( orientation
== wxHORIZONTAL
)
1029 SetColLabelAlignment( align
, -1 );
1031 SetRowLabelAlignment( align
, -1 );
1034 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
1037 if ( orientation
== wxHORIZONTAL
)
1039 GetColLabelAlignment( &h
, &v
);
1044 GetRowLabelAlignment( &h
, &v
);
1049 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1051 if ( orientation
== wxHORIZONTAL
)
1052 SetColLabelValue( pos
, val
);
1054 SetRowLabelValue( pos
, val
);
1057 wxString
GetLabelValue( int orientation
, int pos
)
1059 if ( orientation
== wxHORIZONTAL
)
1060 return GetColLabelValue( pos
);
1062 return GetRowLabelValue( pos
);
1065 wxFont
GetCellTextFont() const
1066 { return m_defaultCellAttr
->GetFont(); }
1068 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1069 { return m_defaultCellAttr
->GetFont(); }
1071 void SetCellTextFont(const wxFont
& fnt
)
1072 { SetDefaultCellFont( fnt
); }
1074 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1075 { SetCellFont( row
, col
, fnt
); }
1077 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1078 { SetCellTextColour( row
, col
, val
); }
1080 void SetCellTextColour(const wxColour
& col
)
1081 { SetDefaultCellTextColour( col
); }
1083 void SetCellBackgroundColour(const wxColour
& col
)
1084 { SetDefaultCellBackgroundColour( col
); }
1086 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1087 { SetCellBackgroundColour( row
, col
, colour
); }
1089 bool GetEditable() { return IsEditable(); }
1090 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1091 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1093 void SetEditInPlace(bool edit
= TRUE
) { }
1095 void SetCellAlignment( int align
, int row
, int col
)
1096 { SetCellAlignment(row
, col
, align
, wxCENTER
); }
1097 void SetCellAlignment( int WXUNUSED(align
) ) {}
1098 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1100 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1101 wxPen
& GetDividerPen() const { return wxNullPen
; }
1102 void OnActivate(bool WXUNUSED(active
)) {}
1104 // ******** End of compatibility functions **********
1108 // ------ control IDs
1109 enum { wxGRID_CELLCTRL
= 2000,
1112 // ------ control types
1113 enum { wxGRID_TEXTCTRL
= 2100,
1118 // for wxGridCellBoolEditor
1119 wxWindow
*GetGridWindow() const;
1125 wxGridWindow
*m_gridWin
;
1126 wxGridRowLabelWindow
*m_rowLabelWin
;
1127 wxGridColLabelWindow
*m_colLabelWin
;
1128 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1130 wxGridTableBase
*m_table
;
1141 wxGridCellCoords m_currentCellCoords
;
1143 wxGridCellCoords m_selectedTopLeft
;
1144 wxGridCellCoords m_selectedBottomRight
;
1145 wxColour m_selectionBackground
;
1146 wxColour m_selectionForeground
;
1148 int m_defaultRowHeight
;
1149 wxArrayInt m_rowHeights
;
1150 wxArrayInt m_rowBottoms
;
1152 int m_defaultColWidth
;
1153 wxArrayInt m_colWidths
;
1154 wxArrayInt m_colRights
;
1155 int m_rowLabelWidth
;
1156 int m_colLabelHeight
;
1158 wxColour m_labelBackgroundColour
;
1159 wxColour m_labelTextColour
;
1162 int m_rowLabelHorizAlign
;
1163 int m_rowLabelVertAlign
;
1164 int m_colLabelHorizAlign
;
1165 int m_colLabelVertAlign
;
1167 bool m_defaultRowLabelValues
;
1168 bool m_defaultColLabelValues
;
1170 wxColour m_gridLineColour
;
1171 bool m_gridLinesEnabled
;
1174 // do we have some place to store attributes in?
1175 bool CanHaveAttributes();
1177 // returns the attribute we may modify in place: a new one if this cell
1178 // doesn't have any yet or the existing one if it does
1180 // DecRef() must be called on the returned pointer, as usual
1181 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1183 // cell attribute cache (currently we only cache 1, may be will do
1184 // more/better later)
1188 wxGridCellAttr
*attr
;
1191 // invalidates the attribute cache
1192 void ClearAttrCache();
1194 // adds an attribute to cache
1195 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1197 // looks for an attr in cache, returns TRUE if found
1198 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1200 // looks for the attr in cache, if not found asks the table and caches the
1202 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1203 wxGridCellAttr
*GetCellAttr(const wxGridCellCoords
& coords
)
1204 { return GetCellAttr( coords
.GetRow(), coords
.GetCol() ); }
1206 // the default cell attr object for cells that don't have their own
1207 wxGridCellAttr
* m_defaultCellAttr
;
1210 wxGridCellCoordsArray m_cellsExposed
;
1211 wxArrayInt m_rowsExposed
;
1212 wxArrayInt m_colsExposed
;
1213 wxArrayInt m_rowLabelsExposed
;
1214 wxArrayInt m_colLabelsExposed
;
1221 WXGRID_CURSOR_SELECT_CELL
,
1222 WXGRID_CURSOR_RESIZE_ROW
,
1223 WXGRID_CURSOR_RESIZE_COL
,
1224 WXGRID_CURSOR_SELECT_ROW
,
1225 WXGRID_CURSOR_SELECT_COL
1228 // this method not only sets m_cursorMode but also sets the correct cursor
1229 // for the given mode and, if captureMouse is not FALSE releases the mouse
1230 // if it was captured and captures it if it must be captured
1232 // for this to work, you should always use it and not set m_cursorMode
1234 void ChangeCursorMode(CursorMode mode
,
1235 wxWindow
*win
= (wxWindow
*)NULL
,
1236 bool captureMouse
= TRUE
);
1238 wxWindow
*m_winCapture
; // the window which captured the mouse
1239 CursorMode m_cursorMode
;
1244 wxPoint m_startDragPos
;
1246 bool m_waitForSlowClick
;
1248 wxGridCellCoords m_selectionStart
;
1250 wxCursor m_rowResizeCursor
;
1251 wxCursor m_colResizeCursor
;
1253 bool m_editable
; // applies to whole grid
1254 bool m_cellEditCtrlEnabled
; // is in-place edit currently shown?
1259 void CalcDimensions();
1260 void CalcWindowSizes();
1261 bool Redimension( wxGridTableMessage
& );
1264 bool SendEvent( const wxEventType
, int row
, int col
, wxMouseEvent
& );
1265 bool SendEvent( const wxEventType
, int row
, int col
);
1266 bool SendEvent( const wxEventType type
)
1268 return SendEvent(type
,
1269 m_currentCellCoords
.GetRow(),
1270 m_currentCellCoords
.GetCol());
1273 void OnPaint( wxPaintEvent
& );
1274 void OnSize( wxSizeEvent
& );
1275 void OnKeyDown( wxKeyEvent
& );
1276 void OnEraseBackground( wxEraseEvent
& );
1279 void SetCurrentCell( const wxGridCellCoords
& coords
);
1280 void SetCurrentCell( int row
, int col
)
1281 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1284 // ------ functions to get/send data (see also public functions)
1286 bool GetModelValues();
1287 bool SetModelValues();
1290 DECLARE_DYNAMIC_CLASS( wxGrid
)
1291 DECLARE_EVENT_TABLE()
1299 // ------ Grid event class and event types
1302 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1306 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1307 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1311 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1312 int row
=-1, int col
=-1, int x
=-1, int y
=-1,
1313 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1315 virtual int GetRow() { return m_row
; }
1316 virtual int GetCol() { return m_col
; }
1317 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1318 bool ControlDown() { return m_control
; }
1319 bool MetaDown() { return m_meta
; }
1320 bool ShiftDown() { return m_shift
; }
1321 bool AltDown() { return m_alt
; }
1333 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1336 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1340 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1341 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1345 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1346 int rowOrCol
=-1, int x
=-1, int y
=-1,
1347 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1349 int GetRowOrCol() { return m_rowOrCol
; }
1350 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1351 bool ControlDown() { return m_control
; }
1352 bool MetaDown() { return m_meta
; }
1353 bool ShiftDown() { return m_shift
; }
1354 bool AltDown() { return m_alt
; }
1365 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1369 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1372 wxGridRangeSelectEvent()
1375 m_topLeft
= wxGridNoCellCoords
;
1376 m_bottomRight
= wxGridNoCellCoords
;
1383 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1384 const wxGridCellCoords
& topLeft
,
1385 const wxGridCellCoords
& bottomRight
,
1386 bool control
=FALSE
, bool shift
=FALSE
,
1387 bool alt
=FALSE
, bool meta
=FALSE
);
1389 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1390 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1391 int GetTopRow() { return m_topLeft
.GetRow(); }
1392 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1393 int GetLeftCol() { return m_topLeft
.GetCol(); }
1394 int GetRightCol() { return m_bottomRight
.GetCol(); }
1395 bool ControlDown() { return m_control
; }
1396 bool MetaDown() { return m_meta
; }
1397 bool ShiftDown() { return m_shift
; }
1398 bool AltDown() { return m_alt
; }
1401 wxGridCellCoords m_topLeft
;
1402 wxGridCellCoords m_bottomRight
;
1408 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1411 // TODO move to wx/event.h
1412 const wxEventType wxEVT_GRID_CELL_LEFT_CLICK
= wxEVT_FIRST
+ 1580;
1413 const wxEventType wxEVT_GRID_CELL_RIGHT_CLICK
= wxEVT_FIRST
+ 1581;
1414 const wxEventType wxEVT_GRID_CELL_LEFT_DCLICK
= wxEVT_FIRST
+ 1582;
1415 const wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1583;
1416 const wxEventType wxEVT_GRID_LABEL_LEFT_CLICK
= wxEVT_FIRST
+ 1584;
1417 const wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK
= wxEVT_FIRST
+ 1585;
1418 const wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK
= wxEVT_FIRST
+ 1586;
1419 const wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1587;
1420 const wxEventType wxEVT_GRID_ROW_SIZE
= wxEVT_FIRST
+ 1588;
1421 const wxEventType wxEVT_GRID_COL_SIZE
= wxEVT_FIRST
+ 1589;
1422 const wxEventType wxEVT_GRID_RANGE_SELECT
= wxEVT_FIRST
+ 1590;
1423 const wxEventType wxEVT_GRID_CELL_CHANGE
= wxEVT_FIRST
+ 1591;
1424 const wxEventType wxEVT_GRID_SELECT_CELL
= wxEVT_FIRST
+ 1592;
1425 const wxEventType wxEVT_GRID_EDITOR_SHOWN
= wxEVT_FIRST
+ 1593;
1426 const wxEventType wxEVT_GRID_EDITOR_HIDDEN
= wxEVT_FIRST
+ 1594;
1429 typedef void (wxEvtHandler::*wxGridEventFunction
)(wxGridEvent
&);
1430 typedef void (wxEvtHandler::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1431 typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1433 #define EVT_GRID_CELL_LEFT_CLICK(fn) { wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1434 #define EVT_GRID_CELL_RIGHT_CLICK(fn) { wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1435 #define EVT_GRID_CELL_LEFT_DCLICK(fn) { wxEVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1436 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) { wxEVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1437 #define EVT_GRID_LABEL_LEFT_CLICK(fn) { wxEVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1438 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) { wxEVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1439 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) { wxEVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1440 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1441 #define EVT_GRID_ROW_SIZE(fn) { wxEVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1442 #define EVT_GRID_COL_SIZE(fn) { wxEVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1443 #define EVT_GRID_RANGE_SELECT(fn) { wxEVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
1444 #define EVT_GRID_CELL_CHANGE(fn) { wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1445 #define EVT_GRID_SELECT_CELL(fn) { wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1446 #define EVT_GRID_EDITOR_SHOWN(fn) { wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1447 #define EVT_GRID_EDITOR_HIDDEN(fn) { wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1450 #if 0 // TODO: implement these ? others ?
1452 const wxEventType wxEVT_GRID_CREATE_CELL
= wxEVT_FIRST
+ 1576;
1453 const wxEventType wxEVT_GRID_CHANGE_LABELS
= wxEVT_FIRST
+ 1577;
1454 const wxEventType wxEVT_GRID_CHANGE_SEL_LABEL
= wxEVT_FIRST
+ 1578;
1456 #define EVT_GRID_CREATE_CELL(fn) { wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1457 #define EVT_GRID_CHANGE_LABELS(fn) { wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1458 #define EVT_GRID_CHANGE_SEL_LABEL(fn) { wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1462 #endif // #ifndef __WXGRID_H__
1464 #endif // ifndef wxUSE_NEW_GRID