Merge branch 'dvc-more-fixes'

More, mostly event-related, wxDataViewCtrl fixes.

See https://github.com/wxWidgets/wxWidgets/pull/718
This commit is contained in:
Vadim Zeitlin
2018-02-05 13:59:43 +01:00
12 changed files with 160 additions and 82 deletions

View File

@@ -182,6 +182,7 @@ All (GUI):
- Generate wxEVT_SEARCH on Enter under all platforms. - Generate wxEVT_SEARCH on Enter under all platforms.
- Extend wxRendererNative::DrawGauge() to work for vertical gauges too. - Extend wxRendererNative::DrawGauge() to work for vertical gauges too.
- Add wxHD_BITMAP_ON_RIGHT style to wxHeaderCtrl. - Add wxHD_BITMAP_ON_RIGHT style to wxHeaderCtrl.
- Send wxEVT_DATAVIEW_ITEM_EDITING_DONE when editing was cancelled too.
wxGTK: wxGTK:

View File

@@ -755,6 +755,12 @@ public:
virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr))
{ return false; } { return false; }
// Set the colour used for the "alternate" rows when wxDV_ROW_LINES is on.
// Also only supported in the generic version, which returns true to
// indicate it.
virtual bool SetAlternateRowColour(const wxColour& WXUNUSED(colour))
{ return false; }
virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE
{ {
return GetClassDefaultAttributes(GetWindowVariant()); return GetClassDefaultAttributes(GetWindowVariant());
@@ -853,7 +859,6 @@ public:
// for wxEVT_DATAVIEW_ITEM_EDITING_DONE only // for wxEVT_DATAVIEW_ITEM_EDITING_DONE only
bool IsEditCancelled() const { return m_editCancelled; } bool IsEditCancelled() const { return m_editCancelled; }
void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
// for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
wxDataViewColumn *GetDataViewColumn() const { return m_column; } wxDataViewColumn *GetDataViewColumn() const { return m_column; }
@@ -897,11 +902,12 @@ public:
wxDEPRECATED_MSG("Pass the argument to the ctor instead") wxDEPRECATED_MSG("Pass the argument to the ctor instead")
void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
wxDEPRECATED_MSG("Pass the argument to the ctor instead") wxDEPRECATED_MSG("Pass the argument to the ctor instead")
void SetColumn( int col ) { m_col = col; }
wxDEPRECATED_MSG("Pass the argument to the ctor instead")
void SetItem( const wxDataViewItem &item ) { m_item = item; } void SetItem( const wxDataViewItem &item ) { m_item = item; }
#endif // WXWIN_COMPATIBILITY_3_0 #endif // WXWIN_COMPATIBILITY_3_0
void SetColumn( int col ) { m_col = col; }
void SetEditCancelled() { m_editCancelled = true; }
protected: protected:
wxDataViewItem m_item; wxDataViewItem m_item;
int m_col; int m_col;

View File

@@ -241,15 +241,18 @@ protected:
// (typically selection with dark background). For internal use only. // (typically selection with dark background). For internal use only.
virtual bool IsHighlighted() const = 0; virtual bool IsHighlighted() const = 0;
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
void DestroyEditControl();
// Helper of PrepareForItem() also used in StartEditing(): returns the // Helper of PrepareForItem() also used in StartEditing(): returns the
// value checking that its type matches our GetVariantType(). // value checking that its type matches our GetVariantType().
wxVariant CheckedGetValue(const wxDataViewModel* model, wxVariant CheckedGetValue(const wxDataViewModel* model,
const wxDataViewItem& item, const wxDataViewItem& item,
unsigned column) const; unsigned column) const;
// Validates the given value (if it is non-null) and sends (in any case)
// ITEM_EDITING_DONE event and, finally, updates the model with the value
// (f it is valid, of course) if the event wasn't vetoed.
bool DoHandleEditingDone(wxVariant* value);
wxString m_variantType; wxString m_variantType;
wxDataViewColumn *m_owner; wxDataViewColumn *m_owner;
wxWeakRef<wxWindow> m_editorCtrl; wxWeakRef<wxWindow> m_editorCtrl;
@@ -261,7 +264,10 @@ protected:
// renderer is required // renderer is required
wxDataViewCtrl* GetView() const; wxDataViewCtrl* GetView() const;
protected: private:
// Called from {Called,Finish}Editing() and dtor to cleanup m_editorCtrl
void DestroyEditControl();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase);
}; };

