]>
git.saurik.com Git - wxWidgets.git/blob - samples/newgrid/griddemo.h
d586e320f290b05760ef5e9245f0aa04b56f1516
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Grid control wxWindows sample
4 // Author: Michael Bedward
7 // Copyright: (c) Michael Bedward, Julian Smart
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
15 #if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
16 #error "This sample requires the new wxGrid class."
21 class GridApp
: public wxApp
28 class GridFrame
: public wxFrame
32 wxLogTextCtrl
*logger
;
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
& );
48 void SetCellFgColour(wxCommandEvent
&);
49 void SetCellBgColour(wxCommandEvent
&);
51 void InsertRow( wxCommandEvent
& );
52 void InsertCol( wxCommandEvent
& );
53 void DeleteSelectedRows( wxCommandEvent
& );
54 void DeleteSelectedCols( wxCommandEvent
& );
55 void ClearGrid( wxCommandEvent
& );
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
& );
65 void OnEditorShown(wxGridEvent
&);
66 void OnEditorHidden(wxGridEvent
&);
72 void OnQuit( wxCommandEvent
& );
73 void About( wxCommandEvent
& );
74 void OnVTable( wxCommandEvent
& );
75 void OnBugsTable( wxCommandEvent
& );
79 ID_TOGGLEROWLABELS
= 100,
83 ID_SETLABELTEXTCOLOUR
,
85 ID_ROWLABELHORIZALIGN
,
88 ID_COLLABELHORIZALIGN
,
96 ID_SET_CELL_FG_COLOUR
,
97 ID_SET_CELL_BG_COLOUR
,
105 DECLARE_EVENT_TABLE()
108 class MyGridCellRenderer
: public wxGridCellStringRenderer
111 virtual void Draw(wxGrid
& grid
,
112 wxGridCellAttr
& attr
,
119 // ----------------------------------------------------------------------------
120 // demonstration of virtual table which doesn't store all of its data in
122 // ----------------------------------------------------------------------------
124 class BigGridTable
: public wxGridTableBase
127 BigGridTable(long sizeGrid
) { m_sizeGrid
= sizeGrid
; }
129 long GetNumberRows() { return m_sizeGrid
; }
130 long GetNumberCols() { return m_sizeGrid
; }
132 wxString
GetValue( int row
, int col
)
134 return wxString::Format("(%d, %d)", row
, col
);
137 void SetValue( int , int , const wxString
& ) { /* ignore */ }
138 bool IsEmptyCell( int , int ) { return FALSE
; }
144 class BigGridFrame
: public wxFrame
147 BigGridFrame(long sizeGrid
);
151 BigGridTable
* m_table
;
154 // ----------------------------------------------------------------------------
155 // another, more realistic, grid example
156 // ----------------------------------------------------------------------------
158 class BugsGridFrame
: public wxFrame