OSStatus SetHasScrollBars( bool horiz, bool vert );
OSStatus SetHeaderButtonHeight( UInt16 height );
OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle );
+ OSStatus SetIndent(float Indent);
OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height);
OSStatus SetScrollPosition( UInt32 top , UInt32 left );
OSStatus IsUsedPropertyID(DataBrowserPropertyID propertyID) const; // checks if passed property id is used by the control; no error is returned if the id exists
- OSStatus RemoveColumn(DataBrowserTableViewColumnIndex index);
+ OSStatus RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID);
+ OSStatus RemoveColumnByIndex (DataBrowserTableViewColumnIndex index);
OSStatus SetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index);
OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=true);
OSStatus SetSortOrder (DataBrowserSortOrder order);
OSStatus SetSortProperty(DataBrowserPropertyID propertyID);
+//
+// container handling
+//
+ OSStatus CloseContainer(DataBrowserItemID containerID);
+
+ OSStatus OpenContainer(DataBrowserItemID containerID);
+
protected :
//
// callback functions
// implementation
//
virtual bool Render(void); // declared in wxDataViewRenderer but will not be used here, therefore calling this function will
- // return 'false' without having done anything
+ // return 'true' without having done anything
virtual DataBrowserPropertyType GetPropertyType(void) const
{
// wxDataViewToggleRenderer
// ---------------------------------------------------------
+class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewIconTextRenderer(wxString const& varianttype = wxT("wxDataViewIconText"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited functions from wxDataViewRenderer
+//
+ virtual bool Render(void);
+
+//
+// implementation
+//
+ virtual DataBrowserPropertyType GetPropertyType(void) const
+ {
+ return kDataBrowserIconAndTextType;
+ }
+
+protected:
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
{
public:
bool Create(wxWindow *parent, wxWindowID id, wxPoint const& pos=wxDefaultPosition, wxSize const& size=wxDefaultSize, long style=0,
wxValidator const& validator=wxDefaultValidator);
- // inherited methods from 'wxDataViewCtrlBase':
- virtual bool AppendColumn(wxDataViewColumn* columnPtr);
-
- virtual bool AssociateModel(wxDataViewModel* model);
-
virtual wxControl* GetMainWindow(void) // should disappear as it is not of any use for the native implementation
{
return this;
}
+ // inherited methods from 'wxDataViewCtrlBase':
+ virtual bool AssociateModel(wxDataViewModel* model);
+
+ virtual bool AppendColumn(wxDataViewColumn* columnPtr);
+ virtual bool ClearColumns(void);
+ virtual bool DeleteColumn(wxDataViewColumn* columnPtr);
+ virtual wxDataViewColumn* GetColumn(unsigned int pos) const;
+ virtual unsigned int GetColumnCount(void) const;
+
+ virtual void Collapse(wxDataViewItem const& item);
virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr=NULL);
+ virtual void Expand(wxDataViewItem const& item);
virtual wxRect GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const;
virtual wxDataViewItem GetSelection(void) const;
virtual void Unselect(wxDataViewItem const& item);
virtual void UnselectAll(void);
-
-
+
//
// implementation
//
// adds all children of the passed parent to the control; if 'parentItem' is invalid the root(s) is/are added:
void AddChildrenLevel(wxDataViewItem const& parentItem);
+ // returns a pointer to a column;
+ // in case the pointer cannot be found NULL is returned:
+ wxDataViewColumn* GetColumnPtr(DataBrowserPropertyID propertyID) const;
+
// checks if currently a delete process is running:
bool IsDeleting(void) const
{
void OnSize(wxSizeEvent &event);
private:
+ // type definitions:
+ WX_DECLARE_HASH_MAP(DataBrowserPropertyID,wxDataViewColumn*,wxIntegerHash,wxIntegerEqual,ColumnPointerHashMapType);
+
// initializing of local variables:
void Init(void);
void* m_cgContext; // pointer to core graphics context
- wxDataViewModelNotifier* m_NotifierPtr; // the notifier is NOT owned by this class but by the associated model
+ ColumnPointerHashMapType m_ColumnPointers; // all column pointers are stored in a hash map with the property ID as a key
// wxWidget internal stuff:
DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
return ::SetDataBrowserTableViewRowHeight(this->m_controlRef,height);
}
-OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars( bool horiz, bool vert )
+OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars(bool horiz, bool vert)
{
- return SetDataBrowserHasScrollBars(this->m_controlRef, horiz, vert );
-}
+ return ::SetDataBrowserHasScrollBars(this->m_controlRef,horiz,vert);
+} /* wxMacDataBrowserTableViewControl::SetHasScrollBars(bool, bool) */
OSStatus wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16 height)
{
- return SetDataBrowserListViewHeaderBtnHeight(this->m_controlRef, height );
-}
+ return ::SetDataBrowserListViewHeaderBtnHeight(this->m_controlRef,height);
+} /* wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16) */
-OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle )
+OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle(DataBrowserTableViewHiliteStyle hiliteStyle)
{
- return SetDataBrowserTableViewHiliteStyle(this->m_controlRef, hiliteStyle );
-}
+ return ::SetDataBrowserTableViewHiliteStyle(this->m_controlRef,hiliteStyle);
+} /*wxMacDataBrowserTableViewControl::SetHiliteStyle(DataBrowserTableViewHiliteStyle) */
+
+OSStatus wxMacDataBrowserTableViewControl::SetIndent(float Indent)
+{
+ return ::DataBrowserSetMetric(this->m_controlRef,kDataBrowserMetricDisclosureColumnPerDepthGap,true,Indent);
+} /* wxMacDataBrowserTableViewControl::SetIndent(float* Indent) */
OSStatus wxMacDataBrowserTableViewControl::SetRowHeight(DataBrowserItemID item, UInt16 height)
{
return ::GetDataBrowserTableViewColumnPosition(this->m_controlRef,propertyID,&index);
} /* wxMacDataBrowserTableViewControl::IsUsedPropertyId(DataBrowserPropertyID) const */
-OSStatus wxMacDataBrowserTableViewControl::RemoveColumn(DataBrowserTableViewColumnIndex index)
+OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID)
+{
+ return ::RemoveDataBrowserTableViewColumn(this->m_controlRef,propertyID);
+} /* wxMacDataBrowserTableViewControl::RemoveColumnByProperty(DataBrowserTableViewColumnID) */
+
+OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByIndex(DataBrowserTableViewColumnIndex index)
{
DataBrowserTableViewColumnID propertyID;
this->GetPropertyID(index,&propertyID);
return ::RemoveDataBrowserTableViewColumn(this->m_controlRef,propertyID);
-} /* wxMacDataBrowserTableViewControl::RemoveColumn(DataBrowserTableViewColumnIndex) */
+} /* wxMacDataBrowserTableViewControl::RemoveColumnByIndex(DataBrowserTableViewColumnIndex) */
OSStatus wxMacDataBrowserTableViewControl::SetColumnIndex(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index)
{
return ::SetDataBrowserSortProperty(this->m_controlRef,propertyID);
}
+//
+// container handling
+//
+OSStatus wxMacDataBrowserTableViewControl::CloseContainer(DataBrowserItemID containerID)
+{
+ return ::CloseDataBrowserContainer(this->m_controlRef,containerID);
+} /* wxMacDataBrowserTableViewControl::CloseContainer(DataBrowserItemID) */
+
+OSStatus wxMacDataBrowserTableViewControl::OpenContainer(DataBrowserItemID containerID)
+{
+ return ::OpenDataBrowserContainer(this->m_controlRef,containerID);
+} /* wxMacDataBrowserTableViewControl::OpenContainer(DataBrowserItemID) */
+
IMPLEMENT_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl,wxMacControl)
// ============================================================================
if (propertyID >= kMinPropertyID) // in case data columns set the data
{
// variable definitions:
- DataBrowserTableViewColumnIndex columnIndex;
- OSStatus errorStatus;
- wxVariant variant;
- wxDataViewColumn* dataViewColumnPtr;
- wxDataViewCtrl* dataViewCtrlPtr;
+ wxVariant variant;
+ wxDataViewColumn* dataViewColumnPtr;
+ wxDataViewCtrl* dataViewCtrlPtr;
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."));
- errorStatus = this->GetColumnIndex(propertyID,&columnIndex);
- wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Column index does not exist."));
- dataViewColumnPtr = dataViewCtrlPtr->GetColumn(columnIndex);
+ dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
wxCHECK_MSG(dataViewColumnPtr != NULL,errDataBrowserNotConfigured,_("No column for the specified column position existing."));
wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,errDataBrowserNotConfigured,_("No renderer specified for column."));
dataViewCtrlPtr->GetModel()->GetValue(variant,wxDataViewItem(reinterpret_cast<void*>(itemID)),dataViewColumnPtr->GetModelColumn());
- dataViewColumnPtr->GetRenderer()->SetDataReference(itemData);
- dataViewColumnPtr->GetRenderer()->SetValue(variant);
- wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->Render(),errDataBrowserNotConfigured,_("Rendering failed."));
+ if (!(variant.IsNull()))
+ {
+ dataViewColumnPtr->GetRenderer()->SetDataReference(itemData);
+ dataViewColumnPtr->GetRenderer()->SetValue(variant);
+ wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->Render(),errDataBrowserNotConfigured,_("Rendering failed."));
+ } /* if */
return noErr;
} /* if */
else // react on special system requests
+ {
switch (propertyID)
{
case kDataBrowserContainerIsClosableProperty:
// opening the container is allowed if not vetoed:
return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
} /* block */
- return noErr;
case kDataBrowserContainerIsOpenableProperty:
{
// variable definitions:
case kDataBrowserItemIsEditableProperty:
return ::SetDataBrowserItemDataBooleanValue(itemData,true);
} /* switch */
+ } /* if */
} /* if */
return errDataBrowserPropertyNotSupported;
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemDataRef, Boolean) */
-void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef WXUNUSED(itemData))
+void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
{
switch (message)
{
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
+ case kDataBrowserEditStarted:
+ {
+ // variable definitions:
+ wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+
+ if (dataViewCtrlPtr != NULL)
+ {
+ // initialize wxWidget event:
+ DataBrowserPropertyID propertyID;
+ 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;
+
+ wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
+ dataViewEvent.SetColumn(columnIndex);
+ dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));
+ } /* if */
+ // finally send the equivalent wxWidget event:
+ dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+ } /* if */
+ } /* block */
+ break;
+ case kDataBrowserEditStopped:
+ {
+ // variable definitions:
+ wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+
+ if (dataViewCtrlPtr != NULL)
+ {
+ // initialize wxWidget event:
+ DataBrowserPropertyID propertyID;
+ 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)
+ {
+ // variable definition and initialization:
+ DataBrowserTableViewColumnIndex columnIndex;
+
+ wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
+ dataViewEvent.SetColumn(columnIndex);
+ dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));
+ } /* if */
+ // finally send the equivalent wxWidget event:
+ dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+ } /* if */
+ } /* block */
+ break;
case kDataBrowserItemAdded:
{
// variable definitions:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
+ case kDataBrowserItemDeselected:
+ {
+ // variable definitions:
+ wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+
+ if (dataViewCtrlPtr != NULL) // can become NULL if an item is still selected while removing the data browser
+ {
+ // initialize wxWidget event:
+ wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DESELECTED,dataViewCtrlPtr->GetId()); // variable definition
+
+ dataViewEvent.SetEventObject(dataViewCtrlPtr);
+ dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+ // finally send the equivalent wxWidget event:
+ dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+ } /* if */
+ } /* block */
+ break;
case kDataBrowserItemDoubleClicked:
{
// variable definitions:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
+ case kDataBrowserSelectionSetChanged:
+ break;
case kDataBrowserUserStateChanged:
{
DataBrowserPropertyID propertyID;
// ---------------------------------------------------------
#pragma mark -
wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
- :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL)
+ :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL), m_DCPtr(NULL)
{
} /* wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const&, wxDataViewCellMode) */
bool wxDataViewCustomRenderer::Render(void)
{
- return false;
+ return true;
} /* wxDataViewCustomRenderer::Render(void) */
void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr)
IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer)
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+ :wxDataViewRenderer(varianttype,mode)
+{
+}
+
+bool wxDataViewIconTextRenderer::Render(void)
+{
+ wxLogMessage(wxString(_("Types: ")) << this->GetValue().GetType() << wxT(' ') << this->GetVariantType());
+ if (this->GetValue().GetType() == this->GetVariantType())
+ {
+ // variable definition:
+ wxDataViewIconText iconText;
+
+ iconText << this->GetValue();
+
+ // variable definition:
+ wxMacCFStringHolder cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+
+ return ((::SetDataBrowserItemDataIcon(this->GetDataReference(),MAC_WXHICON(iconText.GetIcon().GetHICON())) == noErr) &&
+ (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr));
+ } /* if */
+ else
+ return false;
+} /* wxDataViewIconTextRenderer::Render(void) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer)
+
+
// ---------------------------------------------------------
// wxDataViewToggleRenderer
// ---------------------------------------------------------
{
this->m_Deleting = false;
this->m_macIsUserPane = false;
- this->m_NotifierPtr = NULL;
this->m_cgContext = NULL;
} /* wxDataViewCtrl::Init(void) */
return true;
} /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
+bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model)
+{
+ if (!wxDataViewCtrlBase::AssociateModel(model))
+ return false;
+
+ model->AddNotifier(new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer)));
+
+ return true;
+} /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
+
bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
{
+ DataBrowserPropertyID NewPropertyID;
+
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
// first, some error checking:
+ wxCHECK_MSG(MacDataViewListCtrlPtr != NULL, false,_("m_peer is not or incorrectly initialized"));
wxCHECK_MSG(dataViewColumnPtr != NULL, false,_("Column pointer must not be NULL."));
wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL, false,_("Column does not have a renderer."));
wxCHECK_MSG(this->GetModel() != NULL, false,_("No model associated with control."));
wxCHECK_MSG((dataViewColumnPtr->GetModelColumn() >= 0) &&
(dataViewColumnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
- if (this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr))
+ if ((MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr) && this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr))
{
+ // insert column into hash map:
+ this->m_ColumnPointers.insert(ColumnPointerHashMapType::value_type(NewPropertyID,dataViewColumnPtr));
+
// variable definitions:
- DataBrowserPropertyID NewPropertyID;
- DataBrowserListViewColumnDesc columnDescription;
- wxMacCFStringHolder cfTitle(dataViewColumnPtr->GetTitle(),(this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()));
- wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+ DataBrowserListViewColumnDesc columnDescription;
+ wxMacCFStringHolder cfTitle(dataViewColumnPtr->GetTitle(),(this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()));
// initialize column description:
- wxCHECK_MSG(MacDataViewListCtrlPtr != NULL, false,_("m_peer is not or incorrectly initialized"));
- wxCHECK_MSG(MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr,false,_("Maximum number of columns reached."));
dataViewColumnPtr->SetPropertyID(NewPropertyID);
if (dataViewColumnPtr->GetWidth() <= 0)
dataViewColumnPtr->SetWidth(wxDVC_DEFAULT_WIDTH);
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
#endif
columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
- if (dataViewColumnPtr->IsResizable())
+ if (dataViewColumnPtr->IsResizeable())
{
columnDescription.headerBtnDesc.minimumWidth = 0;
columnDescription.headerBtnDesc.maximumWidth = 30000;
// final adjustments for the layout:
wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,dataViewColumnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
-#if 0
- if (dataViewColumnPtr->IsSortable()) // if the current column is marked sortable this column will become the active sortable column, otherwise don't do anything
- MacDataViewListCtrlPtr->SetSortProperty(NewPropertyID);
-#endif
if (dataViewColumnPtr == this->GetExpanderColumn()) // if the current column is marked expandable this column will become the active expandable column
MacDataViewListCtrlPtr->SetDisclosureColumn(NewPropertyID,true);
return false;
} /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
-bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model)
+bool wxDataViewCtrl::ClearColumns(void)
{
- if (!wxDataViewCtrlBase::AssociateModel(model))
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+ while (this->m_ColumnPointers.begin() != this->m_ColumnPointers.end())
+ {
+ wxCHECK_MSG(MacDataViewListCtrlPtr->RemoveColumnByProperty(this->m_ColumnPointers.begin()->first) == noErr,false,_("Could not remove column."));
+ delete this->m_ColumnPointers.begin()->second;
+ this->m_ColumnPointers.erase(this->m_ColumnPointers.begin());
+ } /* while */
+ return true;
+} /* wxDataViewCtrl::ClearColumns(void) */
+
+bool wxDataViewCtrl::DeleteColumn(wxDataViewColumn* columnPtr)
+{
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+ if ((MacDataViewListCtrlPtr->RemoveColumnByProperty(columnPtr->GetPropertyID()) == noErr) && (this->m_ColumnPointers.erase(columnPtr->GetPropertyID()) > 0))
+ {
+ delete columnPtr;
+ return true;
+ } /* if */
+ else
return false;
+} /* wxDataViewCtrl::DeleteColumn(wxDataViewColumn*) */
+
+wxDataViewColumn* wxDataViewCtrl::GetColumn(unsigned int pos) const
+{
+ DataBrowserPropertyID propertyID;
- this->m_NotifierPtr = new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer));
- model->AddNotifier(this->m_NotifierPtr);
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
- return true;
-} /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
+
+ if (MacDataViewListCtrlPtr->GetPropertyID(pos,&propertyID) == noErr)
+ {
+ // variable definition:
+ ColumnPointerHashMapType::const_iterator Result(this->m_ColumnPointers.find(propertyID));
+
+ if (Result != this->m_ColumnPointers.end())
+ return Result->second;
+ else
+ return NULL;
+ } /* if */
+ else
+ return NULL;
+} /* wxDataViewCtrl::GetColumn(unsigned int pos) const */
+
+unsigned int wxDataViewCtrl::GetColumnCount(void) const
+{
+ return this->m_ColumnPointers.size();
+} /* wxDataViewCtrl::GetColumnCount(void) const */
+
+void wxDataViewCtrl::Collapse(wxDataViewItem const& item)
+{
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+ MacDataViewListCtrlPtr->CloseContainer(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+} /* wxDataViewCtrl::Collapse(wxDataViewItem const&) */
void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr)
{
} /* if */
} /* wxDataViewCtrl::EnsureVisible(wxDataViewItem const&, wxDataViewColumn const*) */
+void wxDataViewCtrl::Expand(wxDataViewItem const& item)
+{
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+ MacDataViewListCtrlPtr->OpenContainer(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+} /* wxDataViewCtrl::Expand(wxDataViewItem const&) */
+
wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
{
if (item.IsOk() && (columnPtr != NULL))
} /* while */
} /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
+wxDataViewColumn* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID propertyID) const
+{
+ // variable definition:
+ ColumnPointerHashMapType::const_iterator Result(this->m_ColumnPointers.find(propertyID));
+
+ if (Result != this->m_ColumnPointers.end())
+ return Result->second;
+ else
+ return NULL;
+} /* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID) const */
+
// inherited methods from wxDataViewCtrlBase
void wxDataViewCtrl::DoSetExpanderColumn(void)
{
- if (this->GetExpanderColumn() < this->GetColumnCount())
+ if (this->GetExpanderColumn() != NULL)
{
// variable definition and initialization:
- DataBrowserPropertyID propertyID;
wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
- if (MacDataViewListCtrlPtr->GetPropertyID(this->GetExpanderColumn(),&propertyID) == noErr)
- (void) MacDataViewListCtrlPtr->SetDisclosureColumn(propertyID);
+ (void) MacDataViewListCtrlPtr->SetDisclosureColumn(this->GetExpanderColumn()->GetPropertyID());
} /* if */
} /* wxDataViewCtrl::DoSetExpanderColumn(void) */
void wxDataViewCtrl::DoSetIndent(void)
{
-} /* wxDataViewCtrl::DoSetExpanderColumn(void) */
+ wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+ (void) MacDataViewListCtrlPtr->SetIndent(static_cast<float>(this->GetIndent()));
+} /* wxDataViewCtrl::DoSetIndent(void) */
// event handling:
void wxDataViewCtrl::OnSize(wxSizeEvent& event)