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