Makes custom cell activatable.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37735 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-02-26 01:51:28 +00:00
parent 1272e71b8a
commit 553f7d8f56
4 changed files with 110 additions and 45 deletions

View File

@@ -115,7 +115,7 @@ class MyCustomCell: public wxDataViewCustomCell
{
public:
MyCustomCell() :
wxDataViewCustomCell( wxT("string"), wxDATAVIEW_CELL_INERT )
wxDataViewCustomCell( wxT("string"), wxDATAVIEW_CELL_ACTIVATABLE )
{
m_colour = wxT("black");
}
@@ -140,6 +140,11 @@ public:
{
return wxSize(20,8);
}
bool Activate( wxRect rect )
{
wxPrintf( wxT("activate\n") );
return false;
}
private:
wxString m_colour;
@@ -231,7 +236,7 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
dataview_left->AppendTextColumn( wxT("first"), 0 );
dataview_left->AppendTextColumn( wxT("second"), 1 );
wxDataViewTextCell *text_cell = new wxDataViewTextCell( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
wxDataViewColumn *column = new wxDataViewColumn( wxT("editable"), text_cell, 2 );
dataview_left->AppendColumn( column );
@@ -247,7 +252,7 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
// Right wxDataViewCtrl using the same model
dataview_right = new wxDataViewCtrl( this, -1 );
dataview_right->AssociateModel( model );
text_cell = new wxDataViewTextCell( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
column = new wxDataViewColumn( wxT("editable"), text_cell, 2 );
dataview_right->AppendColumn( column );
@@ -256,7 +261,7 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
wxDataViewToggleCell *toggle_cell = new wxDataViewToggleCell( wxT("bool"), wxDATAVIEW_CELL_EDITABLE );
column = new wxDataViewColumn( wxT("bool"), toggle_cell, 3 );
dataview_right->AppendColumn( column );
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add( dataview_left, 1, wxGROW );
sizer->Add(10,10);