X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5829b3034b9bf4f5e54ac354a07de94cd132de49..57bf907d8e45ced18486d74c04f41c06034b7e65:/src/osx/carbon/dataview.cpp?ds=inline diff --git a/src/osx/carbon/dataview.cpp b/src/osx/carbon/dataview.cpp index 6c71d42150..dd3cebff16 100644 --- a/src/osx/carbon/dataview.cpp +++ b/src/osx/carbon/dataview.cpp @@ -967,6 +967,24 @@ void wxDataViewColumn::SetWidth(int width) } } +void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort)) +{ + // see wxGTK native wxDataViewColumn implementation + wxFAIL_MSG( "not implemented" ); +} + +bool wxDataViewColumn::IsSortKey() const +{ + wxDataViewCtrl * const dataViewCtrlPtr(GetOwner()); + wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr( + dynamic_cast( + dataViewCtrlPtr->GetPeer())); + + DataBrowserPropertyID propertyID; + return macDataViewListCtrlPtr->GetSortProperty(&propertyID) == noErr && + propertyID == m_propertyID; +} + //----------------------------------------------------------------------------- // wxDataViewCtrl //----------------------------------------------------------------------------- @@ -1165,6 +1183,8 @@ void wxDataViewCtrl::Collapse(wxDataViewItem const& item) void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) { + ExpandAncestors(item); + if (item.IsOk()) { DataBrowserPropertyID propertyID; @@ -1186,6 +1206,23 @@ void wxDataViewCtrl::Expand(wxDataViewItem const& item) MacDataViewListCtrlPtr->OpenContainer(reinterpret_cast(item.GetID())); } +bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const +{ + if (item.IsOk()) + { + wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(m_peer)); + + DataBrowserItemState state = 0; + OSStatus err = ::GetDataBrowserItemState( + MacDataViewListCtrlPtr->GetControlRef(), + reinterpret_cast(item.GetID()), + &state ); + if ((err == 0) && (state & kDataBrowserContainerIsOpen)) + return true; + } + return false; +} + wxDataViewColumn* wxDataViewCtrl::GetSortingColumn() const { DataBrowserPropertyID propertyID; @@ -1297,6 +1334,8 @@ void wxDataViewCtrl::Select(wxDataViewItem const& item) { if (item.IsOk()) { + ExpandAncestors(item); + DataBrowserItemID itemID(reinterpret_cast(item.GetID())); wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(m_peer)); @@ -1306,18 +1345,31 @@ void wxDataViewCtrl::Select(wxDataViewItem const& item) void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel) { - size_t const NoOfSelections = sel.GetCount(); + size_t const NoOfSelections = sel.GetCount(); - DataBrowserItemID* itemIDs; + wxDataViewItem last_parent; - wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(m_peer)); + size_t i; + for (i = 0; i < NoOfSelections; i++) + { + wxDataViewItem item = sel[i]; + wxDataViewItem parent = GetModel()->GetParent( item ); + if (parent) + { + if (parent != last_parent) + ExpandAncestors(item); + } + last_parent = parent; + } + DataBrowserItemID* itemIDs; + wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(m_peer)); - itemIDs = new DataBrowserItemID[NoOfSelections]; - for (size_t i=0; i(sel[i].GetID()); - MacDataViewListCtrlPtr->SetSelectedItems(NoOfSelections,itemIDs,kDataBrowserItemsAssign); - delete[] itemIDs; + itemIDs = new DataBrowserItemID[NoOfSelections]; + for (i=0; i(sel[i].GetID()); + MacDataViewListCtrlPtr->SetSelectedItems(NoOfSelections,itemIDs,kDataBrowserItemsAssign); + delete[] itemIDs; } void wxDataViewCtrl::Unselect(wxDataViewItem const& item)