]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridctrl.h
Finally fixed control scrolling
[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 #include "wx/grid.h"
16
17 #if wxUSE_GRID
18
19 #define wxGRID_VALUE_CHOICEINT _T("choiceint")
20 #define wxGRID_VALUE_DATETIME _T("datetime")
21
22 #if wxUSE_DATETIME
23
24 // the default renderer for the cells containing Time and dates..
25 class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
26 {
27 public:
28 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
29 const wxString& informat = wxDefaultDateTimeFormat);
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
49 protected:
50 wxString GetString(const wxGrid& grid, int row, int col);
51
52 wxString m_iformat;
53 wxString m_oformat;
54 wxDateTime m_dateDef;
55 wxDateTime::TimeZone m_tz;
56 };
57
58 #endif // wxUSE_DATETIME
59
60 // the default renderer for the cells containing Time and dates..
61 class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
62 {
63 public:
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
84 protected:
85 wxString GetString(const wxGrid& grid, int row, int col);
86
87 wxArrayString m_choices;
88 };
89
90
91 #if wxUSE_COMBOBOX
92
93 class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
94 {
95 public:
96 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
97 virtual ~wxGridCellEnumEditor() {}
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
104 private:
105 long int m_startint;
106
107 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
108 };
109
110 #endif // wxUSE_COMBOBOX
111
112 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
113 {
114 public:
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; }
122
123 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
124 };
125
126 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
127 {
128 public:
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
146 private:
147 wxArrayString GetTextLines( wxGrid& grid,
148 wxDC& dc,
149 const wxGridCellAttr& attr,
150 const wxRect& rect,
151 int row, int col);
152
153 };
154
155 #endif // wxUSE_GRID
156 #endif // _WX_GENERIC_GRIDCTRL_H_