Call Expand on an item's parent chain in EnsureVisible
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
#include "wx/weakref.h"
|
#include "wx/weakref.h"
|
||||||
|
|
||||||
#if !(defined(__WXGTK20__) || defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
|
#if !(defined(__WXGTK20__) || defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
|
||||||
//#if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
|
// #if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
|
||||||
#define wxHAS_GENERIC_DATAVIEWCTRL
|
#define wxHAS_GENERIC_DATAVIEWCTRL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -717,7 +717,7 @@ public:
|
|||||||
virtual bool IsExpanded( const wxDataViewItem & item ) const = 0;
|
virtual bool IsExpanded( const wxDataViewItem & item ) const = 0;
|
||||||
|
|
||||||
virtual void EnsureVisible( const wxDataViewItem & item,
|
virtual void EnsureVisible( const wxDataViewItem & item,
|
||||||
const wxDataViewColumn *column = NULL ) = 0;
|
const wxDataViewColumn *column = NULL );
|
||||||
virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
|
virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
|
||||||
virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
|
virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
|
||||||
|
|
||||||
@@ -879,7 +879,7 @@ private:
|
|||||||
long m_min,m_max;
|
long m_min,m_max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(wxMAC)
|
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXMAC__)
|
||||||
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
// wxDataViewChoiceRenderer
|
// wxDataViewChoiceRenderer
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
|
|
||||||
#include "wx/weakref.h"
|
#include "wx/weakref.h"
|
||||||
|
#include "wx/vector.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
@@ -895,6 +896,30 @@ const wxDataViewModel* wxDataViewCtrlBase::GetModel() const
|
|||||||
return m_model;
|
return m_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDataViewCtrlBase::EnsureVisible( const wxDataViewItem & item,
|
||||||
|
const wxDataViewColumn *WXUNUSED(column) )
|
||||||
|
{
|
||||||
|
if (!m_model) return;
|
||||||
|
|
||||||
|
wxVector<wxDataViewItem> 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 *
|
wxDataViewColumn *
|
||||||
wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
|
wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
|
||||||
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
|
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
|
||||||
@@ -1275,7 +1300,7 @@ bool wxDataViewSpinRenderer::GetValue( wxVariant &value ) const
|
|||||||
// wxDataViewChoiceRenderer
|
// wxDataViewChoiceRenderer
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
|
||||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(wxMAC)
|
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXMAC__)
|
||||||
|
|
||||||
wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices, wxDataViewCellMode mode, int alignment ) :
|
wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices, wxDataViewCellMode mode, int alignment ) :
|
||||||
wxDataViewCustomRenderer(wxT("string"), mode, alignment )
|
wxDataViewCustomRenderer(wxT("string"), mode, alignment )
|
||||||
|
@@ -3659,6 +3659,8 @@ void wxDataViewCtrl::EnsureVisible( int row, int column )
|
|||||||
|
|
||||||
void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataViewColumn * column )
|
void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataViewColumn * column )
|
||||||
{
|
{
|
||||||
|
wxDataViewCtrlBase::EnsureVisible( item, column );
|
||||||
|
|
||||||
m_clientArea->RecalculateDisplay();
|
m_clientArea->RecalculateDisplay();
|
||||||
|
|
||||||
int row = m_clientArea->GetRowByItem(item);
|
int row = m_clientArea->GetRowByItem(item);
|
||||||
|
@@ -4187,8 +4187,10 @@ void wxDataViewCtrl::UnselectAll()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item,
|
void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item,
|
||||||
const wxDataViewColumn *WXUNUSED(column))
|
const wxDataViewColumn *column)
|
||||||
{
|
{
|
||||||
|
wxDataViewCtrlBase::EnsureVisible(item,column);
|
||||||
|
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
iter.user_data = (gpointer) item.GetID();
|
iter.user_data = (gpointer) item.GetID();
|
||||||
GtkTreePath *path = m_internal->get_path( &iter );
|
GtkTreePath *path = m_internal->get_path( &iter );
|
||||||
|
@@ -1183,6 +1183,8 @@ void wxDataViewCtrl::Collapse(wxDataViewItem const& item)
|
|||||||
|
|
||||||
void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr)
|
void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr)
|
||||||
{
|
{
|
||||||
|
wxDataViewCtrlBase::EnsureVisible(item,columnPtr);
|
||||||
|
|
||||||
if (item.IsOk())
|
if (item.IsOk())
|
||||||
{
|
{
|
||||||
DataBrowserPropertyID propertyID;
|
DataBrowserPropertyID propertyID;
|
||||||
|
Reference in New Issue
Block a user