/////////////////////////////////////////////////////////////////////////////
// Name: src/mac/carbon/databrow.cpp
// Purpose: Classes and functions for the Carbon data browser
/////////////////////////////////////////////////////////////////////////////
// Name: src/mac/carbon/databrow.cpp
// Purpose: Classes and functions for the Carbon data browser
// ============================================================================
// wxMacDataBrowserTableViewControl
// ============================================================================
// ============================================================================
// wxMacDataBrowserTableViewControl
// ============================================================================
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)
attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
(void) this->SetAttributes(attributes);
} /* if */
attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
(void) this->SetAttributes(attributes);
} /* if */
if ((style & wxDV_NO_HEADER) != 0)
this->SetHeaderButtonHeight(0);
} /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */
if ((style & wxDV_NO_HEADER) != 0)
this->SetHeaderButtonHeight(0);
} /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */
return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight);
} /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */
return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight);
} /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */
OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes)
{
return ::DataBrowserGetAttributes(this->GetControlRef(),attributes);
} /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */
OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes)
{
return ::DataBrowserGetAttributes(this->GetControlRef(),attributes);
} /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */
OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes)
{
return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes);
} /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */
OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes)
{
return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes);
} /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */
// 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 */
// 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 */
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."));
content.bottom -= wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
content.right -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
content.bottom -= wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
content.right -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
dataViewCustomRendererPtr->GetDC()->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
(void) (dataViewCustomRendererPtr->Render(wxRect(static_cast<int>(rectangle->left),static_cast<int>(rectangle->top),
static_cast<int>(1+rectangle->right-rectangle->left),static_cast<int>(1+rectangle->bottom-rectangle->top)),
dataViewCustomRendererPtr->GetDC()->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
(void) (dataViewCustomRendererPtr->Render(wxRect(static_cast<int>(rectangle->left),static_cast<int>(rectangle->top),
static_cast<int>(1+rectangle->right-rectangle->left),static_cast<int>(1+rectangle->bottom-rectangle->top)),
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
if (dataViewCtrlPtr->IsDeleting())
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
if (dataViewCtrlPtr->IsDeleting())
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
errorStatus = this->GetColumnIndex(propertyID,&columnIndex);
wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Could not determine column index"));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
errorStatus = this->GetColumnIndex(propertyID,&columnIndex);
wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Could not determine column index"));
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
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->GetPeer());
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."));
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)));
// finally send the equivalent wxWidget event:
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
// opening the container is allowed if not vetoed:
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
} /* block */
// opening the container is allowed if not vetoed:
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
} /* block */
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
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:
// opening the container is allowed if not vetoed:
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
} /* block */
// opening the container is allowed if not vetoed:
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
} /* block */
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:
} /* block */
break;
case kDataBrowserContainerOpened:
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
} /* block */
break;
case kDataBrowserContainerOpened:
{
// 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:
// add children to the expanded container:
dataViewCtrlPtr->AddChildrenLevel(wxDataViewItem(reinterpret_cast<void*>(itemID)));
} /* block */
// add children to the expanded container:
dataViewCtrlPtr->AddChildrenLevel(wxDataViewItem(reinterpret_cast<void*>(itemID)));
} /* block */
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.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.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:
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
// finally send the equivalent wxWidget event:
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
// finally send the equivalent wxWidget event:
wxCHECK_RET(this->GetColumnWidth(columnPtr->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
columnPtr->SetWidthVariable(columnWidth);
} /* for */
wxCHECK_RET(this->GetColumnWidth(columnPtr->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
columnPtr->SetWidthVariable(columnWidth);
} /* for */
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:
dataViewEvent.SetColumn(columnIndex);
dataViewEvent.SetDataViewColumn(columnPtr);
// finally send the equivalent wxWidget event:
dataViewEvent.SetColumn(columnIndex);
dataViewEvent.SetDataViewColumn(columnPtr);
// finally send the equivalent wxWidget event:
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */