X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f2a8de6e754cbbd6d0d7c216c5b44518fae872e..fc684792c6b050fbfeabbea92e302bc3469d7489:/src/osx/dataview_osx.cpp diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index f2140e4e36..f2d16e61a0 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -2,7 +2,7 @@ // Name: src/osx/dataview_osx.cpp // Purpose: wxDataViewCtrl native mac implementation // Author: -// Id: $Id: dataview_osx.cpp 58317 2009-01-27 +// Id: $Id$ // Copyright: (c) 2009 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -97,8 +97,8 @@ bool wxOSXDataViewModelNotifier::ItemAdded(wxDataViewItem const& parent, wxDataV wxCHECK_MSG(item.IsOk(),false,_("Added item is invalid.")); - noFailureFlag = this->m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,item); - this->AdjustRowHeight(item); + noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,item); + AdjustRowHeight(item); return noFailureFlag; } @@ -108,9 +108,9 @@ bool wxOSXDataViewModelNotifier::ItemsAdded(wxDataViewItem const& parent, wxData // insert all valid items into control: - noFailureFlag = this->m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,items); + noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,items); // adjust row heights: - this->AdjustRowHeights(items); + AdjustRowHeights(items); // done: return noFailureFlag; } @@ -118,18 +118,18 @@ bool wxOSXDataViewModelNotifier::ItemsAdded(wxDataViewItem const& parent, wxData bool wxOSXDataViewModelNotifier::ItemChanged(wxDataViewItem const& item) { wxCHECK_MSG(item.IsOk(), false,_("Changed item is invalid.")); - wxCHECK_MSG(this->GetOwner() != NULL,false,_("Owner not initialized.")); - if (this->m_DataViewCtrlPtr->GetDataViewPeer()->Update(this->GetOwner()->GetParent(item),item)) + wxCHECK_MSG(GetOwner() != NULL,false,_("Owner not initialized.")); + if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item)) { // sent the equivalent wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,this->m_DataViewCtrlPtr->GetId()); + wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId()); - dataViewEvent.SetEventObject(this->m_DataViewCtrlPtr); + dataViewEvent.SetEventObject(m_DataViewCtrlPtr); dataViewEvent.SetItem(item); // sent the equivalent wxWidget event: - this->m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); + m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); // row height may have to be adjusted: - this->AdjustRowHeight(item); + AdjustRowHeight(item); // done return true; } @@ -141,21 +141,21 @@ bool wxOSXDataViewModelNotifier::ItemsChanged(wxDataViewItemArray const& items) { size_t const noOfItems = items.GetCount(); - wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,this->m_DataViewCtrlPtr->GetId()); + wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId()); - dataViewEvent.SetEventObject(this->m_DataViewCtrlPtr); + dataViewEvent.SetEventObject(m_DataViewCtrlPtr); for (size_t indexItem=0; indexItemm_DataViewCtrlPtr->GetDataViewPeer()->Update(this->GetOwner()->GetParent(items[indexItem]),items[indexItem])) + if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(items[indexItem]),items[indexItem])) { // send for all changed items a wxWidget event: dataViewEvent.SetItem(items[indexItem]); - this->m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); + m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); } else return false; // if this location is reached all items have been updated: - this->AdjustRowHeights(items); + AdjustRowHeights(items); // done: return true; } @@ -170,10 +170,10 @@ bool wxOSXDataViewModelNotifier::ItemDeleted(wxDataViewItem const& parent, wxDat // not to be identical because the being edited item might be below the passed item in the hierarchy); // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process // has been started and that variables can currently not be updated even when requested by the system: - this->m_DataViewCtrlPtr->SetDeleting(true); - noFailureFlag = this->m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,item); + m_DataViewCtrlPtr->SetDeleting(true); + noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,item); // enable automatic updating again: - this->m_DataViewCtrlPtr->SetDeleting(false); + m_DataViewCtrlPtr->SetDeleting(false); // done: return noFailureFlag; } @@ -187,11 +187,11 @@ bool wxOSXDataViewModelNotifier::ItemsDeleted(wxDataViewItem const& parent, wxDa // not to be identical because the being edited item might be below the passed item in the hierarchy); // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process // has been started and that variables can currently not be updated even when requested by the system: - this->m_DataViewCtrlPtr->SetDeleting(true); + m_DataViewCtrlPtr->SetDeleting(true); // delete all specified items: - noFailureFlag = this->m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,items); + noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,items); // enable automatic updating again: - this->m_DataViewCtrlPtr->SetDeleting(false); + m_DataViewCtrlPtr->SetDeleting(false); // done: return noFailureFlag; } @@ -199,16 +199,16 @@ bool wxOSXDataViewModelNotifier::ItemsDeleted(wxDataViewItem const& parent, wxDa bool wxOSXDataViewModelNotifier::ValueChanged(wxDataViewItem const& item, unsigned int col) { wxCHECK_MSG(item.IsOk(), false,_("Passed item is invalid.")); - wxCHECK_MSG(this->GetOwner() != NULL,false,_("Owner not initialized.")); - if (this->m_DataViewCtrlPtr->GetDataViewPeer()->Update(this->GetOwner()->GetParent(item),item)) + wxCHECK_MSG(GetOwner() != NULL,false,_("Owner not initialized.")); + if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item)) { - wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,this->m_DataViewCtrlPtr->GetId()); + wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId()); - dataViewEvent.SetEventObject(this->m_DataViewCtrlPtr); + dataViewEvent.SetEventObject(m_DataViewCtrlPtr); dataViewEvent.SetColumn(col); dataViewEvent.SetItem(item); // send the equivalent wxWidget event: - this->m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); + m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); // done return true; } @@ -218,26 +218,26 @@ bool wxOSXDataViewModelNotifier::ValueChanged(wxDataViewItem const& item, unsign bool wxOSXDataViewModelNotifier::Cleared() { - return this->m_DataViewCtrlPtr->GetDataViewPeer()->Reload(); + return m_DataViewCtrlPtr->GetDataViewPeer()->Reload(); } void wxOSXDataViewModelNotifier::Resort() { - this->m_DataViewCtrlPtr->GetDataViewPeer()->Resort(); + m_DataViewCtrlPtr->GetDataViewPeer()->Resort(); } void wxOSXDataViewModelNotifier::AdjustRowHeight(wxDataViewItem const& item) { - if ((this->m_DataViewCtrlPtr->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) != 0) + if ((m_DataViewCtrlPtr->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) != 0) { - wxDataViewModel *model = this->GetOwner(); + wxDataViewModel *model = GetOwner(); int height = 20; // TODO find out standard height - unsigned int num = this->m_DataViewCtrlPtr->GetColumnCount(); + unsigned int num = m_DataViewCtrlPtr->GetColumnCount(); unsigned int col; for (col = 0; col < num; col++) { - wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col)); + wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col)); if (!(column->IsHidden())) { @@ -252,27 +252,27 @@ void wxOSXDataViewModelNotifier::AdjustRowHeight(wxDataViewItem const& item) } } if (height > 20) - this->m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(item,height); + m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(item,height); } } void wxOSXDataViewModelNotifier::AdjustRowHeights(wxDataViewItemArray const& items) { - if ((this->m_DataViewCtrlPtr->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) != 0) + if ((m_DataViewCtrlPtr->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) != 0) { size_t const noOfItems = items.GetCount(); - wxDataViewModel *model = this->GetOwner(); + wxDataViewModel *model = GetOwner(); for (size_t itemIndex=0; itemIndexm_DataViewCtrlPtr->GetColumnCount(); + unsigned int num = m_DataViewCtrlPtr->GetColumnCount(); unsigned int col; for (col = 0; col < num; col++) { - wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col)); + wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col)); if (!(column->IsHidden())) { @@ -287,7 +287,7 @@ void wxOSXDataViewModelNotifier::AdjustRowHeights(wxDataViewItemArray const& ite } } if (height > 20) - this->m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(items[itemIndex],height); + m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(items[itemIndex],height); } } } @@ -298,25 +298,16 @@ void wxOSXDataViewModelNotifier::AdjustRowHeights(wxDataViewItemArray const& ite // dependent methods can be found in the environment's // source file. // --------------------------------------------------------- -wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) +wxDataViewCustomRenderer::~wxDataViewCustomRenderer() { - delete this->m_DCPtr; -} - -void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state ) -{ - wxDataViewCtrl *view = GetOwner()->GetOwner(); - - wxColour col = (state & wxDATAVIEW_CELL_SELECTED) ? *wxWHITE : view->GetForegroundColour(); - dc->SetTextForeground(col); - dc->DrawText( text, cell.x + xoffset, cell.y + ((cell.height - dc->GetCharHeight()) / 2)); + delete m_DCPtr; } wxDC* wxDataViewCustomRenderer::GetDC() { - if ((this->m_DCPtr == NULL) && (this->GetOwner() != NULL) && (this->GetOwner()->GetOwner() != NULL)) - this->m_DCPtr = new wxClientDC(this->GetOwner()->GetOwner()); - return this->m_DCPtr; + if ((m_DCPtr == NULL) && (GetOwner() != NULL) && (GetOwner()->GetOwner() != NULL)) + m_DCPtr = new wxClientDC(GetOwner()->GetOwner()); + return m_DCPtr; } void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr) @@ -325,23 +316,13 @@ void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr) m_DCPtr = newDCPtr; } -// --------------------------------------------------------- -// wxDataViewTextRendererAttr -// --------------------------------------------------------- -wxDataViewTextRendererAttr::wxDataViewTextRendererAttr(wxString const& varianttype, wxDataViewCellMode mode, int align) - :wxDataViewTextRenderer(varianttype,mode,align) -{ -} - -IMPLEMENT_CLASS(wxDataViewTextRendererAttr,wxDataViewTextRenderer) - //----------------------------------------------------------------------------- // wxDataViewCtrl //----------------------------------------------------------------------------- wxDataViewCtrl::~wxDataViewCtrl() { - this->ClearColumns(); + ClearColumns(); } void wxDataViewCtrl::Init() @@ -352,20 +333,26 @@ void wxDataViewCtrl::Init() m_cgContext = NULL; } -bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator ) +bool wxDataViewCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) { - if (!(this->wxControl::Create(parent,id,pos,size,style & ~(wxHSCROLL | wxVSCROLL),validator))) + if (!(wxControl::Create(parent,id,pos,size,style,validator,name))) return false; - m_peer = ::CreateDataView(this,parent,id,pos,size,style,this->GetExtraStyle()); + m_peer = ::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle()); - this->MacPostControlCreate(pos,size); + MacPostControlCreate(pos,size); return true; } bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model) { - wxDataViewWidgetImpl* dataViewWidgetPtr(this->GetDataViewPeer()); + wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); wxCHECK_MSG(dataViewWidgetPtr != NULL,false,_("Pointer to native control must not be NULL.")); @@ -391,35 +378,35 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr) bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) { - wxDataViewWidgetImpl* dataViewWidgetPtr(this->GetDataViewPeer()); + wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); // first, some error checking: wxCHECK_MSG(dataViewWidgetPtr != NULL, false,_("Pointer to native control must not be NULL.")); wxCHECK_MSG(columnPtr != NULL, false,_("Column pointer must not be NULL.")); wxCHECK_MSG(columnPtr->GetRenderer() != NULL, false,_("Column does not have a renderer.")); - wxCHECK_MSG(this->GetModel() != NULL, false,_("No model associated with control.")); + wxCHECK_MSG(GetModel() != NULL, false,_("No model associated with control.")); wxCHECK_MSG((columnPtr->GetModelColumn() >= 0) && - (columnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model.")); + (columnPtr->GetModelColumn() < GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model.")); // add column to wxWidget's internal structure: - if (this->wxDataViewCtrlBase::InsertColumn(pos,columnPtr)) + if (wxDataViewCtrlBase::InsertColumn(pos,columnPtr)) { - this->m_ColumnPtrs.Add(columnPtr); + m_ColumnPtrs.Add(columnPtr); // if the insertion in the native control is successful the rest can also be initialized: if (dataViewWidgetPtr->InsertColumn(pos,columnPtr)) { // make sure that the data is up-to-date... // if the newly appended column is the first column add the initial data to the control and mark the column as an expander column, // otherwise ask the control to 'update' the data in the newly appended column: - if (this->GetColumnCount() == 1) - this->SetExpanderColumn(columnPtr); + if (GetColumnCount() == 1) + SetExpanderColumn(columnPtr); // done: return true; } else { // clean-up: - this->m_ColumnPtrs.Remove(columnPtr); + m_ColumnPtrs.Remove(columnPtr); delete columnPtr; // and send a message in debug mode: wxFAIL_MSG(_("Column could not be added to native control.")); @@ -439,9 +426,9 @@ bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) bool wxDataViewCtrl::ClearColumns() { - if (this->GetDataViewPeer()->ClearColumns()) + if (GetDataViewPeer()->ClearColumns()) { - WX_CLEAR_ARRAY(this->m_ColumnPtrs); + WX_CLEAR_ARRAY(m_ColumnPtrs); return true; } else @@ -450,9 +437,9 @@ bool wxDataViewCtrl::ClearColumns() bool wxDataViewCtrl::DeleteColumn(wxDataViewColumn* columnPtr) { - if (this->GetDataViewPeer()->DeleteColumn(columnPtr)) + if (GetDataViewPeer()->DeleteColumn(columnPtr)) { - this->m_ColumnPtrs.Remove(columnPtr); + m_ColumnPtrs.Remove(columnPtr); delete columnPtr; return true; } @@ -462,57 +449,67 @@ bool wxDataViewCtrl::DeleteColumn(wxDataViewColumn* columnPtr) wxDataViewColumn* wxDataViewCtrl::GetColumn(unsigned int pos) const { - return this->GetDataViewPeer()->GetColumn(pos); + return GetDataViewPeer()->GetColumn(pos); } unsigned int wxDataViewCtrl::GetColumnCount() const { - return this->m_ColumnPtrs.GetCount(); + return m_ColumnPtrs.GetCount(); } int wxDataViewCtrl::GetColumnPosition(wxDataViewColumn const* columnPtr) const { - return this->GetDataViewPeer()->GetColumnPosition(columnPtr); + return GetDataViewPeer()->GetColumnPosition(columnPtr); } void wxDataViewCtrl::Collapse(wxDataViewItem const& item) { - this->GetDataViewPeer()->Collapse(item); + GetDataViewPeer()->Collapse(item); } void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) { if (item.IsOk()) { - this->ExpandAncestors(item); // make sure that the item exists in the control - this->GetDataViewPeer()->EnsureVisible(item,columnPtr); + ExpandAncestors(item); // make sure that the item exists in the control + GetDataViewPeer()->EnsureVisible(item,columnPtr); } } void wxDataViewCtrl::Expand(wxDataViewItem const& item) { - return this->GetDataViewPeer()->Expand(item); + return GetDataViewPeer()->Expand(item); } bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const { - return (item.IsOk() && this->GetDataViewPeer()->IsExpanded(item)); + return (item.IsOk() && GetDataViewPeer()->IsExpanded(item)); } wxDataViewColumn* wxDataViewCtrl::GetSortingColumn() const { - return this->GetDataViewPeer()->GetSortingColumn(); + return GetDataViewPeer()->GetSortingColumn(); } unsigned int wxDataViewCtrl::GetCount() const { - return this->GetDataViewPeer()->GetCount(); + return GetDataViewPeer()->GetCount(); +} + +wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const +{ + return GetDataViewPeer()->GetCurrentItem(); +} + +void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item) +{ + GetDataViewPeer()->SetCurrentItem(item); } wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const { if (item.IsOk() && (columnPtr != NULL)) - return this->GetDataViewPeer()->GetRectangle(item,columnPtr); + return GetDataViewPeer()->GetRectangle(item,columnPtr); else return wxRect(); } @@ -522,7 +519,7 @@ wxDataViewItem wxDataViewCtrl::GetSelection() const wxDataViewItemArray itemIDs; - if (this->GetDataViewPeer()->GetSelections(itemIDs) > 0) + if (GetDataViewPeer()->GetSelections(itemIDs) > 0) return itemIDs[0]; else return wxDataViewItem(); @@ -530,31 +527,31 @@ wxDataViewItem wxDataViewCtrl::GetSelection() const int wxDataViewCtrl::GetSelections(wxDataViewItemArray& sel) const { - return this->GetDataViewPeer()->GetSelections(sel); + return GetDataViewPeer()->GetSelections(sel); } void wxDataViewCtrl::HitTest(wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const { - return this->GetDataViewPeer()->HitTest(point,item,columnPtr); + return GetDataViewPeer()->HitTest(point,item,columnPtr); } bool wxDataViewCtrl::IsSelected(wxDataViewItem const& item) const { - return this->GetDataViewPeer()->IsSelected(item); + return GetDataViewPeer()->IsSelected(item); } void wxDataViewCtrl::Select(wxDataViewItem const& item) { if (item.IsOk()) { - this->ExpandAncestors(item); // make sure that the item exists in the control - this->GetDataViewPeer()->Select(item); + ExpandAncestors(item); // make sure that the item exists in the control + GetDataViewPeer()->Select(item); } } -void wxDataViewCtrl::SelectAll(void) +void wxDataViewCtrl::SelectAll() { - this->GetDataViewPeer()->SelectAll(); + GetDataViewPeer()->SelectAll(); } void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel) @@ -570,15 +567,15 @@ void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel) for (i = 0; i < noOfSelections; i++) { wxDataViewItem item = sel[i]; - wxDataViewItem parent = this->GetModel()->GetParent( item ); + wxDataViewItem parent = GetModel()->GetParent( item ); if (parent.IsOk() && (parent != last_parent)) - this->ExpandAncestors(item); + ExpandAncestors(item); last_parent = parent; } // finally select the items: - wxDataViewWidgetImpl* dataViewWidgetPtr(this->GetDataViewPeer()); // variable definition for abbreviational purposes + wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); // variable definition for abbreviational purposes for (i=0; iSelect(sel[i]); @@ -587,20 +584,20 @@ void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel) void wxDataViewCtrl::Unselect(wxDataViewItem const& item) { if (item.IsOk()) - this->GetDataViewPeer()->Unselect(item); + GetDataViewPeer()->Unselect(item); } -void wxDataViewCtrl::UnselectAll(void) +void wxDataViewCtrl::UnselectAll() { - this->GetDataViewPeer()->UnselectAll(); + GetDataViewPeer()->UnselectAll(); } // // implementation // -wxDataViewWidgetImpl* wxDataViewCtrl::GetDataViewPeer(void) const +wxDataViewWidgetImpl* wxDataViewCtrl::GetDataViewPeer() const { - return dynamic_cast(this->GetPeer()); + return dynamic_cast(GetPeer()); } void wxDataViewCtrl::AddChildren(wxDataViewItem const& parentItem) @@ -610,18 +607,18 @@ void wxDataViewCtrl::AddChildren(wxDataViewItem const& parentItem) wxDataViewItemArray items; - wxCHECK_RET(this->GetModel() != NULL,_("Model pointer not initialized.")); - noOfChildren = this->GetModel()->GetChildren(parentItem,items); - (void) this->GetModel()->ItemsAdded(parentItem,items); + wxCHECK_RET(GetModel() != NULL,_("Model pointer not initialized.")); + noOfChildren = GetModel()->GetChildren(parentItem,items); + (void) GetModel()->ItemsAdded(parentItem,items); } -void wxDataViewCtrl::FinishCustomItemEditing(void) +void wxDataViewCtrl::FinishCustomItemEditing() { - if (this->GetCustomRendererItem().IsOk()) + if (GetCustomRendererItem().IsOk()) { - this->GetCustomRendererPtr()->FinishEditing(); - this->SetCustomRendererItem(wxDataViewItem()); - this->SetCustomRendererPtr (NULL); + GetCustomRendererPtr()->FinishEditing(); + SetCustomRendererItem(wxDataViewItem()); + SetCustomRendererPtr (NULL); } } @@ -633,7 +630,8 @@ wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); - attr.font.CreateSystemFont(wxOSX_SYSTEM_FONT_VIEWS); + static wxFont font = wxFont(wxOSX_SYSTEM_FONT_VIEWS); + attr.font = font; return attr; } @@ -641,25 +639,25 @@ wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) // inherited methods from wxDataViewCtrlBase void wxDataViewCtrl::DoSetExpanderColumn() { - if (this->GetExpanderColumn() != NULL) - this->GetDataViewPeer()->DoSetExpanderColumn(this->GetExpanderColumn()); + if (GetExpanderColumn() != NULL) + GetDataViewPeer()->DoSetExpanderColumn(GetExpanderColumn()); } void wxDataViewCtrl::DoSetIndent() { - this->GetDataViewPeer()->DoSetIndent(this->GetIndent()); + GetDataViewPeer()->DoSetIndent(GetIndent()); } // event handling: void wxDataViewCtrl::OnSize(wxSizeEvent& event) { - unsigned int const noOfColumns = this->GetColumnCount(); + unsigned int const noOfColumns = GetColumnCount(); // reset DC of all custom renderers because DC has changed: for (unsigned int i=0; iGetColumn(i)); + wxDataViewColumn* dataViewColumnPtr(GetColumn(i)); if (dataViewColumnPtr != NULL) { @@ -671,7 +669,7 @@ void wxDataViewCtrl::OnSize(wxSizeEvent& event) } // update the layout of the native control after a size event: - this->GetDataViewPeer()->OnSize(); + GetDataViewPeer()->OnSize(); event.Skip(); }