// wxRect renderrect( rect.x, rect.y, rect.width, rect.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 );
unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (treepath)[0];
class wxGtkDataViewListModelNotifier: public wxDataViewListModelNotifier
{
public:
- wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store, wxDataViewListModel *wx_model );
+ wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store,
+ wxDataViewListModel *wx_model,
+ wxDataViewCtrl* ctrl );
+ ~wxGtkDataViewListModelNotifier();
virtual bool RowAppended();
virtual bool RowPrepended();
virtual bool RowsReordered( unsigned int *new_order );
virtual bool Cleared();
- virtual bool Freed()
- {
- m_wx_model = NULL;
- m_gtk_store = NULL;
- return wxDataViewListModelNotifier::Freed();
- }
-
GtkWxListStore *m_gtk_store;
wxDataViewListModel *m_wx_model;
+ wxDataViewCtrl *m_owner;
};
// ---------------------------------------------------------
// ---------------------------------------------------------
wxGtkDataViewListModelNotifier::wxGtkDataViewListModelNotifier(
- GtkWxListStore* gtk_store, wxDataViewListModel *wx_model )
+ GtkWxListStore* gtk_store, wxDataViewListModel *wx_model,
+ wxDataViewCtrl *ctrl )
{
m_gtk_store = gtk_store;
m_wx_model = wx_model;
+ m_owner = ctrl;
+}
+
+wxGtkDataViewListModelNotifier::~wxGtkDataViewListModelNotifier()
+{
+ m_wx_model = NULL;
+ m_gtk_store = NULL;
}
bool wxGtkDataViewListModelNotifier::RowAppended()
bool wxGtkDataViewListModelNotifier::ValueChanged( unsigned int model_col, unsigned int model_row )
{
// This adds GTK+'s missing MVC logic for ValueChanged
- wxObjectList::compatibility_iterator
- node = GetOwner()->m_viewingColumns.GetFirst();
- while (node)
+ unsigned int index;
+ for (index = 0; index < m_owner->GetColumnCount(); index++)
{
- wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
- if (viewing_column->m_modelColumn == model_col)
+ wxDataViewColumn *column = m_owner->GetColumn( index );
+ if (column->GetModelColumn() == model_col)
{
- GtkTreeView *widget = GTK_TREE_VIEW(viewing_column->m_viewColumn->GetOwner()->m_treeview);
- GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(viewing_column->m_viewColumn->GetGtkHandle());
+ GtkTreeView *widget = GTK_TREE_VIEW(m_owner->m_treeview);
+ GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
// Get cell area
GtkTreePath *path = gtk_tree_path_new();
gtk_tree_path_append_index( path, model_row );
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 );
- int ydiff = column->button->allocation.height;
+ GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
+ double d = gtk_adjustment_get_value( hadjust );
+ int xdiff = (int) d;
+
+ int ydiff = gcolumn->button->allocation.height;
// Redraw
gtk_widget_queue_draw_area( GTK_WIDGET(widget),
- cell_area.x, 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;
gtk_tree_path_free (path);
// This adds GTK+'s missing MVC logic for RowsReordered
- wxObjectList::compatibility_iterator
- node = GetOwner()->m_viewingColumns.GetFirst();
- while (node)
- {
- 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();
- }
+ GtkTreeView *widget = GTK_TREE_VIEW(m_owner->m_treeview);
+ // Doesn't work yet...
+ gtk_widget_queue_draw( GTK_WIDGET(widget) );
return true;
}
int align ) :
wxDataViewRenderer( varianttype, mode, align )
{
- m_renderer = (GtkWidget*) gtk_cell_renderer_text_new();
+ m_renderer = (GtkCellRenderer*) gtk_cell_renderer_text_new();
if (mode & wxDATAVIEW_CELL_EDITABLE)
{
int align ) :
wxDataViewRenderer( varianttype, mode, align )
{
- m_renderer = (GtkWidget*) gtk_cell_renderer_pixbuf_new();
+ m_renderer = (GtkCellRenderer*) gtk_cell_renderer_pixbuf_new();
SetMode(mode);
SetAlignment(align);
wxDataViewCellMode mode, int align ) :
wxDataViewRenderer( varianttype, mode, align )
{
- m_renderer = (GtkWidget*) gtk_cell_renderer_toggle_new();
+ m_renderer = (GtkCellRenderer*) gtk_cell_renderer_toggle_new();
if (mode & wxDATAVIEW_CELL_ACTIVATABLE)
{
GtkWxCellRenderer *renderer = (GtkWxCellRenderer *) gtk_wx_cell_renderer_new();
renderer->cell = this;
- m_renderer = (GtkWidget*) renderer;
+ m_renderer = (GtkCellRenderer*) renderer;
SetMode(mode);
SetAlignment(align);
#ifdef __WXGTK26__
if (!gtk_check_version(2,6,0))
{
- m_renderer = (GtkWidget*) gtk_cell_renderer_progress_new();
+ m_renderer = (GtkCellRenderer*) gtk_cell_renderer_progress_new();
GValue gvalue = { 0, };
g_value_init( &gvalue, G_TYPE_STRING );
cell->GetVariantType().c_str() );
cell->SetValue( value );
+
+/*
+ To set the background to this
+
+ wxColour colour(30,100,255);
+ GdkColor *gcol = colour.GetColor();
+
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, GDK_TYPE_COLOR );
+ g_value_set_boxed( &gvalue, gcol );
+ g_object_set_property( G_OBJECT(renderer), "cell-background_gdk", &gvalue );
+ g_value_unset( &gvalue );
+*/
}
IMPLEMENT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
}
else
#endif
+ {
gtk_tree_view_set_rules_hint( GTK_TREE_VIEW(m_treeview), (style & wxDV_HORIZ_RULES) != 0 );
+ }
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
GtkWxListStore *gtk_store = wxgtk_list_store_new();
gtk_store->model = model;
- m_notifier = new wxGtkDataViewListModelNotifier( gtk_store, model );
+ m_notifier = new wxGtkDataViewListModelNotifier( gtk_store, model, this );
model->AddNotifier( m_notifier );