#include "wx/weakref.h"
#if !(defined(__WXGTK20__) || defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
-//#if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
+// #if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
#define wxHAS_GENERIC_DATAVIEWCTRL
#endif
virtual bool IsExpanded( const wxDataViewItem & item ) const = 0;
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 wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
long m_min,m_max;
};
-#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(wxMAC)
+#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXMAC__)
// -------------------------------------
// wxDataViewChoiceRenderer
#include "wx/choice.h"
#include "wx/weakref.h"
+#include "wx/vector.h"
#ifndef WX_PRECOMP
#include "wx/dc.h"
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 *
wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
// 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 )
void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataViewColumn * column )
{
+ wxDataViewCtrlBase::EnsureVisible( item, column );
+
m_clientArea->RecalculateDisplay();
int row = m_clientArea->GetRowByItem(item);
}
void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item,
- const wxDataViewColumn *WXUNUSED(column))
+ const wxDataViewColumn *column)
{
+ wxDataViewCtrlBase::EnsureVisible(item,column);
+
GtkTreeIter iter;
iter.user_data = (gpointer) item.GetID();
GtkTreePath *path = m_internal->get_path( &iter );
void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr)
{
+ wxDataViewCtrlBase::EnsureVisible(item,columnPtr);
+
if (item.IsOk())
{
DataBrowserPropertyID propertyID;