1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/grid.h
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"
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 // Draws the part of the cell not occupied by the control: the base class
150 // version just fills it with background colour from the attribute
151 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
153 // Fetch the value from the table and prepare the edit control
154 // to begin editing. Set the focus to the edit control.
155 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
) = 0;
157 // Complete the editing of the current cell. If saveValue is
158 // true then send the new value back to the table. Returns true
159 // if the value has changed. If necessary, the control may be
161 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
) = 0;
163 // Reset the value in the control back to its starting value
164 virtual void Reset() = 0;
166 // If the editor is enabled by pressing keys on the grid,
167 // this will be called to let the editor do something about
168 // that first key if desired.
169 virtual void StartingKey(wxKeyEvent
& event
);
171 // if the editor is enabled by clicking on the cell, this method will be
173 virtual void StartingClick();
175 // Some types of controls on some platforms may need some help
176 // with the Return key.
177 virtual void HandleReturn(wxKeyEvent
& event
);
180 virtual void Destroy();
183 // the control we show on screen
184 wxControl
* m_control
;
186 // if we change the colours/font of the control from the default ones, we
187 // must restore the default later and we save them here between calls to
188 // Show(TRUE) and Show(FALSE)
194 // the editor for string/text data
195 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
198 wxGridCellTextEditor();
200 virtual void Create(wxWindow
* parent
,
202 wxEvtHandler
* evtHandler
);
204 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
206 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
207 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
209 virtual void Reset();
210 virtual void StartingKey(wxKeyEvent
& event
);
211 virtual void HandleReturn(wxKeyEvent
& event
);
214 wxTextCtrl
*Text() const { return (wxTextCtrl
*)m_control
; }
217 wxString m_startValue
;
220 // the editor for boolean data
221 class WXDLLEXPORT wxGridCellBoolEditor
: public wxGridCellEditor
224 virtual void Create(wxWindow
* parent
,
226 wxEvtHandler
* evtHandler
);
228 virtual void SetSize(const wxRect
& rect
);
229 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
231 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
232 virtual bool EndEdit(int row
, int col
, bool saveValue
, wxGrid
* grid
);
234 virtual void Reset();
235 virtual void StartingClick();
238 wxCheckBox
*CBox() const { return (wxCheckBox
*)m_control
; }
244 // ----------------------------------------------------------------------------
245 // wxGridCellAttr: this class can be used to alter the cells appearance in
246 // the grid by changing their colour/font/... from default. An object of this
247 // class may be returned by wxGridTable::GetAttr().
248 // ----------------------------------------------------------------------------
250 class WXDLLEXPORT wxGridCellAttr
260 // VZ: considering the number of members wxGridCellAttr has now, this ctor
261 // seems to be pretty useless... may be we should just remove it?
262 wxGridCellAttr(const wxColour
& colText
,
263 const wxColour
& colBack
,
267 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
270 SetAlignment(hAlign
, vAlign
);
273 // default copy ctor ok
275 // this class is ref counted: it is created with ref count of 1, so
276 // calling DecRef() once will delete it. Calling IncRef() allows to lock
277 // it until the matching DecRef() is called
278 void IncRef() { m_nRef
++; }
279 void DecRef() { if ( !--m_nRef
) delete this; }
280 void SafeIncRef() { if ( this ) IncRef(); }
281 void SafeDecRef() { if ( this ) DecRef(); }
284 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
285 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
286 void SetFont(const wxFont
& font
) { m_font
= font
; }
287 void SetAlignment(int hAlign
, int vAlign
)
292 void SetReadOnly(bool isReadOnly
= TRUE
) { m_isReadOnly
= isReadOnly
; }
294 // takes ownership of the pointer
295 void SetRenderer(wxGridCellRenderer
*renderer
)
296 { delete m_renderer
; m_renderer
= renderer
; }
297 void SetEditor(wxGridCellEditor
* editor
)
298 { delete m_editor
; m_editor
= editor
; }
301 bool HasTextColour() const { return m_colText
.Ok(); }
302 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
303 bool HasFont() const { return m_font
.Ok(); }
304 bool HasAlignment() const { return m_hAlign
|| m_vAlign
; }
305 bool HasRenderer() const { return m_renderer
!= NULL
; }
306 bool HasEditor() const { return m_editor
!= NULL
; }
308 const wxColour
& GetTextColour() const;
309 const wxColour
& GetBackgroundColour() const;
310 const wxFont
& GetFont() const;
311 void GetAlignment(int *hAlign
, int *vAlign
) const;
312 wxGridCellRenderer
*GetRenderer() const;
313 wxGridCellEditor
*GetEditor() const;
315 bool IsReadOnly() const { return m_isReadOnly
; }
317 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
320 // the common part of all ctors
325 m_isReadOnly
= FALSE
;
331 // the dtor is private because only DecRef() can delete us
332 ~wxGridCellAttr() { delete m_renderer
; delete m_editor
; }
334 // the ref count - when it goes to 0, we die
343 wxGridCellRenderer
* m_renderer
;
344 wxGridCellEditor
* m_editor
;
345 wxGridCellAttr
* m_defGridAttr
;
349 // suppress the stupid gcc warning about the class having private dtor and
351 friend class wxGridCellAttrDummyFriend
;
354 // ----------------------------------------------------------------------------
355 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
357 // ----------------------------------------------------------------------------
359 // implementation note: we separate it from wxGridTableBase because we wish to
360 // avoid deriving a new table class if possible, and sometimes it will be
361 // enough to just derive another wxGridCellAttrProvider instead
363 // the default implementation is reasonably efficient for the generic case,
364 // but you might still wish to implement your own for some specific situations
365 // if you have performance problems with the stock one
366 class WXDLLEXPORT wxGridCellAttrProvider
369 wxGridCellAttrProvider();
370 virtual ~wxGridCellAttrProvider();
372 // DecRef() must be called on the returned pointer
373 virtual wxGridCellAttr
*GetAttr(int row
, int col
) const;
375 // all these functions take ownership of the pointer, don't call DecRef()
377 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
378 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
379 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
381 // these functions must be called whenever some rows/cols are deleted
382 // because the internal data must be updated then
383 void UpdateAttrRows( size_t pos
, int numRows
);
384 void UpdateAttrCols( size_t pos
, int numCols
);
389 wxGridCellAttrProviderData
*m_data
;
392 //////////////////////////////////////////////////////////////////////
394 // Grid table classes
396 //////////////////////////////////////////////////////////////////////
399 class WXDLLEXPORT wxGridTableBase
: public wxObject
403 virtual ~wxGridTableBase();
405 // You must override these functions in a derived table class
407 virtual long GetNumberRows() = 0;
408 virtual long GetNumberCols() = 0;
409 virtual wxString
GetValue( int row
, int col
) = 0;
410 virtual void SetValue( int row
, int col
, const wxString
& s
) = 0;
411 virtual bool IsEmptyCell( int row
, int col
) = 0;
413 // Overriding these is optional
415 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
416 virtual wxGrid
* GetView() const { return m_view
; }
418 virtual void Clear() {}
419 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
420 virtual bool AppendRows( size_t numRows
= 1 );
421 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
422 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
423 virtual bool AppendCols( size_t numCols
= 1 );
424 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
426 virtual wxString
GetRowLabelValue( int row
);
427 virtual wxString
GetColLabelValue( int col
);
428 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
429 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
431 // Attribute handling
434 // give us the attr provider to use - we take ownership of the pointer
435 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
437 // get the currently used attr provider (may be NULL)
438 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
440 // change row/col number in attribute if needed
441 void UpdateAttrRows( size_t pos
, int numRows
);
442 void UpdateAttrCols( size_t pos
, int numCols
);
444 // by default forwarded to wxGridCellAttrProvider if any. May be
445 // overridden to handle attributes directly in this class.
446 virtual wxGridCellAttr
*GetAttr( int row
, int col
);
448 // these functions take ownership of the pointer
449 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
450 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
451 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
455 wxGridCellAttrProvider
*m_attrProvider
;
457 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
461 // ----------------------------------------------------------------------------
462 // wxGridTableMessage
463 // ----------------------------------------------------------------------------
465 // IDs for messages sent from grid table to view
467 enum wxGridTableRequest
469 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
470 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
471 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
472 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
473 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
474 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
475 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
476 wxGRIDTABLE_NOTIFY_COLS_DELETED
479 class WXDLLEXPORT wxGridTableMessage
482 wxGridTableMessage();
483 wxGridTableMessage( wxGridTableBase
*table
, int id
,
487 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
488 wxGridTableBase
* GetTableObject() const { return m_table
; }
489 void SetId( int id
) { m_id
= id
; }
490 int GetId() { return m_id
; }
491 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
492 int GetCommandInt() { return m_comInt1
; }
493 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
494 int GetCommandInt2() { return m_comInt2
; }
497 wxGridTableBase
*m_table
;
505 // ------ wxGridStringArray
506 // A 2-dimensional array of strings for data values
509 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
513 // ------ wxGridStringTable
515 // Simplest type of data table for a grid for small tables of strings
516 // that are stored in memory
519 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
523 wxGridStringTable( int numRows
, int numCols
);
524 ~wxGridStringTable();
526 // these are pure virtual in wxGridTableBase
528 long GetNumberRows();
529 long GetNumberCols();
530 wxString
GetValue( int row
, int col
);
531 void SetValue( int row
, int col
, const wxString
& s
);
532 bool IsEmptyCell( int row
, int col
);
534 // overridden functions from wxGridTableBase
537 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
538 bool AppendRows( size_t numRows
= 1 );
539 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
540 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
541 bool AppendCols( size_t numCols
= 1 );
542 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
544 void SetRowLabelValue( int row
, const wxString
& );
545 void SetColLabelValue( int col
, const wxString
& );
546 wxString
GetRowLabelValue( int row
);
547 wxString
GetColLabelValue( int col
);
550 wxGridStringArray m_data
;
552 // These only get used if you set your own labels, otherwise the
553 // GetRow/ColLabelValue functions return wxGridTableBase defaults
555 wxArrayString m_rowLabels
;
556 wxArrayString m_colLabels
;
558 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
563 // ============================================================================
565 // ============================================================================
567 // ----------------------------------------------------------------------------
568 // wxGridCellCoords: location of a cell in the grid
569 // ----------------------------------------------------------------------------
571 class WXDLLEXPORT wxGridCellCoords
574 wxGridCellCoords() { m_row
= m_col
= -1; }
575 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
577 // default copy ctor is ok
579 long GetRow() const { return m_row
; }
580 void SetRow( long n
) { m_row
= n
; }
581 long GetCol() const { return m_col
; }
582 void SetCol( long n
) { m_col
= n
; }
583 void Set( long row
, long col
) { m_row
= row
; m_col
= col
; }
585 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
587 if ( &other
!= this )
595 bool operator==( const wxGridCellCoords
& other
) const
597 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
600 bool operator!=( const wxGridCellCoords
& other
) const
602 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
605 bool operator!() const
607 return (m_row
== -1 && m_col
== -1 );
616 // For comparisons...
618 extern wxGridCellCoords wxGridNoCellCoords
;
619 extern wxRect wxGridNoCellRect
;
621 // An array of cell coords...
623 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
625 // ----------------------------------------------------------------------------
627 // ----------------------------------------------------------------------------
629 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
637 wxGrid( wxWindow
*parent
,
639 const wxPoint
& pos
= wxDefaultPosition
,
640 const wxSize
& size
= wxDefaultSize
,
642 const wxString
& name
= wxPanelNameStr
);
646 bool CreateGrid( int numRows
, int numCols
);
649 // ------ grid dimensions
651 int GetNumberRows() { return m_numRows
; }
652 int GetNumberCols() { return m_numCols
; }
655 // ------ display update functions
657 void CalcRowLabelsExposed( wxRegion
& reg
);
659 void CalcColLabelsExposed( wxRegion
& reg
);
660 void CalcCellsExposed( wxRegion
& reg
);
663 // ------ event handlers
665 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
666 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
667 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
668 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
669 bool ProcessTableMessage( wxGridTableMessage
& );
671 void DoEndDragResizeRow();
672 void DoEndDragResizeCol();
674 wxGridTableBase
* GetTable() const { return m_table
; }
675 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
);
678 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
679 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
680 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
681 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
682 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
683 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
685 void DrawGridCellArea( wxDC
& dc
);
686 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
687 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
688 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
689 void DrawHighlight(wxDC
& dc
);
691 // this function is called when the current cell highlight must be redrawn
692 // and may be overridden by the user
693 virtual void DrawCellHighlight( wxDC
& dc
, const wxGridCellAttr
*attr
);
695 void DrawRowLabels( wxDC
& dc
);
696 void DrawRowLabel( wxDC
& dc
, int row
);
698 void DrawColLabels( wxDC
& dc
);
699 void DrawColLabel( wxDC
& dc
, int col
);
702 // ------ Cell text drawing functions
704 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
705 int horizontalAlignment
= wxLEFT
,
706 int verticalAlignment
= wxTOP
);
708 // Split a string containing newline chararcters into an array of
709 // strings and return the number of lines
711 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
713 void GetTextBoxSize( wxDC
& dc
,
714 wxArrayString
& lines
,
715 long *width
, long *height
);
719 // Code that does a lot of grid modification can be enclosed
720 // between BeginBatch() and EndBatch() calls to avoid screen
723 void BeginBatch() { m_batchCount
++; }
724 void EndBatch() { if ( m_batchCount
> 0 ) m_batchCount
--; }
725 int GetBatchCount() { return m_batchCount
; }
728 // ------ edit control functions
730 bool IsEditable() { return m_editable
; }
731 void EnableEditing( bool edit
);
733 void EnableCellEditControl( bool enable
= TRUE
);
734 void DisableCellEditControl() { EnableCellEditControl(FALSE
); }
735 bool CanEnableCellControl() const;
736 bool IsCellEditControlEnabled() const;
738 bool IsCurrentCellReadOnly() const;
740 void ShowCellEditControl();
741 void HideCellEditControl();
742 void SetEditControlValue( const wxString
& s
= wxEmptyString
);
743 void SaveEditControlValue();
746 // ------ grid location functions
747 // Note that all of these functions work with the logical coordinates of
748 // grid cells and labels so you will need to convert from device
749 // coordinates for mouse events etc.
751 void XYToCell( int x
, int y
, wxGridCellCoords
& );
755 int YToEdgeOfRow( int y
);
756 int XToEdgeOfCol( int x
);
758 wxRect
CellToRect( int row
, int col
);
759 wxRect
CellToRect( const wxGridCellCoords
& coords
)
760 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
762 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
763 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
765 // check to see if a cell is either wholly visible (the default arg) or
766 // at least partially visible in the grid window
768 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
769 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
770 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
771 void MakeCellVisible( int row
, int col
);
772 void MakeCellVisible( const wxGridCellCoords
& coords
)
773 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
776 // ------ grid cursor movement functions
778 void SetGridCursor( int row
, int col
)
779 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
782 bool MoveCursorDown();
783 bool MoveCursorLeft();
784 bool MoveCursorRight();
787 bool MoveCursorUpBlock();
788 bool MoveCursorDownBlock();
789 bool MoveCursorLeftBlock();
790 bool MoveCursorRightBlock();
793 // ------ label and gridline formatting
795 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
796 int GetRowLabelSize() { return m_rowLabelWidth
; }
797 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
798 int GetColLabelSize() { return m_colLabelHeight
; }
799 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
800 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
801 wxFont
GetLabelFont() { return m_labelFont
; }
802 void GetRowLabelAlignment( int *horiz
, int *vert
);
803 void GetColLabelAlignment( int *horiz
, int *vert
);
804 wxString
GetRowLabelValue( int row
);
805 wxString
GetColLabelValue( int col
);
806 wxColour
GetGridLineColour() { return m_gridLineColour
; }
808 void SetRowLabelSize( int width
);
809 void SetColLabelSize( int height
);
810 void SetLabelBackgroundColour( const wxColour
& );
811 void SetLabelTextColour( const wxColour
& );
812 void SetLabelFont( const wxFont
& );
813 void SetRowLabelAlignment( int horiz
, int vert
);
814 void SetColLabelAlignment( int horiz
, int vert
);
815 void SetRowLabelValue( int row
, const wxString
& );
816 void SetColLabelValue( int col
, const wxString
& );
817 void SetGridLineColour( const wxColour
& );
819 // this sets the specified attribute for all cells in this row/col
820 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
821 void SetColAttr(int col
, wxGridCellAttr
*attr
);
823 void EnableGridLines( bool enable
= TRUE
);
824 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
826 // ------ row and col formatting
828 int GetDefaultRowSize();
829 int GetRowSize( int row
);
830 int GetDefaultColSize();
831 int GetColSize( int col
);
832 wxColour
GetDefaultCellBackgroundColour();
833 wxColour
GetCellBackgroundColour( int row
, int col
);
834 wxColour
GetDefaultCellTextColour();
835 wxColour
GetCellTextColour( int row
, int col
);
836 wxFont
GetDefaultCellFont();
837 wxFont
GetCellFont( int row
, int col
);
838 void GetDefaultCellAlignment( int *horiz
, int *vert
);
839 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
841 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
842 void SetRowSize( int row
, int height
);
843 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
845 void SetColSize( int col
, int width
);
847 // column won't be resized to be lesser width - this must be called during
848 // the grid creation because it won't resize the column if it's already
849 // narrower than the minimal width
850 void SetColMinimalWidth( int col
, int width
);
852 void SetDefaultCellBackgroundColour( const wxColour
& );
853 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
854 void SetDefaultCellTextColour( const wxColour
& );
856 void SetCellTextColour( int row
, int col
, const wxColour
& );
857 void SetDefaultCellFont( const wxFont
& );
858 void SetCellFont( int row
, int col
, const wxFont
& );
859 void SetDefaultCellAlignment( int horiz
, int vert
);
860 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
862 // takes ownership of the pointer
863 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
864 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
865 wxGridCellRenderer
*GetDefaultRenderer() const;
866 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
868 // takes ownership of the pointer
869 void SetDefaultEditor(wxGridCellEditor
*editor
);
870 void SetCellEditor(int row
, int col
, wxGridCellEditor
*editor
);
871 wxGridCellEditor
*GetDefaultEditor() const;
872 wxGridCellEditor
* GetCellEditor(int row
, int col
);
875 // ------ cell value accessors
877 wxString
GetCellValue( int row
, int col
)
881 return m_table
->GetValue( row
, col
);
885 return wxEmptyString
;
889 wxString
GetCellValue( const wxGridCellCoords
& coords
)
890 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
892 void SetCellValue( int row
, int col
, const wxString
& s
);
893 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
894 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
896 // returns TRUE if the cell can't be edited
897 bool IsReadOnly(int row
, int col
) const;
899 // make the cell editable/readonly
900 void SetReadOnly(int row
, int col
, bool isReadOnly
= TRUE
);
902 // ------ selections of blocks of cells
904 void SelectRow( int row
, bool addToSelected
= FALSE
);
905 void SelectCol( int col
, bool addToSelected
= FALSE
);
907 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
909 void SelectBlock( const wxGridCellCoords
& topLeft
,
910 const wxGridCellCoords
& bottomRight
)
911 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
912 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
917 { return ( m_selectedTopLeft
!= wxGridNoCellCoords
&&
918 m_selectedBottomRight
!= wxGridNoCellCoords
);
921 void ClearSelection();
923 bool IsInSelection( int row
, int col
)
924 { return ( IsSelection() &&
925 row
>= m_selectedTopLeft
.GetRow() &&
926 col
>= m_selectedTopLeft
.GetCol() &&
927 row
<= m_selectedBottomRight
.GetRow() &&
928 col
<= m_selectedBottomRight
.GetCol() );
931 bool IsInSelection( const wxGridCellCoords
& coords
)
932 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
934 void GetSelection( int* topRow
, int* leftCol
, int* bottomRow
, int* rightCol
)
936 // these will all be -1 if there is no selected block
938 *topRow
= m_selectedTopLeft
.GetRow();
939 *leftCol
= m_selectedTopLeft
.GetCol();
940 *bottomRow
= m_selectedBottomRight
.GetRow();
941 *rightCol
= m_selectedBottomRight
.GetCol();
945 // This function returns the rectangle that encloses the block of cells
946 // limited by TopLeft and BottomRight cell in device coords and clipped
947 // to the client size of the grid window.
949 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
950 const wxGridCellCoords
& bottomRight
);
952 // This function returns the rectangle that encloses the selected cells
953 // in device coords and clipped to the client size of the grid window.
955 wxRect
SelectionToDeviceRect()
957 return BlockToDeviceRect( m_selectedTopLeft
,
958 m_selectedBottomRight
);
961 // Access or update the selection fore/back colours
962 wxColour
GetSelectionBackground() const
963 { return m_selectionBackground
; }
964 wxColour
GetSelectionForeground() const
965 { return m_selectionForeground
; }
967 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
968 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
972 // ------ For compatibility with previous wxGrid only...
974 // ************************************************
975 // ** Don't use these in new code because they **
976 // ** are liable to disappear in a future **
978 // ************************************************
981 wxGrid( wxWindow
*parent
,
982 int x
= -1, int y
= -1, int w
= -1, int h
= -1,
984 const wxString
& name
= wxPanelNameStr
)
985 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
), style
, name
)
990 void SetCellValue( const wxString
& val
, int row
, int col
)
991 { SetCellValue( row
, col
, val
); }
993 void UpdateDimensions()
994 { CalcDimensions(); }
996 int GetRows() { return GetNumberRows(); }
997 int GetCols() { return GetNumberCols(); }
998 int GetCursorRow() { return GetGridCursorRow(); }
999 int GetCursorColumn() { return GetGridCursorCol(); }
1001 int GetScrollPosX() { return 0; }
1002 int GetScrollPosY() { return 0; }
1004 void SetScrollX( int x
) { }
1005 void SetScrollY( int y
) { }
1007 void SetColumnWidth( int col
, int width
)
1008 { SetColSize( col
, width
); }
1010 int GetColumnWidth( int col
)
1011 { return GetColSize( col
); }
1013 void SetRowHeight( int row
, int height
)
1014 { SetRowSize( row
, height
); }
1016 // GetRowHeight() is below
1018 int GetViewHeight() // returned num whole rows visible
1021 int GetViewWidth() // returned num whole cols visible
1024 void SetLabelSize( int orientation
, int sz
)
1026 if ( orientation
== wxHORIZONTAL
)
1027 SetColLabelSize( sz
);
1029 SetRowLabelSize( sz
);
1032 int GetLabelSize( int orientation
)
1034 if ( orientation
== wxHORIZONTAL
)
1035 return GetColLabelSize();
1037 return GetRowLabelSize();
1040 void SetLabelAlignment( int orientation
, int align
)
1042 if ( orientation
== wxHORIZONTAL
)
1043 SetColLabelAlignment( align
, -1 );
1045 SetRowLabelAlignment( align
, -1 );
1048 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
1051 if ( orientation
== wxHORIZONTAL
)
1053 GetColLabelAlignment( &h
, &v
);
1058 GetRowLabelAlignment( &h
, &v
);
1063 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1065 if ( orientation
== wxHORIZONTAL
)
1066 SetColLabelValue( pos
, val
);
1068 SetRowLabelValue( pos
, val
);
1071 wxString
GetLabelValue( int orientation
, int pos
)
1073 if ( orientation
== wxHORIZONTAL
)
1074 return GetColLabelValue( pos
);
1076 return GetRowLabelValue( pos
);
1079 wxFont
GetCellTextFont() const
1080 { return m_defaultCellAttr
->GetFont(); }
1082 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1083 { return m_defaultCellAttr
->GetFont(); }
1085 void SetCellTextFont(const wxFont
& fnt
)
1086 { SetDefaultCellFont( fnt
); }
1088 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1089 { SetCellFont( row
, col
, fnt
); }
1091 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1092 { SetCellTextColour( row
, col
, val
); }
1094 void SetCellTextColour(const wxColour
& col
)
1095 { SetDefaultCellTextColour( col
); }
1097 void SetCellBackgroundColour(const wxColour
& col
)
1098 { SetDefaultCellBackgroundColour( col
); }
1100 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1101 { SetCellBackgroundColour( row
, col
, colour
); }
1103 bool GetEditable() { return IsEditable(); }
1104 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1105 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1107 void SetEditInPlace(bool edit
= TRUE
) { }
1109 void SetCellAlignment( int align
, int row
, int col
)
1110 { SetCellAlignment(row
, col
, align
, wxCENTER
); }
1111 void SetCellAlignment( int WXUNUSED(align
) ) {}
1112 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1114 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1115 wxPen
& GetDividerPen() const { return wxNullPen
; }
1116 void OnActivate(bool WXUNUSED(active
)) {}
1118 // ******** End of compatibility functions **********
1122 // ------ control IDs
1123 enum { wxGRID_CELLCTRL
= 2000,
1126 // ------ control types
1127 enum { wxGRID_TEXTCTRL
= 2100,
1132 // for wxGridCellBoolEditor
1133 wxWindow
*GetGridWindow() const;
1139 wxGridWindow
*m_gridWin
;
1140 wxGridRowLabelWindow
*m_rowLabelWin
;
1141 wxGridColLabelWindow
*m_colLabelWin
;
1142 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1144 wxGridTableBase
*m_table
;
1155 wxGridCellCoords m_currentCellCoords
;
1157 wxGridCellCoords m_selectedTopLeft
;
1158 wxGridCellCoords m_selectedBottomRight
;
1159 wxColour m_selectionBackground
;
1160 wxColour m_selectionForeground
;
1162 // NB: *never* access m_row/col arrays directly because they are created
1163 // on demand, *always* use accessor functions instead!
1165 // init the m_rowHeights/Bottoms arrays with default values
1166 void InitRowHeights();
1168 int m_defaultRowHeight
;
1169 wxArrayInt m_rowHeights
;
1170 wxArrayInt m_rowBottoms
;
1172 // init the m_colWidths/Rights arrays
1173 void InitColWidths();
1175 int m_defaultColWidth
;
1176 wxArrayInt m_colWidths
;
1177 wxArrayInt m_colRights
;
1179 // get the col/row coords
1180 int GetColWidth(int col
) const;
1181 int GetColLeft(int col
) const;
1182 int GetColRight(int col
) const;
1184 // this function must be public for compatibility...
1186 int GetRowHeight(int row
) const;
1189 int GetRowTop(int row
) const;
1190 int GetRowBottom(int row
) const;
1192 int m_rowLabelWidth
;
1193 int m_colLabelHeight
;
1195 wxColour m_labelBackgroundColour
;
1196 wxColour m_labelTextColour
;
1199 int m_rowLabelHorizAlign
;
1200 int m_rowLabelVertAlign
;
1201 int m_colLabelHorizAlign
;
1202 int m_colLabelVertAlign
;
1204 bool m_defaultRowLabelValues
;
1205 bool m_defaultColLabelValues
;
1207 wxColour m_gridLineColour
;
1208 bool m_gridLinesEnabled
;
1210 // if a column has a minimal width, it will be the value for it in this
1212 wxHashTable m_colMinWidths
;
1214 // get the minimal width of the given column
1215 int GetColMinimalWidth(int col
) const;
1217 // do we have some place to store attributes in?
1218 bool CanHaveAttributes();
1220 // returns the attribute we may modify in place: a new one if this cell
1221 // doesn't have any yet or the existing one if it does
1223 // DecRef() must be called on the returned pointer, as usual
1224 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1226 // cell attribute cache (currently we only cache 1, may be will do
1227 // more/better later)
1231 wxGridCellAttr
*attr
;
1234 // invalidates the attribute cache
1235 void ClearAttrCache();
1237 // adds an attribute to cache
1238 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1240 // looks for an attr in cache, returns TRUE if found
1241 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1243 // looks for the attr in cache, if not found asks the table and caches the
1245 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1246 wxGridCellAttr
*GetCellAttr(const wxGridCellCoords
& coords
)
1247 { return GetCellAttr( coords
.GetRow(), coords
.GetCol() ); }
1249 // the default cell attr object for cells that don't have their own
1250 wxGridCellAttr
* m_defaultCellAttr
;
1253 wxGridCellCoordsArray m_cellsExposed
;
1254 wxArrayInt m_rowsExposed
;
1255 wxArrayInt m_colsExposed
;
1256 wxArrayInt m_rowLabelsExposed
;
1257 wxArrayInt m_colLabelsExposed
;
1264 WXGRID_CURSOR_SELECT_CELL
,
1265 WXGRID_CURSOR_RESIZE_ROW
,
1266 WXGRID_CURSOR_RESIZE_COL
,
1267 WXGRID_CURSOR_SELECT_ROW
,
1268 WXGRID_CURSOR_SELECT_COL
1271 // this method not only sets m_cursorMode but also sets the correct cursor
1272 // for the given mode and, if captureMouse is not FALSE releases the mouse
1273 // if it was captured and captures it if it must be captured
1275 // for this to work, you should always use it and not set m_cursorMode
1277 void ChangeCursorMode(CursorMode mode
,
1278 wxWindow
*win
= (wxWindow
*)NULL
,
1279 bool captureMouse
= TRUE
);
1281 wxWindow
*m_winCapture
; // the window which captured the mouse
1282 CursorMode m_cursorMode
;
1287 wxPoint m_startDragPos
;
1289 bool m_waitForSlowClick
;
1291 wxGridCellCoords m_selectionStart
;
1293 wxCursor m_rowResizeCursor
;
1294 wxCursor m_colResizeCursor
;
1296 bool m_editable
; // applies to whole grid
1297 bool m_cellEditCtrlEnabled
; // is in-place edit currently shown?
1302 void CalcDimensions();
1303 void CalcWindowSizes();
1304 bool Redimension( wxGridTableMessage
& );
1307 bool SendEvent( const wxEventType
, int row
, int col
, wxMouseEvent
& );
1308 bool SendEvent( const wxEventType
, int row
, int col
);
1309 bool SendEvent( const wxEventType type
)
1311 return SendEvent(type
,
1312 m_currentCellCoords
.GetRow(),
1313 m_currentCellCoords
.GetCol());
1316 void OnPaint( wxPaintEvent
& );
1317 void OnSize( wxSizeEvent
& );
1318 void OnKeyDown( wxKeyEvent
& );
1319 void OnEraseBackground( wxEraseEvent
& );
1322 void SetCurrentCell( const wxGridCellCoords
& coords
);
1323 void SetCurrentCell( int row
, int col
)
1324 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1327 // ------ functions to get/send data (see also public functions)
1329 bool GetModelValues();
1330 bool SetModelValues();
1333 DECLARE_DYNAMIC_CLASS( wxGrid
)
1334 DECLARE_EVENT_TABLE()
1338 // ----------------------------------------------------------------------------
1339 // Grid event class and event types
1340 // ----------------------------------------------------------------------------
1342 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1346 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1347 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1351 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1352 int row
=-1, int col
=-1, int x
=-1, int y
=-1,
1353 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1355 virtual int GetRow() { return m_row
; }
1356 virtual int GetCol() { return m_col
; }
1357 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1358 bool ControlDown() { return m_control
; }
1359 bool MetaDown() { return m_meta
; }
1360 bool ShiftDown() { return m_shift
; }
1361 bool AltDown() { return m_alt
; }
1373 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1376 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1380 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1381 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1385 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1386 int rowOrCol
=-1, int x
=-1, int y
=-1,
1387 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1389 int GetRowOrCol() { return m_rowOrCol
; }
1390 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1391 bool ControlDown() { return m_control
; }
1392 bool MetaDown() { return m_meta
; }
1393 bool ShiftDown() { return m_shift
; }
1394 bool AltDown() { return m_alt
; }
1405 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1409 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1412 wxGridRangeSelectEvent()
1415 m_topLeft
= wxGridNoCellCoords
;
1416 m_bottomRight
= wxGridNoCellCoords
;
1423 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1424 const wxGridCellCoords
& topLeft
,
1425 const wxGridCellCoords
& bottomRight
,
1426 bool control
=FALSE
, bool shift
=FALSE
,
1427 bool alt
=FALSE
, bool meta
=FALSE
);
1429 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1430 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1431 int GetTopRow() { return m_topLeft
.GetRow(); }
1432 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1433 int GetLeftCol() { return m_topLeft
.GetCol(); }
1434 int GetRightCol() { return m_bottomRight
.GetCol(); }
1435 bool ControlDown() { return m_control
; }
1436 bool MetaDown() { return m_meta
; }
1437 bool ShiftDown() { return m_shift
; }
1438 bool AltDown() { return m_alt
; }
1441 wxGridCellCoords m_topLeft
;
1442 wxGridCellCoords m_bottomRight
;
1448 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1451 // TODO move to wx/event.h
1452 const wxEventType wxEVT_GRID_CELL_LEFT_CLICK
= wxEVT_FIRST
+ 1580;
1453 const wxEventType wxEVT_GRID_CELL_RIGHT_CLICK
= wxEVT_FIRST
+ 1581;
1454 const wxEventType wxEVT_GRID_CELL_LEFT_DCLICK
= wxEVT_FIRST
+ 1582;
1455 const wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1583;
1456 const wxEventType wxEVT_GRID_LABEL_LEFT_CLICK
= wxEVT_FIRST
+ 1584;
1457 const wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK
= wxEVT_FIRST
+ 1585;
1458 const wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK
= wxEVT_FIRST
+ 1586;
1459 const wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK
= wxEVT_FIRST
+ 1587;
1460 const wxEventType wxEVT_GRID_ROW_SIZE
= wxEVT_FIRST
+ 1588;
1461 const wxEventType wxEVT_GRID_COL_SIZE
= wxEVT_FIRST
+ 1589;
1462 const wxEventType wxEVT_GRID_RANGE_SELECT
= wxEVT_FIRST
+ 1590;
1463 const wxEventType wxEVT_GRID_CELL_CHANGE
= wxEVT_FIRST
+ 1591;
1464 const wxEventType wxEVT_GRID_SELECT_CELL
= wxEVT_FIRST
+ 1592;
1465 const wxEventType wxEVT_GRID_EDITOR_SHOWN
= wxEVT_FIRST
+ 1593;
1466 const wxEventType wxEVT_GRID_EDITOR_HIDDEN
= wxEVT_FIRST
+ 1594;
1469 typedef void (wxEvtHandler
::*wxGridEventFunction
)(wxGridEvent
&);
1470 typedef void (wxEvtHandler
::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1471 typedef void (wxEvtHandler
::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1473 #define EVT_GRID_CELL_LEFT_CLICK(fn) { wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1474 #define EVT_GRID_CELL_RIGHT_CLICK(fn) { wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1475 #define EVT_GRID_CELL_LEFT_DCLICK(fn) { wxEVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1476 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) { wxEVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1477 #define EVT_GRID_LABEL_LEFT_CLICK(fn) { wxEVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1478 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) { wxEVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1479 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) { wxEVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1480 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) { wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1481 #define EVT_GRID_ROW_SIZE(fn) { wxEVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1482 #define EVT_GRID_COL_SIZE(fn) { wxEVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL },
1483 #define EVT_GRID_RANGE_SELECT(fn) { wxEVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL },
1484 #define EVT_GRID_CELL_CHANGE(fn) { wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1485 #define EVT_GRID_SELECT_CELL(fn) { wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1486 #define EVT_GRID_EDITOR_SHOWN(fn) { wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1487 #define EVT_GRID_EDITOR_HIDDEN(fn) { wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1490 #if 0 // TODO: implement these ? others ?
1492 const wxEventType wxEVT_GRID_CREATE_CELL
= wxEVT_FIRST
+ 1576;
1493 const wxEventType wxEVT_GRID_CHANGE_LABELS
= wxEVT_FIRST
+ 1577;
1494 const wxEventType wxEVT_GRID_CHANGE_SEL_LABEL
= wxEVT_FIRST
+ 1578;
1496 #define EVT_GRID_CREATE_CELL(fn) { wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1497 #define EVT_GRID_CHANGE_LABELS(fn) { wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1498 #define EVT_GRID_CHANGE_SEL_LABEL(fn) { wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
1502 #endif // #ifndef __WXGRID_H__
1504 #endif // ifndef wxUSE_NEW_GRID