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/combobox.h"
32 #include "wx/dynarray.h"
35 // Default parameters for wxGrid
37 #define WXGRID_DEFAULT_NUMBER_ROWS 10
38 #define WXGRID_DEFAULT_NUMBER_COLS 10
40 #define WXGRID_DEFAULT_ROW_HEIGHT 25
42 #define WXGRID_DEFAULT_ROW_HEIGHT 30
44 #define WXGRID_DEFAULT_COL_WIDTH 80
45 #define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32
46 #define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82
47 #define WXGRID_LABEL_EDGE_ZONE 5
48 #define WXGRID_MIN_ROW_HEIGHT 15
49 #define WXGRID_MIN_COL_WIDTH 15
50 #define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16
52 // ----------------------------------------------------------------------------
53 // forward declarations
54 // ----------------------------------------------------------------------------
56 class WXDLLEXPORT wxGrid
;
57 class WXDLLEXPORT wxGridCellAttr
;
58 class WXDLLEXPORT wxGridCellAttrProviderData
;
59 class WXDLLEXPORT wxGridColLabelWindow
;
60 class WXDLLEXPORT wxGridCornerLabelWindow
;
61 class WXDLLEXPORT wxGridRowLabelWindow
;
62 class WXDLLEXPORT wxGridTableBase
;
63 class WXDLLEXPORT wxGridWindow
;
65 class WXDLLEXPORT wxCheckBox
;
66 class WXDLLEXPORT wxTextCtrl
;
68 // ----------------------------------------------------------------------------
69 // wxGridCellRenderer: this class is responsible for actually drawing the cell
70 // in the grid. You may pass it to the wxGridCellAttr (below) to change the
71 // format of one given cell or to wxGrid::SetDefaultRenderer() to change the
72 // view of all cells. This is an ABC, you will normally use one of the
73 // predefined derived classes or derive oyur own class from it.
74 // ----------------------------------------------------------------------------
76 class WXDLLEXPORT wxGridCellRenderer
79 // draw the given cell on the provided DC inside the given rectangle
80 // using the style specified by the attribute and the default or selected
81 // state corresponding to the isSelected value.
83 // this pure virtual function has a default implementation which will
84 // prepare the DC using the given attribute: it will draw the rectangle
85 // with the bg colour from attr and set the text colour and font
86 virtual void Draw(wxGrid
& grid
,
94 // the default renderer for the cells containing string data
95 class WXDLLEXPORT wxGridCellStringRenderer
: public wxGridCellRenderer
99 virtual void Draw(wxGrid
& grid
,
100 wxGridCellAttr
& attr
,
107 // renderer for boolean fields
108 class WXDLLEXPORT wxGridCellBoolRenderer
: public wxGridCellRenderer
112 // draw a check mark or nothing
113 virtual void Draw(wxGrid
& grid
,
114 wxGridCellAttr
& attr
,
121 // ----------------------------------------------------------------------------
122 // wxGridCellEditor: This class is responsible for providing and manipulating
123 // the in-place edit controls for the grid. Instances of wxGridCellEditor
124 // (actually, instances of derived classes since it is an ABC) can be
125 // associated with the cell attributes for individual cells, rows, columns, or
126 // even for the entire grid.
127 // ----------------------------------------------------------------------------
129 class WXDLLEXPORT wxGridCellEditor
133 virtual ~wxGridCellEditor();
135 bool IsCreated() { return m_control
!= NULL
; }
137 // Creates the actual edit control
138 virtual void Create(wxWindow
* parent
,
140 wxEvtHandler
* evtHandler
) = 0;
142 // Size and position the edit control
143 virtual void SetSize(const wxRect
& rect
);
145 // Show or hide the edit control, use the specified attributes to set
146 // colours/fonts for it
147 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
149 // Fetch the value from the table and prepare the edit control
150 // to begin editing. Set the focus to the edit control.
151 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
) = 0;
153 // Complete the editing of the current cell. If saveValue is
154 // true then send the new value back to the table. Returns true
155 // if the value has changed. If necessary, the control may be
157 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
) = 0;
159 // Reset the value in the control back to its starting value
160 virtual void Reset() = 0;
162 // If the editor is enabled by pressing keys on the grid,
163 // this will be called to let the editor do something about
164 // that first key if desired.
165 virtual void StartingKey(wxKeyEvent
& event
);
167 // Some types of controls on some platforms may need some help
168 // with the Return key.
169 virtual void HandleReturn(wxKeyEvent
& event
);
172 virtual void Destroy();
175 // the control we show on screen
176 wxControl
* m_control
;
178 // if we change the colours/font of the control from the default ones, we
179 // must restore the default later and we save them here between calls to
180 // Show(TRUE) and Show(FALSE)
186 // the editor for string/text data
187 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
190 wxGridCellTextEditor();
192 virtual void Create(wxWindow
* parent
,
194 wxEvtHandler
* evtHandler
);
196 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
197 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
199 virtual void Reset();
200 virtual void StartingKey(wxKeyEvent
& event
);
201 virtual void HandleReturn(wxKeyEvent
& event
);
204 wxTextCtrl
*Text() const { return (wxTextCtrl
*)m_control
; }
207 wxString m_startValue
;
210 // the editor for boolean data
211 class WXDLLEXPORT wxGridCellBoolEditor
: public wxGridCellEditor
214 virtual void Create(wxWindow
* parent
,
216 wxEvtHandler
* evtHandler
);
218 virtual void SetSize(const wxRect
& rect
);
219 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
221 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
222 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
224 virtual void Reset();
225 virtual void StartingKey(wxKeyEvent
& event
);
228 wxCheckBox
*CBox() const { return (wxCheckBox
*)m_control
; }
233 wxRect m_rectCell
; // the total size of the cell
236 // ----------------------------------------------------------------------------
237 // wxGridCellAttr: this class can be used to alter the cells appearance in
238 // the grid by changing their colour/font/... from default. An object of this
239 // class may be returned by wxGridTable::GetAttr().
240 // ----------------------------------------------------------------------------
242 class WXDLLEXPORT wxGridCellAttr
252 // VZ: considering the number of members wxGridCellAttr has now, this ctor
253 // seems to be pretty useless... may be we should just remove it?
254 wxGridCellAttr(const wxColour
& colText
,
255 const wxColour
& colBack
,
259 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
262 SetAlignment(hAlign
, vAlign
);
265 // default copy ctor ok
267 // this class is ref counted: it is created with ref count of 1, so
268 // calling DecRef() once will delete it. Calling IncRef() allows to lock
269 // it until the matching DecRef() is called
270 void IncRef() { m_nRef
++; }
271 void DecRef() { if ( !--m_nRef
) delete this; }
272 void SafeIncRef() { if ( this ) IncRef(); }
273 void SafeDecRef() { if ( this ) DecRef(); }
276 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
277 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
278 void SetFont(const wxFont
& font
) { m_font
= font
; }
279 void SetAlignment(int hAlign
, int vAlign
)
284 void SetReadOnly(bool isReadOnly
= TRUE
) { m_isReadOnly
= isReadOnly
; }
286 // takes ownership of the pointer
287 void SetRenderer(wxGridCellRenderer
*renderer
)
288 { delete m_renderer
; m_renderer
= renderer
; }
289 void SetEditor(wxGridCellEditor
* editor
)
290 { delete m_editor
; m_editor
= editor
; }
293 bool HasTextColour() const { return m_colText
.Ok(); }
294 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
295 bool HasFont() const { return m_font
.Ok(); }
296 bool HasAlignment() const { return m_hAlign
|| m_vAlign
; }
297 bool HasRenderer() const { return m_renderer
!= NULL
; }
298 bool HasEditor() const { return m_editor
!= NULL
; }
300 const wxColour
& GetTextColour() const;
301 const wxColour
& GetBackgroundColour() const;
302 const wxFont
& GetFont() const;
303 void GetAlignment(int *hAlign
, int *vAlign
) const;
304 wxGridCellRenderer
*GetRenderer() const;
305 wxGridCellEditor
*GetEditor() const;
307 bool IsReadOnly() const { return m_isReadOnly
; }
309 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
312 // the common part of all ctors
317 m_isReadOnly
= FALSE
;
323 // the dtor is private because only DecRef() can delete us
324 ~wxGridCellAttr() { delete m_renderer
; delete m_editor
; }
326 // the ref count - when it goes to 0, we die
335 wxGridCellRenderer
* m_renderer
;
336 wxGridCellEditor
* m_editor
;
337 wxGridCellAttr
* m_defGridAttr
;
341 // suppress the stupid gcc warning about the class having private dtor and
343 friend class wxGridCellAttrDummyFriend
;
346 // ----------------------------------------------------------------------------
347 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
349 // ----------------------------------------------------------------------------
351 // implementation note: we separate it from wxGridTableBase because we wish to
352 // avoid deriving a new table class if possible, and sometimes it will be
353 // enough to just derive another wxGridCellAttrProvider instead
355 // the default implementation is reasonably efficient for the generic case,
356 // but you might still wish to implement your own for some specific situations
357 // if you have performance problems with the stock one
358 class WXDLLEXPORT wxGridCellAttrProvider
361 wxGridCellAttrProvider();
362 virtual ~wxGridCellAttrProvider();
364 // DecRef() must be called on the returned pointer
365 virtual wxGridCellAttr
*GetAttr(int row
, int col
) const;
367 // all these functions take ownership of the pointer, don't call DecRef()
369 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
370 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
371 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
373 // these functions must be called whenever some rows/cols are deleted
374 // because the internal data must be updated then
375 void UpdateAttrRows( size_t pos
, int numRows
);
376 void UpdateAttrCols( size_t pos
, int numCols
);
381 wxGridCellAttrProviderData
*m_data
;
384 //////////////////////////////////////////////////////////////////////
386 // Grid table classes
388 //////////////////////////////////////////////////////////////////////
391 class WXDLLEXPORT wxGridTableBase
: public wxObject
395 virtual ~wxGridTableBase();
397 // You must override these functions in a derived table class
399 virtual long GetNumberRows() = 0;
400 virtual long GetNumberCols() = 0;
401 virtual wxString
GetValue( int row
, int col
) = 0;
402 virtual void SetValue( int row
, int col
, const wxString
& s
) = 0;
403 virtual bool IsEmptyCell( int row
, int col
) = 0;
405 // Overriding these is optional
407 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
408 virtual wxGrid
* GetView() const { return m_view
; }
410 virtual void Clear() {}
411 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
412 virtual bool AppendRows( size_t numRows
= 1 );
413 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
414 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
415 virtual bool AppendCols( size_t numCols
= 1 );
416 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
418 virtual wxString
GetRowLabelValue( int row
);
419 virtual wxString
GetColLabelValue( int col
);
420 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
421 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
423 // Attribute handling
426 // give us the attr provider to use - we take ownership of the pointer
427 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
429 // get the currently used attr provider (may be NULL)
430 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
432 // change row/col number in attribute if needed
433 void UpdateAttrRows( size_t pos
, int numRows
);
434 void UpdateAttrCols( size_t pos
, int numCols
);
436 // by default forwarded to wxGridCellAttrProvider if any. May be
437 // overridden to handle attributes directly in this class.
438 virtual wxGridCellAttr
*GetAttr( int row
, int col
);
440 // these functions take ownership of the pointer
441 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
442 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
443 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
447 wxGridCellAttrProvider
*m_attrProvider
;
449 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
453 // ----------------------------------------------------------------------------
454 // wxGridTableMessage
455 // ----------------------------------------------------------------------------
457 // IDs for messages sent from grid table to view
459 enum wxGridTableRequest
461 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
462 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
463 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
464 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
465 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
466 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
467 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
468 wxGRIDTABLE_NOTIFY_COLS_DELETED
471 class WXDLLEXPORT wxGridTableMessage
474 wxGridTableMessage();
475 wxGridTableMessage( wxGridTableBase
*table
, int id
,
479 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
480 wxGridTableBase
* GetTableObject() const { return m_table
; }
481 void SetId( int id
) { m_id
= id
; }
482 int GetId() { return m_id
; }
483 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
484 int GetCommandInt() { return m_comInt1
; }
485 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
486 int GetCommandInt2() { return m_comInt2
; }
489 wxGridTableBase
*m_table
;
497 // ------ wxGridStringArray
498 // A 2-dimensional array of strings for data values
501 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
505 // ------ wxGridStringTable
507 // Simplest type of data table for a grid for small tables of strings
508 // that are stored in memory
511 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
515 wxGridStringTable( int numRows
, int numCols
);
516 ~wxGridStringTable();
518 // these are pure virtual in wxGridTableBase
520 long GetNumberRows();
521 long GetNumberCols();
522 wxString
GetValue( int row
, int col
);
523 void SetValue( int row
, int col
, const wxString
& s
);
524 bool IsEmptyCell( int row
, int col
);
526 // overridden functions from wxGridTableBase
529 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
530 bool AppendRows( size_t numRows
= 1 );
531 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
532 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
533 bool AppendCols( size_t numCols
= 1 );
534 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
536 void SetRowLabelValue( int row
, const wxString
& );
537 void SetColLabelValue( int col
, const wxString
& );
538 wxString
GetRowLabelValue( int row
);
539 wxString
GetColLabelValue( int col
);
542 wxGridStringArray m_data
;
544 // These only get used if you set your own labels, otherwise the
545 // GetRow/ColLabelValue functions return wxGridTableBase defaults
547 wxArrayString m_rowLabels
;
548 wxArrayString m_colLabels
;
550 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
555 //////////////////////////////////////////////////////////////////////
559 //////////////////////////////////////////////////////////////////////
561 class WXDLLEXPORT wxGridCellCoords
564 wxGridCellCoords() { m_row
= m_col
= -1; }
565 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
567 // default copy ctor is ok
569 long GetRow() const { return m_row
; }
570 void SetRow( long n
) { m_row
= n
; }
571 long GetCol() const { return m_col
; }
572 void SetCol( long n
) { m_col
= n
; }
573 void Set( long row
, long col
) { m_row
= row
; m_col
= col
; }
575 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
577 if ( &other
!= this )
585 bool operator==( const wxGridCellCoords
& other
) const
587 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
590 bool operator!=( const wxGridCellCoords
& other
) const
592 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
595 bool operator!() const
597 return (m_row
== -1 && m_col
== -1 );
606 // For comparisons...
608 extern wxGridCellCoords wxGridNoCellCoords
;
609 extern wxRect wxGridNoCellRect
;
611 // An array of cell coords...
613 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
617 // ----------------------------------------------------------------------------
619 // ----------------------------------------------------------------------------
621 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
629 wxGrid( wxWindow
*parent
,
631 const wxPoint
& pos
= wxDefaultPosition
,
632 const wxSize
& size
= wxDefaultSize
,
634 const wxString
& name
= wxPanelNameStr
);
638 bool CreateGrid( int numRows
, int numCols
);
641 // ------ grid dimensions
643 int GetNumberRows() { return m_numRows
; }
644 int GetNumberCols() { return m_numCols
; }
647 // ------ display update functions
649 void CalcRowLabelsExposed( wxRegion
& reg
);
651 void CalcColLabelsExposed( wxRegion
& reg
);
652 void CalcCellsExposed( wxRegion
& reg
);
655 // ------ event handlers
657 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
658 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
659 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
660 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
661 bool ProcessTableMessage( wxGridTableMessage
& );
663 void DoEndDragResizeRow();
664 void DoEndDragResizeCol();
666 wxGridTableBase
* GetTable() const { return m_table
; }
667 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
);
670 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
671 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
672 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
673 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
674 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
675 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
677 void DrawGridCellArea( wxDC
& dc
);
678 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
679 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
680 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
681 void DrawCellHighlight( wxDC
& dc
, const wxGridCellAttr
*attr
);
683 void DrawRowLabels( wxDC
& dc
);
684 void DrawRowLabel( wxDC
& dc
, int row
);
686 void DrawColLabels( wxDC
& dc
);
687 void DrawColLabel( wxDC
& dc
, int col
);
690 // ------ Cell text drawing functions
692 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
693 int horizontalAlignment
= wxLEFT
,
694 int verticalAlignment
= wxTOP
);
696 // Split a string containing newline chararcters into an array of
697 // strings and return the number of lines
699 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
701 void GetTextBoxSize( wxDC
& dc
,
702 wxArrayString
& lines
,
703 long *width
, long *height
);
707 // Code that does a lot of grid modification can be enclosed
708 // between BeginBatch() and EndBatch() calls to avoid screen
711 void BeginBatch() { m_batchCount
++; }
712 void EndBatch() { if ( m_batchCount
> 0 ) m_batchCount
--; }
713 int GetBatchCount() { return m_batchCount
; }
716 // ------ edit control functions
718 bool IsEditable() { return m_editable
; }
719 void EnableEditing( bool edit
);
721 void EnableCellEditControl( bool enable
= TRUE
);
722 void DisableCellEditControl() { EnableCellEditControl(FALSE
); }
723 bool CanEnableCellControl() const;
724 bool IsCellEditControlEnabled() const;
726 bool IsCurrentCellReadOnly() const;
728 void ShowCellEditControl();
729 void HideCellEditControl();
730 void SetEditControlValue( const wxString
& s
= wxEmptyString
);
731 void SaveEditControlValue();
734 // ------ grid location functions
735 // Note that all of these functions work with the logical coordinates of
736 // grid cells and labels so you will need to convert from device
737 // coordinates for mouse events etc.
739 void XYToCell( int x
, int y
, wxGridCellCoords
& );
743 int YToEdgeOfRow( int y
);
744 int XToEdgeOfCol( int x
);
746 wxRect
CellToRect( int row
, int col
);
747 wxRect
CellToRect( const wxGridCellCoords
& coords
)
748 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
750 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
751 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
753 // check to see if a cell is either wholly visible (the default arg) or
754 // at least partially visible in the grid window
756 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
757 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
758 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
759 void MakeCellVisible( int row
, int col
);
760 void MakeCellVisible( const wxGridCellCoords
& coords
)
761 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
764 // ------ grid cursor movement functions
766 void SetGridCursor( int row
, int col
)
767 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
770 bool MoveCursorDown();
771 bool MoveCursorLeft();
772 bool MoveCursorRight();
775 bool MoveCursorUpBlock();
776 bool MoveCursorDownBlock();
777 bool MoveCursorLeftBlock();
778 bool MoveCursorRightBlock();
781 // ------ label and gridline formatting
783 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
784 int GetRowLabelSize() { return m_rowLabelWidth
; }
785 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
786 int GetColLabelSize() { return m_colLabelHeight
; }
787 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
788 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
789 wxFont
GetLabelFont() { return m_labelFont
; }
790 void GetRowLabelAlignment( int *horiz
, int *vert
);
791 void GetColLabelAlignment( int *horiz
, int *vert
);
792 wxString
GetRowLabelValue( int row
);
793 wxString
GetColLabelValue( int col
);
794 wxColour
GetGridLineColour() { return m_gridLineColour
; }
796 void SetRowLabelSize( int width
);
797 void SetColLabelSize( int height
);
798 void SetLabelBackgroundColour( const wxColour
& );
799 void SetLabelTextColour( const wxColour
& );
800 void SetLabelFont( const wxFont
& );
801 void SetRowLabelAlignment( int horiz
, int vert
);
802 void SetColLabelAlignment( int horiz
, int vert
);
803 void SetRowLabelValue( int row
, const wxString
& );
804 void SetColLabelValue( int col
, const wxString
& );
805 void SetGridLineColour( const wxColour
& );
807 // this sets the specified attribute for all cells in this row/col
808 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
809 void SetColAttr(int col
, wxGridCellAttr
*attr
);
811 void EnableGridLines( bool enable
= TRUE
);
812 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
814 // ------ row and col formatting
816 int GetDefaultRowSize();
817 int GetRowSize( int row
);
818 int GetDefaultColSize();
819 int GetColSize( int col
);
820 wxColour
GetDefaultCellBackgroundColour();
821 wxColour
GetCellBackgroundColour( int row
, int col
);
822 wxColour
GetDefaultCellTextColour();
823 wxColour
GetCellTextColour( int row
, int col
);
824 wxFont
GetDefaultCellFont();
825 wxFont
GetCellFont( int row
, int col
);
826 void GetDefaultCellAlignment( int *horiz
, int *vert
);
827 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
829 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
830 void SetRowSize( int row
, int height
);
831 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
833 void SetColSize( int col
, int width
);
834 void SetDefaultCellBackgroundColour( const wxColour
& );
835 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
836 void SetDefaultCellTextColour( const wxColour
& );
838 void SetCellTextColour( int row
, int col
, const wxColour
& );
839 void SetDefaultCellFont( const wxFont
& );
840 void SetCellFont( int row
, int col
, const wxFont
& );
841 void SetDefaultCellAlignment( int horiz
, int vert
);
842 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
844 // takes ownership of the pointer
845 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
846 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
847 wxGridCellRenderer
*GetDefaultRenderer() const;
848 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
850 // takes ownership of the pointer
851 void SetDefaultEditor(wxGridCellEditor
*editor
);
852 void SetCellEditor(int row
, int col
, wxGridCellEditor
*editor
);
853 wxGridCellEditor
*GetDefaultEditor() const;
854 wxGridCellEditor
* GetCellEditor(int row
, int col
);
857 // ------ cell value accessors
859 wxString
GetCellValue( int row
, int col
)
863 return m_table
->GetValue( row
, col
);
867 return wxEmptyString
;
871 wxString
GetCellValue( const wxGridCellCoords
& coords
)
872 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
874 void SetCellValue( int row
, int col
, const wxString
& s
);
875 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
876 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
878 // returns TRUE if the cell can't be edited
879 bool IsReadOnly(int row
, int col
) const;
881 // make the cell editable/readonly
882 void SetReadOnly(int row
, int col
, bool isReadOnly
= TRUE
);
884 // ------ selections of blocks of cells
886 void SelectRow( int row
, bool addToSelected
= FALSE
);
887 void SelectCol( int col
, bool addToSelected
= FALSE
);
889 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
891 void SelectBlock( const wxGridCellCoords
& topLeft
,
892 const wxGridCellCoords
& bottomRight
)
893 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
894 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
899 { return ( m_selectedTopLeft
!= wxGridNoCellCoords
&&
900 m_selectedBottomRight
!= wxGridNoCellCoords
);
903 void ClearSelection();
905 bool IsInSelection( int row
, int col
)
906 { return ( IsSelection() &&
907 row
>= m_selectedTopLeft
.GetRow() &&
908 col
>= m_selectedTopLeft
.GetCol() &&
909 row
<= m_selectedBottomRight
.GetRow() &&
910 col
<= m_selectedBottomRight
.GetCol() );
913 bool IsInSelection( const wxGridCellCoords
& coords
)
914 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
916 void GetSelection( int* topRow
, int* leftCol
, int* bottomRow
, int* rightCol
)
918 // these will all be -1 if there is no selected block
920 *topRow
= m_selectedTopLeft
.GetRow();
921 *leftCol
= m_selectedTopLeft
.GetCol();
922 *bottomRow
= m_selectedBottomRight
.GetRow();
923 *rightCol
= m_selectedBottomRight
.GetCol();
927 // This function returns the rectangle that encloses the block of cells
928 // limited by TopLeft and BottomRight cell in device coords and clipped
929 // to the client size of the grid window.
931 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
932 const wxGridCellCoords
& bottomRight
);
934 // This function returns the rectangle that encloses the selected cells
935 // in device coords and clipped to the client size of the grid window.
937 wxRect
SelectionToDeviceRect()
939 return BlockToDeviceRect( m_selectedTopLeft
,
940 m_selectedBottomRight
);
943 // Access or update the selection fore/back colours
944 wxColour
GetSelectionBackground() const
945 { return m_selectionBackground
; }
946 wxColour
GetSelectionForeground() const
947 { return m_selectionForeground
; }
949 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
950 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
954 // ------ For compatibility with previous wxGrid only...
956 // ************************************************
957 // ** Don't use these in new code because they **
958 // ** are liable to disappear in a future **
960 // ************************************************
963 wxGrid( wxWindow
*parent
,
964 int x
= -1, int y
= -1, int w
= -1, int h
= -1,
966 const wxString
& name
= wxPanelNameStr
)
967 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
), style
, name
)
972 void SetCellValue( const wxString
& val
, int row
, int col
)
973 { SetCellValue( row
, col
, val
); }
975 void UpdateDimensions()
976 { CalcDimensions(); }
978 int GetRows() { return GetNumberRows(); }
979 int GetCols() { return GetNumberCols(); }
980 int GetCursorRow() { return GetGridCursorRow(); }
981 int GetCursorColumn() { return GetGridCursorCol(); }
983 int GetScrollPosX() { return 0; }
984 int GetScrollPosY() { return 0; }
986 void SetScrollX( int x
) { }
987 void SetScrollY( int y
) { }
989 void SetColumnWidth( int col
, int width
)
990 { SetColSize( col
, width
); }
992 int GetColumnWidth( int col
)
993 { return GetColSize( col
); }
995 void SetRowHeight( int row
, int height
)
996 { SetRowSize( row
, height
); }
998 int GetRowHeight( int row
)
999 { return GetRowSize( row
); }
1001 int GetViewHeight() // returned num whole rows visible
1004 int GetViewWidth() // returned num whole cols visible
1007 void SetLabelSize( int orientation
, int sz
)
1009 if ( orientation
== wxHORIZONTAL
)
1010 SetColLabelSize( sz
);
1012 SetRowLabelSize( sz
);
1015 int GetLabelSize( int orientation
)
1017 if ( orientation
== wxHORIZONTAL
)
1018 return GetColLabelSize();
1020 return GetRowLabelSize();
1023 void SetLabelAlignment( int orientation
, int align
)
1025 if ( orientation
== wxHORIZONTAL
)
1026 SetColLabelAlignment( align
, -1 );
1028 SetRowLabelAlignment( align
, -1 );
1031 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
1034 if ( orientation
== wxHORIZONTAL
)
1036 GetColLabelAlignment( &h
, &v
);
1041 GetRowLabelAlignment( &h
, &v
);
1046 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1048 if ( orientation
== wxHORIZONTAL
)
1049 SetColLabelValue( pos
, val
);
1051 SetRowLabelValue( pos
, val
);
1054 wxString
GetLabelValue( int orientation
, int pos
)
1056 if ( orientation
== wxHORIZONTAL
)
1057 return GetColLabelValue( pos
);
1059 return GetRowLabelValue( pos
);
1062 wxFont
GetCellTextFont() const
1063 { return m_defaultCellAttr
->GetFont(); }
1065 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1066 { return m_defaultCellAttr
->GetFont(); }
1068 void SetCellTextFont(const wxFont
& fnt
)
1069 { SetDefaultCellFont( fnt
); }
1071 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1072 { SetCellFont( row
, col
, fnt
); }
1074 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1075 { SetCellTextColour( row
, col
, val
); }
1077 void SetCellTextColour(const wxColour
& col
)
1078 { SetDefaultCellTextColour( col
); }
1080 void SetCellBackgroundColour(const wxColour
& col
)
1081 { SetDefaultCellBackgroundColour( col
); }
1083 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1084 { SetCellBackgroundColour( row
, col
, colour
); }
1086 bool GetEditable() { return IsEditable(); }
1087 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1088 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1090 void SetEditInPlace(bool edit
= TRUE
) { }
1092 void SetCellAlignment( int align
, int row
, int col
)
1093 { SetCellAlignment(row
, col
, align
, wxCENTER
); }
1094 void SetCellAlignment( int WXUNUSED(align
) ) {}
1095 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1097 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1098 wxPen
& GetDividerPen() const { return wxNullPen
; }
1099 void OnActivate(bool WXUNUSED(active
)) {}
1101 // ******** End of compatibility functions **********
1105 // ------ control IDs
1106 enum { wxGRID_CELLCTRL
= 2000,
1109 // ------ control types
1110 enum { wxGRID_TEXTCTRL
= 2100,
1115 // for wxGridCellBoolEditor
1116 wxWindow
*GetGridWindow() const;
1122 wxGridWindow
*m_gridWin
;
1123 wxGridRowLabelWindow
*m_rowLabelWin
;
1124 wxGridColLabelWindow
*m_colLabelWin
;
1125 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1127 wxGridTableBase
*m_table
;
1138 wxGridCellCoords m_currentCellCoords
;
1140 wxGridCellCoords m_selectedTopLeft
;
1141 wxGridCellCoords m_selectedBottomRight
;
1142 wxColour m_selectionBackground
;
1143 wxColour m_selectionForeground
;
1145 int m_defaultRowHeight
;
1146 wxArrayInt m_rowHeights
;
1147 wxArrayInt m_rowBottoms
;
1149 int m_defaultColWidth
;
1150 wxArrayInt m_colWidths
;
1151 wxArrayInt m_colRights
;
1152 int m_rowLabelWidth
;
1153 int m_colLabelHeight
;
1155 wxColour m_labelBackgroundColour
;
1156 wxColour m_labelTextColour
;
1159 int m_rowLabelHorizAlign
;
1160 int m_rowLabelVertAlign
;
1161 int m_colLabelHorizAlign
;
1162 int m_colLabelVertAlign
;
1164 bool m_defaultRowLabelValues
;
1165 bool m_defaultColLabelValues
;
1167 wxColour m_gridLineColour
;
1168 bool m_gridLinesEnabled
;
1171 // do we have some place to store attributes in?
1172 bool CanHaveAttributes();
1174 // returns the attribute we may modify in place: a new one if this cell
1175 // doesn't have any yet or the existing one if it does
1177 // DecRef() must be called on the returned pointer, as usual
1178 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1180 // cell attribute cache (currently we only cache 1, may be will do
1181 // more/better later)
1185 wxGridCellAttr
*attr
;
1188 // invalidates the attribute cache
1189 void ClearAttrCache();
1191 // adds an attribute to cache
1192 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1194 // looks for an attr in cache, returns TRUE if found
1195 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1197 // looks for the attr in cache, if not found asks the table and caches the
1199 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1200 wxGridCellAttr
*GetCellAttr(const wxGridCellCoords
& coords
)
1201 { return GetCellAttr( coords
.GetRow(), coords
.GetCol() ); }
1203 // the default cell attr object for cells that don't have their own
1204 wxGridCellAttr
* m_defaultCellAttr
;
1207 wxGridCellCoordsArray m_cellsExposed
;
1208 wxArrayInt m_rowsExposed
;
1209 wxArrayInt m_colsExposed
;
1210 wxArrayInt m_rowLabelsExposed
;
1211 wxArrayInt m_colLabelsExposed
;
1218 WXGRID_CURSOR_SELECT_CELL
,
1219 WXGRID_CURSOR_RESIZE_ROW
,
1220 WXGRID_CURSOR_RESIZE_COL
,
1221 WXGRID_CURSOR_SELECT_ROW
,
1222 WXGRID_CURSOR_SELECT_COL
1225 // this method not only sets m_cursorMode but also sets the correct cursor
1226 // for the given mode and, if captureMouse is not FALSE releases the mouse
1227 // if it was captured and captures it if it must be captured
1229 // for this to work, you should always use it and not set m_cursorMode
1231 void ChangeCursorMode(CursorMode mode
,
1232 wxWindow
*win
= (wxWindow
*)NULL
,
1233 bool captureMouse
= TRUE
);
1235 wxWindow
*m_winCapture
; // the window which captured the mouse
1236 CursorMode m_cursorMode
;
1241 wxPoint m_startDragPos
;
1243 bool m_waitForSlowClick
;
1245 wxGridCellCoords m_selectionStart
;
1247 wxCursor m_rowResizeCursor
;
1248 wxCursor m_colResizeCursor
;
1250 bool m_editable
; // applies to whole grid
1251 bool m_cellEditCtrlEnabled
; // is in-place edit currently shown?
1256 void CalcDimensions();
1257 void CalcWindowSizes();
1258 bool Redimension( wxGridTableMessage
& );
1261 bool SendEvent( const wxEventType
, int row
, int col
, wxMouseEvent
& );
1262 bool SendEvent( const wxEventType
, int row
, int col
);
1263 bool SendEvent( const wxEventType type
)
1265 return SendEvent(type
,
1266 m_currentCellCoords
.GetRow(),
1267 m_currentCellCoords
.GetCol());
1270 void OnPaint( wxPaintEvent
& );
1271 void OnSize( wxSizeEvent
& );
1272 void OnKeyDown( wxKeyEvent
& );
1273 void OnEraseBackground( wxEraseEvent
& );
1276 void SetCurrentCell( const wxGridCellCoords
& coords
);
1277 void SetCurrentCell( int row
, int col
)
1278 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1281 // ------ functions to get/send data (see also public functions)
1283 bool GetModelValues();
1284 bool SetModelValues();
1287 DECLARE_DYNAMIC_CLASS( wxGrid
)
1288 DECLARE_EVENT_TABLE()
1296 // ------ Grid event class and event types
1299 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1303 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1304 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1308 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1309 int row
=-1, int col
=-1, int x
=-1, int y
=-1,
1310 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1312 virtual int GetRow() { return m_row
; }
1313 virtual int GetCol() { return m_col
; }
1314 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1315 bool ControlDown() { return m_control
; }
1316 bool MetaDown() { return m_meta
; }
1317 bool ShiftDown() { return m_shift
; }
1318 bool AltDown() { return m_alt
; }
1330 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1333 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1337 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1338 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1342 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1343 int rowOrCol
=-1, int x
=-1, int y
=-1,
1344 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1346 int GetRowOrCol() { return m_rowOrCol
; }
1347 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1348 bool ControlDown() { return m_control
; }
1349 bool MetaDown() { return m_meta
; }
1350 bool ShiftDown() { return m_shift
; }
1351 bool AltDown() { return m_alt
; }
1362 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1366 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1369 wxGridRangeSelectEvent()
1372 m_topLeft
= wxGridNoCellCoords
;
1373 m_bottomRight
= wxGridNoCellCoords
;
1380 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1381 const wxGridCellCoords
& topLeft
,
1382 const wxGridCellCoords
& bottomRight
,
1383 bool control
=FALSE
, bool shift
=FALSE
,
1384 bool alt
=FALSE
, bool meta
=FALSE
);
1386 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1387 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1388 int GetTopRow() { return m_topLeft
.GetRow(); }
1389 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1390 int GetLeftCol() { return m_topLeft
.GetCol(); }
1391 int GetRightCol() { return m_bottomRight
.GetCol(); }
1392 bool ControlDown() { return m_control
; }
1393 bool MetaDown() { return m_meta
; }
1394 bool ShiftDown() { return m_shift
; }
1395 bool AltDown() { return m_alt
; }
1398 wxGridCellCoords m_topLeft
;
1399 wxGridCellCoords m_bottomRight
;
1405 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1408 // TODO move to wx/event.h
1409 const wxEventType wxEVT_GRID_CELL_LEFT_CLICK
= wxEVT_FIRST
+ 1580;
1410 const wxEventType wxEVT_GRID_CELL_RIGHT_CLICK
= wxEVT_FIRST
+ 1581;
1411 const wxEventType wxEVT_GRID_CELL_LEFT_DCLICK
= wxEVT_FIRST
+ 1582;
1412 const wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1583;
1413 const wxEventType wxEVT_GRID_LABEL_LEFT_CLICK
= wxEVT_FIRST
+ 1584;
1414 const wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK
= wxEVT_FIRST
+ 1585;
1415 const wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK
= wxEVT_FIRST
+ 1586;
1416 const wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1587;
1417 const wxEventType wxEVT_GRID_ROW_SIZE
= wxEVT_FIRST
+ 1588;
1418 const wxEventType wxEVT_GRID_COL_SIZE
= wxEVT_FIRST
+ 1589;
1419 const wxEventType wxEVT_GRID_RANGE_SELECT
= wxEVT_FIRST
+ 1590;
1420 const wxEventType wxEVT_GRID_CELL_CHANGE
= wxEVT_FIRST
+ 1591;
1421 const wxEventType wxEVT_GRID_SELECT_CELL
= wxEVT_FIRST
+ 1592;
1422 const wxEventType wxEVT_GRID_EDITOR_SHOWN
= wxEVT_FIRST
+ 1593;
1423 const wxEventType wxEVT_GRID_EDITOR_HIDDEN
= wxEVT_FIRST
+ 1594;
1426 typedef void (wxEvtHandler::*wxGridEventFunction
)(wxGridEvent
&);
1427 typedef void (wxEvtHandler::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1428 typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1430 #define EVT_GRID_CELL_LEFT_CLICK(fn) { wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1431 #define EVT_GRID_CELL_RIGHT_CLICK(fn) { wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1432 #define EVT_GRID_CELL_LEFT_DCLICK(fn) { wxEVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1433 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) { wxEVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1434 #define EVT_GRID_LABEL_LEFT_CLICK(fn) { wxEVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1435 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) { wxEVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1436 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) { wxEVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1437 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1438 #define EVT_GRID_ROW_SIZE(fn) { wxEVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1439 #define EVT_GRID_COL_SIZE(fn) { wxEVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1440 #define EVT_GRID_RANGE_SELECT(fn) { wxEVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
1441 #define EVT_GRID_CELL_CHANGE(fn) { wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1442 #define EVT_GRID_SELECT_CELL(fn) { wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1443 #define EVT_GRID_EDITOR_SHOWN(fn) { wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1444 #define EVT_GRID_EDITOR_HIDDEN(fn) { wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1447 #if 0 // TODO: implement these ? others ?
1449 const wxEventType wxEVT_GRID_CREATE_CELL
= wxEVT_FIRST
+ 1576;
1450 const wxEventType wxEVT_GRID_CHANGE_LABELS
= wxEVT_FIRST
+ 1577;
1451 const wxEventType wxEVT_GRID_CHANGE_SEL_LABEL
= wxEVT_FIRST
+ 1578;
1453 #define EVT_GRID_CREATE_CELL(fn) { wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1454 #define EVT_GRID_CHANGE_LABELS(fn) { wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1455 #define EVT_GRID_CHANGE_SEL_LABEL(fn) { wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1459 #endif // #ifndef __WXGRID_H__
1461 #endif // ifndef wxUSE_NEW_GRID