git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61140
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
return this->m_NativeDataPtr;
}
return this->m_NativeDataPtr;
}
- virtual bool Render() = 0; // a call to the native data browser function to render the data;
+ virtual bool MacRender() = 0; // a call to the native data browser function to render the data;
// returns true if the data value could be rendered, false otherwise
void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
// returns true if the data value could be rendered, false otherwise
void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
+ virtual bool MacRender();
void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
//
// inherited functions from wxDataViewRenderer
//
//
// inherited functions from wxDataViewRenderer
//
+ virtual bool MacRender();
- raster = (uint32*) _TIFFmalloc( bytesNeeded );
+ raster = (uint32*) _TIFFmalloc( (uint32)bytesNeeded );
if (year_cnt == 1 && month_cnt == 1 && day_cnt == 1)
return fmt;
if (year_cnt == 1 && month_cnt == 1 && day_cnt == 1)
return fmt;
- else
- return x_format;
}
bool SetFormat(const wxString& fmt)
}
bool SetFormat(const wxString& fmt)
- URefCon refCon = NULL ;
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
if (ControlPtr != NULL)
return ControlPtr->DataBrowserCompareProc(itemOneID,itemTwoID,sortProperty);
else
if (ControlPtr != NULL)
return ControlPtr->DataBrowserCompareProc(itemOneID,itemTwoID,sortProperty);
else
- return errDataBrowserPropertyNotSupported;
} /* wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlRef, DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */
pascal void wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection)
} /* wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlRef, DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */
pascal void wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection)
if (ControlPtr != NULL)
return ControlPtr->DataBrowserTrackingProc(itemID,propertyID,theRect,startPt,modifiers);
else
if (ControlPtr != NULL)
return ControlPtr->DataBrowserTrackingProc(itemID,propertyID,theRect,startPt,modifiers);
else
- return kDataBrowserNothingHit;
+ return kDataBrowserNothingHit;
} /* wxMacDataBrowserTableViewControl::DataBrowserTrackingProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, Rect const*, Point, EventModifiers) */
pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID)
{
wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
} /* wxMacDataBrowserTableViewControl::DataBrowserTrackingProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, Rect const*, Point, EventModifiers) */
pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID)
{
wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
return ((controlPtr != NULL) && controlPtr->DataBrowserAcceptDragProc(dragRef,itemID));
} /* wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc(ControlRef, DragReference, DataBrowserItemID) */
pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef)
{
wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
return ((controlPtr != NULL) && controlPtr->DataBrowserAcceptDragProc(dragRef,itemID));
} /* wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc(ControlRef, DragReference, DataBrowserItemID) */
pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef)
{
wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
return ((controlPtr != NULL) && controlPtr->DataBrowserAddDragItemProc(dragRef,itemID,itemRef));
} /* wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc(ControlRef, DragReference, DataBrowserItemID, ItemReference*) */
pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID)
{
wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
return ((controlPtr != NULL) && controlPtr->DataBrowserAddDragItemProc(dragRef,itemID,itemRef));
} /* wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc(ControlRef, DragReference, DataBrowserItemID, ItemReference*) */
pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID)
{
wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
return ((controlPtr != NULL) && controlPtr->DataBrowserReceiveDragProc(dragRef,itemID));
} /* wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc(ControlRef, DragReference, DataBrowserItemID) */
return ((controlPtr != NULL) && controlPtr->DataBrowserReceiveDragProc(dragRef,itemID));
} /* wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc(ControlRef, DragReference, DataBrowserItemID) */
SetReferenceInNativeControl();
verify_noerr(err);
SetReferenceInNativeControl();
verify_noerr(err);
::InstallControlEventHandler(this->m_controlRef, GetDataBrowserCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, peer, (EventHandlerRef *)&m_macDataViewCtrlEventHandler);
::InstallControlEventHandler(this->m_controlRef, GetDataBrowserCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, peer, (EventHandlerRef *)&m_macDataViewCtrlEventHandler);
// setup standard callbacks:
if (gDataBrowserTableViewGetContextualMenuUPP == NULL) gDataBrowserTableViewGetContextualMenuUPP = NewDataBrowserGetContextualMenuUPP(wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc);
if (gDataBrowserTableViewItemCompareUPP == NULL) gDataBrowserTableViewItemCompareUPP = NewDataBrowserItemCompareUPP (wxMacDataBrowserTableViewControl::DataBrowserCompareProc);
// setup standard callbacks:
if (gDataBrowserTableViewGetContextualMenuUPP == NULL) gDataBrowserTableViewGetContextualMenuUPP = NewDataBrowserGetContextualMenuUPP(wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc);
if (gDataBrowserTableViewItemCompareUPP == NULL) gDataBrowserTableViewItemCompareUPP = NewDataBrowserItemCompareUPP (wxMacDataBrowserTableViewControl::DataBrowserCompareProc);
}
OptionBits attributes; // variable definition
}
OptionBits attributes; // variable definition
if (this->GetAttributes(&attributes) == noErr) // get default settings
{
if ((style & wxDV_VERT_RULES) != 0)
if (this->GetAttributes(&attributes) == noErr) // get default settings
{
if ((style & wxDV_VERT_RULES) != 0)
// lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns
// the column position for the property id:
DataBrowserTableViewColumnIndex index;
// lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns
// the column position for the property id:
DataBrowserTableViewColumnIndex index;
return ::GetDataBrowserTableViewColumnPosition(this->m_controlRef,propertyID,&index);
} /* wxMacDataBrowserTableViewControl::IsUsedPropertyId(DataBrowserPropertyID) const */
return ::GetDataBrowserTableViewColumnPosition(this->m_controlRef,propertyID,&index);
} /* wxMacDataBrowserTableViewControl::IsUsedPropertyId(DataBrowserPropertyID) const */
OSStatus wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID* id) const
{
ItemCount noOfItems;
OSStatus wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID* id) const
{
ItemCount noOfItems;
status = this->GetItemCount(&noOfItems);
wxCHECK_MSG(status == noErr,status,_("Could not retrieve number of items"));
if (noOfItems == 0)
status = this->GetItemCount(&noOfItems);
wxCHECK_MSG(status == noErr,status,_("Could not retrieve number of items"));
if (noOfItems == 0)
// lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns
// the column position for the property id:
DataBrowserTableViewColumnIndex index;
// lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns
// the column position for the property id:
DataBrowserTableViewColumnIndex index;
return ::GetDataBrowserTableViewItemRow(this->m_controlRef,itemID,&index);
} /* wxMacDataBrowserTableViewControl::IsUsedItemID(DataBrowserItemID) const */
return ::GetDataBrowserTableViewItemRow(this->m_controlRef,itemID,&index);
} /* wxMacDataBrowserTableViewControl::IsUsedItemID(DataBrowserItemID) const */
{
DataBrowserItemID* itemIDPtr;
Handle handle(::NewHandle(0));
{
DataBrowserItemID* itemIDPtr;
Handle handle(::NewHandle(0));
bool wxMacDataViewDataBrowserListViewControl::ClearColumns(void)
{
UInt32 noOfColumns;
bool wxMacDataViewDataBrowserListViewControl::ClearColumns(void)
{
UInt32 noOfColumns;
wxCHECK_MSG(this->GetColumnCount(&noOfColumns) == noErr,false,_("Could not determine number of columns."));
for (UInt32 i=0; i<noOfColumns; ++i)
wxCHECK_MSG(this->RemoveColumnByIndex(0) == noErr,false,_("Could not remove column."));
wxCHECK_MSG(this->GetColumnCount(&noOfColumns) == noErr,false,_("Could not determine number of columns."));
for (UInt32 i=0; i<noOfColumns; ++i)
wxCHECK_MSG(this->RemoveColumnByIndex(0) == noErr,false,_("Could not remove column."));
if (noOfColumns == 1)
{
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
if (noOfColumns == 1)
{
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_MSG(dataViewCtrlPtr != NULL,false,_("wxWidget's control not initialized."));
dataViewCtrlPtr->AddChildren(wxDataViewItem());
return true;
wxCHECK_MSG(dataViewCtrlPtr != NULL,false,_("wxWidget's control not initialized."));
dataViewCtrlPtr->AddChildren(wxDataViewItem());
return true;
//
// other methods (inherited from wxDataViewWidgetImpl)
//
//
// other methods (inherited from wxDataViewWidgetImpl)
//
-void wxMacDataViewDataBrowserListViewControl::HitTest(wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const
+void
+wxMacDataViewDataBrowserListViewControl::HitTest(const wxPoint& WXUNUSED(point),
+ wxDataViewItem& item,
+ wxDataViewColumn*& columnPtr) const
{
// not yet implemented:
item = wxDataViewItem();
{
// not yet implemented:
item = wxDataViewItem();
void wxMacDataViewDataBrowserListViewControl::OnSize(void)
{
UInt32 noOfColumns;
void wxMacDataViewDataBrowserListViewControl::OnSize(void)
{
UInt32 noOfColumns;
this->GetColumnCount(&noOfColumns);
if (noOfColumns <= 1) // no horizontal scroll bar and the only column expands to the width of the whole control
{
this->GetColumnCount(&noOfColumns);
if (noOfColumns <= 1) // no horizontal scroll bar and the only column expands to the width of the whole control
{
DataBrowserSortOrder sortOrder;
DataBrowserTableViewColumnIndex modelColumnIndex;
DataBrowserSortOrder sortOrder;
DataBrowserTableViewColumnIndex modelColumnIndex;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->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."));
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."));
{
// variable definition and initialization:
wxDataViewColumn* ColumnPtr(this->GetColumnPtr(sortProperty));
{
// variable definition and initialization:
wxDataViewColumn* ColumnPtr(this->GetColumnPtr(sortProperty));
wxCHECK_MSG(ColumnPtr != NULL,false,_("Could not determine column index."));
modelColumnIndex = ColumnPtr->GetModelColumn();
}
wxCHECK_MSG(ColumnPtr != NULL,false,_("Could not determine column index."));
modelColumnIndex = ColumnPtr->GetModelColumn();
}
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr;
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr;
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
if (dataViewCtrlPtr->IsDeleting())
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
if (dataViewCtrlPtr->IsDeleting())
// variable definitions:
OSStatus errorStatus;
wxDataViewColumn* dataViewColumnPtr;
// variable definitions:
OSStatus errorStatus;
wxDataViewColumn* dataViewColumnPtr;
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
dataViewColumnPtr = this->GetColumnPtr(propertyID);
wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index."));
wxDataViewItem dvItem(reinterpret_cast<void*>(itemID));
unsigned int col = dataViewColumnPtr->GetModelColumn();
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
dataViewColumnPtr = this->GetColumnPtr(propertyID);
wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index."));
wxDataViewItem dvItem(reinterpret_cast<void*>(itemID));
unsigned int col = dataViewColumnPtr->GetModelColumn();
switch (dataViewColumnPtr->GetRenderer()->GetNativeData()->GetPropertyType())
{
case kDataBrowserCheckboxType:
switch (dataViewColumnPtr->GetRenderer()->GetNativeData()->GetPropertyType())
{
case kDataBrowserCheckboxType:
wxMacCFStringHolder modifiedString(stringReference);
#endif
wxVariant modifiedData(modifiedString.AsString());
wxMacCFStringHolder modifiedString(stringReference);
#endif
wxVariant modifiedData(modifiedString.AsString());
if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
return noErr;
if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
return noErr;
wxVariant variant;
wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr;
wxVariant variant;
wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr;
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
{
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItemDataRef(itemData);
dataViewColumnPtr->GetRenderer()->SetValue(variant);
{
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItemDataRef(itemData);
dataViewColumnPtr->GetRenderer()->SetValue(variant);
- wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->Render(),errDataBrowserNotConfigured,_("Rendering failed."));
+ wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->MacRender(),errDataBrowserNotConfigured,_("Rendering failed."));
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
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
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
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID)));
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID)));
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
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
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
{
// variable definition:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
{
// variable definition:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewCtrlPtr->GetModel()->IsContainer(wxDataViewItem(reinterpret_cast<void*>(itemID))));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewCtrlPtr->GetModel()->IsContainer(wxDataViewItem(reinterpret_cast<void*>(itemID))));
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
{
// initialize wxWidget event:
dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
{
// initialize wxWidget event:
- DataBrowserPropertyID propertyID;
+ DataBrowserPropertyID propertyID;
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
if (this->GetPropertyID(itemData,&propertyID) == noErr)
{
// variable definition and initialization:
DataBrowserTableViewColumnIndex columnIndex;
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
if (this->GetPropertyID(itemData,&propertyID) == noErr)
{
// variable definition and initialization:
DataBrowserTableViewColumnIndex columnIndex;
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
dataViewEvent.SetColumn(columnIndex);
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
dataViewEvent.SetColumn(columnIndex);
- dataViewEvent.SetDataViewColumn(this->GetColumnPtr(propertyID));
+ dataViewEvent.SetDataViewColumn(this->GetColumnPtr(propertyID));
}
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
}
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
case kDataBrowserEditStopped:
{
// initialize wxWidget event:
case kDataBrowserEditStopped:
{
// initialize wxWidget event:
- DataBrowserPropertyID propertyID;
+ DataBrowserPropertyID propertyID;
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
if (this->GetPropertyID(itemData,&propertyID) == noErr)
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
if (this->GetPropertyID(itemData,&propertyID) == noErr)
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
dataViewEvent.SetColumn(columnIndex);
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
dataViewEvent.SetColumn(columnIndex);
- dataViewEvent.SetDataViewColumn(this->GetColumnPtr(propertyID));
+ dataViewEvent.SetDataViewColumn(this->GetColumnPtr(propertyID));
}
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
}
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumnPtr(i);
// variable definition:
UInt16 columnWidth;
wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumnPtr(i);
// variable definition:
UInt16 columnWidth;
wxCHECK_RET(this->GetColumnWidth(columnPtr->GetNativeData()->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
columnPtr->SetWidthVariable(columnWidth);
}
wxCHECK_RET(this->GetColumnWidth(columnPtr->GetNativeData()->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
columnPtr->SetWidthVariable(columnWidth);
}
{
DataBrowserSortOrder sortOrder;
DataBrowserTableViewColumnIndex columnIndex;
{
DataBrowserSortOrder sortOrder;
DataBrowserTableViewColumnIndex columnIndex;
if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetColumnIndex(propertyID,&columnIndex) == noErr))
{
// variable definition and initialization:
if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetColumnIndex(propertyID,&columnIndex) == noErr))
{
// variable definition and initialization:
}
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
}
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
-void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice)
+void
+wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID,
+ DataBrowserPropertyID propertyID,
+ DataBrowserItemState state,
+ Rect const* rectangle,
+ SInt16 WXUNUSED(bitDepth),
+ Boolean WXUNUSED(colorDevice))
{
DataBrowserTableViewColumnIndex columnIndex;
wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr;
{
DataBrowserTableViewColumnIndex columnIndex;
wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr;
wxDataViewCustomRenderer* dataViewCustomRendererPtr;
wxVariant dataToRender;
wxDataViewCustomRenderer* dataViewCustomRendererPtr;
wxVariant dataToRender;
content.right -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
wxDC *dc = dataViewCustomRendererPtr->GetDC();
content.right -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
wxDC *dc = dataViewCustomRendererPtr->GetDC();
int active_border_fudge = 0;
if (dataViewCtrlPtr->HasFocus() && !dataViewCtrlPtr->HasFlag( wxBORDER_NONE ))
active_border_fudge = 1;
else
active_border_fudge = -2;
int active_border_fudge = 0;
if (dataViewCtrlPtr->HasFocus() && !dataViewCtrlPtr->HasFlag( wxBORDER_NONE ))
active_border_fudge = 1;
else
active_border_fudge = -2;
wxRect cellrect( static_cast<int>(rectangle->left + active_border_fudge),
static_cast<int>(rectangle->top + active_border_fudge),
static_cast<int>(1+rectangle->right-rectangle->left),
static_cast<int>(rectangle->bottom-rectangle->top) );
wxRect cellrect( static_cast<int>(rectangle->left + active_border_fudge),
static_cast<int>(rectangle->top + active_border_fudge),
static_cast<int>(1+rectangle->right-rectangle->left),
static_cast<int>(rectangle->bottom-rectangle->top) );
bool is_active = IsControlActive( this->m_controlRef );
if (state == kDataBrowserItemIsSelected)
{
bool is_active = IsControlActive( this->m_controlRef );
if (state == kDataBrowserItemIsSelected)
{
-
- wxColour col( wxMacCreateCGColorFromHITheme( (is_active) ?
+
+ wxColour col( wxMacCreateCGColorFromHITheme( (is_active) ?
kThemeBrushAlternatePrimaryHighlightColor
: kThemeBrushSecondaryHighlightColor ) );
kThemeBrushAlternatePrimaryHighlightColor
: kThemeBrushSecondaryHighlightColor ) );
wxRect rect = cellrect;
Rect itemrect;
GetDataBrowserItemPartBounds( this->m_controlRef, itemID, propertyID,
kDataBrowserPropertyEnclosingPart, &itemrect );
rect.x = itemrect.left-2;
rect.width = itemrect.right-itemrect.left+3;
wxRect rect = cellrect;
Rect itemrect;
GetDataBrowserItemPartBounds( this->m_controlRef, itemID, propertyID,
kDataBrowserPropertyEnclosingPart, &itemrect );
rect.x = itemrect.left-2;
rect.width = itemrect.right-itemrect.left+3;
wxBrush selBrush( col );
wxPen oldpen( dc->GetPen() );
wxBrush oldbrush( dc->GetBrush() );
wxBrush selBrush( col );
wxPen oldpen( dc->GetPen() );
wxBrush oldbrush( dc->GetBrush() );
wxDataViewModel *model = dataViewCtrlPtr->GetModel();
if ((columnIndex == 0) || !model->IsContainer(dataItem) || model->HasContainerColumns(dataItem))
wxDataViewModel *model = dataViewCtrlPtr->GetModel();
if ((columnIndex == 0) || !model->IsContainer(dataItem) || model->HasContainerColumns(dataItem))
// make sure that 'Render' can draw only in the allowed area:
dc->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
// make sure that 'Render' can draw only in the allowed area:
dc->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
- (void) (dataViewCustomRendererPtr->Render( cellrect, dc,
+ (void) (dataViewCustomRendererPtr->Render( cellrect, dc,
((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0)));
dc->DestroyClippingRegion(); // probably not necessary
}
((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0)));
dc->DestroyClippingRegion(); // probably not necessary
}
dataViewCustomRendererPtr->SetDC(NULL);
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemState, Rect const*, SInt16, Boolean) */
dataViewCustomRendererPtr->SetDC(NULL);
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemState, Rect const*, SInt16, Boolean) */
-Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit)
+Boolean
+wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc(
+ DataBrowserItemID WXUNUSED(itemID),
+ DataBrowserPropertyID WXUNUSED(propertyID),
+ CFStringRef WXUNUSED(theString),
+ Rect* WXUNUSED(maxEditTextRect),
+ Boolean* WXUNUSED(shrinkToFit))
{
return false;
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc(DataBrowserItemID, DataBrowserPropertyID, CFStringRef, Rect*, Boolean*) */
{
return false;
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc(DataBrowserItemID, DataBrowserPropertyID, CFStringRef, Rect*, Boolean*) */
wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr;
wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr;
wxDataViewCustomRenderer* dataViewCustomRendererPtr;
wxDataViewCustomRenderer* dataViewCustomRendererPtr;
wxDataViewItem dataViewCustomRendererItem;
wxDataViewItem dataViewCustomRendererItem;
{
// variable definition:
wxRect wxRectangle;
{
// variable definition:
wxRect wxRectangle;
::wxMacNativeToRect(theRect,&wxRectangle);
dataViewCustomRendererPtr->StartEditing(dataViewCustomRendererItem,wxRectangle);
dataViewCtrlPtr->SetCustomRendererItem(dataViewCustomRendererItem);
::wxMacNativeToRect(theRect,&wxRectangle);
dataViewCustomRendererPtr->StartEditing(dataViewCustomRendererItem,wxRectangle);
dataViewCtrlPtr->SetCustomRendererItem(dataViewCustomRendererItem);
ItemReference itemRef;
wxDataObjectComposite* dataObjects;
wxMemoryBuffer buffer;
ItemReference itemRef;
wxDataObjectComposite* dataObjects;
wxMemoryBuffer buffer;
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = this->GetDnDDataObjects(dragRef,itemRef);
// create wxWidget's event:
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = this->GetDnDDataObjects(dragRef,itemRef);
// create wxWidget's event:
Boolean addDragItem;
wxDataViewCtrl* dataViewCtrlPtr;
Boolean addDragItem;
wxDataViewCtrl* dataViewCtrlPtr;
wxDataViewItem dataViewItem;
wxDataViewItem dataViewItem;
// the object a wxDataObjectComposite object is used;
// currently, the composite object only contains a TAB concatenated string of all data:
wxDataObjectComposite* dataObject(new wxDataObjectComposite());
// the object a wxDataObjectComposite object is used;
// currently, the composite object only contains a TAB concatenated string of all data:
wxDataObjectComposite* dataObject(new wxDataObjectComposite());
dataObject->Add(new wxTextDataObject(::ConcatenateDataViewItemValues(dataViewCtrlPtr,dataViewItem)));
dataViewEvent.SetDataObject(dataObject);
// check if event has not been vetoed:
dataObject->Add(new wxTextDataObject(::ConcatenateDataViewItemValues(dataViewCtrlPtr,dataViewItem)));
dataViewEvent.SetDataObject(dataObject);
// check if event has not been vetoed:
{
// constant definition for abbreviational purposes:
size_t const noOfFormats = dataViewEvent.GetDataObject()->GetFormatCount();
{
// constant definition for abbreviational purposes:
size_t const noOfFormats = dataViewEvent.GetDataObject()->GetFormatCount();
if (noOfFormats > 0)
{
// variable definition:
wxDataFormat* dataFormats;
if (noOfFormats > 0)
{
// variable definition:
wxDataFormat* dataFormats;
dataFormats = new wxDataFormat[noOfFormats];
dataViewEvent.GetDataObject()->GetAllFormats(dataFormats,wxDataObject::Get);
for (size_t i=0; i<noOfFormats; ++i)
dataFormats = new wxDataFormat[noOfFormats];
dataViewEvent.GetDataObject()->GetAllFormats(dataFormats,wxDataObject::Get);
for (size_t i=0; i<noOfFormats; ++i)
size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT);
// variable definition and initialization:
wxMemoryBuffer dataObject(dataSize);
size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT);
// variable definition and initialization:
wxMemoryBuffer dataObject(dataSize);
dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize));
dataObject.UngetWriteBuf(dataSize);
if (::AddDragItemFlavor(dragRef,*itemRef,'TEXT',dataObject.GetData(),dataSize,0) != noErr)
dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize));
dataObject.UngetWriteBuf(dataSize);
if (::AddDragItemFlavor(dragRef,*itemRef,'TEXT',dataObject.GetData(),dataSize,0) != noErr)
size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT);
// as there is no direct access to the data copy it to a memory buffer:
wxMemoryBuffer dataObject(dataSize);
size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT);
// as there is no direct access to the data copy it to a memory buffer:
wxMemoryBuffer dataObject(dataSize);
dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize));
dataObject.UngetWriteBuf(dataSize);
// if the data is stored in unicode format the internal representation is utf-8 (not mentioned in the documentation but in the source code);
// DnD uses fixed utf-16 representation -> use the OSX functions for a conversion:
CFDataRef osxData (::CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,reinterpret_cast<UInt8*>(dataObject.GetData()),dataSize,kCFAllocatorNull));
CFStringRef osxString(::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,osxData,kCFStringEncodingUTF8));
dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize));
dataObject.UngetWriteBuf(dataSize);
// if the data is stored in unicode format the internal representation is utf-8 (not mentioned in the documentation but in the source code);
// DnD uses fixed utf-16 representation -> use the OSX functions for a conversion:
CFDataRef osxData (::CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,reinterpret_cast<UInt8*>(dataObject.GetData()),dataSize,kCFAllocatorNull));
CFStringRef osxString(::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,osxData,kCFStringEncodingUTF8));
// the osxString contains now the data and therefore the previously occupied memory can be released and re-used:
::CFRelease(osxData);
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF16,32);
// the osxString contains now the data and therefore the previously occupied memory can be released and re-used:
::CFRelease(osxData);
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF16,32);
ItemReference itemRef;
wxDataObjectComposite* dataObjects;
wxMemoryBuffer buffer;
ItemReference itemRef;
wxDataObjectComposite* dataObjects;
wxMemoryBuffer buffer;
// collect native information:
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = this->GetDnDDataObjects(dragRef,itemRef);
// collect native information:
::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1!
dataObjects = this->GetDnDDataObjects(dragRef,itemRef);
size_t indexFormat;
wxDataFormat* formats;
size_t indexFormat;
wxDataFormat* formats;
// get all formats and check afterwards if the formats are compatible; if they are compatible the preferred format is returned otherwise
// wxDF_INVALID is returned;
// currently compatible types (ordered by priority are):
// get all formats and check afterwards if the formats are compatible; if they are compatible the preferred format is returned otherwise
// wxDF_INVALID is returned;
// currently compatible types (ordered by priority are):
{
// variable definition:
FlavorType flavorDataObject;
{
// variable definition:
FlavorType flavorDataObject;
if (::GetFlavorType(dragRef,itemRef,indexFlavor,&flavorDataObject) == noErr) // GetFlavorType uses a 1 based index!
switch (flavorDataObject)
{
if (::GetFlavorType(dragRef,itemRef,indexFlavor,&flavorDataObject) == noErr) // GetFlavorType uses a 1 based index!
switch (flavorDataObject)
{
// variable definitions:
Size nativeDataSize;
wxMemoryBuffer nativeData;
// variable definitions:
Size nativeDataSize;
wxMemoryBuffer nativeData;
if ((::GetFlavorDataSize(dragRef,itemRef,'TEXT',&nativeDataSize) == noErr) &&
(::GetFlavorData(dragRef,itemRef,'TEXT',nativeData.GetWriteBuf(nativeDataSize),&nativeDataSize,0) == noErr))
{
if ((::GetFlavorDataSize(dragRef,itemRef,'TEXT',&nativeDataSize) == noErr) &&
(::GetFlavorData(dragRef,itemRef,'TEXT',nativeData.GetWriteBuf(nativeDataSize),&nativeDataSize,0) == noErr))
{
{
// variable definition:
Size nativeDataSize;
{
// variable definition:
Size nativeDataSize;
if (::GetFlavorDataSize(dragRef,itemRef,'utxt',&nativeDataSize) == noErr)
{
CFMutableDataRef draggedData;
if (::GetFlavorDataSize(dragRef,itemRef,'utxt',&nativeDataSize) == noErr)
{
CFMutableDataRef draggedData;
draggedData = ::CFDataCreateMutable(kCFAllocatorDefault,nativeDataSize);
::CFDataSetLength(draggedData,nativeDataSize);
if (::GetFlavorData(dragRef,itemRef,'utxt',::CFDataGetMutableBytePtr(draggedData),&nativeDataSize,0) == noErr)
draggedData = ::CFDataCreateMutable(kCFAllocatorDefault,nativeDataSize);
::CFDataSetLength(draggedData,nativeDataSize);
if (::GetFlavorData(dragRef,itemRef,'utxt',::CFDataGetMutableBytePtr(draggedData),&nativeDataSize,0) == noErr)
// convert internally used UTF-16 representation to a UTF-8 representation:
CFDataRef osxData;
CFStringRef osxString;
// convert internally used UTF-16 representation to a UTF-8 representation:
CFDataRef osxData;
CFStringRef osxString;
osxString = ::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,draggedData,kCFStringEncodingUTF16); // BOM character is handled by this function automatically
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF8,32);
if (textDataObject == NULL)
osxString = ::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,draggedData,kCFStringEncodingUTF16); // BOM character is handled by this function automatically
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF8,32);
if (textDataObject == NULL)
wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumnPtr(DataBrowserPropertyID propertyID) const
{
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumnPtr(DataBrowserPropertyID propertyID) const
{
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
if (dataViewCtrlPtr != NULL)
{
size_t const noOfColumns = dataViewCtrlPtr->GetColumnCount();
if (dataViewCtrlPtr != NULL)
{
size_t const noOfColumns = dataViewCtrlPtr->GetColumnCount();
for (size_t i=0; i<noOfColumns; ++i)
if (dataViewCtrlPtr->GetColumnPtr(i)->GetNativeData()->GetPropertyID() == propertyID)
return dataViewCtrlPtr->GetColumnPtr(i);
for (size_t i=0; i<noOfColumns; ++i)
if (dataViewCtrlPtr->GetColumnPtr(i)->GetNativeData()->GetPropertyID() == propertyID)
return dataViewCtrlPtr->GetColumnPtr(i);
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCustomType));
}
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCustomType));
}
-bool wxDataViewCustomRenderer::Render()
+bool wxDataViewCustomRenderer::MacRender()
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserTextType));
}
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserTextType));
}
-bool wxDataViewTextRenderer::Render()
+bool wxDataViewTextRenderer::MacRender()
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << this->GetValue().GetType());
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << this->GetValue().GetType());
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconType));
}
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconType));
}
-bool wxDataViewBitmapRenderer::Render()
+bool wxDataViewBitmapRenderer::MacRender()
// This method returns 'true' if
// - the passed bitmap is valid and it could be assigned to the native data browser;
// - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap.
// This method returns 'true' if
// - the passed bitmap is valid and it could be assigned to the native data browser;
// - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap.
// ---------------------------------------------------------
// wxDataViewIconTextRenderer
// ---------------------------------------------------------
// ---------------------------------------------------------
// wxDataViewIconTextRenderer
// ---------------------------------------------------------
-wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(
+ const wxString& varianttype,
+ wxDataViewCellMode mode,
+ int WXUNUSED(align))
:wxDataViewRenderer(varianttype,mode)
{
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconAndTextType));
}
:wxDataViewRenderer(varianttype,mode)
{
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconAndTextType));
}
-bool wxDataViewIconTextRenderer::Render()
+bool wxDataViewIconTextRenderer::MacRender()
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << this->GetValue().GetType());
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << this->GetValue().GetType());
// ---------------------------------------------------------
// wxDataViewToggleRenderer
// ---------------------------------------------------------
// ---------------------------------------------------------
// wxDataViewToggleRenderer
// ---------------------------------------------------------
-wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+wxDataViewToggleRenderer::wxDataViewToggleRenderer(
+ const wxString& varianttype,
+ wxDataViewCellMode mode,
+ int WXUNUSED(align))
:wxDataViewRenderer(varianttype,mode)
{
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCheckboxType));
}
:wxDataViewRenderer(varianttype,mode)
{
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCheckboxType));
}
-bool wxDataViewToggleRenderer::Render()
+bool wxDataViewToggleRenderer::MacRender()
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Toggle renderer cannot render value; value type: ")) << this->GetValue().GetType());
return (::SetDataBrowserItemDataButtonValue(this->GetNativeData()->GetItemDataRef(),this->GetValue().GetBool()) == noErr);
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Toggle renderer cannot render value; value type: ")) << this->GetValue().GetType());
return (::SetDataBrowserItemDataButtonValue(this->GetNativeData()->GetItemDataRef(),this->GetValue().GetBool()) == noErr);
// ---------------------------------------------------------
// wxDataViewProgressRenderer
// ---------------------------------------------------------
// ---------------------------------------------------------
// wxDataViewProgressRenderer
// ---------------------------------------------------------
-wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString const& label, wxString const& varianttype, wxDataViewCellMode mode, int align)
+wxDataViewProgressRenderer::wxDataViewProgressRenderer(
+ const wxString& WXUNUSED(label),
+ wxString const& varianttype,
+ wxDataViewCellMode mode,
+ int align)
:wxDataViewRenderer(varianttype,mode,align)
{
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserProgressBarType));
}
:wxDataViewRenderer(varianttype,mode,align)
{
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserProgressBarType));
}
-bool wxDataViewProgressRenderer::Render()
+bool wxDataViewProgressRenderer::MacRender()
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Progress renderer cannot render value type; value type: ")) << this->GetValue().GetType());
return ((::SetDataBrowserItemDataMinimum(this->GetNativeData()->GetItemDataRef(), 0) == noErr) &&
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Progress renderer cannot render value type; value type: ")) << this->GetValue().GetType());
return ((::SetDataBrowserItemDataMinimum(this->GetNativeData()->GetItemDataRef(), 0) == noErr) &&
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserDateTimeType));
}
this->SetNativeData(new wxDataViewRendererNativeData(kDataBrowserDateTimeType));
}
-bool wxDataViewDateRenderer::Render()
+bool wxDataViewDateRenderer::MacRender()
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Date renderer cannot render value; value type: ")) << this->GetValue().GetType());
return (::SetDataBrowserItemDataDateTime(this->GetNativeData()->GetItemDataRef(),this->GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan,1904)).GetSeconds().GetLo()) == noErr);
{
wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Date renderer cannot render value; value type: ")) << this->GetValue().GetType());
return (::SetDataBrowserItemDataDateTime(this->GetNativeData()->GetItemDataRef(),this->GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan,1904)).GetSeconds().GetLo()) == noErr);
virtual bool Load(const wxString& fileName);
virtual bool Load(const wxURI& location);
virtual bool Load(const wxString& fileName);
virtual bool Load(const wxURI& location);
+ virtual bool Load(const wxURI& location,
+ const wxURI& WXUNUSED(proxy))
+ {
+ return Load(location);
+ }
virtual bool Play();
virtual bool Pause();
virtual bool Play();
virtual bool Pause();
HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
HIPointConvert( &p, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceView, contentView );
if ( x )
HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
HIPointConvert( &p, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceView, contentView );
if ( x )
}
void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
}
void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
HIPointConvert( &p, kHICoordSpaceView, contentView, kHICoordSpace72DPIGlobal, NULL );
if ( x )
HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
HIPointConvert( &p, kHICoordSpaceView, contentView, kHICoordSpace72DPIGlobal, NULL );
if ( x )
}
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
}
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
if ( !thisWindow->MacDoRedraw( cEvent.GetTicks() ) )
{
// for native controls: call their native paint method
if ( !thisWindow->MacDoRedraw( cEvent.GetTicks() ) )
{
// for native controls: call their native paint method
- if ( !thisWindow->MacIsUserPane() ||
+ if ( !thisWindow->MacIsUserPane() ||
( thisWindow->IsTopLevel() && thisWindow->GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) )
{
if ( thisWindow->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
( thisWindow->IsTopLevel() && thisWindow->GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) )
{
if ( thisWindow->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
#endif
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), static_cast<void*>(thisWindow));
#endif
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), static_cast<void*>(thisWindow));
// remove this as soon as posting the synthesized event works properly
static bool inKillFocusEvent = false ;
// remove this as soon as posting the synthesized event works properly
static bool inKillFocusEvent = false ;
formerFocusWindow = thisWindow;
wxLogTrace(_T("Focus"), _T("focus to be lost(%p)"), static_cast<void*>(thisWindow));
}
formerFocusWindow = thisWindow;
wxLogTrace(_T("Focus"), _T("focus to be lost(%p)"), static_cast<void*>(thisWindow));
}
ControlPartCode previousControlPart = 0;
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
ControlPartCode previousControlPart = 0;
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
#if 1
// TODO test this first, avoid double posts etc...
PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
#if 1
// TODO test this first, avoid double posts etc...
PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
{
wxWindow* wx = wxFindWindowFromWXWidget( (WXWidget) control ) ;
if ( wx )
{
wxWindow* wx = wxFindWindowFromWXWidget( (WXWidget) control ) ;
if ( wx )
wxEventType scrollEvent = wxEVT_NULL;
switch ( partCode )
{
wxEventType scrollEvent = wxEVT_NULL;
switch ( partCode )
{
}
wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ;
}
wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ;
-wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer,
- wxWindowMac* WXUNUSED(parent),
- wxWindowID WXUNUSED(id),
- const wxPoint& pos,
+wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer,
+ wxWindowMac* WXUNUSED(parent),
+ wxWindowID WXUNUSED(id),
+ const wxPoint& pos,
long WXUNUSED(extraStyle))
{
OSStatus err = noErr;
long WXUNUSED(extraStyle))
{
OSStatus err = noErr;
{
verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderAbove, NULL ) );
}
{
verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderAbove, NULL ) );
}
void wxMacControl::Lower()
{
verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderBelow, NULL ) );
void wxMacControl::Lower()
{
verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderBelow, NULL ) );
void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const
{
HIShapeRef rgn = NULL;
void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const
{
HIShapeRef rgn = NULL;
if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr)
{
CGRect cgrect;
HIShapeGetBounds(rgn, &cgrect);
if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr)
{
CGRect cgrect;
HIShapeGetBounds(rgn, &cgrect);
- content = (Rect){ cgrect.origin.y, cgrect.origin.x, cgrect.origin.y+cgrect.size.height, cgrect.origin.x+cgrect.size.width };
+ content = (Rect){ (short)cgrect.origin.y,
+ (short)cgrect.origin.x,
+ (short)(cgrect.origin.y+cgrect.size.height),
+ (short)(cgrect.origin.x+cgrect.size.width) };
height = r.bottom - r.top;
}
height = r.bottom - r.top;
}
-void wxMacControl::SetControlSize( wxWindowVariant variant )
+void wxMacControl::SetControlSize( wxWindowVariant variant )
{
ControlSize size ;
switch ( variant )
{
ControlSize size ;
switch ( variant )
if ( err == errCouldntSetFocus )
return false ;
SetUserFocusWindow(GetControlOwner( m_controlRef ) );
if ( err == errCouldntSetFocus )
return false ;
SetUserFocusWindow(GetControlOwner( m_controlRef ) );
-wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
+wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
{
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
// the content view, so we have to retrieve it explicitly
{
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
// the content view, so we have to retrieve it explicitly
wxMacControl* contentview = new wxMacControl(now , true /*isRootControl*/);
HIViewFindByID( HIViewGetRoot( (WindowRef) now->GetWXWindow() ) , kHIViewWindowContentID ,
contentview->GetControlRefAddr() ) ;
wxMacControl* contentview = new wxMacControl(now , true /*isRootControl*/);
HIViewFindByID( HIViewGetRoot( (WindowRef) now->GetWXWindow() ) , kHIViewWindowContentID ,
contentview->GetControlRefAddr() ) ;
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetColumnPtr(tableColumn);
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItem(item);
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItemCell(cell);
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetColumnPtr(tableColumn);
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItem(item);
dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItemCell(cell);
- (void) dataViewColumnPtr->GetRenderer()->Render();
+ (void) dataViewColumnPtr->GetRenderer()->MacRender();
this->SetNativeData(new wxDataViewRendererNativeData([[wxCustomCell alloc] init]));
}
this->SetNativeData(new wxDataViewRendererNativeData([[wxCustomCell alloc] init]));
}
-bool wxDataViewCustomRenderer::Render()
+bool wxDataViewCustomRenderer::MacRender()
{
[this->GetNativeData()->GetItemCell() setObjectValue:[[[wxCustomRendererObject alloc] initWithRenderer:this
item:this->GetNativeData()->GetItem()
{
[this->GetNativeData()->GetItemCell() setObjectValue:[[[wxCustomRendererObject alloc] initWithRenderer:this
item:this->GetNativeData()->GetItem()
-bool wxDataViewTextRenderer::Render()
+bool wxDataViewTextRenderer::MacRender()
{
if (this->GetValue().GetType() == this->GetVariantType())
{
{
if (this->GetValue().GetType() == this->GetVariantType())
{
-bool wxDataViewBitmapRenderer::Render()
+bool wxDataViewBitmapRenderer::MacRender()
// This method returns 'true' if
// - the passed bitmap is valid and it could be assigned to the native data browser;
// - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap.
// This method returns 'true' if
// - the passed bitmap is valid and it could be assigned to the native data browser;
// - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap.
-bool wxDataViewChoiceRenderer::Render()
+bool wxDataViewChoiceRenderer::MacRender()
{
if (this->GetValue().GetType() == this->GetVariantType())
{
{
if (this->GetValue().GetType() == this->GetVariantType())
{
[dateFormatter release];
}
[dateFormatter release];
}
-bool wxDataViewDateRenderer::Render()
+bool wxDataViewDateRenderer::MacRender()
{
if (this->GetValue().GetType() == this->GetVariantType())
{
{
if (this->GetValue().GetType() == this->GetVariantType())
{
-bool wxDataViewIconTextRenderer::Render()
+bool wxDataViewIconTextRenderer::MacRender()
{
if (this->GetValue().GetType() == this->GetVariantType())
{
{
if (this->GetValue().GetType() == this->GetVariantType())
{
-bool wxDataViewToggleRenderer::Render()
+bool wxDataViewToggleRenderer::MacRender()
{
if (this->GetValue().GetType() == this->GetVariantType())
{
{
if (this->GetValue().GetType() == this->GetVariantType())
{
-bool wxDataViewProgressRenderer::Render()
+bool wxDataViewProgressRenderer::MacRender()
{
if (this->GetValue().GetType() == this->GetVariantType())
{
{
if (this->GetValue().GetType() == this->GetVariantType())
{
-wxVisualAttributes wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
+wxVisualAttributes
+wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
wxVisualAttributes attr;
{
wxVisualAttributes attr;