Harmonize wxDataViewCtrl::GetSelection() behaviour in all ports.

wxDataViewCtrl::GetSelection() now always returns invalid item if more than
a single item is selected in a multi-selection control.

Also add HasSelection() and GetSelectedItemsCount() to allow checking if any
items are selected.

Updated the documentation, all ports and added a test for all these functions.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-08-22 12:41:19 +00:00
parent c3ad4d4a45
commit fa93d732e2
16 changed files with 160 additions and 68 deletions

View File

@@ -1107,6 +1107,23 @@ void wxMacDataViewDataBrowserListViewControl::SetCurrentItem(const wxDataViewIte
wxFAIL_MSG( "unimplemented for Carbon" );
}
int wxMacDataViewDataBrowserListViewControl::GetSelectedItemsCount() const
{
Handle handle(::NewHandle(0));
if ( GetItems(kDataBrowserNoItem,true,kDataBrowserItemIsSelected,handle) != noErr )
{
wxFAIL_MSG( "failed to get selected items" );
return 0;
}
size_t noOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID));
HUnlock(handle);
DisposeHandle(handle);
return noOfItems;
}
int wxMacDataViewDataBrowserListViewControl::GetSelections(wxDataViewItemArray& sel) const
{
size_t noOfSelectedItems;