DESCRIPTION
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.
HIERARCHY
Glib::Object +----Clutter::Model
METHODS
boolean = $model->append ($column, $value, ...)
- ... (list)
string or undef = $model->get_column_name ($column)
- $column (integer)
string = $model->get_column_type ($column)
- $column (integer)
boolean = $model->filter_iter ($iter)
- $iter (Clutter::Model::Iter)
boolean = $model->filter_row ($row)
- $row (integer)
$model->set_filter ($func, $data=undef)
- $func (scalar)
- $data (scalar)
iter = $model->get_first_iter
$model->foreach ($func, $data=undef)
- $func (scalar)
- $data (scalar)
$model->insert ($row, $column, $value, ...)
- $row (integer)
- ... (list)
iter = $model->get_iter_at_row ($row)
- $row (integer)
iter = $model->get_last_iter
integer = $model->get_n_columns
integer = $model->get_n_rows
boolean = $model->prepend ($column, $value, ...)
- ... (list)
$model->remove ($row)
- $row (integer)
$model->resort
$model->set_sort ($column, $func, $data=undef)
- $column (integer)
- $func (scalar)
- $data (scalar)
integer = $model->get_sorting_column
$model->set_sorting_column ($column)
- $column (integer)
CREATING A CUSTOM MODEL
MODEL
package MyModel; use Clutter; use Glib::Object::Subclass 'Clutter::Model';
- rows = GET_N_ROWS ($model)
- columns = GET_N_COLUMNS ($model)
- type = GET_COLUMN_TYPE ($model)
- name = GET_COLUMN_NAME ($model)
- iterator = INSERT_ROW ($model, $position)
-
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); }
- REMOVE_ROW ($model, $position)
- iterator = GET_ITER_AT_ROW ($model, $position)
ITERATORS
package MyModel::Iter; use Clutter; use MyModel; use Glib::Object::Subclass 'Clutter::Model::Iter';
- boolean = IS_LAST ($iter)
- NEXT ($iter)
- boolean = IS_FIRST ($iter)
- PREV ($iter)
- model = GET_MODEL ($iter)
- row = GET_ROW ($iter)
- value = GET_VALUE ($iter, $column)
- SET_VALUE ($iter, $column, $value)
PROPERTIES
- 'filter-set' (boolean : readable / private)
- Whether the model has a filter
SIGNALS
- row-added (Clutter::Model, Clutter::Model::Iter)
- row-removed (Clutter::Model, Clutter::Model::Iter)
- row-changed (Clutter::Model, Clutter::Model::Iter)
- sort-changed (Clutter::Model)
- filter-changed (Clutter::Model)
COPYRIGHT
Copyright (C) 2006, 2007, 2008 OpenedHand LtdCopyright (C) 2009 Intel Corporation
This module is free software; you can redistribute it and/or modify it under the terms of either:
- the GNU Lesser General Public Library version 2.1; or
- the Artistic License, version 2.0.
See Clutter for the full copyright notice.