It's slightly less verbose than GetOwner()->GetModel() used all
over the place.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68929
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
const wxString &name = wxT("wxdataviewctrlmainwindow") );
virtual ~wxDataViewMainWindow();
const wxString &name = wxT("wxdataviewctrlmainwindow") );
virtual ~wxDataViewMainWindow();
- bool IsList() const { return GetOwner()->GetModel()->IsListModel(); }
+ bool IsList() const { return GetModel()->IsListModel(); }
bool IsVirtualList() const { return m_root == NULL; }
// notifications from wxDataViewModel
bool IsVirtualList() const { return m_root == NULL; }
// notifications from wxDataViewModel
- g_model = GetOwner()->GetModel();
wxDataViewColumn* col = GetOwner()->GetSortingColumn();
if( !col )
{
wxDataViewColumn* col = GetOwner()->GetSortingColumn();
if( !col )
{
wxDataViewCtrl *GetOwner() { return m_owner; }
const wxDataViewCtrl *GetOwner() const { return m_owner; }
wxDataViewCtrl *GetOwner() { return m_owner; }
const wxDataViewCtrl *GetOwner() const { return m_owner; }
+ wxDataViewModel* GetModel() { return GetOwner()->GetModel(); }
+ const wxDataViewModel* GetModel() const { return GetOwner()->GetModel(); }
+
#if wxUSE_DRAG_AND_DROP
wxBitmap CreateItemBitmap( unsigned int row, int &indent );
#endif // wxUSE_DRAG_AND_DROP
#if wxUSE_DRAG_AND_DROP
wxBitmap CreateItemBitmap( unsigned int row, int &indent );
#endif // wxUSE_DRAG_AND_DROP
wxDataViewItem item = GetItemByRow( row );
wxDataViewItem item = GetItemByRow( row );
- wxDataViewModel *model = GetOwner()->GetModel();
+ wxDataViewModel *model = GetModel();
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() );
event.SetEventObject( m_owner );
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() );
event.SetEventObject( m_owner );
wxDataViewItem item = GetItemByRow( row );
wxDataViewItem item = GetItemByRow( row );
- wxDataViewModel *model = GetOwner()->GetModel();
+ wxDataViewModel *model = GetModel();
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() );
event.SetEventObject( m_owner );
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() );
event.SetEventObject( m_owner );
wxDataViewItem item = GetItemByRow( row );
wxDataViewItem item = GetItemByRow( row );
- wxDataViewModel *model = GetOwner()->GetModel();
+ wxDataViewModel *model = GetModel();
wxCustomDataObject *obj = (wxCustomDataObject *) GetDropTarget()->GetDataObject();
wxCustomDataObject *obj = (wxCustomDataObject *) GetDropTarget()->GetDataObject();
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
- wxDataViewModel *model = GetOwner()->GetModel();
+ wxDataViewModel *model = GetModel();
wxAutoBufferedPaintDC dc( this );
#ifdef __WXMSW__
wxAutoBufferedPaintDC dc( this );
#ifdef __WXMSW__
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
- (wxDataViewVirtualListModel*) GetOwner()->GetModel();
+ (wxDataViewVirtualListModel*) GetModel();
m_count = list_model->GetCount();
}
else
m_count = list_model->GetCount();
}
else
return false;
wxDataViewTreeNode *itemNode = new wxDataViewTreeNode(parentNode, item);
return false;
wxDataViewTreeNode *itemNode = new wxDataViewTreeNode(parentNode, item);
- itemNode->SetHasChildren(GetOwner()->GetModel()->IsContainer(item));
+ itemNode->SetHasChildren(GetModel()->IsContainer(item));
parentNode->SetHasChildren(true);
parentNode->AddChild(itemNode);
parentNode->SetHasChildren(true);
parentNode->AddChild(itemNode);
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
- (wxDataViewVirtualListModel*) GetOwner()->GetModel();
+ (wxDataViewVirtualListModel*) GetModel();
m_count = list_model->GetCount();
if ( !m_selection.empty() )
m_count = list_model->GetCount();
if ( !m_selection.empty() )
// If this was the last child to be removed, it's possible the parent
// node became a leaf. Let's ask the model about it.
if ( parentNode->GetChildNodes().empty() )
// If this was the last child to be removed, it's possible the parent
// node became a leaf. Let's ask the model about it.
if ( parentNode->GetChildNodes().empty() )
- parentNode->SetHasChildren(GetOwner()->GetModel()->IsContainer(parent));
+ parentNode->SetHasChildren(GetModel()->IsContainer(parent));
// If this was the last child to be removed, it's possible the parent
// node became a leaf. Let's ask the model about it.
if ( parentNode->GetChildNodes().empty() )
// If this was the last child to be removed, it's possible the parent
// node became a leaf. Let's ask the model about it.
if ( parentNode->GetChildNodes().empty() )
- parentNode->SetHasChildren(GetOwner()->GetModel()->IsContainer(parent));
+ parentNode->SetHasChildren(GetModel()->IsContainer(parent));
// Update selection by removing 'item' and its entire children tree from the selection.
if ( !m_selection.empty() )
// Update selection by removing 'item' and its entire children tree from the selection.
if ( !m_selection.empty() )
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
le.SetEventObject(parent);
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
le.SetItem(item);
parent->GetEventHandler()->ProcessEvent(le);
le.SetItem(item);
parent->GetEventHandler()->ProcessEvent(le);
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
le.SetEventObject(parent);
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
le.SetItem(item);
le.SetColumn(view_column);
le.SetDataViewColumn(GetOwner()->GetColumn(view_column));
le.SetItem(item);
le.SetColumn(view_column);
le.SetDataViewColumn(GetOwner()->GetColumn(view_column));
m_selection.Clear();
SortPrepare();
m_selection.Clear();
SortPrepare();
- BuildTree( GetOwner()->GetModel() );
+ BuildTree( GetModel() );
GetOwner()->UpdateColBestWidths();
UpdateDisplay();
GetOwner()->UpdateColBestWidths();
UpdateDisplay();
void wxDataViewMainWindow::RecalculateDisplay()
{
void wxDataViewMainWindow::RecalculateDisplay()
{
- wxDataViewModel *model = GetOwner()->GetModel();
+ wxDataViewModel *model = GetModel();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, parent->GetId());
le.SetEventObject(parent);
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, parent->GetId());
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
le.SetItem( item );
parent->GetEventHandler()->ProcessEvent(le);
le.SetItem( item );
parent->GetEventHandler()->ProcessEvent(le);
int wxDataViewMainWindow::GetLineStart( unsigned int row ) const
{
int wxDataViewMainWindow::GetLineStart( unsigned int row ) const
{
- const wxDataViewModel *model = GetOwner()->GetModel();
+ const wxDataViewModel *model = GetModel();
if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
{
if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
{
int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
{
int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
{
- const wxDataViewModel *model = GetOwner()->GetModel();
+ const wxDataViewModel *model = GetModel();
// check for the easy case first
if ( !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
// check for the easy case first
if ( !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const
{
int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const
{
- const wxDataViewModel *model = GetOwner()->GetModel();
+ const wxDataViewModel *model = GetModel();
if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
{
if (GetOwner()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
{
wxDataViewEvent le(type, parent->GetId());
le.SetEventObject(parent);
wxDataViewEvent le(type, parent->GetId());
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
le.SetItem( item );
return !parent->ProcessWindowEvent(le) || le.IsAllowed();
le.SetItem( item );
return !parent->ProcessWindowEvent(le) || le.IsAllowed();
if( node->GetChildNodes().empty() )
{
SortPrepare();
if( node->GetChildNodes().empty() )
{
SortPrepare();
- ::BuildTreeHelper(GetOwner()->GetModel(), node->GetItem(), node);
+ ::BuildTreeHelper(GetModel(), node->GetItem(), node);
}
// By expanding the node all row indices that are currently in the selection list
}
// By expanding the node all row indices that are currently in the selection list
wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item )
{
wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item )
{
- const wxDataViewModel * model = GetOwner()->GetModel();
+ const wxDataViewModel * model = GetModel();
if( model == NULL )
return NULL;
if( model == NULL )
return NULL;
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
- (wxDataViewVirtualListModel*) GetOwner()->GetModel();
+ (wxDataViewVirtualListModel*) GetModel();
return list_model->GetCount();
}
return list_model->GetCount();
}
int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const
{
int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const
{
- const wxDataViewModel * model = GetOwner()->GetModel();
+ const wxDataViewModel * model = GetModel();
if( model == NULL )
return -1;
if( model == NULL )
return -1;
- if (GetOwner()->GetModel()->IsVirtualListModel())
+ if (GetModel()->IsVirtualListModel())
parent->GetId());
le.SetItem( GetItemByRow(m_currentRow) );
le.SetEventObject(parent);
parent->GetId());
le.SetItem( GetItemByRow(m_currentRow) );
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
parent->GetEventHandler()->ProcessEvent(le);
}
parent->GetEventHandler()->ProcessEvent(le);
}
- wxDataViewModel *model = GetOwner()->GetModel();
+ wxDataViewModel *model = GetModel();
#if wxUSE_DRAG_AND_DROP
if (event.Dragging())
#if wxUSE_DRAG_AND_DROP
if (event.Dragging())
le.SetColumn( col->GetModelColumn() );
le.SetDataViewColumn( col );
le.SetEventObject(parent);
le.SetColumn( col->GetModelColumn() );
le.SetDataViewColumn( col );
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
parent->GetEventHandler()->ProcessEvent(le);
}
parent->GetEventHandler()->ProcessEvent(le);
}
le.SetColumn( col->GetModelColumn() );
le.SetDataViewColumn( col );
le.SetEventObject(parent);
le.SetColumn( col->GetModelColumn() );
le.SetDataViewColumn( col );
le.SetEventObject(parent);
- le.SetModel(GetOwner()->GetModel());
+ le.SetModel(GetModel());
le.SetValue(value);
parent->GetEventHandler()->ProcessEvent(le);
}
le.SetValue(value);
parent->GetEventHandler()->ProcessEvent(le);
}