View File

@@ -277,10 +277,11 @@ public:
virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE; virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE;
// These methods are specific to generic wxDataViewCtrl implementation and virtual bool SetAlternateRowColour(const wxColour& colour) wxOVERRIDE;
// This method is specific to generic wxDataViewCtrl implementation and
// should not be used in portable code. // should not be used in portable code.
wxColour GetAlternateRowColour() const { return m_alternateRowColour; } wxColour GetAlternateRowColour() const { return m_alternateRowColour; }
void SetAlternateRowColour(const wxColour& colour);
// The returned pointer is null if the control has wxDV_NO_HEADER style. // The returned pointer is null if the control has wxDV_NO_HEADER style.
// //

View File

@@ -47,9 +47,10 @@ public:
// called when the cell value was edited by user with the new value // called when the cell value was edited by user with the new value
// //
// it validates the new value and notifies the model about the change by // it uses GtkGetValueFromString() to parse the new value, then validates
// calling GtkOnCellChanged() if it was accepted // it by calling Validate() and notifies the model about the change if it
virtual void GtkOnTextEdited(const char *itempath, const wxString& value); // passes validation
void GtkOnTextEdited(const char *itempath, const wxString& value);
GtkCellRenderer* GetGtkHandle() { return m_renderer; } GtkCellRenderer* GetGtkHandle() { return m_renderer; }
void GtkInitHandlers(); void GtkInitHandlers();
@@ -78,14 +79,16 @@ protected:
virtual bool IsHighlighted() const wxOVERRIDE; virtual bool IsHighlighted() const wxOVERRIDE;
virtual void GtkOnCellChanged(const wxVariant& value,
const wxDataViewItem& item,
unsigned col);
// Apply our effective alignment (i.e. m_alignment if specified or the // Apply our effective alignment (i.e. m_alignment if specified or the
// associated column alignment by default) to the given renderer. // associated column alignment by default) to the given renderer.
void GtkApplyAlignment(GtkCellRenderer *renderer); void GtkApplyAlignment(GtkCellRenderer *renderer);
// This method is used to interpret the string entered by user and by
// default just uses it as is, but can be overridden for classes requiring
// special treatment.
virtual wxVariant GtkGetValueFromString(const wxString& str) const;
GtkCellRenderer *m_renderer; GtkCellRenderer *m_renderer;
int m_alignment; int m_alignment;

View File

@@ -228,9 +228,7 @@ public:
virtual void GtkPackIntoColumn(GtkTreeViewColumn *column) wxOVERRIDE; virtual void GtkPackIntoColumn(GtkTreeViewColumn *column) wxOVERRIDE;
protected: protected:
virtual void GtkOnCellChanged(const wxVariant& value, virtual wxVariant GtkGetValueFromString(const wxString& str) const wxOVERRIDE;
const wxDataViewItem& item,
unsigned col) wxOVERRIDE;
private: private:
wxDataViewIconText m_value; wxDataViewIconText m_value;
@@ -281,7 +279,7 @@ public:
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
private: private:
virtual void GtkOnTextEdited(const char *itempath, const wxString& str) wxOVERRIDE; virtual wxVariant GtkGetValueFromString(const wxString& str) const;
}; };

View File

