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_
15 #if defined(__GNUG__) && !defined(__APPLE__)
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
;
96 class WXDLLEXPORT 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
);
111 #endif // wxUSE_COMBOBOX
113 class WXDLLEXPORT wxGridCellAutoWrapStringEditor
: public wxGridCellTextEditor
116 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
117 virtual void Create(wxWindow
* parent
,
119 wxEvtHandler
* evtHandler
);
121 virtual wxGridCellEditor
*Clone() const
122 { return new wxGridCellAutoWrapStringEditor
; }
125 class WXDLLEXPORT wxGridCellAutoWrapStringRenderer
: public wxGridCellStringRenderer
128 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
130 virtual void Draw(wxGrid
& grid
,
131 wxGridCellAttr
& attr
,
137 virtual wxSize
GetBestSize(wxGrid
& grid
,
138 wxGridCellAttr
& attr
,
142 virtual wxGridCellRenderer
*Clone() const
143 { return new wxGridCellAutoWrapStringRenderer
; }
146 wxArrayString
GetTextLines( wxGrid
& grid
,
148 wxGridCellAttr
& attr
,
154 #endif // #if wxUSE_GRID || wxUSE_NEW_GRID
156 #endif //_WX_GENERIC_GRIDCTRL_H_