1 ///////////////////////////////////////////////////////////////////////////
2 // Name: generic/gridctrl.h
3 // Purpose: wxGrid controls
4 // Author: Paul Gammans, Roger Gammans
8 // Copyright: (c) The Computer Surgery (paul@compsurg.co.uk)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_GRIDCTRL_H_
13 #define _WX_GENERIC_GRIDCTRL_H_
16 #pragma interface "gridctrl.h"
19 #if wxUSE_GRID || wxUSE_NEW_GRID
22 #include "wx/string.h"
23 #include "wx/datetime.h"
25 #define wxGRID_VALUE_CHOICEINT _T("choiceint")
26 #define wxGRID_VALUE_DATETIME _T("datetime")
28 // the default renderer for the cells containing Time and dates..
29 class WXDLLEXPORT wxGridCellDateTimeRenderer
: public wxGridCellStringRenderer
32 wxGridCellDateTimeRenderer(wxString outformat
= _T("%c"),
33 wxString informat
= _T("%c"));
35 // draw the string right aligned
36 virtual void Draw(wxGrid
& grid
,
43 virtual wxSize
GetBestSize(wxGrid
& grid
,
48 virtual wxGridCellRenderer
*Clone() const;
50 // parameters string format is "width[,precision]"
51 virtual void SetParameters(const wxString
& params
);
54 wxString
GetString(wxGrid
& grid
, int row
, int col
);
59 wxDateTime::TimeZone m_tz
;
63 // the default renderer for the cells containing Time and dates..
64 class WXDLLEXPORT wxGridCellEnumRenderer
: public wxGridCellStringRenderer
67 wxGridCellEnumRenderer( const wxString
& choices
= wxEmptyString
);
69 // draw the string right aligned
70 virtual void Draw(wxGrid
& grid
,
77 virtual wxSize
GetBestSize(wxGrid
& grid
,
82 virtual wxGridCellRenderer
*Clone() const;
84 // parameters string format is "item1[,item2[...,itemN]]"
85 virtual void SetParameters(const wxString
& params
);
88 wxString
GetString(wxGrid
& grid
, int row
, int col
);
90 wxArrayString m_choices
;
94 class WXDLLEXPORT wxGridCellEnumEditor
: public wxGridCellChoiceEditor
97 wxGridCellEnumEditor( const wxString
& choices
= wxEmptyString
);
98 virtual ~wxGridCellEnumEditor() {};
100 virtual wxGridCellEditor
* Clone() const;
102 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
103 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
110 class wxGridCellAutoWrapStringEditor
: public wxGridCellTextEditor
113 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
114 virtual void Create(wxWindow
* parent
,
116 wxEvtHandler
* evtHandler
);
118 virtual wxGridCellEditor
*Clone() const
119 { return new wxGridCellAutoWrapStringEditor
; }
122 class wxGridCellAutoWrapStringRenderer
: public wxGridCellStringRenderer
125 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
127 virtual void Draw(wxGrid
& grid
,
128 wxGridCellAttr
& attr
,
134 virtual wxSize
GetBestSize(wxGrid
& grid
,
135 wxGridCellAttr
& attr
,
139 virtual wxGridCellRenderer
*Clone() const
140 { return new wxGridCellAutoWrapStringRenderer
; }
143 wxArrayString
GetTextLines( wxGrid
& grid
,
145 wxGridCellAttr
& attr
,
151 #endif // #if wxUSE_GRID || wxUSE_NEW_GRID
153 #endif //_WX_GENERIC_GRIDCTRL_H_