X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5179bc0bca526f0297d8930838ad4112faa967cd..2ffeccb3b73dbf4424e3ba098e357a2eba36634d:/src/common/datavcmn.cpp?ds=sidebyside diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 47400107e1..949ffa233f 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -22,6 +22,7 @@ #include "wx/choice.h" #include "wx/weakref.h" +#include "wx/vector.h" #ifndef WX_PRECOMP #include "wx/dc.h" @@ -895,6 +896,30 @@ const wxDataViewModel* wxDataViewCtrlBase::GetModel() const return m_model; } +void wxDataViewCtrlBase::ExpandAncestors( const wxDataViewItem & item ) +{ + if (!m_model) return; + + if (!item.IsOk()) return; + + wxVector parentChain; + + // at first we get all the parents of the selected item + wxDataViewItem parent = m_model->GetParent(item); + while (parent.IsOk()) + { + parentChain.push_back(parent); + parent = m_model->GetParent(parent); + } + + // then we expand the parents, starting at the root + while (!parentChain.empty()) + { + Expand(parentChain.back()); + parentChain.pop_back(); + } +} + wxDataViewColumn * wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) @@ -1275,7 +1300,7 @@ bool wxDataViewSpinRenderer::GetValue( wxVariant &value ) const // wxDataViewChoiceRenderer // ------------------------------------- -#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(wxMAC) +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXMAC__) wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices, wxDataViewCellMode mode, int alignment ) : wxDataViewCustomRenderer(wxT("string"), mode, alignment )