]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridctrl.h
use slashes instead of backslashes and quotes instead of angle brackets in all #includes
[wxWidgets.git] / include / wx / generic / gridctrl.h
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)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GENERIC_GRIDCTRL_H_
13 #define _WX_GENERIC_GRIDCTRL_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "gridctrl.h"
17 #endif
18
19 #if wxUSE_GRID
20
21 #include "wx/grid.h"
22 #include "wx/string.h"
23 #include "wx/arrstr.h"
24 #include "wx/datetime.h"
25
26 #define wxGRID_VALUE_CHOICEINT _T("choiceint")
27 #define wxGRID_VALUE_DATETIME _T("datetime")
28
29 #if wxUSE_DATETIME
30
31 // the default renderer for the cells containing Time and dates..
32 class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
33 {
34 public:
35 wxGridCellDateTimeRenderer(wxString outformat = _T("%c"),
36 wxString informat = _T("%c"));
37
38 // draw the string right aligned
39 virtual void Draw(wxGrid& grid,
40 wxGridCellAttr& attr,
41 wxDC& dc,
42 const wxRect& rect,
43 int row, int col,
44 bool isSelected);
45
46 virtual wxSize GetBestSize(wxGrid& grid,
47 wxGridCellAttr& attr,
48 wxDC& dc,
49 int row, int col);
50
51 virtual wxGridCellRenderer *Clone() const;
52
53 // parameters string format is "width[,precision]"
54 virtual void SetParameters(const wxString& params);
55
56 protected:
57 wxString GetString(wxGrid& grid, int row, int col);
58
59 wxString m_iformat;
60 wxString m_oformat;
61 wxDateTime m_dateDef;
62 wxDateTime::TimeZone m_tz;
63 };
64
65 #endif // wxUSE_DATETIME
66
67 // the default renderer for the cells containing Time and dates..
68 class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
69 {
70 public:
71 wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
72
73 // draw the string right aligned
74 virtual void Draw(wxGrid& grid,
75 wxGridCellAttr& attr,
76 wxDC& dc,
77 const wxRect& rect,
78 int row, int col,
79 bool isSelected);
80
81 virtual wxSize GetBestSize(wxGrid& grid,
82 wxGridCellAttr& attr,
83 wxDC& dc,
84 int row, int col);
85
86 virtual wxGridCellRenderer *Clone() const;
87
88 // parameters string format is "item1[,item2[...,itemN]]"
89 virtual void SetParameters(const wxString& params);
90
91 protected:
92 wxString GetString(wxGrid& grid, int row, int col);
93
94 wxArrayString m_choices;
95 };
96
97
98 #if wxUSE_COMBOBOX
99
100 class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
101 {
102 public:
103 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
104 virtual ~wxGridCellEnumEditor() {}
105
106 virtual wxGridCellEditor* Clone() const;
107
108 virtual bool EndEdit(int row, int col, wxGrid* grid);
109 virtual void BeginEdit(int row, int col, wxGrid* grid);
110
111 private:
112 long int m_startint;
113
114 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
115 };
116
117 #endif // wxUSE_COMBOBOX
118
119 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
120 {
121 public:
122 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
123 virtual void Create(wxWindow* parent,
124 wxWindowID id,
125 wxEvtHandler* evtHandler);
126
127 virtual wxGridCellEditor *Clone() const
128 { return new wxGridCellAutoWrapStringEditor; }
129
130 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
131 };
132
133 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
134 {
135 public:
136 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
137
138 virtual void Draw(wxGrid& grid,
139 wxGridCellAttr& attr,
140 wxDC& dc,
141 const wxRect& rect,
142 int row, int col,
143 bool isSelected);
144
145 virtual wxSize GetBestSize(wxGrid& grid,
146 wxGridCellAttr& attr,
147 wxDC& dc,
148 int row, int col);
149
150 virtual wxGridCellRenderer *Clone() const
151 { return new wxGridCellAutoWrapStringRenderer; }
152
153 private:
154 wxArrayString GetTextLines( wxGrid& grid,
155 wxDC& dc,
156 wxGridCellAttr& attr,
157 const wxRect& rect,
158 int row, int col);
159
160 };
161
162 #endif // #if wxUSE_GRID
163
164 #endif //_WX_GENERIC_GRIDCTRL_H_
165