]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridctrl.h
extract setting max length in wxGridCellTextEditor::DoCreate() and call it from wxGri...
[wxWidgets.git] / include / wx / generic / gridctrl.h
CommitLineData
d10f4bf9
VZ
1///////////////////////////////////////////////////////////////////////////
2// Name: generic/gridctrl.h
3// Purpose: wxGrid controls
4// Author: Paul Gammans, Roger Gammans
5// Modified by:
6// Created: 11/04/2001
7// RCS-ID: $Id$
8// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk)
65571936 9// Licence: wxWindows licence
d10f4bf9
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_GRIDCTRL_H_
13#define _WX_GENERIC_GRIDCTRL_H_
14
d10f4bf9 15#include "wx/grid.h"
df9fac6d
PC
16
17#if wxUSE_GRID
d10f4bf9
VZ
18
19#define wxGRID_VALUE_CHOICEINT _T("choiceint")
20#define wxGRID_VALUE_DATETIME _T("datetime")
21
e2b87f38
VZ
22#if wxUSE_DATETIME
23
d10f4bf9 24// the default renderer for the cells containing Time and dates..
12f190b0 25class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
26{
27public:
fbfb8bcc
VZ
28 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
29 const wxString& informat = wxDefaultDateTimeFormat);
d10f4bf9
VZ
30
31 // draw the string right aligned
32 virtual void Draw(wxGrid& grid,
33 wxGridCellAttr& attr,
34 wxDC& dc,
35 const wxRect& rect,
36 int row, int col,
37 bool isSelected);
38
39 virtual wxSize GetBestSize(wxGrid& grid,
40 wxGridCellAttr& attr,
41 wxDC& dc,
42 int row, int col);
43
44 virtual wxGridCellRenderer *Clone() const;
45
46 // parameters string format is "width[,precision]"
47 virtual void SetParameters(const wxString& params);
48
49protected:
fbfb8bcc 50 wxString GetString(const wxGrid& grid, int row, int col);
d10f4bf9
VZ
51
52 wxString m_iformat;
53 wxString m_oformat;
54 wxDateTime m_dateDef;
55 wxDateTime::TimeZone m_tz;
56};
57
e2b87f38 58#endif // wxUSE_DATETIME
d10f4bf9
VZ
59
60// the default renderer for the cells containing Time and dates..
12f190b0 61class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
62{
63public:
64 wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
65
66 // draw the string right aligned
67 virtual void Draw(wxGrid& grid,
68 wxGridCellAttr& attr,
69 wxDC& dc,
70 const wxRect& rect,
71 int row, int col,
72 bool isSelected);
73
74 virtual wxSize GetBestSize(wxGrid& grid,
75 wxGridCellAttr& attr,
76 wxDC& dc,
77 int row, int col);
78
79 virtual wxGridCellRenderer *Clone() const;
80
81 // parameters string format is "item1[,item2[...,itemN]]"
82 virtual void SetParameters(const wxString& params);
83
84protected:
fbfb8bcc 85 wxString GetString(const wxGrid& grid, int row, int col);
d10f4bf9
VZ
86
87 wxArrayString m_choices;
88};
89
90
3379ed37
VZ
91#if wxUSE_COMBOBOX
92
12f190b0 93class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
d10f4bf9
VZ
94{
95public:
96 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
6fb99eb3 97 virtual ~wxGridCellEnumEditor() {}
d10f4bf9
VZ
98
99 virtual wxGridCellEditor* Clone() const;
100
101 virtual bool EndEdit(int row, int col, wxGrid* grid);
102 virtual void BeginEdit(int row, int col, wxGrid* grid);
103
104private:
105 long int m_startint;
fc7a2a60
VZ
106
107 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
d10f4bf9
VZ
108};
109
3379ed37 110#endif // wxUSE_COMBOBOX
d10f4bf9 111
12f190b0 112class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
d10f4bf9
VZ
113{
114public:
115 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
116 virtual void Create(wxWindow* parent,
117 wxWindowID id,
118 wxEvtHandler* evtHandler);
119
120 virtual wxGridCellEditor *Clone() const
121 { return new wxGridCellAutoWrapStringEditor; }
fc7a2a60
VZ
122
123 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
d10f4bf9
VZ
124};
125
12f190b0 126class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
127{
128public:
129 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
130
131 virtual void Draw(wxGrid& grid,
132 wxGridCellAttr& attr,
133 wxDC& dc,
134 const wxRect& rect,
135 int row, int col,
136 bool isSelected);
137
138 virtual wxSize GetBestSize(wxGrid& grid,
139 wxGridCellAttr& attr,
140 wxDC& dc,
141 int row, int col);
142
143 virtual wxGridCellRenderer *Clone() const
144 { return new wxGridCellAutoWrapStringRenderer; }
145
146private:
147 wxArrayString GetTextLines( wxGrid& grid,
148 wxDC& dc,
fbfb8bcc 149 const wxGridCellAttr& attr,
d10f4bf9
VZ
150 const wxRect& rect,
151 int row, int col);
152
153};
154
df9fac6d
PC
155#endif // wxUSE_GRID
156#endif // _WX_GENERIC_GRIDCTRL_H_