]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dataview.cpp
Document lack of wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK under OS X.
[wxWidgets.git] / src / osx / carbon / dataview.cpp
index ff748471c213319136e043f7f89e6c1445d1eb73..db4326848cbbaa1dad1b41f19f39ec700020900b 100644 (file)
@@ -1102,11 +1102,34 @@ wxDataViewItem wxMacDataViewDataBrowserListViewControl::GetCurrentItem() const
     return wxDataViewItem();
 }
 
+wxDataViewColumn *wxMacDataViewDataBrowserListViewControl::GetCurrentColumn() const
+{
+    wxFAIL_MSG( "unimplemented for Carbon" );
+    return NULL;
+}
+
 void wxMacDataViewDataBrowserListViewControl::SetCurrentItem(const wxDataViewItem& WXUNUSED(item))
 {
     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;
@@ -1611,7 +1634,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
               {
                 columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending()));
                // initialize wxWidget event:
-                wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
+                wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable definition
 
                 dataViewEvent.SetEventObject(dataViewCtrlPtr);
                 dataViewEvent.SetColumn(columnIndex);
@@ -1756,7 +1779,7 @@ DataBrowserTrackingResult wxMacDataViewDataBrowserListViewControl::DataBrowserTr
   dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer());
   wxCHECK_MSG(dataViewCtrlPtr != NULL,            false,_("Pointer to data view control not set correctly."));
   wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly."));
-  dataViewCustomRendererItem = reinterpret_cast<void*>(itemID);
+  dataViewCustomRendererItem = wxDataViewItem(reinterpret_cast<void*>(itemID));
   wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item"));
   dataViewColumnPtr = GetColumnPtr(propertyID);
   wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing."));
@@ -1814,8 +1837,11 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserAcceptDragProc(DragR
     wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE,dataViewCtrlPtr->GetId());
 
     dataViewEvent.SetEventObject(dataViewCtrlPtr);
-    dataViewEvent.SetItem(reinterpret_cast<void*>(itemID)); // this is the item that receives the event
-                                                            // (can be an invalid item ID, this is especially useful if the dataview does not contain any items)
+
+    // this is the item that receives the event (can be an invalid item ID, this is
+    // especially useful if the dataview does not contain any items)
+    dataViewEvent.SetItem( wxDataViewItem(reinterpret_cast<void*>(itemID)) );
+
     dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
     dataViewEvent.SetDataObject(dataObjects);
     dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects));
@@ -1848,7 +1874,7 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserAddDragItemProc(Drag
   dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer());
   wxCHECK_MSG(dataViewCtrlPtr != NULL,            false,_("Pointer to data view control not set correctly."));
   wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly."));
-  dataViewItem = reinterpret_cast<void*>(itemID);
+  dataViewItem = wxDataViewItem(reinterpret_cast<void*>(itemID));
   wxCHECK_MSG(dataViewItem.IsOk(),false,_("Invalid data view item"));
 
  // send a begin drag event and proceed with dragging unless the event is vetoed:
@@ -1988,8 +2014,11 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserReceiveDragProc(Drag
     wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP,dataViewCtrlPtr->GetId());
 
     dataViewEvent.SetEventObject(dataViewCtrlPtr);
-    dataViewEvent.SetItem(reinterpret_cast<void*>(itemID)); // this is the item that receives the event
-                                                            // (can be an invalid item ID, this is especially useful if the dataview does not contain any items)
+
+    // this is the item that receives the event (can be an invalid item ID, this is
+    // especially useful if the dataview does not contain any items)
+    dataViewEvent.SetItem( wxDataViewItem(reinterpret_cast<void*>(itemID)) );
+
     dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
     dataViewEvent.SetDataObject(dataObjects);
     dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects));
@@ -2788,12 +2817,6 @@ bool wxDataViewColumn::IsHidden() const
 }
 
 
-void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort))
-{
-    // see wxGTK native wxDataViewColumn implementation
-    wxFAIL_MSG( "not implemented" );
-}
-
 void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
 {
   delete m_NativeDataPtr;