]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridctrl.h
temporary fix the linking problem due to making GSocket::Detected_Read/Write() non...
[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 #include "wx/datetime.h"
25
26 // the default renderer for the cells containing Time and dates..
27 class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
28 {
29 public:
30 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
31 const wxString& informat = wxDefaultDateTimeFormat);
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(const 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 #endif // wxUSE_DATETIME
61
62 // the default renderer for the cells containing Time and dates..
63 class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
64 {
65 public:
66 wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
67
68 // draw the string right aligned
69 virtual void Draw(wxGrid& grid,
70 wxGridCellAttr& attr,
71 wxDC& dc,
72 const wxRect& rect,
73 int row, int col,
74 bool isSelected);
75
76 virtual wxSize GetBestSize(wxGrid& grid,
77 wxGridCellAttr& attr,
78 wxDC& dc,
79 int row, int col);
80
81 virtual wxGridCellRenderer *Clone() const;
82
83 // parameters string format is "item1[,item2[...,itemN]]"
84 virtual void SetParameters(const wxString& params);
85
86 protected:
87 wxString GetString(const wxGrid& grid, int row, int col);
88
89 wxArrayString m_choices;
90 };
91
92
93 #if wxUSE_COMBOBOX
94
95 class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
96 {
97 public:
98 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
99 virtual ~wxGridCellEnumEditor() {}
100
101 virtual wxGridCellEditor* Clone() const;
102
103 virtual bool EndEdit(int row, int col, wxGrid* grid);
104 virtual void BeginEdit(int row, int col, wxGrid* grid);
105
106 private:
107 long int m_startint;
108
109 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
110 };
111
112 #endif // wxUSE_COMBOBOX
113
114 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
115 {
116 public:
117 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
118 virtual void Create(wxWindow* parent,
119 wxWindowID id,
120 wxEvtHandler* evtHandler);
121
122 virtual wxGridCellEditor *Clone() const
123 { return new wxGridCellAutoWrapStringEditor; }
124
125 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
126 };
127
128 class WXDLLIMPEXP_ADV 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 const wxGridCellAttr& attr,
152 const wxRect& rect,
153 int row, int col);
154
155 };
156
157 #endif // wxUSE_GRID
158 #endif // _WX_GENERIC_GRIDCTRL_H_