@@ -1566,6 +1566,21 @@ public:
*/ */
virtual void SelectAll(); virtual void SelectAll();
/**
Set custom colour for the alternate rows used with wxDV_ROW_LINES
style.
Note that calling this method has no effect if wxDV_ROW_LINES is off.
@param colour The colour to use for the alternate rows.
@return @true if customizing this colour is supported (currently only
in the generic version), @false if this method is not implemented
under this platform.
@since 3.1.1
*/
bool SetAlternateRowColour(const wxColour& colour);
/** /**
Set which column shall contain the tree-like expanders. Set which column shall contain the tree-like expanders.
*/ */
@@ -3633,8 +3648,8 @@ public:
Process a @c wxEVT_DATAVIEW_COLUMN_SORTED event. Process a @c wxEVT_DATAVIEW_COLUMN_SORTED event.
@event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
Process a @c wxEVT_DATAVIEW_COLUMN_REORDERED event. Process a @c wxEVT_DATAVIEW_COLUMN_REORDERED event.
Currently this even is only generated when using the native OS X Currently this event is not generated when using the native GTK+
version. version of the control.
@event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
Process a @c wxEVT_DATAVIEW_ITEM_BEGIN_DRAG event. Process a @c wxEVT_DATAVIEW_ITEM_BEGIN_DRAG event.
@event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
@@ -3660,6 +3675,9 @@ public:
/** /**
Returns the position of the column in the control or -1 Returns the position of the column in the control or -1
if no column field was set by the event emitter. if no column field was set by the event emitter.
For wxEVT_DATAVIEW_COLUMN_REORDERED, this is the new position of the
column.
*/ */
int GetColumn() const; int GetColumn() const;
@@ -3800,7 +3818,6 @@ public:
*/ */
wxDataViewItem GetItem() const; wxDataViewItem GetItem() const;
void SetItem( const wxDataViewItem &item ); void SetItem( const wxDataViewItem &item );
void SetEditCanceled(bool editCancelled);
void SetPosition( int x, int y ); void SetPosition( int x, int y );
void SetCache(int from, int to); void SetCache(int from, int to);
wxDataObject *GetDataObject() const; wxDataObject *GetDataObject() const;

View File

