Class: Clutter::Model

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

Class for Clutter::Model instances.

Direct Known Subclasses

ListModel

Instance Method Summary collapse

Instance Method Details

#append(array) ⇒ nil

Creates and appends a new row to the Clutter::Model, setting the row values upon creation. For example, to append a new row where column 0 is type %G_TYPE_INT and column 1 is of type %G_TYPE_STRING:

ClutterModel *model; model = clutter_model_default_new (2, G_TYPE_INT, "Score", G_TYPE_STRING, "Team"); clutter_model_append (model, 0, 42, 1, "Team #1", -1);

Parameters:

  • array (Array)

    pairs of column number and value, terminated with -1

Returns:

  • (nil)

#appendv(n_columns, columns, values) ⇒ nil

Creates and appends a new row to the Clutter::Model, setting the row values for the given columns upon creation.

Parameters:

  • n_columns (Integer)

    the number of columns and values

  • columns (Array<Integer>)

    a vector with the columns to set

  • values (Array<GObject::Value>)

    a vector with the values

Returns:

  • (nil)

#filter_iter(iter) ⇒ Boolean

Checks whether the row pointer by iter should be filtered or not using the filtering function set on model.

This function should be used only by subclasses of Clutter::Model.

Parameters:

Returns:

  • (Boolean)

    true if the row should be displayed, false otherwise

#filter_row(row) ⇒ Boolean

Checks whether row should be filtered or not using the filtering function set on model.

This function should be used only by subclasses of Clutter::Model.

Parameters:

  • row (Integer)

    the row to filter

Returns:

  • (Boolean)

    true if the row should be displayed, false otherwise

#filter_setBoolean

Returns whether the model has a filter in place, set using clutter_model_set_filter()

Returns:

  • (Boolean)

    true if a filter is set

#filter_set=(filter_set) ⇒ Boolean

Whether the Clutter::Model has a filter set

This property is set to true if a filter function has been set using clutter_model_set_filter()

Parameters:

  • filter_set (Boolean)

Returns:

  • (Boolean)

    filter-set

  • (Boolean)

    filter-set

#filter_set?Boolean

Whether the Clutter::Model has a filter set

This property is set to true if a filter function has been set using clutter_model_set_filter()

Returns:

  • (Boolean)

    filter-set

#first_iterClutter::ModelIter

Retrieves a Clutter::ModelIter representing the first non-filtered row in model.

Returns:

  • (Clutter::ModelIter)

    A new Clutter::ModelIter. Call g_object_unref() when done using it

#foreach(func, user_data) ⇒ nil

Calls func for each row in the model.

Parameters:

  • func (Clutter::ModelForeachFunc)

    a Clutter::ModelForeachFunc

  • user_data (GObject)

    user data to pass to func

Returns:

  • (nil)

#get_column_name(column) ⇒ String

Retrieves the name of the column

Parameters:

  • column (Integer)

    the column number

Returns:

  • (String)

    the name of the column. The model holds the returned string, and it should not be modified or freed

#get_column_type(column) ⇒ GLib::Type

Retrieves the type of the column.

Parameters:

  • column (Integer)

    the column number

Returns:

  • (GLib::Type)

    the type of the column.

#get_iter_at_row(row) ⇒ Clutter::ModelIter

Retrieves a Clutter::ModelIter representing the row at the given index.

If a filter function has been set using clutter_model_set_filter() then the model implementation will return the first non filtered row.

Parameters:

  • row (Integer)

    position of the row to retrieve

Returns:

  • (Clutter::ModelIter)

    A new Clutter::ModelIter, or nil if row was out of bounds. When done using the iterator object, call g_object_unref() to deallocate its resources

#insert(row, array) ⇒ nil

Inserts a new row to the Clutter::Model at row, setting the row values upon creation. For example, to insert a new row at index 100, where column 0 is type %G_TYPE_INT and column 1 is of type %G_TYPE_STRING:

ClutterModel *model; model = clutter_model_default_new (2, G_TYPE_INT, "Score", G_TYPE_STRING, "Team"); clutter_model_insert (model, 3, 0, 42, 1, "Team #1", -1);

Parameters:

  • row (Integer)

    the position to insert the new row

  • array (Array)

    pairs of column number and value, terminated with -1

Returns:

  • (nil)

#insert_value(row, column, value) ⇒ nil

Sets the data in the cell specified by iter and column. The type of value must be convertable to the type of the column. If the row does not exist then it is created.

