Change SetValue( wxVariant &value ) to

SetValue( const wxVariant &value )
    (already documented)
   Delete in-place editing control through
    pending list, not in event handler.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2007-04-24 09:36:48 +00:00
parent 2d9152d5d6
commit 2fa73716ca
4 changed files with 20 additions and 17 deletions

View File

@ -140,7 +140,7 @@ public:
virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ) const = 0;
// set value, call ValueChanged() afterwards!
virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0;
virtual bool SetValue( const wxVariant &variant, unsigned int col, unsigned int row ) = 0;
// delegated notifiers
virtual bool RowAppended();
@ -200,7 +200,7 @@ public:
virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ) const;
// set value, call ValueChanged() afterwards!
virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row );
virtual bool SetValue( const wxVariant &variant, unsigned int col, unsigned int row );
// called from user
virtual bool RowAppended();

View File

@ -118,7 +118,7 @@ public:
variant = tmp;
}
}
virtual bool SetValue( wxVariant &value, unsigned int col, unsigned int row )
virtual bool SetValue( const wxVariant &value, unsigned int col, unsigned int row )
{
if (col == 6)
{
@ -343,7 +343,7 @@ public:
variant = tmp;
}
virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row )
virtual bool SetValue( const wxVariant &variant, unsigned int col, unsigned int row )
{
if (col == 0)
{
@ -682,10 +682,12 @@ void MyFrame::CreateDataViewControls()
style |= wxDV_MULTIPLE;
if (GetMenuBar()->FindItem(ID_NO_HEADER_MODE)->IsChecked())
style |= wxDV_NO_HEADER;
#if 0
if (GetMenuBar()->FindItem(ID_HORIZ_RULES_MODE)->IsChecked())
style |= wxDV_HORIZ_RULES;
if (GetMenuBar()->FindItem(ID_VERT_RULES_MODE)->IsChecked())
style |= wxDV_VERT_RULES;
#endif
// Left wxDataViewCtrl
@ -693,6 +695,9 @@ void MyFrame::CreateDataViewControls()
wxDefaultSize, style );
wxDataViewTextRenderer *text_renderer;
wxDataViewColumn *column;
wxObjectDataPtr<MyTextModel> model(new MyTextModel);
dataview_left->AssociateModel( model.get() );
@ -701,10 +706,8 @@ void MyFrame::CreateDataViewControls()
dataview_left->AppendTextColumn( wxT("Second"), 1, wxDATAVIEW_CELL_INERT, -1,
DEFAULT_ALIGN );
wxDataViewTextRenderer *text_renderer =
new wxDataViewTextRenderer( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
wxDataViewColumn *column = new wxDataViewColumn( wxT("editable"), text_renderer, 2,
-1, DEFAULT_ALIGN );
text_renderer = new wxDataViewTextRenderer( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
column = new wxDataViewColumn( wxT("editable"), text_renderer, 2, -1, DEFAULT_ALIGN );
dataview_left->AppendColumn( column );
dataview_left->AppendToggleColumn( wxT("fourth"), 3, wxDATAVIEW_CELL_INERT, -1,
@ -719,7 +722,6 @@ void MyFrame::CreateDataViewControls()
dataview_left->AppendDateColumn( wxT("date"), 6, wxDATAVIEW_CELL_INERT, -1, DEFAULT_ALIGN );
// Right wxDataViewCtrl using the same model
dataview_right = new wxDataViewCtrl( m_panelRight, wxID_ANY );
dataview_right->AssociateModel( model.get() );

View File

@ -603,7 +603,7 @@ void wxDataViewSortedListModel::GetValue( wxVariant &variant, unsigned int col,
m_child->GetValue( variant, col, child_row );
}
bool wxDataViewSortedListModel::SetValue( wxVariant &variant, unsigned int col, unsigned int row )
bool wxDataViewSortedListModel::SetValue( const wxVariant &variant, unsigned int col, unsigned int row )
{
unsigned int child_row = m_array[row];
bool ret = m_child->SetValue( variant, col, child_row );
@ -744,21 +744,19 @@ bool wxDataViewRendererBase::StartEditing( unsigned int row, wxRect labelRect )
void wxDataViewRendererBase::CancelEditing()
{
// m_editorCtrl->PopEventHandler( true );
delete m_editorCtrl;
wxPendingDelete.Append( m_editorCtrl );
GetOwner()->GetOwner()->GetMainWindow()->SetFocus();
// m_editorCtrl->PopEventHandler( true );
}
bool wxDataViewRendererBase::FinishEditing()
{
// m_editorCtrl->PopEventHandler( true );
wxVariant value;
GetValueFromEditorCtrl( m_editorCtrl, value );
delete m_editorCtrl;
wxPendingDelete.Append( m_editorCtrl );
GetOwner()->GetOwner()->GetMainWindow()->SetFocus();
@ -769,6 +767,8 @@ bool wxDataViewRendererBase::FinishEditing()
GetOwner()->GetOwner()->GetModel()->SetValue( value, col, m_row );
GetOwner()->GetOwner()->GetModel()->ValueChanged( col, m_row );
// m_editorCtrl->PopEventHandler( true );
return true;
}
@ -831,7 +831,6 @@ void wxDataViewEditorCtrlEvtHandler::OnKillFocus( wxFocusEvent &event )
m_owner->FinishEditing();
}
// We must let the native text control handle focus
event.Skip();
}

View File

@ -2037,7 +2037,9 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
}
else
#endif
{
gtk_tree_view_set_rules_hint( GTK_TREE_VIEW(m_treeview), (style & wxDV_HORIZ_RULES) != 0 );
}
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);