unsigned long columnIndex;
wxDataViewColumn* column;
OSStatus status;
- wxDataViewEvent DataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId());
+ wxDataViewEvent DataViewEvent(wxEVT_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId());
CarbonEvent.GetParameter(kEventParamDirectObject,&controlReference);
// determine the column that triggered the event (this is the column that is responsible for sorting the data view):
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;
SetHasScrollBars(true,true);
}
-void wxMacDataViewDataBrowserListViewControl::StartEditor( const wxDataViewItem & item, unsigned int column )
+void wxMacDataViewDataBrowserListViewControl::StartEditor( const wxDataViewItem & WXUNUSED(item), unsigned int WXUNUSED(column) )
{
// implement me
}
}
void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* WXUNUSED(selection))
- // In this method we do not supply a contextual menu handler at all but only send a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU.
+ // In this method we do not supply a contextual menu handler at all but only send a wxEVT_DATAVIEW_ITEM_CONTEXT_MENU.
{
wxArrayDataBrowserItemID itemIDs;
*helpType = kCMHelpItemNoHelp;
*helpItemString = NULL;
// create information for a context menu event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID)));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID)));
dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
{
// initialize wxWidget event:
DataBrowserPropertyID propertyID;
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
{
// initialize wxWidget event:
DataBrowserPropertyID propertyID;
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
case kDataBrowserItemDoubleClicked:
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
case kDataBrowserSelectionSetChanged:
{
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
{
columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending()));
// initialize wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetColumn(columnIndex);
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."));
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = GetDnDDataObjects(dragRef,itemRef);
// create wxWidget's event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_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));
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:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_BEGIN_DRAG,dataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(dataViewItem);
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = GetDnDDataObjects(dragRef,itemRef);
// create wxWidget's event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP,dataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_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));
}
-void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort))
-{
- // see wxGTK native wxDataViewColumn implementation
- wxFAIL_MSG( "not implemented" );
-}
-
void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
{
delete m_NativeDataPtr;