Resource for building custom models



I have a custom TreeView in which I want to implement both a filter and sorting functionality. Unfortunately Gtk2::TreeStore does not implement Gtk2::TreeModelFilter. Currently, I get around this by overriding the following routine in my custom TreeView.

 

sub set_model

{

    my ($self, $model) = @_;

   

    $self->{model} = $model;

    $self->{filter_model} = Gtk2::TreeModelFilter->new($model);

    $self->{filter_model}->set_visible_func(\&_visible_func, $self);

    $self->{sort_model} = Gtk2::TreeModelSort->new($self->{filter_model});

    $self->Gtk2::TreeView::set_model($self->{sort_model});

}

 

I would like to create a custom model so I don’t need to use this hack. I have looked around for information on this – but it is sparse – and that I do find is not all that informative. Does anyone know of a resource that I can use to learn how to do this?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]