]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridctrl.h
disable toggle button under Mac OS X (not yet implemented)
[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 class WXDLLEXPORT wxGridCellEnumEditor : public wxGridCellChoiceEditor
95 {
96 public:
97 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
98 virtual ~wxGridCellEnumEditor() {};
99
100 virtual wxGridCellEditor* Clone() const;
101
102 virtual bool EndEdit(int row, int col, wxGrid* grid);
103 virtual void BeginEdit(int row, int col, wxGrid* grid);
104
105 private:
106 long int m_startint;
107 };
108
109
110 class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
111 {
112 public:
113 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
114 virtual void Create(wxWindow* parent,
115 wxWindowID id,
116 wxEvtHandler* evtHandler);
117
118 virtual wxGridCellEditor *Clone() const
119 { return new wxGridCellAutoWrapStringEditor; }
120 };
121
122 class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
123 {
124 public:
125 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
126
127 virtual void Draw(wxGrid& grid,
128 wxGridCellAttr& attr,
129 wxDC& dc,
130 const wxRect& rect,
131 int row, int col,
132 bool isSelected);
133
134 virtual wxSize GetBestSize(wxGrid& grid,
135 wxGridCellAttr& attr,
136 wxDC& dc,
137 int row, int col);
138
139 virtual wxGridCellRenderer *Clone() const
140 { return new wxGridCellAutoWrapStringRenderer; }
141
142 private:
143 wxArrayString GetTextLines( wxGrid& grid,
144 wxDC& dc,
145 wxGridCellAttr& attr,
146 const wxRect& rect,
147 int row, int col);
148
149 };
150
151 #endif // #if wxUSE_GRID || wxUSE_NEW_GRID
152
153 #endif //_WX_GENERIC_GRIDCTRL_H_
154