ModelTag


Description:

[ CCode ( cname = "dee_model_register_tag" , simple_generics = true ) ]
public ModelTag (Model model)

Register a new tag on a Model.

A tag is an extra value attached to a given row on a model. The tags are invisible to all that doesn't have the tag handle returned by this method. Model implementations must ensure that @get is an O(1) operation.

Tags can be very useful in associating some extra data to a row in a model and have that automatically synced when the model changes. If you're writing a tiled view for a model you might want to tag each row with the tile widget for that row. That way you have very convenient access to the tile widget given any row in the model.

The private nature of tags and the fact that you can store arbitrary pointers and binary data in them also means that they are not serialized if you utilize a model implementation that exposes the Serializable interface.

Parameters:

this

The model to register a tag on

tag_destroy

Function called when a tagged row is removed from the model. This function will also be called on all tagged rows when the model is finalized.

Returns:

A ModelTag handle that you can use to set and get tags with