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