## EReflowModel

EReflowModel

## Synopsis

    struct              EReflowModel;
    void                e_reflow_model_set_width            (EReflowModel *reflow_model,
                                                             gint width);
    gint                e_reflow_model_count                (EReflowModel *reflow_model);
    gint                e_reflow_model_height               (EReflowModel *reflow_model,
                                                             gint n,
                                                             GnomeCanvasGroup *parent);
    GnomeCanvasItem *   e_reflow_model_incarnate            (EReflowModel *reflow_model,
                                                             gint n,
                                                             GnomeCanvasGroup *parent);
    GHashTable *        e_reflow_model_create_cmp_cache     (EReflowModel *reflow_model);
    gint                e_reflow_model_compare              (EReflowModel *reflow_model,
                                                             gint n1,
                                                             gint n2,
                                                             GHashTable *cmp_cache);
    void                e_reflow_model_reincarnate          (EReflowModel *reflow_model,
                                                             gint n,
                                                             GnomeCanvasItem *item);
    void                e_reflow_model_changed              (EReflowModel *reflow_model);
    void                e_reflow_model_comparison_changed   (EReflowModel *reflow_model);
    void                e_reflow_model_items_inserted       (EReflowModel *reflow_model,
                                                             gint position,
                                                             gint count);
    void                e_reflow_model_item_removed         (EReflowModel *reflow_model,
                                                             gint n);
    void                e_reflow_model_item_changed         (EReflowModel *reflow_model,
                                                             gint n);

## Object Hierarchy

      GObject
       +----EReflowModel

## Signals

      "comparison-changed"                             : Run Last
      "model-changed"                                  : Run Last
      "model-item-changed"                             : Run Last
      "model-item-removed"                             : Run Last
      "model-items-inserted"                           : Run Last

## Description

## Details

### struct EReflowModel

    struct EReflowModel;

### e_reflow_model_set_width ()

    void                e_reflow_model_set_width            (EReflowModel *reflow_model,
                                                             gint width);

`reflow_model` : | The e-reflow-model to operate on
`width` : | The new value for the width of each item.

### e_reflow_model_count ()

    gint                e_reflow_model_count                (EReflowModel *reflow_model);

`reflow_model` : | The e-reflow-model to operate on
Returns : | the number of items in the reflow model.

### e_reflow_model_height ()

    gint                e_reflow_model_height               (EReflowModel *reflow_model,
                                                             gint n,
                                                             GnomeCanvasGroup *parent);

`reflow_model` : | The e-reflow-model to operate on
`n` : | The item number to get the height of.
`parent` : | The parent GnomeCanvasItem.
Returns : | the height of the nth item.

### e_reflow_model_incarnate ()

    GnomeCanvasItem *   e_reflow_model_incarnate            (EReflowModel *reflow_model,
                                                             gint n,
                                                             GnomeCanvasGroup *parent);

Create a GnomeCanvasItem to represent the nth piece of data.

`reflow_model` : | The e-reflow-model to operate on
`n` : | The item to create.
`parent` : | The parent GnomeCanvasItem to create a child of.
Returns : | the new GnomeCanvasItem.

### e_reflow_model_create_cmp_cache ()

    GHashTable *        e_reflow_model_create_cmp_cache     (EReflowModel *reflow_model);

Creates a compare cache for quicker sorting. The sorting function may not depend on the cache, but it should benefit from it if available.

`reflow_model` : | The e-reflow-model to operate on
Returns : | Newly created GHashTable with cached compare values. This will be automatically freed with `g_hash_table_destroy()` when no longer needed.

### e_reflow_model_compare ()

    gint                e_reflow_model_compare              (EReflowModel *reflow_model,
                                                             gint n1,
                                                             gint n2,
                                                             GHashTable *cmp_cache);

Compares item n1 and item n2 to see which should come first.

`reflow_model` : | The e-reflow-model to operate on
`n1` : | The first item to compare
`n2` : | The second item to compare
`cmp_cache` : | GHashTable of cached compare values, created by `e_reflow_model_create_cmp_cache()`. This can be NULL, when caching is not available, even when `reflow_model` defines the create_cmp_cache function.
Returns : | strcmp like semantics for the comparison value.

### e_reflow_model_reincarnate ()

    void                e_reflow_model_reincarnate          (EReflowModel *reflow_model,
                                                             gint n,
                                                             GnomeCanvasItem *item);

Update item to represent the nth piece of data.

`reflow_model` : | The e-reflow-model to operate on
`n` : | The item to create.
`item` : | The item to reuse.

### e_reflow_model_changed ()

    void                e_reflow_model_changed              (EReflowModel *reflow_model);

Use this function to notify any views of this reflow model that the contents of the reflow model have changed. This will emit the signal "model_changed" on the `reflow_model` object.

It is preferable to use the `e_reflow_model_item_changed()` signal to notify of smaller changes than to invalidate the entire model, as the views might have ways of caching the information they render from the model.

`reflow_model` : | the reflow model to notify of the change

### e_reflow_model_comparison_changed ()

    void                e_reflow_model_comparison_changed   (EReflowModel *reflow_model);

Use this function to notify any views of this reflow model that the sorting has changed. The actual contents of the items hasn't, so there's no need to re-query the model for the heights of the individual items.

`reflow_model` : | the reflow model to notify of the change

### e_reflow_model_items_inserted ()

    void                e_reflow_model_items_inserted       (EReflowModel *reflow_model,
                                                             gint position,
                                                             gint count);

Use this function to notify any views of the reflow model that a number of items have been inserted.

`reflow_model` : | The model changed.
`position` : | The position the items were insert in.
`count` : | The number of items inserted.

### e_reflow_model_item_removed ()

    void                e_reflow_model_item_removed         (EReflowModel *reflow_model,
                                                             gint n);

Use this function to notify any views of the reflow model that an item has been removed.

`reflow_model` : | The model changed.
`n` : | The position from which the items were removed.

### e_reflow_model_item_changed ()

    void                e_reflow_model_item_changed         (EReflowModel *reflow_model,
                                                             gint n);

Use this function to notify any views of the reflow model that the contents of item `item` have changed in model such that the height has changed or the item needs to be reincarnated. This function will emit the "model_item_changed" signal on the `reflow_model` object

`reflow_model` : | the reflow model to notify of the change
`n` : | the item that was changed in the model.

## Signal Details

### The `"comparison-changed"` signal

    void                user_function                      (EReflowModel *ereflowmodel,
                                                            gpointer      user_data)         : Run Last

### The `"model-changed"` signal

    void                user_function                      (EReflowModel *ereflowmodel,
                                                            gpointer      user_data)         : Run Last

### The `"model-item-changed"` signal

    void                user_function                      (EReflowModel *ereflowmodel,
                                                            gint          arg1,
                                                            gpointer      user_data)         : Run Last

### The `"model-item-removed"` signal

    void                user_function                      (EReflowModel *ereflowmodel,
                                                            gint          arg1,
                                                            gpointer      user_data)         : Run Last

### The `"model-items-inserted"` signal

    void                user_function                      (EReflowModel *ereflowmodel,
                                                            gint          arg1,
                                                            gint          arg2,
                                                            gpointer      user_data)         : Run Last