Emmanuele Bassi > Clutter-0.820 > xs/ClutterModel.xs

Download:
Clutter-0.820.tar.gz

Annotate this POD

CPAN RT

New  3
Open  2
View/Report Bugs
Source   Latest Release: Clutter-1.002

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)
syntax highlighting: