MexModel

MexModel — Interface for collections of MexContent

Synopsis

struct              MexModelIface;
gint                (*MexModelSortFunc)                 (MexContent *a,
                                                         MexContent *b,
                                                         gpointer userdata);
void                mex_model_add                       (MexModel *model,
                                                         GList *content);
void                mex_model_add_content               (MexModel *model,
                                                         MexContent *content);
void                mex_model_clear                     (MexModel *model);
MexContent *        mex_model_get_content               (MexModel *model,
                                                         guint index_);
GController *       mex_model_get_controller            (MexModel *model);
guint               mex_model_get_length                (MexModel *model);
MexModel *          mex_model_get_model                 (MexModel *model);
gint                mex_model_index                     (MexModel *model,
                                                         MexContent *content);
gboolean            mex_model_is_sorted                 (MexModel *model);
void                mex_model_remove_content            (MexModel *model,
                                                         MexContent *content);
void                mex_model_set_sort_func             (MexModel *model,
                                                         MexModelSortFunc sort_func,
                                                         gpointer user_data);
gchar *             mex_model_to_string                 (MexModel *model,
                                                         MexDebugVerbosity verbosity);

Description

A class can implement MexModel to provide generic access to a collection of MexContent objects, with optional sorting and filtering.

The interface also provides access to the GController for a model, which advertises changes to the model via signals.

Details

struct MexModelIface

struct MexModelIface {
  GTypeInterface g_iface;

  /* virtual functions */
  GController *   (*get_controller)   (MexModel *model);
  MexContent *    (*get_content)      (MexModel *model,
                                       guint     index_);
  void (*add_content) (MexModel   *model,
                       MexContent *content);
  void (*add) (MexModel *model,
               GList    *content_list);
  void (*remove_content) (MexModel   *model,
                          MexContent *content);
  void (*clear) (MexModel *model);
  void (*set_sort_func) (MexModel         *model,
                         MexModelSortFunc  sort_func,
                         gpointer          user_data);
  gboolean (*is_sorted) (MexModel *model);
  guint (*get_length) (MexModel *model);
  gint  (*index)      (MexModel *model, MexContent *content);

  MexModel *(*get_model) (MexModel *model);
};

MexModelSortFunc ()

gint                (*MexModelSortFunc)                 (MexContent *a,
                                                         MexContent *b,
                                                         gpointer userdata);

mex_model_add ()

void                mex_model_add                       (MexModel *model,
                                                         GList *content);

mex_model_add_content ()

void                mex_model_add_content               (MexModel *model,
                                                         MexContent *content);

mex_model_clear ()

void                mex_model_clear                     (MexModel *model);

mex_model_get_content ()

MexContent *        mex_model_get_content               (MexModel *model,
                                                         guint index_);

Retrieves the MexContent object at position index_ for this model.

model :

a MexModel

index_ :

a position

Returns :

A GController. Call g_object_unref() on the controller once finished with it. [transfer full]

Since 0.2


mex_model_get_controller ()

GController *       mex_model_get_controller            (MexModel *model);

Retrieves the GController object for this model.

model :

a MexModel

Returns :

A GController. Call g_object_unref() on the controller once finished with it. [transfer full]

Since 0.2


mex_model_get_length ()

guint               mex_model_get_length                (MexModel *model);

mex_model_get_model ()

MexModel *          mex_model_get_model                 (MexModel *model);

FIXME

model :

the model

Returns :

the model. [transfer none]

Since 0.2


mex_model_index ()

gint                mex_model_index                     (MexModel *model,
                                                         MexContent *content);

mex_model_is_sorted ()

gboolean            mex_model_is_sorted                 (MexModel *model);

mex_model_remove_content ()

void                mex_model_remove_content            (MexModel *model,
                                                         MexContent *content);

mex_model_set_sort_func ()

void                mex_model_set_sort_func             (MexModel *model,
                                                         MexModelSortFunc sort_func,
                                                         gpointer user_data);

model :

the model to sort

sort_func :

the function to sort the model with. [scope call]

user_data :

data given to sort_func when called

Since 0.2


mex_model_to_string ()

gchar *             mex_model_to_string                 (MexModel *model,
                                                         MexDebugVerbosity verbosity);

model :

the model

verbosity :

the verbosity of the dump

Returns :

a string representation of the model

Since 0.2