]> git.saurik.com Git - wxWidgets.git/blob - samples/newgrid/griddemo.h
added wxGridCellRenderer
[wxWidgets.git] / samples / newgrid / griddemo.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: griddemo.h
3 // Purpose: Grid control wxWindows sample
4 // Author: Michael Bedward
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Michael Bedward, Julian Smart
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
10
11
12 #ifndef griddemo_h
13 #define griddemo_h
14
15 #if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
16 #error "This sample requires the new wxGrid class."
17 #endif
18
19 class wxGrid;
20
21 class GridApp : public wxApp
22 {
23 public:
24 bool OnInit();
25 };
26
27
28 class GridFrame : public wxFrame
29 {
30 wxGrid *grid;
31 wxTextCtrl *logWin;
32 wxLogTextCtrl *logger;
33 wxString logBuf;
34
35 void SetDefaults();
36
37 void ToggleRowLabels( wxCommandEvent& );
38 void ToggleColLabels( wxCommandEvent& );
39 void ToggleEditing( wxCommandEvent& );
40 void SetLabelColour( wxCommandEvent& );
41 void SetLabelTextColour( wxCommandEvent& );
42 void SetRowLabelHorizAlignment( wxCommandEvent& );
43 void SetRowLabelVertAlignment( wxCommandEvent& );
44 void SetColLabelHorizAlignment( wxCommandEvent& );
45 void SetColLabelVertAlignment( wxCommandEvent& );
46 void SetGridLineColour( wxCommandEvent& );
47
48 void SetCellFgColour(wxCommandEvent &);
49 void SetCellBgColour(wxCommandEvent &);
50
51 void InsertRow( wxCommandEvent& );
52 void InsertCol( wxCommandEvent& );
53 void DeleteSelectedRows( wxCommandEvent& );
54 void DeleteSelectedCols( wxCommandEvent& );
55 void ClearGrid( wxCommandEvent& );
56
57 void OnLabelLeftClick( wxGridEvent& );
58 void OnCellLeftClick( wxGridEvent& );
59 void OnRowSize( wxGridSizeEvent& );
60 void OnColSize( wxGridSizeEvent& );
61 void OnSelectCell( wxGridEvent& );
62 void OnRangeSelected( wxGridRangeSelectEvent& );
63 void OnCellValueChanged( wxGridEvent& );
64
65 public:
66 GridFrame();
67 ~GridFrame();
68
69 void OnQuit( wxCommandEvent& );
70 void About( wxCommandEvent& );
71
72 enum
73 {
74 ID_TOGGLEROWLABELS = 100,
75 ID_TOGGLECOLLABELS,
76 ID_TOGGLEEDIT,
77 ID_SETLABELCOLOUR,
78 ID_SETLABELTEXTCOLOUR,
79 ID_ROWLABELALIGN,
80 ID_ROWLABELHORIZALIGN,
81 ID_ROWLABELVERTALIGN,
82 ID_COLLABELALIGN,
83 ID_COLLABELHORIZALIGN,
84 ID_COLLABELVERTALIGN,
85 ID_GRIDLINECOLOUR,
86 ID_INSERTROW,
87 ID_INSERTCOL,
88 ID_DELETEROW,
89 ID_DELETECOL,
90 ID_CLEARGRID,
91 ID_SET_CELL_FG_COLOUR,
92 ID_SET_CELL_BG_COLOUR,
93 ID_ABOUT,
94
95 ID_TESTFUNC
96 };
97
98 DECLARE_EVENT_TABLE()
99 };
100
101 class MyGridCellRenderer : public wxGridCellStringRenderer
102 {
103 public:
104 virtual void Draw(wxGrid& grid,
105 wxDC& dc,
106 const wxRect& rect,
107 int row, int col,
108 bool isSelected);
109 };
110
111 #endif
112