Parameters:

  • row (Integer)

    position of the row to modify

  • column (Integer)

    column to modify

  • value (GObject::Value)

    new value for the cell

Returns:

  • (nil)

#insertv(row, n_columns, columns, values) ⇒ nil

Inserts data at row into the Clutter::Model, setting the row values for the given columns upon creation.

Parameters:

  • row (Integer)

    row index

  • n_columns (Integer)

    the number of columns and values to set

  • columns (Array<Integer>)

    a vector containing the columns to set

  • values (Array<GObject::Value>)

    a vector containing the values for the cells

Returns:

  • (nil)

#last_iterClutter::ModelIter

Retrieves a Clutter::ModelIter representing the last non-filtered row in model.

Returns:

  • (Clutter::ModelIter)

    A new Clutter::ModelIter. Call g_object_unref() when done using it

#n_columnsInteger

Retrieves the number of columns inside model.

Returns:

  • (Integer)

    the number of columns

#n_rowsInteger

Retrieves the number of rows inside model, eventually taking into account any filtering function set using clutter_model_set_filter().

Returns:

  • (Integer)

    The length of the model. If there is a filter set, then the length of the filtered model is returned.

#prepend(array) ⇒ nil

Creates and prepends a new row to the Clutter::Model, setting the row values upon creation. For example, to prepend a new row where column 0 is type %G_TYPE_INT and column 1 is of type %G_TYPE_STRING:

ClutterModel *model; model = clutter_model_default_new (2, G_TYPE_INT, "Score", G_TYPE_STRING, "Team"); clutter_model_prepend (model, 0, 42, 1, "Team #1", -1);

Parameters:

  • array (Array)

    pairs of column number and value, terminated with -1

Returns:

  • (nil)

#prependv(n_columns, columns, values) ⇒ nil

Creates and prepends a new row to the Clutter::Model, setting the row values for the given columns upon creation.

Parameters:

  • n_columns (Integer)

    the number of columns and values to set

  • columns (Array<Integer>)

    a vector containing the columns to set

  • values (Array<GObject::Value>)

    a vector containing the values for the cells

Returns:

  • (nil)

#remove(row) ⇒ nil

Removes the row at the given position from the model.

Parameters:

  • row (Integer)

    position of row to remove

Returns:

  • (nil)

#resortnil

Force a resort on the model. This function should only be used by subclasses of Clutter::Model.

Returns:

  • (nil)

#set_filter(func, user_data, notify) ⇒ nil

Filters the model using the given filtering function.

Parameters:

  • func (Clutter::ModelFilterFunc)

    a Clutter::ModelFilterFunc, or #NULL

  • user_data (GObject)

    user data to pass to func, or #NULL

  • notify (GLib::DestroyNotify)

    destroy notifier of user_data, or #NULL

Returns:

  • (nil)

#set_names(n_columns, names) ⇒ nil

Assigns a name to the columns of a Clutter::Model.

This function is meant primarily for #GObjects that inherit from Clutter::Model, and should only be used when contructing a #ClutterModel. It will not work after the initial creation of the Clutter::Model.

Parameters:

  • n_columns (Integer)

    the number of column names

  • names (Array<String>)

    an array of strings

Returns:

  • (nil)

#set_sort(column, func, user_data, notify) ⇒ nil

Sorts model using the given sorting function.

Parameters:

  • column (Integer)

    the column to sort on

  • func (Clutter::ModelSortFunc)

    a Clutter::ModelSortFunc, or #NULL

  • user_data (GObject)

    user data to pass to func, or #NULL

  • notify (GLib::DestroyNotify)

    destroy notifier of user_data, or #NULL

Returns:

  • (nil)

#set_types(n_columns, types) ⇒ nil

Sets the types of the columns inside a Clutter::Model.

This function is meant primarily for #GObjects that inherit from Clutter::Model, and should only be used when contructing a #ClutterModel. It will not work after the initial creation of the Clutter::Model.

Parameters:

  • n_columns (Integer)

    number of columns for the model

  • types (Array<GLib::Type>)

    an array of #GType types

Returns:

  • (nil)

#sorting_columnInteger

Retrieves the number of column used for sorting the model.

Returns:

  • (Integer)

    a column number, or -1 if the model is not sorted

#sorting_column=(column) ⇒ nil

Sets the model to sort by column. If column is a negative value the sorting column will be unset.

Parameters:

  • column (Integer)

    the column of the model to sort, or -1

Returns:

  • (nil)