X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/739a839903d6017270e085b7308eda71934efa64..689d801314845c6db093358a81c7879b672aa5e6:/src/osx/carbon/dataview.cpp diff --git a/src/osx/carbon/dataview.cpp b/src/osx/carbon/dataview.cpp index 4da4cb3efb..dd3cebff16 100644 --- a/src/osx/carbon/dataview.cpp +++ b/src/osx/carbon/dataview.cpp @@ -1183,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; @@ -1210,8 +1212,13 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const { wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(m_peer)); - // TODO ??? - // This doesn't seem to be supported + DataBrowserItemState state = 0; + OSStatus err = ::GetDataBrowserItemState( + MacDataViewListCtrlPtr->GetControlRef(), + reinterpret_cast(item.GetID()), + &state ); + if ((err == 0) && (state & kDataBrowserContainerIsOpen)) + return true; } return false; } @@ -1327,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)); @@ -1336,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)