@@ -133,6 +133,7 @@ private:
void OnHeaderClickList( wxDataViewEvent &event ); void OnHeaderClickList( wxDataViewEvent &event );
void OnSorted( wxDataViewEvent &event ); void OnSorted( wxDataViewEvent &event );
void OnSortedList( wxDataViewEvent &event ); void OnSortedList( wxDataViewEvent &event );
void OnColumnReordered( wxDataViewEvent &event);
void OnContextMenu( wxDataViewEvent &event ); void OnContextMenu( wxDataViewEvent &event );
@@ -416,13 +417,14 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_DATAVIEW_SELECTION_CHANGED(ID_MUSIC_CTRL, MyFrame::OnSelectionChanged) EVT_DATAVIEW_SELECTION_CHANGED(ID_MUSIC_CTRL, MyFrame::OnSelectionChanged)
EVT_DATAVIEW_ITEM_START_EDITING(ID_MUSIC_CTRL, MyFrame::OnStartEditing) EVT_DATAVIEW_ITEM_START_EDITING(ID_MUSIC_CTRL, MyFrame::OnStartEditing)
EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL, MyFrame::OnEditingStarted) EVT_DATAVIEW_ITEM_EDITING_STARTED(wxID_ANY, MyFrame::OnEditingStarted)
EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL, MyFrame::OnEditingDone) EVT_DATAVIEW_ITEM_EDITING_DONE(wxID_ANY, MyFrame::OnEditingDone)
EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderClick) EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderClick)
EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderRightClick) EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderRightClick)
EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL, MyFrame::OnSorted) EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL, MyFrame::OnSorted)
EVT_DATAVIEW_COLUMN_SORTED(ID_ATTR_CTRL, MyFrame::OnSortedList) EVT_DATAVIEW_COLUMN_SORTED(ID_ATTR_CTRL, MyFrame::OnSortedList)
EVT_DATAVIEW_COLUMN_REORDERED(wxID_ANY, MyFrame::OnColumnReordered)
EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_ATTR_CTRL, MyFrame::OnHeaderClickList) EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_ATTR_CTRL, MyFrame::OnHeaderClickList)
EVT_DATAVIEW_ITEM_CONTEXT_MENU(ID_MUSIC_CTRL, MyFrame::OnContextMenu) EVT_DATAVIEW_ITEM_CONTEXT_MENU(ID_MUSIC_CTRL, MyFrame::OnContextMenu)
@@ -1218,14 +1220,20 @@ void MyFrame::OnStartEditing( wxDataViewEvent &event )
void MyFrame::OnEditingStarted( wxDataViewEvent &event ) void MyFrame::OnEditingStarted( wxDataViewEvent &event )
{ {
wxString title = m_music_model->GetTitle( event.GetItem() ); // This event doesn't, currently, carry the value, so get it ourselves.
wxLogMessage( "wxEVT_DATAVIEW_ITEM_EDITING_STARTED, Item: %s", title ); wxDataViewModel* const model = event.GetModel();
wxVariant value;
model->GetValue(value, event.GetItem(), event.GetColumn());
wxLogMessage("wxEVT_DATAVIEW_ITEM_EDITING_STARTED, current value %s",
value.GetString());
} }
void MyFrame::OnEditingDone( wxDataViewEvent &event ) void MyFrame::OnEditingDone( wxDataViewEvent &event )
{ {
wxString title = m_music_model->GetTitle( event.GetItem() ); wxLogMessage("wxEVT_DATAVIEW_ITEM_EDITING_DONE, new value %s",
wxLogMessage( "wxEVT_DATAVIEW_ITEM_EDITING_DONE, Item: %s", title ); event.IsEditCancelled()
? wxString("unavailable because editing was cancelled")
: event.GetValue().GetString());
} }
void MyFrame::OnExpanded( wxDataViewEvent &event ) void MyFrame::OnExpanded( wxDataViewEvent &event )
@@ -1290,6 +1298,19 @@ void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )
wxLogMessage( "wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, Column position: %d", pos ); wxLogMessage( "wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, Column position: %d", pos );
} }
void MyFrame::OnColumnReordered(wxDataViewEvent& event)
{
wxDataViewColumn* const col = event.GetDataViewColumn();
if ( !col )
{
wxLogError("Unknown column reordered?");
return;
}
wxLogMessage("wxEVT_DATAVIEW_COLUMN_REORDERED: \"%s\" is now at position %d",
col->GetTitle(), event.GetColumn());
}
void MyFrame::OnSortedList( wxDataViewEvent &/*event*/) void MyFrame::OnSortedList( wxDataViewEvent &/*event*/)
{ {
wxVector<wxDataViewColumn *> const columns = m_ctrl[1]->GetSortingColumns(); wxVector<wxDataViewColumn *> const columns = m_ctrl[1]->GetSortingColumns();

View File

@@ -766,10 +766,10 @@ void wxDataViewRendererBase::DestroyEditControl()
void wxDataViewRendererBase::CancelEditing() void wxDataViewRendererBase::CancelEditing()
{ {
if (!m_editorCtrl) if ( m_editorCtrl )
return; DestroyEditControl();
DestroyEditControl(); DoHandleEditingDone(NULL);
} }
bool wxDataViewRendererBase::FinishEditing() bool wxDataViewRendererBase::FinishEditing()
@@ -777,34 +777,55 @@ bool wxDataViewRendererBase::FinishEditing()
if (!m_editorCtrl) if (!m_editorCtrl)
return true; return true;
// Try to get the value, normally we should succeed but if we fail, don't bool gotValue = false;
// return immediately, we still need to destroy the edit control.
wxVariant value;
const bool gotValue = GetValueFromEditorCtrl(m_editorCtrl, value);
wxDataViewColumn* const column = GetOwner(); wxVariant value;
wxDataViewCtrl* const dv_ctrl = column->GetOwner(); if ( GetValueFromEditorCtrl(m_editorCtrl, value) )
{
// This is the normal case and we will use this value below (if it
// passes validation).
gotValue = true;
}
//else: Not really supposed to happen, but still proceed with
// destroying the edit control if it does.
DestroyEditControl(); DestroyEditControl();
dv_ctrl->GetMainWindow()->SetFocus(); GetView()->GetMainWindow()->SetFocus();
if ( !gotValue ) return DoHandleEditingDone(gotValue ? &value : NULL);
return false; }
bool isValid = Validate(value); bool
unsigned int col = GetOwner()->GetModelColumn(); wxDataViewRendererBase::DoHandleEditingDone(wxVariant* value)
{
if ( value )
{
if ( !Validate(*value) )
{
// Invalid value can't be used, so if it's the same as if we hadn't
// got it in the first place.
value = NULL;
}
}
wxDataViewColumn* const column = GetOwner();
wxDataViewCtrl* const dv_ctrl = column->GetOwner();
unsigned int col = column->GetModelColumn();
// Now we should send Editing Done event // Now we should send Editing Done event
wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_EDITING_DONE, dv_ctrl, column, m_item); wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_EDITING_DONE, dv_ctrl, column, m_item);
event.SetValue( value ); if ( value )
event.SetEditCanceled( !isValid ); event.SetValue(*value);
else
event.SetEditCancelled();
dv_ctrl->GetEventHandler()->ProcessEvent( event ); dv_ctrl->GetEventHandler()->ProcessEvent( event );
bool accepted = false; bool accepted = false;
if ( isValid && event.IsAllowed() ) if ( value && event.IsAllowed() )
{ {
dv_ctrl->GetModel()->ChangeValue(value, m_item, col); dv_ctrl->GetModel()->ChangeValue(*value, m_item, col);
accepted = true; accepted = true;
} }

