]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridctrl.h
Last part from weak ref patch for event sink disconnection
[wxWidgets.git] / include / wx / generic / gridctrl.h
CommitLineData
d10f4bf9
VZ
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)
65571936 9// Licence: wxWindows licence
d10f4bf9
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_GRIDCTRL_H_
13#define _WX_GENERIC_GRIDCTRL_H_
14
d10f4bf9 15#include "wx/grid.h"
df9fac6d
PC
16
17#if wxUSE_GRID
d10f4bf9
VZ
18
19#define wxGRID_VALUE_CHOICEINT _T("choiceint")
20#define wxGRID_VALUE_DATETIME _T("datetime")
21
e2b87f38 22#if wxUSE_DATETIME
6d7aee4f
VZ
23
24#include "wx/datetime.h"
e2b87f38 25
d10f4bf9 26// the default renderer for the cells containing Time and dates..
12f190b0 27class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
28{
29public:
fbfb8bcc
VZ
30 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
31 const wxString& informat = wxDefaultDateTimeFormat);
d10f4bf9
VZ
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
51protected:
fbfb8bcc 52 wxString GetString(const wxGrid& grid, int row, int col);
d10f4bf9
VZ
53
54 wxString m_iformat;
55 wxString m_oformat;
56 wxDateTime m_dateDef;
57 wxDateTime::TimeZone m_tz;
58};
59
e2b87f38 60#endif // wxUSE_DATETIME
d10f4bf9
VZ
61
62// the default renderer for the cells containing Time and dates..
12f190b0 63class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
64{
65public:
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
86protected:
fbfb8bcc 87 wxString GetString(const wxGrid& grid, int row, int col);
d10f4bf9
VZ
88
89 wxArrayString m_choices;
90};
91
92
3379ed37
VZ
93#if wxUSE_COMBOBOX
94
12f190b0 95class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
d10f4bf9
VZ
96{
97public:
98 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
6fb99eb3 99 virtual ~wxGridCellEnumEditor() {}
d10f4bf9
VZ
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
106private:
107 long int m_startint;
fc7a2a60
VZ
108
109 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
d10f4bf9
VZ
110};
111
3379ed37 112#endif // wxUSE_COMBOBOX
d10f4bf9 113
12f190b0 114class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
d10f4bf9
VZ
115{
116public:
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; }
fc7a2a60
VZ
124
125 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
d10f4bf9
VZ
126};
127
12f190b0 128class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
129{
130public:
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
148private:
149 wxArrayString GetTextLines( wxGrid& grid,
150 wxDC& dc,
fbfb8bcc 151 const wxGridCellAttr& attr,
d10f4bf9
VZ
152 const wxRect& rect,
153 int row, int col);
154
155};
156
df9fac6d
PC
157#endif // wxUSE_GRID
158#endif // _WX_GENERIC_GRIDCTRL_H_