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(NO_GCC_PRAGMA)
16 #pragma interface "gridctrl.h"
22 #include "wx/string.h"
23 #include "wx/arrstr.h"
24 #include "wx/datetime.h"
26 #define wxGRID_VALUE_CHOICEINT _T("choiceint")
27 #define wxGRID_VALUE_DATETIME _T("datetime")
31 // the default renderer for the cells containing Time and dates..
32 class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer
: public wxGridCellStringRenderer
35 wxGridCellDateTimeRenderer(wxString outformat
= _T("%c"),
36 wxString informat
= _T("%c"));
38 // draw the string right aligned
39 virtual void Draw(wxGrid
& grid
,
46 virtual wxSize
GetBestSize(wxGrid
& grid
,
51 virtual wxGridCellRenderer
*Clone() const;
53 // parameters string format is "width[,precision]"
54 virtual void SetParameters(const wxString
& params
);
57 wxString
GetString(wxGrid
& grid
, int row
, int col
);
62 wxDateTime::TimeZone m_tz
;
65 #endif // wxUSE_DATETIME
67 // the default renderer for the cells containing Time and dates..
68 class WXDLLIMPEXP_ADV wxGridCellEnumRenderer
: public wxGridCellStringRenderer
71 wxGridCellEnumRenderer( const wxString
& choices
= wxEmptyString
);
73 // draw the string right aligned
74 virtual void Draw(wxGrid
& grid
,
81 virtual wxSize
GetBestSize(wxGrid
& grid
,
86 virtual wxGridCellRenderer
*Clone() const;
88 // parameters string format is "item1[,item2[...,itemN]]"
89 virtual void SetParameters(const wxString
& params
);
92 wxString
GetString(wxGrid
& grid
, int row
, int col
);
94 wxArrayString m_choices
;
100 class WXDLLIMPEXP_ADV wxGridCellEnumEditor
: public wxGridCellChoiceEditor
103 wxGridCellEnumEditor( const wxString
& choices
= wxEmptyString
);
104 virtual ~wxGridCellEnumEditor() {}
106 virtual wxGridCellEditor
* Clone() const;
108 virtual bool EndEdit(int row
, int col
, wxGrid
* grid
);
109 virtual void BeginEdit(int row
, int col
, wxGrid
* grid
);
114 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor
)
117 #endif // wxUSE_COMBOBOX
119 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor
: public wxGridCellTextEditor
122 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
123 virtual void Create(wxWindow
* parent
,
125 wxEvtHandler
* evtHandler
);
127 virtual wxGridCellEditor
*Clone() const
128 { return new wxGridCellAutoWrapStringEditor
; }
130 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor
)
133 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer
: public wxGridCellStringRenderer
136 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
138 virtual void Draw(wxGrid
& grid
,
139 wxGridCellAttr
& attr
,
145 virtual wxSize
GetBestSize(wxGrid
& grid
,
146 wxGridCellAttr
& attr
,
150 virtual wxGridCellRenderer
*Clone() const
151 { return new wxGridCellAutoWrapStringRenderer
; }
154 wxArrayString
GetTextLines( wxGrid
& grid
,
156 wxGridCellAttr
& attr
,
162 #endif // #if wxUSE_GRID
164 #endif //_WX_GENERIC_GRIDCTRL_H_