Removed wxDataViewViewColumn since it is redundant.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -119,14 +119,6 @@ Adds {\it notifier} to the internal list of notifers.
|
|||||||
|
|
||||||
See also \helpref{RemoveNotifier}{wxdataviewlistmodelremovenotifier}.
|
See also \helpref{RemoveNotifier}{wxdataviewlistmodelremovenotifier}.
|
||||||
|
|
||||||
\membersection{wxDataViewListModel::AddViewingColumn}\label{wxdataviewlistmodeladdviewingcolumn}
|
|
||||||
|
|
||||||
\func{void}{AddViewingColumn}{\param{wxDataViewColumn* }{view\_column}, \param{unsigned int }{model\_column}}
|
|
||||||
|
|
||||||
Used internally. Used for maintaining a list of
|
|
||||||
\helpref{wxDataViewColumn}{wxdataviewcolumn} that
|
|
||||||
display a certain column of this model.
|
|
||||||
|
|
||||||
\membersection{wxDataViewListModel::Cleared}\label{wxdataviewlistmodelcleared}
|
\membersection{wxDataViewListModel::Cleared}\label{wxdataviewlistmodelcleared}
|
||||||
|
|
||||||
\func{bool}{virtual Cleared}{\void}
|
\func{bool}{virtual Cleared}{\void}
|
||||||
@@ -171,14 +163,6 @@ Removes the notifier from the list of notifiers.
|
|||||||
|
|
||||||
See also \helpref{AddNotifier}{wxdataviewlistmodeladdnotifier}.
|
See also \helpref{AddNotifier}{wxdataviewlistmodeladdnotifier}.
|
||||||
|
|
||||||
\membersection{wxDataViewListModel::RemoveViewingColumn}\label{wxdataviewlistmodelremoveviewingcolumn}
|
|
||||||
|
|
||||||
\func{void}{RemoveViewingColumn}{\param{wxDataViewColumn* }{column}}
|
|
||||||
|
|
||||||
Used internally. Used for maintaining a list of
|
|
||||||
\helpref{wxDataViewColumn}{wxdataviewcolumn} that
|
|
||||||
display a certain column of this model.
|
|
||||||
|
|
||||||
\membersection{wxDataViewListModel::RowAppended}\label{wxdataviewlistmodelrowappended}
|
\membersection{wxDataViewListModel::RowAppended}\label{wxdataviewlistmodelrowappended}
|
||||||
|
|
||||||
\func{virtual bool}{RowAppended}{\void}
|
\func{virtual bool}{RowAppended}{\void}
|
||||||
|
@@ -119,12 +119,6 @@ public:
|
|||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxDataViewListModel: public wxDataViewModel
|
class WXDLLIMPEXP_ADV wxDataViewListModel: public wxDataViewModel
|
||||||
{
|
{
|
||||||
friend class WXDLLIMPEXP_ADV wxDataViewCtrl;
|
|
||||||
friend class WXDLLIMPEXP_ADV wxDataViewCtrlBase;
|
|
||||||
friend class WXDLLIMPEXP_ADV wxDataViewSortedListModel;
|
|
||||||
friend class WXDLLIMPEXP_ADV wxDataViewColumnBase;
|
|
||||||
friend class WXDLLIMPEXP_ADV wxGtkDataViewListModelNotifier;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxDataViewListModel();
|
wxDataViewListModel();
|
||||||
|
|
||||||
@@ -150,23 +144,17 @@ public:
|
|||||||
virtual bool RowsReordered( unsigned int *new_order );
|
virtual bool RowsReordered( unsigned int *new_order );
|
||||||
virtual bool Cleared();
|
virtual bool Cleared();
|
||||||
|
|
||||||
|
void AddNotifier( wxDataViewListModelNotifier *notifier );
|
||||||
|
void RemoveNotifier( wxDataViewListModelNotifier *notifier );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the user should not delete this class directly: he should use DecRef() instead!
|
// the user should not delete this class directly: he should use DecRef() instead!
|
||||||
virtual ~wxDataViewListModel();
|
virtual ~wxDataViewListModel();
|
||||||
|
|
||||||
// Used internally
|
|
||||||
void AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column );
|
|
||||||
void RemoveViewingColumn( wxDataViewColumn *column );
|
|
||||||
|
|
||||||
void AddNotifier( wxDataViewListModelNotifier *notifier );
|
|
||||||
void RemoveNotifier( wxDataViewListModelNotifier *notifier );
|
|
||||||
|
|
||||||
wxList m_notifiers;
|
wxList m_notifiers;
|
||||||
wxList m_viewingColumns;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewSortedListModel
|
// wxDataViewSortedListModel
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
@@ -32,7 +32,6 @@ const wxChar wxDataViewCtrlNameStr[] = wxT("dataviewCtrl");
|
|||||||
|
|
||||||
wxDataViewListModel::wxDataViewListModel()
|
wxDataViewListModel::wxDataViewListModel()
|
||||||
{
|
{
|
||||||
m_viewingColumns.DeleteContents( true );
|
|
||||||
m_notifiers.DeleteContents( true );
|
m_notifiers.DeleteContents( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,28 +167,6 @@ bool wxDataViewListModel::Cleared()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewListModel::AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column )
|
|
||||||
{
|
|
||||||
m_viewingColumns.Append( new wxDataViewViewingColumn( view_column, model_column ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDataViewListModel::RemoveViewingColumn( wxDataViewColumn *column )
|
|
||||||
{
|
|
||||||
wxList::compatibility_iterator node = m_viewingColumns.GetFirst();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxDataViewViewingColumn* tmp = (wxDataViewViewingColumn*) node->GetData();
|
|
||||||
|
|
||||||
if (tmp->m_viewColumn == column)
|
|
||||||
{
|
|
||||||
m_viewingColumns.DeleteObject( tmp );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDataViewListModel::AddNotifier( wxDataViewListModelNotifier *notifier )
|
void wxDataViewListModel::AddNotifier( wxDataViewListModelNotifier *notifier )
|
||||||
{
|
{
|
||||||
m_notifiers.Append( notifier );
|
m_notifiers.Append( notifier );
|
||||||
@@ -872,11 +849,6 @@ wxDataViewColumnBase::~wxDataViewColumnBase()
|
|||||||
{
|
{
|
||||||
if (m_renderer)
|
if (m_renderer)
|
||||||
delete m_renderer;
|
delete m_renderer;
|
||||||
|
|
||||||
if (GetOwner())
|
|
||||||
{
|
|
||||||
GetOwner()->GetModel()->RemoveViewingColumn( (wxDataViewColumn*) this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDataViewColumnBase::GetFlags() const
|
int wxDataViewColumnBase::GetFlags() const
|
||||||
@@ -1029,7 +1001,6 @@ bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
|
|||||||
{
|
{
|
||||||
m_cols.Append( (wxObject*) col );
|
m_cols.Append( (wxObject*) col );
|
||||||
col->SetOwner( (wxDataViewCtrl*) this );
|
col->SetOwner( (wxDataViewCtrl*) this );
|
||||||
m_model->AddViewingColumn( col, col->GetModelColumn() );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -588,7 +588,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
|
|||||||
// wxRect renderrect( rect.x, rect.y, rect.width, rect.height );
|
// wxRect renderrect( rect.x, rect.y, rect.width, rect.height );
|
||||||
wxRect renderrect( cell_area->x, cell_area->y, cell_area->width, cell_area->height );
|
wxRect renderrect( cell_area->x, cell_area->y, cell_area->width, cell_area->height );
|
||||||
|
|
||||||
wxDataViewListModel *model = cell->GetOwner()->GetOwner()->GetModel();
|
// wxDataViewListModel *model = cell->GetOwner()->GetOwner()->GetModel();
|
||||||
|
|
||||||
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
|
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
|
||||||
unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (treepath)[0];
|
unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (treepath)[0];
|
||||||
@@ -777,7 +777,9 @@ gtk_wx_cell_renderer_activate(
|
|||||||
class wxGtkDataViewListModelNotifier: public wxDataViewListModelNotifier
|
class wxGtkDataViewListModelNotifier: public wxDataViewListModelNotifier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store, wxDataViewListModel *wx_model );
|
wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store,
|
||||||
|
wxDataViewListModel *wx_model,
|
||||||
|
wxDataViewCtrl* ctrl );
|
||||||
~wxGtkDataViewListModelNotifier();
|
~wxGtkDataViewListModelNotifier();
|
||||||
|
|
||||||
virtual bool RowAppended();
|
virtual bool RowAppended();
|
||||||
@@ -791,6 +793,7 @@ public:
|
|||||||
|
|
||||||
GtkWxListStore *m_gtk_store;
|
GtkWxListStore *m_gtk_store;
|
||||||
wxDataViewListModel *m_wx_model;
|
wxDataViewListModel *m_wx_model;
|
||||||
|
wxDataViewCtrl *m_owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
@@ -798,10 +801,12 @@ public:
|
|||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
wxGtkDataViewListModelNotifier::wxGtkDataViewListModelNotifier(
|
wxGtkDataViewListModelNotifier::wxGtkDataViewListModelNotifier(
|
||||||
GtkWxListStore* gtk_store, wxDataViewListModel *wx_model )
|
GtkWxListStore* gtk_store, wxDataViewListModel *wx_model,
|
||||||
|
wxDataViewCtrl *ctrl )
|
||||||
{
|
{
|
||||||
m_gtk_store = gtk_store;
|
m_gtk_store = gtk_store;
|
||||||
m_wx_model = wx_model;
|
m_wx_model = wx_model;
|
||||||
|
m_owner = ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGtkDataViewListModelNotifier::~wxGtkDataViewListModelNotifier()
|
wxGtkDataViewListModelNotifier::~wxGtkDataViewListModelNotifier()
|
||||||
@@ -879,34 +884,31 @@ bool wxGtkDataViewListModelNotifier::RowChanged( unsigned int row )
|
|||||||
bool wxGtkDataViewListModelNotifier::ValueChanged( unsigned int model_col, unsigned int model_row )
|
bool wxGtkDataViewListModelNotifier::ValueChanged( unsigned int model_col, unsigned int model_row )
|
||||||
{
|
{
|
||||||
// This adds GTK+'s missing MVC logic for ValueChanged
|
// This adds GTK+'s missing MVC logic for ValueChanged
|
||||||
wxObjectList::compatibility_iterator
|
unsigned int index;
|
||||||
node = GetOwner()->m_viewingColumns.GetFirst();
|
for (index = 0; index < m_owner->GetColumnCount(); index++)
|
||||||
while (node)
|
|
||||||
{
|
{
|
||||||
wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
|
wxDataViewColumn *column = m_owner->GetColumn( index );
|
||||||
if (viewing_column->m_modelColumn == model_col)
|
if (column->GetModelColumn() == model_col)
|
||||||
{
|
{
|
||||||
GtkTreeView *widget = GTK_TREE_VIEW(viewing_column->m_viewColumn->GetOwner()->m_treeview);
|
GtkTreeView *widget = GTK_TREE_VIEW(m_owner->m_treeview);
|
||||||
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(viewing_column->m_viewColumn->GetGtkHandle());
|
GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
|
||||||
|
|
||||||
// Get cell area
|
// Get cell area
|
||||||
GtkTreePath *path = gtk_tree_path_new();
|
GtkTreePath *path = gtk_tree_path_new();
|
||||||
gtk_tree_path_append_index( path, model_row );
|
gtk_tree_path_append_index( path, model_row );
|
||||||
GdkRectangle cell_area;
|
GdkRectangle cell_area;
|
||||||
gtk_tree_view_get_cell_area( widget, path, column, &cell_area );
|
gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area );
|
||||||
gtk_tree_path_free( path );
|
gtk_tree_path_free( path );
|
||||||
|
|
||||||
GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
|
GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
|
||||||
double d = gtk_adjustment_get_value( hadjust );
|
double d = gtk_adjustment_get_value( hadjust );
|
||||||
int xdiff = (int) d;
|
int xdiff = (int) d;
|
||||||
|
|
||||||
int ydiff = column->button->allocation.height;
|
int ydiff = gcolumn->button->allocation.height;
|
||||||
// Redraw
|
// Redraw
|
||||||
gtk_widget_queue_draw_area( GTK_WIDGET(widget),
|
gtk_widget_queue_draw_area( GTK_WIDGET(widget),
|
||||||
cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height );
|
cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height );
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -921,17 +923,9 @@ bool wxGtkDataViewListModelNotifier::RowsReordered( unsigned int *new_order )
|
|||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
|
|
||||||
// This adds GTK+'s missing MVC logic for RowsReordered
|
// This adds GTK+'s missing MVC logic for RowsReordered
|
||||||
wxObjectList::compatibility_iterator
|
GtkTreeView *widget = GTK_TREE_VIEW(m_owner->m_treeview);
|
||||||
node = GetOwner()->m_viewingColumns.GetFirst();
|
// Doesn't work yet...
|
||||||
while (node)
|
gtk_widget_queue_draw( GTK_WIDGET(widget) );
|
||||||
{
|
|
||||||
wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
|
|
||||||
GtkTreeView *widget = GTK_TREE_VIEW(viewing_column->m_viewColumn->GetOwner()->m_treeview);
|
|
||||||
// Doesn't work yet...
|
|
||||||
gtk_widget_queue_draw( GTK_WIDGET(widget) );
|
|
||||||
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2096,7 +2090,7 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewListModel *model )
|
|||||||
GtkWxListStore *gtk_store = wxgtk_list_store_new();
|
GtkWxListStore *gtk_store = wxgtk_list_store_new();
|
||||||
gtk_store->model = model;
|
gtk_store->model = model;
|
||||||
|
|
||||||
m_notifier = new wxGtkDataViewListModelNotifier( gtk_store, model );
|
m_notifier = new wxGtkDataViewListModelNotifier( gtk_store, model, this );
|
||||||
|
|
||||||
model->AddNotifier( m_notifier );
|
model->AddNotifier( m_notifier );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user