MexModel

MexModel — Interface for collections of MexContent

Synopsis

#define             MEX_MODEL_IFACE                     (iface)
#define             MEX_IS_MODEL_IFACE                  (iface)
gint                (*MexModelSortFunc)                 (MexContent *a,
                                                         MexContent *b,
                                                         gpointer userdata);
struct              MexModelIface;
GController *       mex_model_get_controller            (MexModel *model);
MexContent *        mex_model_get_content               (MexModel *model,
                                                         guint index_);
void                mex_model_add_content               (MexModel *model,
                                                         MexContent *content);
void                mex_model_remove_content            (MexModel *model,
                                                         MexContent *content);
void                mex_model_clear                     (MexModel *model);
void                mex_model_set_sort_func             (MexModel *model,
                                                         MexModelSortFunc sort_func,
                                                         gpointer user_data);
guint               mex_model_get_length                (MexModel *model);
gint                mex_model_index                     (MexModel *model,
                                                         MexContent *content);
MexModel *          mex_model_get_model                 (MexModel *model);

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

MEX_MODEL_IFACE()

#define MEX_MODEL_IFACE(iface)      (G_TYPE_CHECK_CLASS_CAST ((iface), MEX_TYPE_MODEL, MexModelIface))

MEX_IS_MODEL_IFACE()

#define MEX_IS_MODEL_IFACE(iface)   (G_TYPE_CHECK_CLASS_TYPE ((iface), MEX_TYPE_MODEL))

MexModelSortFunc ()

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

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 (*remove_content) (MexModel   *model,
                          MexContent *content);
  void (*clear) (MexModel *model);
  void (*set_sort_func) (MexModel         *model,
                         MexModelSortFunc  sort_func,
                         gpointer          user_data);
  guint (*get_length) (MexModel *model);
  gint  (*index)      (MexModel *model, MexContent *content);

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

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_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_add_content ()

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

mex_model_remove_content ()

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

mex_model_clear ()

void                mex_model_clear                     (MexModel *model);

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_get_length ()

guint               mex_model_get_length                (MexModel *model);

mex_model_index ()

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

mex_model_get_model ()

MexModel *          mex_model_get_model                 (MexModel *model);

FIXME

model :

the model

Returns :

the model. [transfer none]

Since 0.2