]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridctrl.h
Added project files for wxUniv under MSW
[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
15#ifdef __GNUG__
16 #pragma interface "gridctrl.h"
17#endif
18
b53dc7d6
GT
19#if wxUSE_GRID || wxUSE_NEW_GRID
20
d10f4bf9
VZ
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..
29class WXDLLEXPORT wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
30{
31public:
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
53protected:
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..
64class WXDLLEXPORT wxGridCellEnumRenderer : public wxGridCellStringRenderer
65{
66public:
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
87protected:
88 wxString GetString(wxGrid& grid, int row, int col);
89
90 wxArrayString m_choices;
91};
92
93
94class WXDLLEXPORT wxGridCellEnumEditor : public wxGridCellChoiceEditor
95{
96public:
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
105private:
106 long int m_startint;
107};
108
109
110class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
111{
112public:
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
122class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
123{
124public:
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
142private:
143 wxArrayString GetTextLines( wxGrid& grid,
144 wxDC& dc,
145 wxGridCellAttr& attr,
146 const wxRect& rect,
147 int row, int col);
148
149};
150
b53dc7d6
GT
151#endif // #if wxUSE_GRID || wxUSE_NEW_GRID
152
d10f4bf9
VZ
153#endif //_WX_GENERIC_GRIDCTRL_H_
154