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)
15 #include "wx/generic/gridg.h"
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 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 // Default parameters for wxGrid
41 #define WXGRID_DEFAULT_NUMBER_ROWS 10
42 #define WXGRID_DEFAULT_NUMBER_COLS 10
44 #define WXGRID_DEFAULT_ROW_HEIGHT 25
46 #define WXGRID_DEFAULT_ROW_HEIGHT 30
48 #define WXGRID_DEFAULT_COL_WIDTH 80
49 #define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32
50 #define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82
51 #define WXGRID_LABEL_EDGE_ZONE 2
52 #define WXGRID_MIN_ROW_HEIGHT 15
53 #define WXGRID_MIN_COL_WIDTH 15
54 #define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16
56 // type names for grid table values
57 #define wxGRID_VALUE_STRING _T("string")
58 #define wxGRID_VALUE_BOOL _T("bool")
59 #define wxGRID_VALUE_NUMBER _T("long")
60 #define wxGRID_VALUE_FLOAT _T("double")
61 #define wxGRID_VALUE_CHOICE _T("choice")
63 #define wxGRID_VALUE_TEXT wxGRID_VALUE_STRING
64 #define wxGRID_VALUE_LONG wxGRID_VALUE_NUMBER
66 // ----------------------------------------------------------------------------
67 // forward declarations
68 // ----------------------------------------------------------------------------
70 class WXDLLEXPORT wxGrid
;
71 class WXDLLEXPORT wxGridCellAttr
;
72 class WXDLLEXPORT wxGridCellAttrProviderData
;
73 class WXDLLEXPORT wxGridColLabelWindow
;
74 class WXDLLEXPORT wxGridCornerLabelWindow
;
75 class WXDLLEXPORT wxGridRowLabelWindow
;
76 class WXDLLEXPORT wxGridTableBase
;
77 class WXDLLEXPORT wxGridWindow
;
78 class WXDLLEXPORT wxGridTypeRegistry
;
79 class WXDLLEXPORT wxGridSelection
;
81 class WXDLLEXPORT wxCheckBox
;
82 class WXDLLEXPORT wxComboBox
;
83 class WXDLLEXPORT wxTextCtrl
;
84 class WXDLLEXPORT wxSpinCtrl
;
86 // ----------------------------------------------------------------------------
88 // ----------------------------------------------------------------------------
90 #define wxSafeIncRef(p) if ( p ) (p)->IncRef()
91 #define wxSafeDecRef(p) if ( p ) (p)->DecRef()
93 // ----------------------------------------------------------------------------
94 // wxGridCellWorker: common base class for wxGridCellRenderer and
97 // NB: this is more an implementation convenience than a design issue, so this
98 // class is not documented and is not public at all
99 // ----------------------------------------------------------------------------
101 class WXDLLEXPORT wxGridCellWorker
104 wxGridCellWorker() { m_nRef
= 1; }
106 // this class is ref counted: it is created with ref count of 1, so
107 // calling DecRef() once will delete it. Calling IncRef() allows to lock
108 // it until the matching DecRef() is called
109 void IncRef() { m_nRef
++; }
110 void DecRef() { if ( !--m_nRef
) delete this; }
112 // interpret renderer parameters: arbitrary string whose interpretatin is
113 // left to the derived classes
114 virtual void SetParameters(const wxString
& params
);
117 // virtual dtor for any base class - private because only DecRef() can
119 virtual ~wxGridCellWorker();
124 // suppress the stupid gcc warning about the class having private dtor and
126 friend class wxGridCellWorkerDummyFriend
;
129 // ----------------------------------------------------------------------------
130 // wxGridCellRenderer: this class is responsible for actually drawing the cell
131 // in the grid. You may pass it to the wxGridCellAttr (below) to change the
132 // format of one given cell or to wxGrid::SetDefaultRenderer() to change the
133 // view of all cells. This is an ABC, you will normally use one of the
134 // predefined derived classes or derive your own class from it.
135 // ----------------------------------------------------------------------------
137 class WXDLLEXPORT wxGridCellRenderer
: public wxGridCellWorker
140 // draw the given cell on the provided DC inside the given rectangle
141 // using the style specified by the attribute and the default or selected
142 // state corresponding to the isSelected value.
144 // this pure virtual function has a default implementation which will
145 // prepare the DC using the given attribute: it will draw the rectangle
146 // with the bg colour from attr and set the text colour and font
147 virtual void Draw(wxGrid
& grid
,
148 wxGridCellAttr
& attr
,
152 bool isSelected
) = 0;
154 // get the preferred size of the cell for its contents
155 virtual wxSize
GetBestSize(wxGrid
& grid
,
156 wxGridCellAttr
& attr
,
158 int row
, int col
) = 0;
160 // create a new object which is the copy of this one
161 virtual wxGridCellRenderer
*Clone() const = 0;
164 // the default renderer for the cells containing string data
165 class WXDLLEXPORT wxGridCellStringRenderer
: public wxGridCellRenderer
169 virtual void Draw(wxGrid
& grid
,
170 wxGridCellAttr
& attr
,
176 // return the string extent
177 virtual wxSize
GetBestSize(wxGrid
& grid
,
178 wxGridCellAttr
& attr
,
182 virtual wxGridCellRenderer
*Clone() const
183 { return new wxGridCellStringRenderer
; }
186 // set the text colours before drawing
187 void SetTextColoursAndFont(wxGrid
& grid
,
188 wxGridCellAttr
& attr
,
192 // calc the string extent for given string/font
193 wxSize
DoGetBestSize(wxGridCellAttr
& attr
,
195 const wxString
& text
);
198 // the default renderer for the cells containing numeric (long) data
199 class WXDLLEXPORT wxGridCellNumberRenderer
: public wxGridCellStringRenderer
202 // draw the string right aligned
203 virtual void Draw(wxGrid
& grid
,
204 wxGridCellAttr
& attr
,
210 virtual wxSize
GetBestSize(wxGrid
& grid
,
211 wxGridCellAttr
& attr
,
215 virtual wxGridCellRenderer
*Clone() const
216 { return new wxGridCellNumberRenderer
; }
219 wxString
GetString(wxGrid
& grid
, int row
, int col
);
222 class WXDLLEXPORT wxGridCellFloatRenderer
: public wxGridCellStringRenderer
225 wxGridCellFloatRenderer(int width
= -1, int precision
= -1);
227 // get/change formatting parameters
228 int GetWidth() const { return m_width
; }
229 void SetWidth(int width
) { m_width
= width
; m_format
.clear(); }
230 int GetPrecision() const { return m_precision
; }
231 void SetPrecision(int precision
) { m_precision
= precision
; m_format
.clear(); }
233 // draw the string right aligned with given width/precision
234 virtual void Draw(wxGrid
& grid
,
235 wxGridCellAttr
& attr
,
241 virtual wxSize
GetBestSize(wxGrid
& grid
,
242 wxGridCellAttr
& attr
,
246 // parameters string format is "width[,precision]"
247 virtual void SetParameters(const wxString
& params
);
249 virtual wxGridCellRenderer
*Clone() const;
252 wxString
GetString(wxGrid
& grid
, int row
, int col
);
255 // formatting parameters
262 // renderer for boolean fields
263 class WXDLLEXPORT wxGridCellBoolRenderer
: public wxGridCellRenderer
266 // draw a check mark or nothing
267 virtual void Draw(wxGrid
& grid
,
268 wxGridCellAttr
& attr
,
274 // return the checkmark size
275 virtual wxSize
GetBestSize(wxGrid
& grid
,
276 wxGridCellAttr
& attr
,
280 virtual wxGridCellRenderer
*Clone() const
281 { return new wxGridCellBoolRenderer
; }
284 static wxSize ms_sizeCheckMark
;
287 // ----------------------------------------------------------------------------
288 // wxGridCellEditor: This class is responsible for providing and manipulating
289 // the in-place edit controls for the grid. Instances of wxGridCellEditor
290 // (actually, instances of derived classes since it is an ABC) can be
291 // associated with the cell attributes for individual cells, rows, columns, or
292 // even for the entire grid.
293 // ----------------------------------------------------------------------------
295 class WXDLLEXPORT wxGridCellEditor
: public wxGridCellWorker
300 bool IsCreated() { return m_control
!= NULL
; }
301 wxControl
* GetControl() { return m_control
; }
302 void SetControl(wxControl
* control
) { m_control
= control
; }
304 // Creates the actual edit control
305 virtual void Create(wxWindow
* parent
,
307 wxEvtHandler
* evtHandler
) = 0;
309 // Size and position the edit control
310 virtual void SetSize(const wxRect
& rect
);
312 // Show or hide the edit control, use the specified attributes to set
313 // colours/fonts for it
314 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
316 // Draws the part of the cell not occupied by the control: the base class
317 // version just fills it with background colour from the attribute
318 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
320 // Fetch the value from the table and prepare the edit control
321 // to begin editing. Set the focus to the edit control.
322 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
) = 0;
324 // Complete the editing of the current cell. Returns true if the value has
325 // changed. If necessary, the control may be destroyed.
326 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
) = 0;
328 // Reset the value in the control back to its starting value
329 virtual void Reset() = 0;
331 // return TRUE to allow the given key to start editing: the base class
332 // version only checks that the event has no modifiers. The derived
333 // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in
334 // their IsAcceptedKey() implementation, although, of course, it is not a
335 // mandatory requirment.
337 // NB: if the key is F2 (special), editing will always start and this
338 // method will not be called at all (but StartingKey() will)
339 virtual bool IsAcceptedKey(wxKeyEvent
& event
);
341 // If the editor is enabled by pressing keys on the grid, this will be
342 // called to let the editor do something about that first key if desired
343 virtual void StartingKey(wxKeyEvent
& event
);
345 // if the editor is enabled by clicking on the cell, this method will be
347 virtual void StartingClick();
349 // Some types of controls on some platforms may need some help
350 // with the Return key.
351 virtual void HandleReturn(wxKeyEvent
& event
);
354 virtual void Destroy();
356 // create a new object which is the copy of this one
357 virtual wxGridCellEditor
*Clone() const = 0;
360 // the dtor is private because only DecRef() can delete us
361 virtual ~wxGridCellEditor();
363 // the control we show on screen
364 wxControl
* m_control
;
366 // if we change the colours/font of the control from the default ones, we
367 // must restore the default later and we save them here between calls to
368 // Show(TRUE) and Show(FALSE)
373 // suppress the stupid gcc warning about the class having private dtor and
375 friend class wxGridCellEditorDummyFriend
;
380 // the editor for string/text data
381 class WXDLLEXPORT wxGridCellTextEditor
: public wxGridCellEditor
384 wxGridCellTextEditor();
386 virtual void Create(wxWindow
* parent
,
388 wxEvtHandler
* evtHandler
);
389 virtual void SetSize(const wxRect
& rect
);
391 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
393 virtual bool IsAcceptedKey(wxKeyEvent
& event
);
394 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
395 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
397 virtual void Reset();
398 virtual void StartingKey(wxKeyEvent
& event
);
399 virtual void HandleReturn(wxKeyEvent
& event
);
401 // parameters string format is "max_width"
402 virtual void SetParameters(const wxString
& params
);
404 virtual wxGridCellEditor
*Clone() const
405 { return new wxGridCellTextEditor
; }
408 wxTextCtrl
*Text() const { return (wxTextCtrl
*)m_control
; }
410 // parts of our virtual functions reused by the derived classes
411 void DoBeginEdit(const wxString
& startValue
);
412 void DoReset(const wxString
& startValue
);
415 size_t m_maxChars
; // max number of chars allowed
416 wxString m_startValue
;
419 // the editor for numeric (long) data
420 class WXDLLEXPORT wxGridCellNumberEditor
: public wxGridCellTextEditor
423 // allows to specify the range - if min == max == -1, no range checking is
425 wxGridCellNumberEditor(int min
= -1, int max
= -1);
427 virtual void Create(wxWindow
* parent
,
429 wxEvtHandler
* evtHandler
);
431 virtual bool IsAcceptedKey(wxKeyEvent
& event
);
432 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
433 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
435 virtual void Reset();
436 virtual void StartingKey(wxKeyEvent
& event
);
438 // parameters string format is "min,max"
439 virtual void SetParameters(const wxString
& params
);
441 virtual wxGridCellEditor
*Clone() const
442 { return new wxGridCellNumberEditor(m_min
, m_max
); }
445 wxSpinCtrl
*Spin() const { return (wxSpinCtrl
*)m_control
; }
447 // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl
448 bool HasRange() const { return m_min
!= m_max
; }
450 // string representation of m_valueOld
451 wxString
GetString() const
452 { return wxString::Format(_T("%ld"), m_valueOld
); }
461 // the editor for floating point numbers (double) data
462 class WXDLLEXPORT wxGridCellFloatEditor
: public wxGridCellTextEditor
465 wxGridCellFloatEditor(int width
= -1, int precision
= -1);
467 virtual void Create(wxWindow
* parent
,
469 wxEvtHandler
* evtHandler
);
471 virtual bool IsAcceptedKey(wxKeyEvent
& event
);
472 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
473 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
475 virtual void Reset();
476 virtual void StartingKey(wxKeyEvent
& event
);
478 virtual wxGridCellEditor
*Clone() const
479 { return new wxGridCellFloatEditor
; }
481 // parameters string format is "width,precision"
482 virtual void SetParameters(const wxString
& params
);
485 // string representation of m_valueOld
486 wxString
GetString() const;
494 #endif // wxUSE_TEXTCTRL
498 // the editor for boolean data
499 class WXDLLEXPORT wxGridCellBoolEditor
: public wxGridCellEditor
502 virtual void Create(wxWindow
* parent
,
504 wxEvtHandler
* evtHandler
);
506 virtual void SetSize(const wxRect
& rect
);
507 virtual void Show(bool show
, wxGridCellAttr
*attr
= (wxGridCellAttr
*)NULL
);
509 virtual bool IsAcceptedKey(wxKeyEvent
& event
);
510 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
511 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
513 virtual void Reset();
514 virtual void StartingClick();
516 virtual wxGridCellEditor
*Clone() const
517 { return new wxGridCellBoolEditor
; }
520 wxCheckBox
*CBox() const { return (wxCheckBox
*)m_control
; }
526 #endif // wxUSE_CHECKBOX
530 // the editor for string data allowing to choose from the list of strings
531 class WXDLLEXPORT wxGridCellChoiceEditor
: public wxGridCellEditor
534 // if !allowOthers, user can't type a string not in choices array
535 wxGridCellChoiceEditor(size_t count
= 0,
536 const wxString choices
[] = NULL
,
537 bool allowOthers
= FALSE
);
539 virtual void Create(wxWindow
* parent
,
541 wxEvtHandler
* evtHandler
);
543 virtual void PaintBackground(const wxRect
& rectCell
, wxGridCellAttr
*attr
);
545 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
546 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
548 virtual void Reset();
550 // parameters string format is "item1[,item2[...,itemN]]"
551 virtual void SetParameters(const wxString
& params
);
553 virtual wxGridCellEditor
*Clone() const;
556 wxComboBox
*Combo() const { return (wxComboBox
*)m_control
; }
559 wxString m_startValue
;
560 wxArrayString m_choices
;
564 #endif // wxUSE_COMBOBOX
566 // ----------------------------------------------------------------------------
567 // wxGridCellAttr: this class can be used to alter the cells appearance in
568 // the grid by changing their colour/font/... from default. An object of this
569 // class may be returned by wxGridTable::GetAttr().
570 // ----------------------------------------------------------------------------
572 class WXDLLEXPORT wxGridCellAttr
586 wxGridCellAttr(wxGridCellAttr
*attrDefault
= NULL
)
590 // MB: args used to be 0,0 here but wxALIGN_LEFT is 0
591 SetAlignment(-1, -1);
594 // VZ: considering the number of members wxGridCellAttr has now, this ctor
595 // seems to be pretty useless... may be we should just remove it?
596 wxGridCellAttr(const wxColour
& colText
,
597 const wxColour
& colBack
,
601 : m_colText(colText
), m_colBack(colBack
), m_font(font
)
604 SetAlignment(hAlign
, vAlign
);
607 // creates a new copy of this object
608 wxGridCellAttr
*Clone() const;
609 void MergeWith(wxGridCellAttr
*mergefrom
);
611 // this class is ref counted: it is created with ref count of 1, so
612 // calling DecRef() once will delete it. Calling IncRef() allows to lock
613 // it until the matching DecRef() is called
614 void IncRef() { m_nRef
++; }
615 void DecRef() { if ( !--m_nRef
) delete this; }
618 void SetTextColour(const wxColour
& colText
) { m_colText
= colText
; }
619 void SetBackgroundColour(const wxColour
& colBack
) { m_colBack
= colBack
; }
620 void SetFont(const wxFont
& font
) { m_font
= font
; }
621 void SetAlignment(int hAlign
, int vAlign
)
626 void SetReadOnly(bool isReadOnly
= TRUE
)
627 { m_isReadOnly
= isReadOnly
? ReadOnly
: ReadWrite
; }
629 // takes ownership of the pointer
630 void SetRenderer(wxGridCellRenderer
*renderer
)
631 { wxSafeDecRef(m_renderer
); m_renderer
= renderer
; }
632 void SetEditor(wxGridCellEditor
* editor
)
633 { wxSafeDecRef(m_editor
); m_editor
= editor
; }
635 void SetKind(wxAttrKind kind
) { m_attrkind
= kind
; }
638 bool HasTextColour() const { return m_colText
.Ok(); }
639 bool HasBackgroundColour() const { return m_colBack
.Ok(); }
640 bool HasFont() const { return m_font
.Ok(); }
641 bool HasAlignment() const { return (m_hAlign
!= -1 || m_vAlign
!= -1); }
642 bool HasRenderer() const { return m_renderer
!= NULL
; }
643 bool HasEditor() const { return m_editor
!= NULL
; }
644 bool HasReadWriteMode() const { return m_isReadOnly
!= Unset
; }
646 const wxColour
& GetTextColour() const;
647 const wxColour
& GetBackgroundColour() const;
648 const wxFont
& GetFont() const;
649 void GetAlignment(int *hAlign
, int *vAlign
) const;
650 wxGridCellRenderer
*GetRenderer(wxGrid
* grid
, int row
, int col
) const;
651 wxGridCellEditor
*GetEditor(wxGrid
* grid
, int row
, int col
) const;
653 bool IsReadOnly() const { return m_isReadOnly
== wxGridCellAttr::ReadOnly
; }
655 wxAttrKind
GetKind() { return m_attrkind
; }
657 void SetDefAttr(wxGridCellAttr
* defAttr
) { m_defGridAttr
= defAttr
; }
667 // the common part of all ctors
668 void Init(wxGridCellAttr
*attrDefault
= NULL
);
670 // the dtor is private because only DecRef() can delete us
673 wxSafeDecRef(m_renderer
);
674 wxSafeDecRef(m_editor
);
677 // the ref count - when it goes to 0, we die
686 wxGridCellRenderer
* m_renderer
;
687 wxGridCellEditor
* m_editor
;
688 wxGridCellAttr
* m_defGridAttr
;
690 wxAttrReadMode m_isReadOnly
;
692 wxAttrKind m_attrkind
;
694 // use Clone() instead
695 DECLARE_NO_COPY_CLASS(wxGridCellAttr
)
697 // suppress the stupid gcc warning about the class having private dtor and
699 friend class wxGridCellAttrDummyFriend
;
702 // ----------------------------------------------------------------------------
703 // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
705 // ----------------------------------------------------------------------------
707 // implementation note: we separate it from wxGridTableBase because we wish to
708 // avoid deriving a new table class if possible, and sometimes it will be
709 // enough to just derive another wxGridCellAttrProvider instead
711 // the default implementation is reasonably efficient for the generic case,
712 // but you might still wish to implement your own for some specific situations
713 // if you have performance problems with the stock one
714 class WXDLLEXPORT wxGridCellAttrProvider
717 wxGridCellAttrProvider();
718 virtual ~wxGridCellAttrProvider();
720 // DecRef() must be called on the returned pointer
721 virtual wxGridCellAttr
*GetAttr(int row
, int col
,
722 wxGridCellAttr::wxAttrKind kind
) const;
724 // all these functions take ownership of the pointer, don't call DecRef()
726 virtual void SetAttr(wxGridCellAttr
*attr
, int row
, int col
);
727 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
728 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
730 // these functions must be called whenever some rows/cols are deleted
731 // because the internal data must be updated then
732 void UpdateAttrRows( size_t pos
, int numRows
);
733 void UpdateAttrCols( size_t pos
, int numCols
);
738 wxGridCellAttrProviderData
*m_data
;
741 //////////////////////////////////////////////////////////////////////
743 // Grid table classes
745 //////////////////////////////////////////////////////////////////////
748 class WXDLLEXPORT wxGridTableBase
: public wxObject
752 virtual ~wxGridTableBase();
754 // You must override these functions in a derived table class
756 virtual int GetNumberRows() = 0;
757 virtual int GetNumberCols() = 0;
758 virtual bool IsEmptyCell( int row
, int col
) = 0;
759 virtual wxString
GetValue( int row
, int col
) = 0;
760 virtual void SetValue( int row
, int col
, const wxString
& value
) = 0;
762 // Data type determination and value access
763 virtual wxString
GetTypeName( int row
, int col
);
764 virtual bool CanGetValueAs( int row
, int col
, const wxString
& typeName
);
765 virtual bool CanSetValueAs( int row
, int col
, const wxString
& typeName
);
767 virtual long GetValueAsLong( int row
, int col
);
768 virtual double GetValueAsDouble( int row
, int col
);
769 virtual bool GetValueAsBool( int row
, int col
);
771 virtual void SetValueAsLong( int row
, int col
, long value
);
772 virtual void SetValueAsDouble( int row
, int col
, double value
);
773 virtual void SetValueAsBool( int row
, int col
, bool value
);
775 // For user defined types
776 virtual void* GetValueAsCustom( int row
, int col
, const wxString
& typeName
);
777 virtual void SetValueAsCustom( int row
, int col
, const wxString
& typeName
, void* value
);
780 // Overriding these is optional
782 virtual void SetView( wxGrid
*grid
) { m_view
= grid
; }
783 virtual wxGrid
* GetView() const { return m_view
; }
785 virtual void Clear() {}
786 virtual bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
787 virtual bool AppendRows( size_t numRows
= 1 );
788 virtual bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
789 virtual bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
790 virtual bool AppendCols( size_t numCols
= 1 );
791 virtual bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
793 virtual wxString
GetRowLabelValue( int row
);
794 virtual wxString
GetColLabelValue( int col
);
795 virtual void SetRowLabelValue( int WXUNUSED(row
), const wxString
& ) {}
796 virtual void SetColLabelValue( int WXUNUSED(col
), const wxString
& ) {}
798 // Attribute handling
801 // give us the attr provider to use - we take ownership of the pointer
802 void SetAttrProvider(wxGridCellAttrProvider
*attrProvider
);
804 // get the currently used attr provider (may be NULL)
805 wxGridCellAttrProvider
*GetAttrProvider() const { return m_attrProvider
; }
807 // Does this table allow attributes? Default implementation creates
808 // a wxGridCellAttrProvider if necessary.
809 virtual bool CanHaveAttributes();
811 // by default forwarded to wxGridCellAttrProvider if any. May be
812 // overridden to handle attributes directly in the table.
813 virtual wxGridCellAttr
*GetAttr( int row
, int col
,
814 wxGridCellAttr::wxAttrKind kind
);
817 // these functions take ownership of the pointer
818 virtual void SetAttr(wxGridCellAttr
* attr
, int row
, int col
);
819 virtual void SetRowAttr(wxGridCellAttr
*attr
, int row
);
820 virtual void SetColAttr(wxGridCellAttr
*attr
, int col
);
824 wxGridCellAttrProvider
*m_attrProvider
;
826 DECLARE_ABSTRACT_CLASS( wxGridTableBase
);
830 // ----------------------------------------------------------------------------
831 // wxGridTableMessage
832 // ----------------------------------------------------------------------------
834 // IDs for messages sent from grid table to view
836 enum wxGridTableRequest
838 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES
= 2000,
839 wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES
,
840 wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
841 wxGRIDTABLE_NOTIFY_ROWS_APPENDED
,
842 wxGRIDTABLE_NOTIFY_ROWS_DELETED
,
843 wxGRIDTABLE_NOTIFY_COLS_INSERTED
,
844 wxGRIDTABLE_NOTIFY_COLS_APPENDED
,
845 wxGRIDTABLE_NOTIFY_COLS_DELETED
848 class WXDLLEXPORT wxGridTableMessage
851 wxGridTableMessage();
852 wxGridTableMessage( wxGridTableBase
*table
, int id
,
856 void SetTableObject( wxGridTableBase
*table
) { m_table
= table
; }
857 wxGridTableBase
* GetTableObject() const { return m_table
; }
858 void SetId( int id
) { m_id
= id
; }
859 int GetId() { return m_id
; }
860 void SetCommandInt( int comInt1
) { m_comInt1
= comInt1
; }
861 int GetCommandInt() { return m_comInt1
; }
862 void SetCommandInt2( int comInt2
) { m_comInt2
= comInt2
; }
863 int GetCommandInt2() { return m_comInt2
; }
866 wxGridTableBase
*m_table
;
874 // ------ wxGridStringArray
875 // A 2-dimensional array of strings for data values
878 WX_DECLARE_EXPORTED_OBJARRAY(wxArrayString
, wxGridStringArray
);
882 // ------ wxGridStringTable
884 // Simplest type of data table for a grid for small tables of strings
885 // that are stored in memory
888 class WXDLLEXPORT wxGridStringTable
: public wxGridTableBase
892 wxGridStringTable( int numRows
, int numCols
);
893 ~wxGridStringTable();
895 // these are pure virtual in wxGridTableBase
899 wxString
GetValue( int row
, int col
);
900 void SetValue( int row
, int col
, const wxString
& s
);
901 bool IsEmptyCell( int row
, int col
);
903 // overridden functions from wxGridTableBase
906 bool InsertRows( size_t pos
= 0, size_t numRows
= 1 );
907 bool AppendRows( size_t numRows
= 1 );
908 bool DeleteRows( size_t pos
= 0, size_t numRows
= 1 );
909 bool InsertCols( size_t pos
= 0, size_t numCols
= 1 );
910 bool AppendCols( size_t numCols
= 1 );
911 bool DeleteCols( size_t pos
= 0, size_t numCols
= 1 );
913 void SetRowLabelValue( int row
, const wxString
& );
914 void SetColLabelValue( int col
, const wxString
& );
915 wxString
GetRowLabelValue( int row
);
916 wxString
GetColLabelValue( int col
);
919 wxGridStringArray m_data
;
921 // These only get used if you set your own labels, otherwise the
922 // GetRow/ColLabelValue functions return wxGridTableBase defaults
924 wxArrayString m_rowLabels
;
925 wxArrayString m_colLabels
;
927 DECLARE_DYNAMIC_CLASS( wxGridStringTable
)
932 // ============================================================================
934 // ============================================================================
936 // ----------------------------------------------------------------------------
937 // wxGridCellCoords: location of a cell in the grid
938 // ----------------------------------------------------------------------------
940 class WXDLLEXPORT wxGridCellCoords
943 wxGridCellCoords() { m_row
= m_col
= -1; }
944 wxGridCellCoords( int r
, int c
) { m_row
= r
; m_col
= c
; }
946 // default copy ctor is ok
948 int GetRow() const { return m_row
; }
949 void SetRow( int n
) { m_row
= n
; }
950 int GetCol() const { return m_col
; }
951 void SetCol( int n
) { m_col
= n
; }
952 void Set( int row
, int col
) { m_row
= row
; m_col
= col
; }
954 wxGridCellCoords
& operator=( const wxGridCellCoords
& other
)
956 if ( &other
!= this )
964 bool operator==( const wxGridCellCoords
& other
) const
966 return (m_row
== other
.m_row
&& m_col
== other
.m_col
);
969 bool operator!=( const wxGridCellCoords
& other
) const
971 return (m_row
!= other
.m_row
|| m_col
!= other
.m_col
);
974 bool operator!() const
976 return (m_row
== -1 && m_col
== -1 );
985 // For comparisons...
987 extern WXDLLEXPORT wxGridCellCoords wxGridNoCellCoords
;
988 extern WXDLLEXPORT wxRect wxGridNoCellRect
;
990 // An array of cell coords...
992 WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellCoords
, wxGridCellCoordsArray
);
994 // ----------------------------------------------------------------------------
996 // ----------------------------------------------------------------------------
998 class WXDLLEXPORT wxGrid
: public wxScrolledWindow
1006 wxGrid( wxWindow
*parent
,
1008 const wxPoint
& pos
= wxDefaultPosition
,
1009 const wxSize
& size
= wxDefaultSize
,
1010 long style
= wxWANTS_CHARS
,
1011 const wxString
& name
= wxPanelNameStr
);
1015 enum wxGridSelectionModes
{wxGridSelectCells
,
1017 wxGridSelectColumns
};
1019 bool CreateGrid( int numRows
, int numCols
,
1020 wxGrid::wxGridSelectionModes selmode
=
1021 wxGrid::wxGridSelectCells
);
1023 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode
);
1025 // ------ grid dimensions
1027 int GetNumberRows() { return m_numRows
; }
1028 int GetNumberCols() { return m_numCols
; }
1031 // ------ display update functions
1033 wxArrayInt
CalcRowLabelsExposed( const wxRegion
& reg
);
1035 wxArrayInt
CalcColLabelsExposed( const wxRegion
& reg
);
1036 wxGridCellCoordsArray
CalcCellsExposed( const wxRegion
& reg
);
1039 // ------ event handlers
1041 void ProcessRowLabelMouseEvent( wxMouseEvent
& event
);
1042 void ProcessColLabelMouseEvent( wxMouseEvent
& event
);
1043 void ProcessCornerLabelMouseEvent( wxMouseEvent
& event
);
1044 void ProcessGridCellMouseEvent( wxMouseEvent
& event
);
1045 bool ProcessTableMessage( wxGridTableMessage
& );
1047 void DoEndDragResizeRow();
1048 void DoEndDragResizeCol();
1050 wxGridTableBase
* GetTable() const { return m_table
; }
1051 bool SetTable( wxGridTableBase
*table
, bool takeOwnership
=FALSE
,
1052 wxGrid::wxGridSelectionModes selmode
=
1053 wxGrid::wxGridSelectCells
);
1056 bool InsertRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
1057 bool AppendRows( int numRows
= 1, bool updateLabels
=TRUE
);
1058 bool DeleteRows( int pos
= 0, int numRows
= 1, bool updateLabels
=TRUE
);
1059 bool InsertCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
1060 bool AppendCols( int numCols
= 1, bool updateLabels
=TRUE
);
1061 bool DeleteCols( int pos
= 0, int numCols
= 1, bool updateLabels
=TRUE
);
1063 void DrawGridCellArea( wxDC
& dc
, const wxGridCellCoordsArray
& cells
);
1064 void DrawGridSpace( wxDC
& dc
);
1065 void DrawCellBorder( wxDC
& dc
, const wxGridCellCoords
& );
1066 void DrawAllGridLines( wxDC
& dc
, const wxRegion
& reg
);
1067 void DrawCell( wxDC
& dc
, const wxGridCellCoords
& );
1068 void DrawHighlight(wxDC
& dc
, const wxGridCellCoordsArray
& cells
);
1070 // this function is called when the current cell highlight must be redrawn
1071 // and may be overridden by the user
1072 virtual void DrawCellHighlight( wxDC
& dc
, const wxGridCellAttr
*attr
);
1074 void DrawRowLabels( wxDC
& dc
, const wxArrayInt
& rows
);
1075 void DrawRowLabel( wxDC
& dc
, int row
);
1077 void DrawColLabels( wxDC
& dc
, const wxArrayInt
& cols
);
1078 void DrawColLabel( wxDC
& dc
, int col
);
1081 // ------ Cell text drawing functions
1083 void DrawTextRectangle( wxDC
& dc
, const wxString
&, const wxRect
&,
1084 int horizontalAlignment
= wxALIGN_LEFT
,
1085 int verticalAlignment
= wxALIGN_TOP
);
1087 void DrawTextRectangle( wxDC
& dc
, const wxArrayString
& lines
, const wxRect
&,
1088 int horizontalAlignment
= wxALIGN_LEFT
,
1089 int verticalAlignment
= wxALIGN_TOP
);
1092 // Split a string containing newline chararcters into an array of
1093 // strings and return the number of lines
1095 void StringToLines( const wxString
& value
, wxArrayString
& lines
);
1097 void GetTextBoxSize( wxDC
& dc
,
1098 const wxArrayString
& lines
,
1099 long *width
, long *height
);
1103 // Code that does a lot of grid modification can be enclosed
1104 // between BeginBatch() and EndBatch() calls to avoid screen
1107 void BeginBatch() { m_batchCount
++; }
1110 int GetBatchCount() { return m_batchCount
; }
1112 // Use this, rather than wxWindow::Refresh(), to force an
1113 // immediate repainting of the grid. Has no effect if you are
1114 // already inside a BeginBatch / EndBatch block.
1116 // This function is necessary because wxGrid has a minimal OnPaint()
1117 // handler to reduce screen flicker.
1119 void ForceRefresh();
1122 // ------ edit control functions
1124 bool IsEditable() { return m_editable
; }
1125 void EnableEditing( bool edit
);
1127 void EnableCellEditControl( bool enable
= TRUE
);
1128 void DisableCellEditControl() { EnableCellEditControl(FALSE
); }
1129 bool CanEnableCellControl() const;
1130 bool IsCellEditControlEnabled() const;
1131 bool IsCellEditControlShown() const;
1133 bool IsCurrentCellReadOnly() const;
1135 void ShowCellEditControl();
1136 void HideCellEditControl();
1137 void SaveEditControlValue();
1140 // ------ grid location functions
1141 // Note that all of these functions work with the logical coordinates of
1142 // grid cells and labels so you will need to convert from device
1143 // coordinates for mouse events etc.
1145 void XYToCell( int x
, int y
, wxGridCellCoords
& );
1146 int YToRow( int y
);
1147 int XToCol( int x
);
1149 int YToEdgeOfRow( int y
);
1150 int XToEdgeOfCol( int x
);
1152 wxRect
CellToRect( int row
, int col
);
1153 wxRect
CellToRect( const wxGridCellCoords
& coords
)
1154 { return CellToRect( coords
.GetRow(), coords
.GetCol() ); }
1156 int GetGridCursorRow() { return m_currentCellCoords
.GetRow(); }
1157 int GetGridCursorCol() { return m_currentCellCoords
.GetCol(); }
1159 // check to see if a cell is either wholly visible (the default arg) or
1160 // at least partially visible in the grid window
1162 bool IsVisible( int row
, int col
, bool wholeCellVisible
= TRUE
);
1163 bool IsVisible( const wxGridCellCoords
& coords
, bool wholeCellVisible
= TRUE
)
1164 { return IsVisible( coords
.GetRow(), coords
.GetCol(), wholeCellVisible
); }
1165 void MakeCellVisible( int row
, int col
);
1166 void MakeCellVisible( const wxGridCellCoords
& coords
)
1167 { MakeCellVisible( coords
.GetRow(), coords
.GetCol() ); }
1170 // ------ grid cursor movement functions
1172 void SetGridCursor( int row
, int col
)
1173 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1175 bool MoveCursorUp( bool expandSelection
);
1176 bool MoveCursorDown( bool expandSelection
);
1177 bool MoveCursorLeft( bool expandSelection
);
1178 bool MoveCursorRight( bool expandSelection
);
1179 bool MovePageDown();
1181 bool MoveCursorUpBlock( bool expandSelection
);
1182 bool MoveCursorDownBlock( bool expandSelection
);
1183 bool MoveCursorLeftBlock( bool expandSelection
);
1184 bool MoveCursorRightBlock( bool expandSelection
);
1187 // ------ label and gridline formatting
1189 int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH
; }
1190 int GetRowLabelSize() { return m_rowLabelWidth
; }
1191 int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT
; }
1192 int GetColLabelSize() { return m_colLabelHeight
; }
1193 wxColour
GetLabelBackgroundColour() { return m_labelBackgroundColour
; }
1194 wxColour
GetLabelTextColour() { return m_labelTextColour
; }
1195 wxFont
GetLabelFont() { return m_labelFont
; }
1196 void GetRowLabelAlignment( int *horiz
, int *vert
);
1197 void GetColLabelAlignment( int *horiz
, int *vert
);
1198 wxString
GetRowLabelValue( int row
);
1199 wxString
GetColLabelValue( int col
);
1200 wxColour
GetGridLineColour() { return m_gridLineColour
; }
1201 wxColour
GetCellHighlightColour() { return m_cellHighlightColour
; }
1202 int GetCellHighlightPenWidth() { return m_cellHighlightPenWidth
; }
1203 int GetCellHighlightROPenWidth() { return m_cellHighlightROPenWidth
; }
1205 void SetRowLabelSize( int width
);
1206 void SetColLabelSize( int height
);
1207 void SetLabelBackgroundColour( const wxColour
& );
1208 void SetLabelTextColour( const wxColour
& );
1209 void SetLabelFont( const wxFont
& );
1210 void SetRowLabelAlignment( int horiz
, int vert
);
1211 void SetColLabelAlignment( int horiz
, int vert
);
1212 void SetRowLabelValue( int row
, const wxString
& );
1213 void SetColLabelValue( int col
, const wxString
& );
1214 void SetGridLineColour( const wxColour
& );
1215 void SetCellHighlightColour( const wxColour
& );
1216 void SetCellHighlightPenWidth(int width
);
1217 void SetCellHighlightROPenWidth(int width
);
1219 void EnableDragRowSize( bool enable
= TRUE
);
1220 void DisableDragRowSize() { EnableDragRowSize( FALSE
); }
1221 bool CanDragRowSize() { return m_canDragRowSize
; }
1222 void EnableDragColSize( bool enable
= TRUE
);
1223 void DisableDragColSize() { EnableDragColSize( FALSE
); }
1224 bool CanDragColSize() { return m_canDragColSize
; }
1225 void EnableDragGridSize(bool enable
= TRUE
);
1226 void DisableDragGridSize() { EnableDragGridSize(FALSE
); }
1227 bool CanDragGridSize() { return m_canDragGridSize
; }
1229 // this sets the specified attribute for all cells in this row/col
1230 void SetRowAttr(int row
, wxGridCellAttr
*attr
);
1231 void SetColAttr(int col
, wxGridCellAttr
*attr
);
1233 // shortcuts for setting the column parameters
1235 // set the format for the data in the column: default is string
1236 void SetColFormatBool(int col
);
1237 void SetColFormatNumber(int col
);
1238 void SetColFormatFloat(int col
, int width
= -1, int precision
= -1);
1239 void SetColFormatCustom(int col
, const wxString
& typeName
);
1241 void EnableGridLines( bool enable
= TRUE
);
1242 bool GridLinesEnabled() { return m_gridLinesEnabled
; }
1244 // ------ row and col formatting
1246 int GetDefaultRowSize();
1247 int GetRowSize( int row
);
1248 int GetDefaultColSize();
1249 int GetColSize( int col
);
1250 wxColour
GetDefaultCellBackgroundColour();
1251 wxColour
GetCellBackgroundColour( int row
, int col
);
1252 wxColour
GetDefaultCellTextColour();
1253 wxColour
GetCellTextColour( int row
, int col
);
1254 wxFont
GetDefaultCellFont();
1255 wxFont
GetCellFont( int row
, int col
);
1256 void GetDefaultCellAlignment( int *horiz
, int *vert
);
1257 void GetCellAlignment( int row
, int col
, int *horiz
, int *vert
);
1259 void SetDefaultRowSize( int height
, bool resizeExistingRows
= FALSE
);
1260 void SetRowSize( int row
, int height
);
1261 void SetDefaultColSize( int width
, bool resizeExistingCols
= FALSE
);
1263 void SetColSize( int col
, int width
);
1265 // automatically size the column or row to fit to its contents, if
1266 // setAsMin is TRUE, this optimal width will also be set as minimal width
1268 void AutoSizeColumn( int col
, bool setAsMin
= TRUE
)
1269 { AutoSizeColOrRow(col
, setAsMin
, TRUE
); }
1270 void AutoSizeRow( int row
, bool setAsMin
= TRUE
)
1271 { AutoSizeColOrRow(row
, setAsMin
, FALSE
); }
1273 // auto size all columns (very ineffective for big grids!)
1274 void AutoSizeColumns( bool setAsMin
= TRUE
)
1275 { (void)SetOrCalcColumnSizes(FALSE
, setAsMin
); }
1277 void AutoSizeRows( bool setAsMin
= TRUE
)
1278 { (void)SetOrCalcRowSizes(FALSE
, setAsMin
); }
1280 // auto size the grid, that is make the columns/rows of the "right" size
1281 // and also set the grid size to just fit its contents
1284 // column won't be resized to be lesser width - this must be called during
1285 // the grid creation because it won't resize the column if it's already
1286 // narrower than the minimal width
1287 void SetColMinimalWidth( int col
, int width
);
1288 void SetRowMinimalHeight( int row
, int width
);
1290 void SetDefaultCellBackgroundColour( const wxColour
& );
1291 void SetCellBackgroundColour( int row
, int col
, const wxColour
& );
1292 void SetDefaultCellTextColour( const wxColour
& );
1294 void SetCellTextColour( int row
, int col
, const wxColour
& );
1295 void SetDefaultCellFont( const wxFont
& );
1296 void SetCellFont( int row
, int col
, const wxFont
& );
1297 void SetDefaultCellAlignment( int horiz
, int vert
);
1298 void SetCellAlignment( int row
, int col
, int horiz
, int vert
);
1300 // takes ownership of the pointer
1301 void SetDefaultRenderer(wxGridCellRenderer
*renderer
);
1302 void SetCellRenderer(int row
, int col
, wxGridCellRenderer
*renderer
);
1303 wxGridCellRenderer
*GetDefaultRenderer() const;
1304 wxGridCellRenderer
* GetCellRenderer(int row
, int col
);
1306 // takes ownership of the pointer
1307 void SetDefaultEditor(wxGridCellEditor
*editor
);
1308 void SetCellEditor(int row
, int col
, wxGridCellEditor
*editor
);
1309 wxGridCellEditor
*GetDefaultEditor() const;
1310 wxGridCellEditor
* GetCellEditor(int row
, int col
);
1314 // ------ cell value accessors
1316 wxString
GetCellValue( int row
, int col
)
1320 return m_table
->GetValue( row
, col
);
1324 return wxEmptyString
;
1328 wxString
GetCellValue( const wxGridCellCoords
& coords
)
1329 { return GetCellValue( coords
.GetRow(), coords
.GetCol() ); }
1331 void SetCellValue( int row
, int col
, const wxString
& s
);
1332 void SetCellValue( const wxGridCellCoords
& coords
, const wxString
& s
)
1333 { SetCellValue( coords
.GetRow(), coords
.GetCol(), s
); }
1335 // returns TRUE if the cell can't be edited
1336 bool IsReadOnly(int row
, int col
) const;
1338 // make the cell editable/readonly
1339 void SetReadOnly(int row
, int col
, bool isReadOnly
= TRUE
);
1341 // ------ selections of blocks of cells
1343 void SelectRow( int row
, bool addToSelected
= FALSE
);
1344 void SelectCol( int col
, bool addToSelected
= FALSE
);
1346 void SelectBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
,
1347 bool addToSelected
= FALSE
);
1349 void SelectBlock( const wxGridCellCoords
& topLeft
,
1350 const wxGridCellCoords
& bottomRight
,
1351 bool addToSelected
= FALSE
)
1352 { SelectBlock( topLeft
.GetRow(), topLeft
.GetCol(),
1353 bottomRight
.GetRow(), bottomRight
.GetCol(),
1360 // ------ deselection
1362 void DeselectRow( int row
);
1363 void DeselectCol( int col
);
1364 void DeselectCell( int row
, int col
);
1366 void ClearSelection();
1368 bool IsInSelection( int row
, int col
);
1370 bool IsInSelection( const wxGridCellCoords
& coords
)
1371 { return IsInSelection( coords
.GetRow(), coords
.GetCol() ); }
1374 // This function returns the rectangle that encloses the block of cells
1375 // limited by TopLeft and BottomRight cell in device coords and clipped
1376 // to the client size of the grid window.
1378 wxRect
BlockToDeviceRect( const wxGridCellCoords
& topLeft
,
1379 const wxGridCellCoords
& bottomRight
);
1381 // Access or update the selection fore/back colours
1382 wxColour
GetSelectionBackground() const
1383 { return m_selectionBackground
; }
1384 wxColour
GetSelectionForeground() const
1385 { return m_selectionForeground
; }
1387 void SetSelectionBackground(const wxColour
& c
) { m_selectionBackground
= c
; }
1388 void SetSelectionForeground(const wxColour
& c
) { m_selectionForeground
= c
; }
1391 // Methods for a registry for mapping data types to Renderers/Editors
1392 void RegisterDataType(const wxString
& typeName
,
1393 wxGridCellRenderer
* renderer
,
1394 wxGridCellEditor
* editor
);
1395 wxGridCellEditor
* GetDefaultEditorForCell(int row
, int col
) const;
1396 wxGridCellEditor
* GetDefaultEditorForCell(const wxGridCellCoords
& c
) const
1397 { return GetDefaultEditorForCell(c
.GetRow(), c
.GetCol()); }
1398 wxGridCellRenderer
* GetDefaultRendererForCell(int row
, int col
) const;
1399 wxGridCellEditor
* GetDefaultEditorForType(const wxString
& typeName
) const;
1400 wxGridCellRenderer
* GetDefaultRendererForType(const wxString
& typeName
) const;
1402 // grid may occupy more space than needed for its rows/columns, this
1403 // function allows to set how big this extra space is
1404 void SetMargins(int extraWidth
, int extraHeight
)
1406 m_extraWidth
= extraWidth
;
1407 m_extraHeight
= extraHeight
;
1412 // Accessors for component windows
1413 wxWindow
* GetGridWindow() { return (wxWindow
*)m_gridWin
; }
1414 wxWindow
* GetGridRowLabelWindow() { return (wxWindow
*)m_rowLabelWin
; }
1415 wxWindow
* GetGridColLabelWindow() { return (wxWindow
*)m_colLabelWin
; }
1416 wxWindow
* GetGridCornerLabelWindow() { return (wxWindow
*)m_cornerLabelWin
; }
1420 // ------ For compatibility with previous wxGrid only...
1422 // ************************************************
1423 // ** Don't use these in new code because they **
1424 // ** are liable to disappear in a future **
1426 // ************************************************
1429 wxGrid( wxWindow
*parent
,
1430 int x
, int y
, int w
= -1, int h
= -1,
1431 long style
= wxWANTS_CHARS
,
1432 const wxString
& name
= wxPanelNameStr
)
1433 : wxScrolledWindow( parent
, -1, wxPoint(x
,y
), wxSize(w
,h
),
1434 (style
|wxWANTS_CHARS
), name
)
1439 void SetCellValue( const wxString
& val
, int row
, int col
)
1440 { SetCellValue( row
, col
, val
); }
1442 void UpdateDimensions()
1443 { CalcDimensions(); }
1445 int GetRows() { return GetNumberRows(); }
1446 int GetCols() { return GetNumberCols(); }
1447 int GetCursorRow() { return GetGridCursorRow(); }
1448 int GetCursorColumn() { return GetGridCursorCol(); }
1450 int GetScrollPosX() { return 0; }
1451 int GetScrollPosY() { return 0; }
1453 void SetScrollX( int WXUNUSED(x
) ) { }
1454 void SetScrollY( int WXUNUSED(y
) ) { }
1456 void SetColumnWidth( int col
, int width
)
1457 { SetColSize( col
, width
); }
1459 int GetColumnWidth( int col
)
1460 { return GetColSize( col
); }
1462 void SetRowHeight( int row
, int height
)
1463 { SetRowSize( row
, height
); }
1465 // GetRowHeight() is below
1467 int GetViewHeight() // returned num whole rows visible
1470 int GetViewWidth() // returned num whole cols visible
1473 void SetLabelSize( int orientation
, int sz
)
1475 if ( orientation
== wxHORIZONTAL
)
1476 SetColLabelSize( sz
);
1478 SetRowLabelSize( sz
);
1481 int GetLabelSize( int orientation
)
1483 if ( orientation
== wxHORIZONTAL
)
1484 return GetColLabelSize();
1486 return GetRowLabelSize();
1489 void SetLabelAlignment( int orientation
, int align
)
1491 if ( orientation
== wxHORIZONTAL
)
1492 SetColLabelAlignment( align
, -1 );
1494 SetRowLabelAlignment( align
, -1 );
1497 int GetLabelAlignment( int orientation
, int WXUNUSED(align
) )
1500 if ( orientation
== wxHORIZONTAL
)
1502 GetColLabelAlignment( &h
, &v
);
1507 GetRowLabelAlignment( &h
, &v
);
1512 void SetLabelValue( int orientation
, const wxString
& val
, int pos
)
1514 if ( orientation
== wxHORIZONTAL
)
1515 SetColLabelValue( pos
, val
);
1517 SetRowLabelValue( pos
, val
);
1520 wxString
GetLabelValue( int orientation
, int pos
)
1522 if ( orientation
== wxHORIZONTAL
)
1523 return GetColLabelValue( pos
);
1525 return GetRowLabelValue( pos
);
1528 wxFont
GetCellTextFont() const
1529 { return m_defaultCellAttr
->GetFont(); }
1531 wxFont
GetCellTextFont(int WXUNUSED(row
), int WXUNUSED(col
)) const
1532 { return m_defaultCellAttr
->GetFont(); }
1534 void SetCellTextFont(const wxFont
& fnt
)
1535 { SetDefaultCellFont( fnt
); }
1537 void SetCellTextFont(const wxFont
& fnt
, int row
, int col
)
1538 { SetCellFont( row
, col
, fnt
); }
1540 void SetCellTextColour(const wxColour
& val
, int row
, int col
)
1541 { SetCellTextColour( row
, col
, val
); }
1543 void SetCellTextColour(const wxColour
& col
)
1544 { SetDefaultCellTextColour( col
); }
1546 void SetCellBackgroundColour(const wxColour
& col
)
1547 { SetDefaultCellBackgroundColour( col
); }
1549 void SetCellBackgroundColour(const wxColour
& colour
, int row
, int col
)
1550 { SetCellBackgroundColour( row
, col
, colour
); }
1552 bool GetEditable() { return IsEditable(); }
1553 void SetEditable( bool edit
= TRUE
) { EnableEditing( edit
); }
1554 bool GetEditInPlace() { return IsCellEditControlEnabled(); }
1556 void SetEditInPlace(bool WXUNUSED(edit
) = TRUE
) { }
1558 void SetCellAlignment( int align
, int row
, int col
)
1559 { SetCellAlignment(row
, col
, align
, wxALIGN_CENTER
); }
1560 void SetCellAlignment( int WXUNUSED(align
) ) {}
1561 void SetCellBitmap(wxBitmap
*WXUNUSED(bitmap
), int WXUNUSED(row
), int WXUNUSED(col
))
1563 void SetDividerPen(const wxPen
& WXUNUSED(pen
)) { }
1564 wxPen
& GetDividerPen() const;
1565 void OnActivate(bool WXUNUSED(active
)) {}
1567 // ******** End of compatibility functions **********
1571 // ------ control IDs
1572 enum { wxGRID_CELLCTRL
= 2000,
1575 // ------ control types
1576 enum { wxGRID_TEXTCTRL
= 2100,
1581 // overridden wxWindow methods
1585 virtual wxSize
DoGetBestSize() const;
1589 wxGridWindow
*m_gridWin
;
1590 wxGridRowLabelWindow
*m_rowLabelWin
;
1591 wxGridColLabelWindow
*m_colLabelWin
;
1592 wxGridCornerLabelWindow
*m_cornerLabelWin
;
1594 wxGridTableBase
*m_table
;
1600 wxGridCellCoords m_currentCellCoords
;
1602 wxGridCellCoords m_selectingTopLeft
;
1603 wxGridCellCoords m_selectingBottomRight
;
1604 wxGridCellCoords m_selectingKeyboard
;
1605 wxGridSelection
*m_selection
;
1606 wxColour m_selectionBackground
;
1607 wxColour m_selectionForeground
;
1609 // NB: *never* access m_row/col arrays directly because they are created
1610 // on demand, *always* use accessor functions instead!
1612 // init the m_rowHeights/Bottoms arrays with default values
1613 void InitRowHeights();
1615 int m_defaultRowHeight
;
1616 wxArrayInt m_rowHeights
;
1617 wxArrayInt m_rowBottoms
;
1619 // init the m_colWidths/Rights arrays
1620 void InitColWidths();
1622 int m_defaultColWidth
;
1623 wxArrayInt m_colWidths
;
1624 wxArrayInt m_colRights
;
1626 // get the col/row coords
1627 int GetColWidth(int col
) const;
1628 int GetColLeft(int col
) const;
1629 int GetColRight(int col
) const;
1631 // this function must be public for compatibility...
1633 int GetRowHeight(int row
) const;
1636 int GetRowTop(int row
) const;
1637 int GetRowBottom(int row
) const;
1639 int m_rowLabelWidth
;
1640 int m_colLabelHeight
;
1642 // the size of the margin left to the right and bottom of the cell area
1646 wxColour m_labelBackgroundColour
;
1647 wxColour m_labelTextColour
;
1650 int m_rowLabelHorizAlign
;
1651 int m_rowLabelVertAlign
;
1652 int m_colLabelHorizAlign
;
1653 int m_colLabelVertAlign
;
1655 bool m_defaultRowLabelValues
;
1656 bool m_defaultColLabelValues
;
1658 wxColour m_gridLineColour
;
1659 bool m_gridLinesEnabled
;
1660 wxColour m_cellHighlightColour
;
1661 int m_cellHighlightPenWidth
;
1662 int m_cellHighlightROPenWidth
;
1665 // common part of AutoSizeColumn/Row() and GetBestSize()
1666 int SetOrCalcColumnSizes(bool calcOnly
, bool setAsMin
= TRUE
);
1667 int SetOrCalcRowSizes(bool calcOnly
, bool setAsMin
= TRUE
);
1669 // common part of AutoSizeColumn/Row()
1670 void AutoSizeColOrRow(int n
, bool setAsMin
, bool column
/* or row? */);
1672 // if a column has a minimal width, it will be the value for it in this
1674 wxHashTableLong m_colMinWidths
,
1677 // get the minimal width of the given column/row
1678 int GetColMinimalWidth(int col
) const;
1679 int GetRowMinimalHeight(int col
) const;
1681 // do we have some place to store attributes in?
1682 bool CanHaveAttributes();
1684 // returns the attribute we may modify in place: a new one if this cell
1685 // doesn't have any yet or the existing one if it does
1687 // DecRef() must be called on the returned pointer, as usual
1688 wxGridCellAttr
*GetOrCreateCellAttr(int row
, int col
) const;
1690 // cell attribute cache (currently we only cache 1, may be will do
1691 // more/better later)
1695 wxGridCellAttr
*attr
;
1698 // invalidates the attribute cache
1699 void ClearAttrCache();
1701 // adds an attribute to cache
1702 void CacheAttr(int row
, int col
, wxGridCellAttr
*attr
) const;
1704 // looks for an attr in cache, returns TRUE if found
1705 bool LookupAttr(int row
, int col
, wxGridCellAttr
**attr
) const;
1707 // looks for the attr in cache, if not found asks the table and caches the
1709 wxGridCellAttr
*GetCellAttr(int row
, int col
) const;
1710 wxGridCellAttr
*GetCellAttr(const wxGridCellCoords
& coords
)
1711 { return GetCellAttr( coords
.GetRow(), coords
.GetCol() ); }
1713 // the default cell attr object for cells that don't have their own
1714 wxGridCellAttr
* m_defaultCellAttr
;
1721 wxGridTypeRegistry
* m_typeRegistry
;
1725 WXGRID_CURSOR_SELECT_CELL
,
1726 WXGRID_CURSOR_RESIZE_ROW
,
1727 WXGRID_CURSOR_RESIZE_COL
,
1728 WXGRID_CURSOR_SELECT_ROW
,
1729 WXGRID_CURSOR_SELECT_COL
1732 // this method not only sets m_cursorMode but also sets the correct cursor
1733 // for the given mode and, if captureMouse is not FALSE releases the mouse
1734 // if it was captured and captures it if it must be captured
1736 // for this to work, you should always use it and not set m_cursorMode
1738 void ChangeCursorMode(CursorMode mode
,
1739 wxWindow
*win
= (wxWindow
*)NULL
,
1740 bool captureMouse
= TRUE
);
1742 wxWindow
*m_winCapture
; // the window which captured the mouse
1743 CursorMode m_cursorMode
;
1745 bool m_canDragRowSize
;
1746 bool m_canDragColSize
;
1747 bool m_canDragGridSize
;
1751 wxPoint m_startDragPos
;
1753 bool m_waitForSlowClick
;
1755 wxGridCellCoords m_selectionStart
;
1757 wxCursor m_rowResizeCursor
;
1758 wxCursor m_colResizeCursor
;
1760 bool m_editable
; // applies to whole grid
1761 bool m_cellEditCtrlEnabled
; // is in-place edit currently shown?
1766 void CalcDimensions();
1767 void CalcWindowSizes();
1768 bool Redimension( wxGridTableMessage
& );
1771 int SendEvent( const wxEventType
, int row
, int col
, wxMouseEvent
& );
1772 int SendEvent( const wxEventType
, int row
, int col
);
1773 int SendEvent( const wxEventType type
)
1775 return SendEvent(type
,
1776 m_currentCellCoords
.GetRow(),
1777 m_currentCellCoords
.GetCol());
1780 void OnPaint( wxPaintEvent
& );
1781 void OnSize( wxSizeEvent
& );
1782 void OnKeyDown( wxKeyEvent
& );
1783 void OnKeyUp( wxKeyEvent
& );
1784 void OnEraseBackground( wxEraseEvent
& );
1787 void SetCurrentCell( const wxGridCellCoords
& coords
);
1788 void SetCurrentCell( int row
, int col
)
1789 { SetCurrentCell( wxGridCellCoords(row
, col
) ); }
1791 void HighlightBlock( int topRow
, int leftCol
, int bottomRow
, int rightCol
);
1793 void HighlightBlock( const wxGridCellCoords
& topLeft
,
1794 const wxGridCellCoords
& bottomRight
)
1795 { HighlightBlock( topLeft
.GetRow(), topLeft
.GetCol(),
1796 bottomRight
.GetRow(), bottomRight
.GetCol() ); }
1798 // ------ functions to get/send data (see also public functions)
1800 bool GetModelValues();
1801 bool SetModelValues();
1803 friend class wxGridSelection
;
1805 DECLARE_DYNAMIC_CLASS( wxGrid
)
1806 DECLARE_EVENT_TABLE()
1809 // ----------------------------------------------------------------------------
1810 // Grid event class and event types
1811 // ----------------------------------------------------------------------------
1813 class WXDLLEXPORT wxGridEvent
: public wxNotifyEvent
1817 : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
1818 m_selecting(0), m_control(0), m_meta(0), m_shift(0), m_alt(0)
1822 wxGridEvent(int id
, wxEventType type
, wxObject
* obj
,
1823 int row
=-1, int col
=-1, int x
=-1, int y
=-1, bool sel
= TRUE
,
1824 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1826 virtual int GetRow() { return m_row
; }
1827 virtual int GetCol() { return m_col
; }
1828 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1829 bool Selecting() { return m_selecting
; }
1830 bool ControlDown() { return m_control
; }
1831 bool MetaDown() { return m_meta
; }
1832 bool ShiftDown() { return m_shift
; }
1833 bool AltDown() { return m_alt
; }
1846 DECLARE_DYNAMIC_CLASS(wxGridEvent
)
1849 class WXDLLEXPORT wxGridSizeEvent
: public wxNotifyEvent
1853 : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1),
1854 m_control(0), m_meta(0), m_shift(0), m_alt(0)
1858 wxGridSizeEvent(int id
, wxEventType type
, wxObject
* obj
,
1859 int rowOrCol
=-1, int x
=-1, int y
=-1,
1860 bool control
=FALSE
, bool shift
=FALSE
, bool alt
=FALSE
, bool meta
=FALSE
);
1862 int GetRowOrCol() { return m_rowOrCol
; }
1863 wxPoint
GetPosition() { return wxPoint( m_x
, m_y
); }
1864 bool ControlDown() { return m_control
; }
1865 bool MetaDown() { return m_meta
; }
1866 bool ShiftDown() { return m_shift
; }
1867 bool AltDown() { return m_alt
; }
1878 DECLARE_DYNAMIC_CLASS(wxGridSizeEvent
)
1882 class WXDLLEXPORT wxGridRangeSelectEvent
: public wxNotifyEvent
1885 wxGridRangeSelectEvent()
1888 m_topLeft
= wxGridNoCellCoords
;
1889 m_bottomRight
= wxGridNoCellCoords
;
1890 m_selecting
= FALSE
;
1897 wxGridRangeSelectEvent(int id
, wxEventType type
, wxObject
* obj
,
1898 const wxGridCellCoords
& topLeft
,
1899 const wxGridCellCoords
& bottomRight
,
1901 bool control
=FALSE
, bool shift
=FALSE
,
1902 bool alt
=FALSE
, bool meta
=FALSE
);
1904 wxGridCellCoords
GetTopLeftCoords() { return m_topLeft
; }
1905 wxGridCellCoords
GetBottomRightCoords() { return m_bottomRight
; }
1906 int GetTopRow() { return m_topLeft
.GetRow(); }
1907 int GetBottomRow() { return m_bottomRight
.GetRow(); }
1908 int GetLeftCol() { return m_topLeft
.GetCol(); }
1909 int GetRightCol() { return m_bottomRight
.GetCol(); }
1910 bool Selecting() { return m_selecting
; }
1911 bool ControlDown() { return m_control
; }
1912 bool MetaDown() { return m_meta
; }
1913 bool ShiftDown() { return m_shift
; }
1914 bool AltDown() { return m_alt
; }
1917 wxGridCellCoords m_topLeft
;
1918 wxGridCellCoords m_bottomRight
;
1925 DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent
)
1929 class WXDLLEXPORT wxGridEditorCreatedEvent
: public wxCommandEvent
{
1931 wxGridEditorCreatedEvent()
1939 wxGridEditorCreatedEvent(int id
, wxEventType type
, wxObject
* obj
,
1940 int row
, int col
, wxControl
* ctrl
);
1942 int GetRow() { return m_row
; }
1943 int GetCol() { return m_col
; }
1944 wxControl
* GetControl() { return m_ctrl
; }
1945 void SetRow(int row
) { m_row
= row
; }
1946 void SetCol(int col
) { m_col
= col
; }
1947 void SetControl(wxControl
* ctrl
) { m_ctrl
= ctrl
; }
1954 DECLARE_DYNAMIC_CLASS(wxGridEditorCreatedEvent
)
1958 BEGIN_DECLARE_EVENT_TYPES()
1959 DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_LEFT_CLICK
, 1580)
1960 DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_RIGHT_CLICK
, 1581)
1961 DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_LEFT_DCLICK
, 1582)
1962 DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_RIGHT_DCLICK
, 1583)
1963 DECLARE_EVENT_TYPE(wxEVT_GRID_LABEL_LEFT_CLICK
, 1584)
1964 DECLARE_EVENT_TYPE(wxEVT_GRID_LABEL_RIGHT_CLICK
, 1585)
1965 DECLARE_EVENT_TYPE(wxEVT_GRID_LABEL_LEFT_DCLICK
, 1586)
1966 DECLARE_EVENT_TYPE(wxEVT_GRID_LABEL_RIGHT_DCLICK
, 1587)
1967 DECLARE_EVENT_TYPE(wxEVT_GRID_ROW_SIZE
, 1588)
1968 DECLARE_EVENT_TYPE(wxEVT_GRID_COL_SIZE
, 1589)
1969 DECLARE_EVENT_TYPE(wxEVT_GRID_RANGE_SELECT
, 1590)
1970 DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_CHANGE
, 1591)
1971 DECLARE_EVENT_TYPE(wxEVT_GRID_SELECT_CELL
, 1592)
1972 DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_SHOWN
, 1593)
1973 DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_HIDDEN
, 1594)
1974 DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_CREATED
, 1595)
1975 END_DECLARE_EVENT_TYPES()
1978 typedef void (wxEvtHandler::*wxGridEventFunction
)(wxGridEvent
&);
1979 typedef void (wxEvtHandler::*wxGridSizeEventFunction
)(wxGridSizeEvent
&);
1980 typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction
)(wxGridRangeSelectEvent
&);
1981 typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction
)(wxGridEditorCreatedEvent
&);
1983 #define EVT_GRID_CELL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1984 #define EVT_GRID_CELL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1985 #define EVT_GRID_CELL_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1986 #define EVT_GRID_CELL_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1987 #define EVT_GRID_LABEL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1988 #define EVT_GRID_LABEL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1989 #define EVT_GRID_LABEL_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1990 #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1991 #define EVT_GRID_ROW_SIZE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL ),
1992 #define EVT_GRID_COL_SIZE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridSizeEventFunction) &fn, NULL ),
1993 #define EVT_GRID_RANGE_SELECT(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridRangeSelectEventFunction) &fn, NULL ),
1994 #define EVT_GRID_CELL_CHANGE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1995 #define EVT_GRID_SELECT_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1996 #define EVT_GRID_EDITOR_SHOWN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1997 #define EVT_GRID_EDITOR_HIDDEN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
1998 #define EVT_GRID_EDITOR_CREATED(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEditorCreatedEventFunction) &fn, NULL ),
2001 #if 0 // TODO: implement these ? others ?
2003 extern const int wxEVT_GRID_CREATE_CELL
;
2004 extern const int wxEVT_GRID_CHANGE_LABELS
;
2005 extern const int wxEVT_GRID_CHANGE_SEL_LABEL
;
2007 #define EVT_GRID_CREATE_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
2008 #define EVT_GRID_CHANGE_LABELS(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
2009 #define EVT_GRID_CHANGE_SEL_LABEL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
2013 #endif // #ifndef __WXGRID_H__
2015 #endif // ifndef wxUSE_NEW_GRID