View File

@@ -5512,13 +5512,16 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
return max_width; return max_width;
} }
void wxDataViewCtrl::ColumnMoved(wxDataViewColumn * WXUNUSED(col), void wxDataViewCtrl::ColumnMoved(wxDataViewColumn *col, unsigned int new_pos)
unsigned int WXUNUSED(new_pos))
{ {
// do _not_ reorder m_cols elements here, they should always be in the // do _not_ reorder m_cols elements here, they should always be in the
// order in which columns were added, we only display the columns in // order in which columns were added, we only display the columns in
// different order // different order
m_clientArea->UpdateDisplay(); m_clientArea->UpdateDisplay();
wxDataViewEvent event(wxEVT_DATAVIEW_COLUMN_REORDERED, this, col);
event.SetColumn(new_pos);
ProcessWindowEvent(event);
} }
bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column ) bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
@@ -5781,9 +5784,10 @@ bool wxDataViewCtrl::SetHeaderAttr(const wxItemAttr& attr)
return true; return true;
} }
void wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour) bool wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour)
{ {
m_alternateRowColour = colour; m_alternateRowColour = colour;
return true;
} }
void wxDataViewCtrl::SelectAll() void wxDataViewCtrl::SelectAll()

View File

@@ -1932,9 +1932,24 @@ bool wxGtkDataViewModelNotifier::Cleared()
// --------------------------------------------------------- // ---------------------------------------------------------
static void static void
wxgtk_cell_editable_editing_done( GtkCellEditable *WXUNUSED(editable), wxgtk_cell_editable_editing_done( GtkCellEditable *editable,
wxDataViewRenderer *wxrenderer ) wxDataViewRenderer *wxrenderer )
{ {
// "editing-cancelled" property is documented as being new since 2.20 in
// GtkCellEditable, but seems to have existed basically forever (since GTK+
// 1.3 days) in GtkCellRendererText, so try to use it in any case.
if ( g_object_class_find_property(G_OBJECT_GET_CLASS(editable),
"editing-canceled") )
{
gboolean wasCancelled;
g_object_get(editable, "editing-canceled", &wasCancelled, NULL);
if ( wasCancelled )
{
wxrenderer->CancelEditing();
return;
}
}
wxrenderer->FinishEditing(); wxrenderer->FinishEditing();
} }
@@ -2155,26 +2170,19 @@ bool wxDataViewRenderer::IsHighlighted() const
GetOwner()->GetOwner()->IsSelected(m_itemBeingRendered); GetOwner()->GetOwner()->IsSelected(m_itemBeingRendered);
} }
void wxVariant
wxDataViewRenderer::GtkOnTextEdited(const char *itempath, const wxString& str) wxDataViewRenderer::GtkGetValueFromString(const wxString& str) const
{ {
wxVariant value(str); return str;
if (!Validate( value ))
return;
wxDataViewItem
item(GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(itempath)));
GtkOnCellChanged(value, item, GetOwner()->GetModelColumn());
} }
void void
wxDataViewRenderer::GtkOnCellChanged(const wxVariant& value, wxDataViewRenderer::GtkOnTextEdited(const char *itempath, const wxString& str)
const wxDataViewItem& item,
unsigned col)
{ {
wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); m_item = wxDataViewItem(GetView()->GTKPathToItem(wxGtkTreePath(itempath)));
model->ChangeValue( value, item, col );
wxVariant value(GtkGetValueFromString(str));
DoHandleEditingDone(&value);
} }
void wxDataViewRenderer::SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) void wxDataViewRenderer::SetAttr(const wxDataViewItemAttr& WXUNUSED(attr))
@@ -2941,17 +2949,10 @@ wxDataViewChoiceByIndexRenderer::wxDataViewChoiceByIndexRenderer( const wxArrayS
m_variantType = wxS("long"); m_variantType = wxS("long");
} }
void wxDataViewChoiceByIndexRenderer::GtkOnTextEdited(const char *itempath, const wxString& str) wxVariant
wxDataViewChoiceByIndexRenderer::GtkGetValueFromString(const wxString& str) const
{ {
wxVariant value( (long) GetChoices().Index( str ) ); return static_cast<long>(GetChoices().Index(str));
if (!Validate( value ))
return;
wxDataViewItem
item(GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(itempath)));
GtkOnCellChanged(value, item, GetOwner()->GetModelColumn());
} }
bool wxDataViewChoiceByIndexRenderer::SetValue( const wxVariant &value ) bool wxDataViewChoiceByIndexRenderer::SetValue( const wxVariant &value )
@@ -3024,17 +3025,15 @@ bool wxDataViewIconTextRenderer::GetValue(wxVariant& value) const
return true; return true;
} }
void wxVariant
wxDataViewIconTextRenderer::GtkOnCellChanged(const wxVariant& value, wxDataViewIconTextRenderer::GtkGetValueFromString(const wxString& str) const
const wxDataViewItem& item,
unsigned col)
{ {
// we receive just the text part of our value as it's the only one which // we receive just the text part of our value as it's the only one which
// can be edited, but we need the full wxDataViewIconText value for the // can be edited, but we need the full wxDataViewIconText value for the
// model // model
wxVariant valueIconText; wxVariant valueIconText;
valueIconText << wxDataViewIconText(value.GetString(), m_value.GetIcon()); valueIconText << wxDataViewIconText(str, m_value.GetIcon());
wxDataViewTextRenderer::GtkOnCellChanged(valueIconText, item, col); return valueIconText;
} }
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@@ -1881,6 +1881,7 @@ outlineView:(NSOutlineView*)outlineView
wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl(); wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl();
wxDataViewEvent event(wxEVT_DATAVIEW_COLUMN_REORDERED, dvc, col); wxDataViewEvent event(wxEVT_DATAVIEW_COLUMN_REORDERED, dvc, col);
event.SetColumn(newColumnPosition);
dvc->GetEventHandler()->ProcessEvent(event); dvc->GetEventHandler()->ProcessEvent(event);
} }