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 // if the editor is enabled by clicking on the cell, this method will be
172 virtual void StartingClick();
174 // Some types of controls on some platforms may need some help
175 // with the Return key.
176 virtual void HandleReturn(wxKeyEvent
& event
);
179 virtual void Destroy();
182 // the control we show on screen
183 wxControl
* m_control
;
185 // if we change the colours/font of the control from the default ones, we
186 // must restore the default later and we save them here between calls to
187 // Show(TRUE) and Show(FALSE)
193 // the editor for string/text data
194 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
197 wxGridCellTextEditor();
199 virtual void Create(wxWindow
* parent
,
201 wxEvtHandler
* evtHandler
);
203 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
205 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
206 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
208 virtual void Reset();
209 virtual void StartingKey(wxKeyEvent
& event
);
210 virtual void HandleReturn(wxKeyEvent
& event
);
213 wxTextCtrl
*Text() const { return (wxTextCtrl
*)m_control
; }
216 wxString m_startValue
;
219 // the editor for boolean data
220 class WXDLLEXPORT wxGridCellBoolEditor
: public wxGridCellEditor
223 virtual void Create(wxWindow
* parent
,
225 wxEvtHandler
* evtHandler
);
227 virtual void SetSize(const wxRect
& rect
);
228 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
230 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
231 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
233 virtual void Reset();
234 virtual void StartingClick();
237 wxCheckBox
*CBox() const { return (wxCheckBox
*)m_control
; }
243 // ----------------------------------------------------------------------------
244 // wxGridCellAttr: this class can be used to alter the cells appearance in
245 // the grid by changing their colour/font/... from default. An object of this
246 // class may be returned by wxGridTable::GetAttr().
247 // ----------------------------------------------------------------------------
249 class WXDLLEXPORT wxGridCellAttr
259 // VZ: considering the number of members wxGridCellAttr has now, this ctor
260 // seems to be pretty useless... may be we should just remove it?
261 wxGridCellAttr(const wxColour
& colText
,
262 const wxColour
& colBack
,
266 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
269 SetAlignment(hAlign
, vAlign
);
272 // default copy ctor ok
274 // this class is ref counted: it is created with ref count of 1, so
275 // calling DecRef() once will delete it. Calling IncRef() allows to lock
276 // it until the matching DecRef() is called
277 void IncRef() { m_nRef
++; }
278 void DecRef() { if ( !--m_nRef
) delete this; }
279 void SafeIncRef() { if ( this ) IncRef(); }
280 void SafeDecRef() { if ( this ) DecRef(); }
283 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
284 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
285 void SetFont(const wxFont
& font
) { m_font
= font
; }
286 void SetAlignment(int hAlign
, int vAlign
)
291 void SetReadOnly(bool isReadOnly
= TRUE
) { m_isReadOnly
= isReadOnly
; }
293 // takes ownership of the pointer
294 void SetRenderer(wxGridCellRenderer
*renderer
)
295 { delete m_renderer
; m_renderer
= renderer
; }
296 void SetEditor(wxGridCellEditor
* editor
)
297 { delete m_editor
; m_editor
= editor
; }
300 bool HasTextColour() const { return m_colText
.Ok(); }
301 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
302 bool HasFont() const { return m_font
.Ok(); }
303 bool HasAlignment() const { return m_hAlign
|| m_vAlign
; }
304 bool HasRenderer() const { return m_renderer
!= NULL
; }
305 bool HasEditor() const { return m_editor
!= NULL
; }
307 const wxColour
& GetTextColour() const;
308 const wxColour
& GetBackgroundColour() const;
309 const wxFont
& GetFont() const;
310 void GetAlignment(int *hAlign
, int *vAlign
) const;
311 wxGridCellRenderer
*GetRenderer() const;
312 wxGridCellEditor
*GetEditor() const;
314 bool IsReadOnly() const { return m_isReadOnly
; }
316 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
319 // the common part of all ctors
324 m_isReadOnly
= FALSE
;
330 // the dtor is private because only DecRef() can delete us
331 ~wxGridCellAttr() { delete m_renderer
; delete m_editor
; }
333 // the ref count - when it goes to 0, we die
342 wxGridCellRenderer
* m_renderer
;
343 wxGridCellEditor
* m_editor
;
344 wxGridCellAttr
* m_defGridAttr
;
348 // suppress the stupid gcc warning about the class having private dtor and
350 friend class wxGridCellAttrDummyFriend
;
353 // ----------------------------------------------------------------------------
354 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
356 // ----------------------------------------------------------------------------
358 // implementation note: we separate it from wxGridTableBase because we wish to
359 // avoid deriving a new table class if possible, and sometimes it will be
360 // enough to just derive another wxGridCellAttrProvider instead
362 // the default implementation is reasonably efficient for the generic case,
363 // but you might still wish to implement your own for some specific situations
364 // if you have performance problems with the stock one
365 class WXDLLEXPORT wxGridCellAttrProvider
368 wxGridCellAttrProvider();
369 virtual ~wxGridCellAttrProvider();
371 // DecRef() must be called on the returned pointer
372 virtual wxGridCellAttr
*GetAttr(int row
, int col
) const;
374 // all these functions take ownership of the pointer, don't call DecRef()
376 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
377 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
378 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
380 // these functions must be called whenever some rows/cols are deleted
381 // because the internal data must be updated then
382 void UpdateAttrRows( size_t pos
, int numRows
);
383 void UpdateAttrCols( size_t pos
, int numCols
);
388 wxGridCellAttrProviderData
*m_data
;
391 //////////////////////////////////////////////////////////////////////
393 // Grid table classes
395 //////////////////////////////////////////////////////////////////////
398 class WXDLLEXPORT wxGridTableBase
: public wxObject
402 virtual ~wxGridTableBase();
404 // You must override these functions in a derived table class
406 virtual long GetNumberRows() = 0;
407 virtual long GetNumberCols() = 0;
408 virtual wxString
GetValue( int row
, int col
) = 0;
409 virtual void SetValue( int row
, int col
, const wxString
& s
) = 0;
410 virtual bool IsEmptyCell( int row
, int col
) = 0;
412 // Overriding these is optional
414 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
415 virtual wxGrid
* GetView() const { return m_view
; }
417 virtual void Clear() {}
418 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
419 virtual bool AppendRows( size_t numRows
= 1 );
420 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
421 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
422 virtual bool AppendCols( size_t numCols
= 1 );
423 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
425 virtual wxString
GetRowLabelValue( int row
);
426 virtual wxString
GetColLabelValue( int col
);
427 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
428 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
430 // Attribute handling
433 // give us the attr provider to use - we take ownership of the pointer
434 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
436 // get the currently used attr provider (may be NULL)
437 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
439 // change row/col number in attribute if needed
440 void UpdateAttrRows( size_t pos
, int numRows
);
441 void UpdateAttrCols( size_t pos
, int numCols
);
443 // by default forwarded to wxGridCellAttrProvider if any. May be
444 // overridden to handle attributes directly in this class.
445 virtual wxGridCellAttr
*GetAttr( int row
, int col
);
447 // these functions take ownership of the pointer
448 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
449 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
450 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
454 wxGridCellAttrProvider
*m_attrProvider
;
456 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
460 // ----------------------------------------------------------------------------
461 // wxGridTableMessage
462 // ----------------------------------------------------------------------------
464 // IDs for messages sent from grid table to view
466 enum wxGridTableRequest
468 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
469 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
470 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
471 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
472 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
473 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
474 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
475 wxGRIDTABLE_NOTIFY_COLS_DELETED
478 class WXDLLEXPORT wxGridTableMessage
481 wxGridTableMessage();
482 wxGridTableMessage( wxGridTableBase
*table
, int id
,
486 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
487 wxGridTableBase
* GetTableObject() const { return m_table
; }
488 void SetId( int id
) { m_id
= id
; }
489 int GetId() { return m_id
; }
490 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
491 int GetCommandInt() { return m_comInt1
; }
492 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
493 int GetCommandInt2() { return m_comInt2
; }
496 wxGridTableBase
*m_table
;
504 // ------ wxGridStringArray
505 // A 2-dimensional array of strings for data values
508 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
512 // ------ wxGridStringTable
514 // Simplest type of data table for a grid for small tables of strings
515 // that are stored in memory
518 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
522 wxGridStringTable( int numRows
, int numCols
);
523 ~wxGridStringTable();
525 // these are pure virtual in wxGridTableBase
527 long GetNumberRows();
528 long GetNumberCols();
529 wxString
GetValue( int row
, int col
);
530 void SetValue( int row
, int col
, const wxString
& s
);
531 bool IsEmptyCell( int row
, int col
);
533 // overridden functions from wxGridTableBase
536 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
537 bool AppendRows( size_t numRows
= 1 );
538 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
539 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
540 bool AppendCols( size_t numCols
= 1 );
541 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
543 void SetRowLabelValue( int row
, const wxString
& );
544 void SetColLabelValue( int col
, const wxString
& );
545 wxString
GetRowLabelValue( int row
);
546 wxString
GetColLabelValue( int col
);
549 wxGridStringArray m_data
;
551 // These only get used if you set your own labels, otherwise the
552 // GetRow/ColLabelValue functions return wxGridTableBase defaults
554 wxArrayString m_rowLabels
;
555 wxArrayString m_colLabels
;
557 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
562 //////////////////////////////////////////////////////////////////////
566 //////////////////////////////////////////////////////////////////////
568 class WXDLLEXPORT wxGridCellCoords
571 wxGridCellCoords() { m_row
= m_col
= -1; }
572 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
574 // default copy ctor is ok
576 long GetRow() const { return m_row
; }
577 void SetRow( long n
) { m_row
= n
; }
578 long GetCol() const { return m_col
; }
579 void SetCol( long n
) { m_col
= n
; }
580 void Set( long row
, long col
) { m_row
= row
; m_col
= col
; }
582 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
584 if ( &other
!= this )
592 bool operator==( const wxGridCellCoords
& other
) const
594 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
597 bool operator!=( const wxGridCellCoords
& other
) const
599 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
602 bool operator!() const
604 return (m_row
== -1 && m_col
== -1 );
613 // For comparisons...
615 extern wxGridCellCoords wxGridNoCellCoords
;
616 extern wxRect wxGridNoCellRect
;
618 // An array of cell coords...
620 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
624 // ----------------------------------------------------------------------------
626 // ----------------------------------------------------------------------------
628 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
636 wxGrid( wxWindow
*parent
,
638 const wxPoint
& pos
= wxDefaultPosition
,
639 const wxSize
& size
= wxDefaultSize
,
641 const wxString
& name
= wxPanelNameStr
);
645 bool CreateGrid( int numRows
, int numCols
);
648 // ------ grid dimensions
650 int GetNumberRows() { return m_numRows
; }
651 int GetNumberCols() { return m_numCols
; }
654 // ------ display update functions
656 void CalcRowLabelsExposed( wxRegion
& reg
);
658 void CalcColLabelsExposed( wxRegion
& reg
);
659 void CalcCellsExposed( wxRegion
& reg
);
662 // ------ event handlers
664 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
665 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
666 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
667 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
668 bool ProcessTableMessage( wxGridTableMessage
& );
670 void DoEndDragResizeRow();
671 void DoEndDragResizeCol();
673 wxGridTableBase
* GetTable() const { return m_table
; }
674 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
);
677 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
678 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
679 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
680 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
681 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
682 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
684 void DrawGridCellArea( wxDC
& dc
);
685 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
686 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
687 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
688 void DrawHighlight(wxDC
& dc
);
690 // this function is called when the current cell highlight must be redrawn
691 // and may be overridden by the user
692 virtual void DrawCellHighlight( wxDC
& dc
, const wxGridCellAttr
*attr
);
694 void DrawRowLabels( wxDC
& dc
);
695 void DrawRowLabel( wxDC
& dc
, int row
);
697 void DrawColLabels( wxDC
& dc
);
698 void DrawColLabel( wxDC
& dc
, int col
);
701 // ------ Cell text drawing functions
703 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
704 int horizontalAlignment
= wxLEFT
,
705 int verticalAlignment
= wxTOP
);
707 // Split a string containing newline chararcters into an array of
708 // strings and return the number of lines
710 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
712 void GetTextBoxSize( wxDC
& dc
,
713 wxArrayString
& lines
,
714 long *width
, long *height
);
718 // Code that does a lot of grid modification can be enclosed
719 // between BeginBatch() and EndBatch() calls to avoid screen
722 void BeginBatch() { m_batchCount
++; }
723 void EndBatch() { if ( m_batchCount
> 0 ) m_batchCount
--; }
724 int GetBatchCount() { return m_batchCount
; }
727 // ------ edit control functions
729 bool IsEditable() { return m_editable
; }
730 void EnableEditing( bool edit
);
732 void EnableCellEditControl( bool enable
= TRUE
);
733 void DisableCellEditControl() { EnableCellEditControl(FALSE
); }
734 bool CanEnableCellControl() const;
735 bool IsCellEditControlEnabled() const;
737 bool IsCurrentCellReadOnly() const;
739 void ShowCellEditControl();
740 void HideCellEditControl();
741 void SetEditControlValue( const wxString
& s
= wxEmptyString
);
742 void SaveEditControlValue();
745 // ------ grid location functions
746 // Note that all of these functions work with the logical coordinates of
747 // grid cells and labels so you will need to convert from device
748 // coordinates for mouse events etc.
750 void XYToCell( int x
, int y
, wxGridCellCoords
& );
754 int YToEdgeOfRow( int y
);
755 int XToEdgeOfCol( int x
);
757 wxRect
CellToRect( int row
, int col
);
758 wxRect
CellToRect( const wxGridCellCoords
& coords
)
759 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
761 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
762 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
764 // check to see if a cell is either wholly visible (the default arg) or
765 // at least partially visible in the grid window
767 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
768 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
769 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
770 void MakeCellVisible( int row
, int col
);
771 void MakeCellVisible( const wxGridCellCoords
& coords
)
772 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
775 // ------ grid cursor movement functions
777 void SetGridCursor( int row
, int col
)
778 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
781 bool MoveCursorDown();
782 bool MoveCursorLeft();
783 bool MoveCursorRight();
786 bool MoveCursorUpBlock();
787 bool MoveCursorDownBlock();
788 bool MoveCursorLeftBlock();
789 bool MoveCursorRightBlock();
792 // ------ label and gridline formatting
794 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
795 int GetRowLabelSize() { return m_rowLabelWidth
; }
796 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
797 int GetColLabelSize() { return m_colLabelHeight
; }
798 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
799 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
800 wxFont
GetLabelFont() { return m_labelFont
; }
801 void GetRowLabelAlignment( int *horiz
, int *vert
);
802 void GetColLabelAlignment( int *horiz
, int *vert
);
803 wxString
GetRowLabelValue( int row
);
804 wxString
GetColLabelValue( int col
);
805 wxColour
GetGridLineColour() { return m_gridLineColour
; }
807 void SetRowLabelSize( int width
);
808 void SetColLabelSize( int height
);
809 void SetLabelBackgroundColour( const wxColour
& );
810 void SetLabelTextColour( const wxColour
& );
811 void SetLabelFont( const wxFont
& );
812 void SetRowLabelAlignment( int horiz
, int vert
);
813 void SetColLabelAlignment( int horiz
, int vert
);
814 void SetRowLabelValue( int row
, const wxString
& );
815 void SetColLabelValue( int col
, const wxString
& );
816 void SetGridLineColour( const wxColour
& );
818 // this sets the specified attribute for all cells in this row/col
819 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
820 void SetColAttr(int col
, wxGridCellAttr
*attr
);
822 void EnableGridLines( bool enable
= TRUE
);
823 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
825 // ------ row and col formatting
827 int GetDefaultRowSize();
828 int GetRowSize( int row
);
829 int GetDefaultColSize();
830 int GetColSize( int col
);
831 wxColour
GetDefaultCellBackgroundColour();
832 wxColour
GetCellBackgroundColour( int row
, int col
);
833 wxColour
GetDefaultCellTextColour();
834 wxColour
GetCellTextColour( int row
, int col
);
835 wxFont
GetDefaultCellFont();
836 wxFont
GetCellFont( int row
, int col
);
837 void GetDefaultCellAlignment( int *horiz
, int *vert
);
838 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
840 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
841 void SetRowSize( int row
, int height
);
842 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
844 void SetColSize( int col
, int width
);
845 void SetDefaultCellBackgroundColour( const wxColour
& );
846 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
847 void SetDefaultCellTextColour( const wxColour
& );
849 void SetCellTextColour( int row
, int col
, const wxColour
& );
850 void SetDefaultCellFont( const wxFont
& );
851 void SetCellFont( int row
, int col
, const wxFont
& );
852 void SetDefaultCellAlignment( int horiz
, int vert
);
853 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
855 // takes ownership of the pointer
856 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
857 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
858 wxGridCellRenderer
*GetDefaultRenderer() const;
859 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
861 // takes ownership of the pointer
862 void SetDefaultEditor(wxGridCellEditor
*editor
);
863 void SetCellEditor(int row
, int col
, wxGridCellEditor
*editor
);
864 wxGridCellEditor
*GetDefaultEditor() const;
865 wxGridCellEditor
* GetCellEditor(int row
, int col
);
868 // ------ cell value accessors
870 wxString
GetCellValue( int row
, int col
)
874 return m_table
->GetValue( row
, col
);
878 return wxEmptyString
;
882 wxString
GetCellValue( const wxGridCellCoords
& coords
)
883 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
885 void SetCellValue( int row
, int col
, const wxString
& s
);
886 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
887 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
889 // returns TRUE if the cell can't be edited
890 bool IsReadOnly(int row
, int col
) const;
892 // make the cell editable/readonly
893 void SetReadOnly(int row
, int col
, bool isReadOnly
= TRUE
);
895 // ------ selections of blocks of cells
897 void SelectRow( int row
, bool addToSelected
= FALSE
);
898 void SelectCol( int col
, bool addToSelected
= FALSE
);
900 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
902 void SelectBlock( const wxGridCellCoords
& topLeft
,
903 const wxGridCellCoords
& bottomRight
)
904 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
905 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
910 { return ( m_selectedTopLeft
!= wxGridNoCellCoords
&&
911 m_selectedBottomRight
!= wxGridNoCellCoords
);
914 void ClearSelection();
916 bool IsInSelection( int row
, int col
)
917 { return ( IsSelection() &&
918 row
>= m_selectedTopLeft
.GetRow() &&
919 col
>= m_selectedTopLeft
.GetCol() &&
920 row
<= m_selectedBottomRight
.GetRow() &&
921 col
<= m_selectedBottomRight
.GetCol() );
924 bool IsInSelection( const wxGridCellCoords
& coords
)
925 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
927 void GetSelection( int* topRow
, int* leftCol
, int* bottomRow
, int* rightCol
)
929 // these will all be -1 if there is no selected block
931 *topRow
= m_selectedTopLeft
.GetRow();
932 *leftCol
= m_selectedTopLeft
.GetCol();
933 *bottomRow
= m_selectedBottomRight
.GetRow();
934 *rightCol
= m_selectedBottomRight
.GetCol();
938 // This function returns the rectangle that encloses the block of cells
939 // limited by TopLeft and BottomRight cell in device coords and clipped
940 // to the client size of the grid window.
942 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
943 const wxGridCellCoords
& bottomRight
);
945 // This function returns the rectangle that encloses the selected cells
946 // in device coords and clipped to the client size of the grid window.
948 wxRect
SelectionToDeviceRect()
950 return BlockToDeviceRect( m_selectedTopLeft
,
951 m_selectedBottomRight
);
954 // Access or update the selection fore/back colours
955 wxColour
GetSelectionBackground() const
956 { return m_selectionBackground
; }
957 wxColour
GetSelectionForeground() const
958 { return m_selectionForeground
; }
960 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
961 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
965 // ------ For compatibility with previous wxGrid only...
967 // ************************************************
968 // ** Don't use these in new code because they **
969 // ** are liable to disappear in a future **
971 // ************************************************
974 wxGrid( wxWindow
*parent
,
975 int x
= -1, int y
= -1, int w
= -1, int h
= -1,
977 const wxString
& name
= wxPanelNameStr
)
978 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
), style
, name
)
983 void SetCellValue( const wxString
& val
, int row
, int col
)
984 { SetCellValue( row
, col
, val
); }
986 void UpdateDimensions()
987 { CalcDimensions(); }
989 int GetRows() { return GetNumberRows(); }
990 int GetCols() { return GetNumberCols(); }
991 int GetCursorRow() { return GetGridCursorRow(); }
992 int GetCursorColumn() { return GetGridCursorCol(); }
994 int GetScrollPosX() { return 0; }
995 int GetScrollPosY() { return 0; }
997 void SetScrollX( int x
) { }
998 void SetScrollY( int y
) { }
1000 void SetColumnWidth( int col
, int width
)
1001 { SetColSize( col
, width
); }
1003 int GetColumnWidth( int col
)
1004 { return GetColSize( col
); }
1006 void SetRowHeight( int row
, int height
)
1007 { SetRowSize( row
, height
); }
1009 int GetRowHeight( int row
)
1010 { return GetRowSize( row
); }
1012 int GetViewHeight() // returned num whole rows visible
1015 int GetViewWidth() // returned num whole cols visible
1018 void SetLabelSize( int orientation
, int sz
)
1020 if ( orientation
== wxHORIZONTAL
)
1021 SetColLabelSize( sz
);
1023 SetRowLabelSize( sz
);
1026 int GetLabelSize( int orientation
)
1028 if ( orientation
== wxHORIZONTAL
)
1029 return GetColLabelSize();
1031 return GetRowLabelSize();
1034 void SetLabelAlignment( int orientation
, int align
)
1036 if ( orientation
== wxHORIZONTAL
)
1037 SetColLabelAlignment( align
, -1 );
1039 SetRowLabelAlignment( align
, -1 );
1042 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
1045 if ( orientation
== wxHORIZONTAL
)
1047 GetColLabelAlignment( &h
, &v
);
1052 GetRowLabelAlignment( &h
, &v
);
1057 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1059 if ( orientation
== wxHORIZONTAL
)
1060 SetColLabelValue( pos
, val
);
1062 SetRowLabelValue( pos
, val
);
1065 wxString
GetLabelValue( int orientation
, int pos
)
1067 if ( orientation
== wxHORIZONTAL
)
1068 return GetColLabelValue( pos
);
1070 return GetRowLabelValue( pos
);
1073 wxFont
GetCellTextFont() const
1074 { return m_defaultCellAttr
->GetFont(); }
1076 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1077 { return m_defaultCellAttr
->GetFont(); }
1079 void SetCellTextFont(const wxFont
& fnt
)
1080 { SetDefaultCellFont( fnt
); }
1082 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1083 { SetCellFont( row
, col
, fnt
); }
1085 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1086 { SetCellTextColour( row
, col
, val
); }
1088 void SetCellTextColour(const wxColour
& col
)
1089 { SetDefaultCellTextColour( col
); }
1091 void SetCellBackgroundColour(const wxColour
& col
)
1092 { SetDefaultCellBackgroundColour( col
); }
1094 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1095 { SetCellBackgroundColour( row
, col
, colour
); }
1097 bool GetEditable() { return IsEditable(); }
1098 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1099 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1101 void SetEditInPlace(bool edit
= TRUE
) { }
1103 void SetCellAlignment( int align
, int row
, int col
)
1104 { SetCellAlignment(row
, col
, align
, wxCENTER
); }
1105 void SetCellAlignment( int WXUNUSED(align
) ) {}
1106 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1108 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1109 wxPen
& GetDividerPen() const { return wxNullPen
; }
1110 void OnActivate(bool WXUNUSED(active
)) {}
1112 // ******** End of compatibility functions **********
1116 // ------ control IDs
1117 enum { wxGRID_CELLCTRL
= 2000,
1120 // ------ control types
1121 enum { wxGRID_TEXTCTRL
= 2100,
1126 // for wxGridCellBoolEditor
1127 wxWindow
*GetGridWindow() const;
1133 wxGridWindow
*m_gridWin
;
1134 wxGridRowLabelWindow
*m_rowLabelWin
;
1135 wxGridColLabelWindow
*m_colLabelWin
;
1136 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1138 wxGridTableBase
*m_table
;
1149 wxGridCellCoords m_currentCellCoords
;
1151 wxGridCellCoords m_selectedTopLeft
;
1152 wxGridCellCoords m_selectedBottomRight
;
1153 wxColour m_selectionBackground
;
1154 wxColour m_selectionForeground
;
1156 int m_defaultRowHeight
;
1157 wxArrayInt m_rowHeights
;
1158 wxArrayInt m_rowBottoms
;
1160 int m_defaultColWidth
;
1161 wxArrayInt m_colWidths
;
1162 wxArrayInt m_colRights
;
1163 int m_rowLabelWidth
;
1164 int m_colLabelHeight
;
1166 wxColour m_labelBackgroundColour
;
1167 wxColour m_labelTextColour
;
1170 int m_rowLabelHorizAlign
;
1171 int m_rowLabelVertAlign
;
1172 int m_colLabelHorizAlign
;
1173 int m_colLabelVertAlign
;
1175 bool m_defaultRowLabelValues
;
1176 bool m_defaultColLabelValues
;
1178 wxColour m_gridLineColour
;
1179 bool m_gridLinesEnabled
;
1182 // do we have some place to store attributes in?
1183 bool CanHaveAttributes();
1185 // returns the attribute we may modify in place: a new one if this cell
1186 // doesn't have any yet or the existing one if it does
1188 // DecRef() must be called on the returned pointer, as usual
1189 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1191 // cell attribute cache (currently we only cache 1, may be will do
1192 // more/better later)
1196 wxGridCellAttr
*attr
;
1199 // invalidates the attribute cache
1200 void ClearAttrCache();
1202 // adds an attribute to cache
1203 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1205 // looks for an attr in cache, returns TRUE if found
1206 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1208 // looks for the attr in cache, if not found asks the table and caches the
1210 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1211 wxGridCellAttr
*GetCellAttr(const wxGridCellCoords
& coords
)
1212 { return GetCellAttr( coords
.GetRow(), coords
.GetCol() ); }
1214 // the default cell attr object for cells that don't have their own
1215 wxGridCellAttr
* m_defaultCellAttr
;
1218 wxGridCellCoordsArray m_cellsExposed
;
1219 wxArrayInt m_rowsExposed
;
1220 wxArrayInt m_colsExposed
;
1221 wxArrayInt m_rowLabelsExposed
;
1222 wxArrayInt m_colLabelsExposed
;
1229 WXGRID_CURSOR_SELECT_CELL
,
1230 WXGRID_CURSOR_RESIZE_ROW
,
1231 WXGRID_CURSOR_RESIZE_COL
,
1232 WXGRID_CURSOR_SELECT_ROW
,
1233 WXGRID_CURSOR_SELECT_COL
1236 // this method not only sets m_cursorMode but also sets the correct cursor
1237 // for the given mode and, if captureMouse is not FALSE releases the mouse
1238 // if it was captured and captures it if it must be captured
1240 // for this to work, you should always use it and not set m_cursorMode
1242 void ChangeCursorMode(CursorMode mode
,
1243 wxWindow
*win
= (wxWindow
*)NULL
,
1244 bool captureMouse
= TRUE
);
1246 wxWindow
*m_winCapture
; // the window which captured the mouse
1247 CursorMode m_cursorMode
;
1252 wxPoint m_startDragPos
;
1254 bool m_waitForSlowClick
;
1256 wxGridCellCoords m_selectionStart
;
1258 wxCursor m_rowResizeCursor
;
1259 wxCursor m_colResizeCursor
;
1261 bool m_editable
; // applies to whole grid
1262 bool m_cellEditCtrlEnabled
; // is in-place edit currently shown?
1267 void CalcDimensions();
1268 void CalcWindowSizes();
1269 bool Redimension( wxGridTableMessage
& );
1272 bool SendEvent( const wxEventType
, int row
, int col
, wxMouseEvent
& );
1273 bool SendEvent( const wxEventType
, int row
, int col
);
1274 bool SendEvent( const wxEventType type
)
1276 return SendEvent(type
,
1277 m_currentCellCoords
.GetRow(),
1278 m_currentCellCoords
.GetCol());
1281 void OnPaint( wxPaintEvent
& );
1282 void OnSize( wxSizeEvent
& );
1283 void OnKeyDown( wxKeyEvent
& );
1284 void OnEraseBackground( wxEraseEvent
& );
1287 void SetCurrentCell( const wxGridCellCoords
& coords
);
1288 void SetCurrentCell( int row
, int col
)
1289 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1292 // ------ functions to get/send data (see also public functions)
1294 bool GetModelValues();
1295 bool SetModelValues();
1298 DECLARE_DYNAMIC_CLASS( wxGrid
)
1299 DECLARE_EVENT_TABLE()
1307 // ------ Grid event class and event types
1310 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1314 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1315 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1319 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1320 int row
=-1, int col
=-1, int x
=-1, int y
=-1,
1321 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1323 virtual int GetRow() { return m_row
; }
1324 virtual int GetCol() { return m_col
; }
1325 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1326 bool ControlDown() { return m_control
; }
1327 bool MetaDown() { return m_meta
; }
1328 bool ShiftDown() { return m_shift
; }
1329 bool AltDown() { return m_alt
; }
1341 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1344 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1348 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1349 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1353 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1354 int rowOrCol
=-1, int x
=-1, int y
=-1,
1355 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1357 int GetRowOrCol() { return m_rowOrCol
; }
1358 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1359 bool ControlDown() { return m_control
; }
1360 bool MetaDown() { return m_meta
; }
1361 bool ShiftDown() { return m_shift
; }
1362 bool AltDown() { return m_alt
; }
1373 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1377 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1380 wxGridRangeSelectEvent()
1383 m_topLeft
= wxGridNoCellCoords
;
1384 m_bottomRight
= wxGridNoCellCoords
;
1391 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1392 const wxGridCellCoords
& topLeft
,
1393 const wxGridCellCoords
& bottomRight
,
1394 bool control
=FALSE
, bool shift
=FALSE
,
1395 bool alt
=FALSE
, bool meta
=FALSE
);
1397 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1398 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1399 int GetTopRow() { return m_topLeft
.GetRow(); }
1400 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1401 int GetLeftCol() { return m_topLeft
.GetCol(); }
1402 int GetRightCol() { return m_bottomRight
.GetCol(); }
1403 bool ControlDown() { return m_control
; }
1404 bool MetaDown() { return m_meta
; }
1405 bool ShiftDown() { return m_shift
; }
1406 bool AltDown() { return m_alt
; }
1409 wxGridCellCoords m_topLeft
;
1410 wxGridCellCoords m_bottomRight
;
1416 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1419 // TODO move to wx/event.h
1420 const wxEventType wxEVT_GRID_CELL_LEFT_CLICK
= wxEVT_FIRST
+ 1580;
1421 const wxEventType wxEVT_GRID_CELL_RIGHT_CLICK
= wxEVT_FIRST
+ 1581;
1422 const wxEventType wxEVT_GRID_CELL_LEFT_DCLICK
= wxEVT_FIRST
+ 1582;
1423 const wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1583;
1424 const wxEventType wxEVT_GRID_LABEL_LEFT_CLICK
= wxEVT_FIRST
+ 1584;
1425 const wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK
= wxEVT_FIRST
+ 1585;
1426 const wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK
= wxEVT_FIRST
+ 1586;
1427 const wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1587;
1428 const wxEventType wxEVT_GRID_ROW_SIZE
= wxEVT_FIRST
+ 1588;
1429 const wxEventType wxEVT_GRID_COL_SIZE
= wxEVT_FIRST
+ 1589;
1430 const wxEventType wxEVT_GRID_RANGE_SELECT
= wxEVT_FIRST
+ 1590;
1431 const wxEventType wxEVT_GRID_CELL_CHANGE
= wxEVT_FIRST
+ 1591;
1432 const wxEventType wxEVT_GRID_SELECT_CELL
= wxEVT_FIRST
+ 1592;
1433 const wxEventType wxEVT_GRID_EDITOR_SHOWN
= wxEVT_FIRST
+ 1593;
1434 const wxEventType wxEVT_GRID_EDITOR_HIDDEN
= wxEVT_FIRST
+ 1594;
1437 typedef void (wxEvtHandler
::*wxGridEventFunction
)(wxGridEvent
&);
1438 typedef void (wxEvtHandler
::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1439 typedef void (wxEvtHandler
::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1441 #define EVT_GRID_CELL_LEFT_CLICK(fn) { wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1442 #define EVT_GRID_CELL_RIGHT_CLICK(fn) { wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1443 #define EVT_GRID_CELL_LEFT_DCLICK(fn) { wxEVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1444 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) { wxEVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1445 #define EVT_GRID_LABEL_LEFT_CLICK(fn) { wxEVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1446 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) { wxEVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1447 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) { wxEVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1448 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1449 #define EVT_GRID_ROW_SIZE(fn) { wxEVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1450 #define EVT_GRID_COL_SIZE(fn) { wxEVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1451 #define EVT_GRID_RANGE_SELECT(fn) { wxEVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
1452 #define EVT_GRID_CELL_CHANGE(fn) { wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1453 #define EVT_GRID_SELECT_CELL(fn) { wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1454 #define EVT_GRID_EDITOR_SHOWN(fn) { wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1455 #define EVT_GRID_EDITOR_HIDDEN(fn) { wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1458 #if 0 // TODO: implement these ? others ?
1460 const wxEventType wxEVT_GRID_CREATE_CELL
= wxEVT_FIRST
+ 1576;
1461 const wxEventType wxEVT_GRID_CHANGE_LABELS
= wxEVT_FIRST
+ 1577;
1462 const wxEventType wxEVT_GRID_CHANGE_SEL_LABEL
= wxEVT_FIRST
+ 1578;
1464 #define EVT_GRID_CREATE_CELL(fn) { wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1465 #define EVT_GRID_CHANGE_LABELS(fn) { wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1466 #define EVT_GRID_CHANGE_SEL_LABEL(fn) { wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1470 #endif // #ifndef __WXGRID_H__
1472 #endif // ifndef wxUSE_NEW_GRID