
Clutter::Model is a generic list model API which can be used to implement the model-view-controller architectural pattern in Clutter.
Clutter::Model provides the base API for manipulating and iterating over strongly typed storages.


package MyModel;
use Clutter;
use Glib::Object::Subclass
'Clutter::Model';
sub INSERT_ROW {
my ($model, $position) = @_;
if ($position > 0) {
# if position is a positive integer, set at the given position
@{$model->{data}}[$position] = { col1 => undef, col2 => "Default", };
}
elsif ($position == 0) {
# if position is zero, then prepend
}
else {
# if position is a negative integer, then append
push @{$model->{data}}, { col1 => undef, col2 => undef, };
$position = scalar @{$model->{data}};
}
# return the iterator for the new row
return Glib::Object->new('MyModel::Iter',
model => $model,
row => $position);
}
package MyModel::Iter;
use Clutter;
use MyModel;
use Glib::Object::Subclass
'Clutter::Model::Iter';