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