#include "wx/utils.h"
#endif
-#include "wx/osx/cocoa/dataview.h"
#include "wx/osx/private.h"
+#include "wx/osx/cocoa/dataview.h"
#include "wx/renderer.h"
// ============================================================================
::CFRelease(osxData);
delete dataObjects;
}
+ return dragSuccessful;
}
-(id) outlineView:(NSOutlineView*)outlineView
sortingColumnPtr:dvc->GetColumn([[newDescriptor key] intValue])
ascending:[newDescriptor ascending]] autorelease]];
}
- [[outlineView dataSource] setSortDescriptors:wxSortDescriptors];
+ [(wxCocoaOutlineDataSource*)[outlineView dataSource] setSortDescriptors:wxSortDescriptors];
// send first the event to wxWidgets that the sorting has changed so that
// the program can do special actions before the sorting actually starts:
wxDataViewEvent event(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,dvc->GetId());
event.SetEventObject(dvc);
- event.SetModel (dvc->GetModel());
+ event.SetModel(dvc->GetModel());
+ event.SetItem(dvc->GetSelection());
dvc->GetEventHandler()->ProcessEvent(event);
}
//
// selection related methods (inherited from wxDataViewWidgetImpl)
//
+
+wxDataViewItem wxCocoaDataViewControl::GetCurrentItem() const
+{
+ return wxDataViewItem([[m_OutlineView itemAtRow:[m_OutlineView selectedRow]] pointer]);
+}
+
+void wxCocoaDataViewControl::SetCurrentItem(const wxDataViewItem& item)
+{
+ // We can't have unselected current item in a NSTableView, as the
+ // documentation of its deselectRow method explains, the control will
+ // automatically change the current item to the closest still selected item
+ // if the current item is deselected. So we have no choice but to select
+ // the item in the same time as making it current.
+ Select(item);
+}
+
int wxCocoaDataViewControl::GetSelections(wxDataViewItemArray& sel) const
{
NSIndexSet* selectedRowIndexes([m_OutlineView selectedRowIndexes]);
{
if (item.IsOk())
[m_OutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[m_OutlineView rowForItem:[m_DataSource getDataViewItemFromBuffer:item]]]
- byExtendingSelection:NO];
+ byExtendingSelection:GetDataViewCtrl()->HasFlag(wxDV_MULTIPLE) ? YES : NO];
}
void wxCocoaDataViewControl::SelectAll()
{
}
+void wxDataViewColumn::SetHidden(bool hidden)
+{
+ // How to set flag here?
+
+ [m_NativeDataPtr->GetNativeColumnPtr() setHidden:hidden];
+}
+
+bool wxDataViewColumn::IsHidden() const
+{
+ return [m_NativeDataPtr->GetNativeColumnPtr() isHidden];
+}
+
void wxDataViewColumn::SetResizeable(bool resizeable)
{
wxDataViewColumnBase::SetResizeable(resizeable);
void wxDataViewColumn::SetSortable(bool sortable)
{
- wxDataViewColumnBase::SetSortable(sortable);
+ // wxDataViewColumnBase::SetSortable(sortable);
+ // Avoid endless recursion and just set the flag here
+ if (sortable)
+ m_flags |= wxDATAVIEW_COL_SORTABLE;
+ else
+ m_flags &= ~wxDATAVIEW_COL_SORTABLE;
}
void wxDataViewColumn::SetSortOrder(bool ascending)