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_
18 #include "wx/string.h"
19 #include "wx/arrstr.h"
20 #include "wx/datetime.h"
22 #define wxGRID_VALUE_CHOICEINT _T("choiceint")
23 #define wxGRID_VALUE_DATETIME _T("datetime")
27 // the default renderer for the cells containing Time and dates..
28 class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer
: public wxGridCellStringRenderer
31 wxGridCellDateTimeRenderer(const wxString
& outformat
= wxDefaultDateTimeFormat
,
32 const wxString
& informat
= wxDefaultDateTimeFormat
);
34 // draw the string right aligned
35 virtual void Draw(wxGrid
& grid
,
42 virtual wxSize
GetBestSize(wxGrid
& grid
,
47 virtual wxGridCellRenderer
*Clone() const;
49 // parameters string format is "width[,precision]"
50 virtual void SetParameters(const wxString
& params
);
53 wxString
GetString(const wxGrid
& grid
, int row
, int col
);
58 wxDateTime::TimeZone m_tz
;
61 #endif // wxUSE_DATETIME
63 // the default renderer for the cells containing Time and dates..
64 class WXDLLIMPEXP_ADV 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(const wxGrid
& grid
, int row
, int col
);
90 wxArrayString m_choices
;
96 class WXDLLIMPEXP_ADV wxGridCellEnumEditor
: public wxGridCellChoiceEditor
99 wxGridCellEnumEditor( const wxString
& choices
= wxEmptyString
);
100 virtual ~wxGridCellEnumEditor() {}
102 virtual wxGridCellEditor
* Clone() const;
104 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
105 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
110 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor
)
113 #endif // wxUSE_COMBOBOX
115 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor
: public wxGridCellTextEditor
118 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
119 virtual void Create(wxWindow
* parent
,
121 wxEvtHandler
* evtHandler
);
123 virtual wxGridCellEditor
*Clone() const
124 { return new wxGridCellAutoWrapStringEditor
; }
126 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor
)
129 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer
: public wxGridCellStringRenderer
132 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
134 virtual void Draw(wxGrid
& grid
,
135 wxGridCellAttr
& attr
,
141 virtual wxSize
GetBestSize(wxGrid
& grid
,
142 wxGridCellAttr
& attr
,
146 virtual wxGridCellRenderer
*Clone() const
147 { return new wxGridCellAutoWrapStringRenderer
; }
150 wxArrayString
GetTextLines( wxGrid
& grid
,
152 const wxGridCellAttr
& attr
,
158 #endif // #if wxUSE_GRID
160 #endif //_WX_GENERIC_GRIDCTRL_H_