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