# ETableModel

## Name

ETableModel --

## Synopsis

    #define     E_TABLE_MODEL_TYPE
    typedef     ETableModel;
    int         e_table_model_column_count      (ETableModel *e_table_model);
    const char* e_table_model_column_name       (ETableModel *e_table_model,
                                                 int col);
    int         e_table_model_row_count         (ETableModel *e_table_model);
    void*       e_table_model_value_at          (ETableModel *e_table_model,
                                                 int col,
                                                 int row);
    void        e_table_model_set_value_at      (ETableModel *e_table_model,
                                                 int col,
                                                 int row,
                                                 const void *value);
    gboolean    e_table_model_is_cell_editable  (ETableModel *e_table_model,
                                                 int col,
                                                 int row);
    void        e_table_model_append_row        (ETableModel *e_table_model,
                                                 ETableModel *source,
                                                 int row);
    const char* e_table_model_row_sort_group    (ETableModel *e_table_model,
                                                 int row);
    gboolean    e_table_model_has_sort_group    (ETableModel *e_table_model);
    void*       e_table_model_duplicate_value   (ETableModel *e_table_model,
                                                 int col,
                                                 const void *value);
    void        e_table_model_free_value        (ETableModel *e_table_model,
                                                 int col,
                                                 void *value);
    void*       e_table_model_initialize_value  (ETableModel *e_table_model,
                                                 int col);
    gboolean    e_table_model_value_is_empty    (ETableModel *e_table_model,
                                                 int col,
                                                 const void *value);
    char*       e_table_model_value_to_string   (ETableModel *e_table_model,
                                                 int col,
                                                 const void *value);
    void        e_table_model_pre_change        (ETableModel *e_table_model);
    void        e_table_model_changed           (ETableModel *e_table_model);
    void        e_table_model_row_changed       (ETableModel *e_table_model,
                                                 int row);
    void        e_table_model_cell_changed      (ETableModel *e_table_model,
                                                 int col,
                                                 int row);
    void        e_table_model_row_inserted      (ETableModel *e_table_model,
                                                 int row);
    void        e_table_model_row_deleted       (ETableModel *e_table_model,
                                                 int row);

## Object Hierarchy

      GtkObject
       +----ETableModel
             +----ETableOne
             +----ETableSimple
             +----ETableSubset
             +----ETreeModel
             +----GalDefineViewsModel

## Signal Prototypes

    "model-changed"
                void        user_function      (ETableModel *etablemodel,
                                                gpointer user_data);
    "model-pre-change"
                void        user_function      (ETableModel *etablemodel,
                                                gpointer user_data);
    "model-row-changed"
                void        user_function      (ETableModel *etablemodel,
                                                gint arg1,
                                                gpointer user_data);
    "model-cell-changed"
                void        user_function      (ETableModel *etablemodel,
                                                gint arg1,
                                                gint arg2,
                                                gpointer user_data);
    "model-row-inserted"
                void        user_function      (ETableModel *etablemodel,
                                                gint arg1,
                                                gpointer user_data);
    "model-row-deleted"
                void        user_function      (ETableModel *etablemodel,
                                                gint arg1,
                                                gpointer user_data);

## Description

## Details

### E_TABLE_MODEL_TYPE

    #define E_TABLE_MODEL_TYPE        (e_table_model_get_type ())

### ETableModel

    typedef struct {
    	GtkObject   base;
    } ETableModel;

### e_table_model_column_count ()

    int         e_table_model_column_count      (ETableModel *e_table_model);

`e_table_model` : | The e-table-model to operate on
Returns : | the number of columns in the table model.

### e_table_model_column_name ()

    const char* e_table_model_column_name       (ETableModel *e_table_model,
                                                 int col);

`e_table_model` : |
`col` : |
Returns : |

### e_table_model_row_count ()

    int         e_table_model_row_count         (ETableModel *e_table_model);

`e_table_model` : | the e-table-model to operate on
Returns : | the number of rows in the Table model.

### e_table_model_value_at ()

    void*       e_table_model_value_at          (ETableModel *e_table_model,
                                                 int col,
                                                 int row);

`e_table_model` : |
`col` : |
`row` : |

### e_table_model_set_value_at ()

    void        e_table_model_set_value_at      (ETableModel *e_table_model,
                                                 int col,
                                                 int row,
                                                 const void *value);

This function instructs the model to store the value in `data` in the the `e_table_model` at column `col` and row `row`. The `data` typically comes from one of the ECell rendering objects.

There should be an agreement between the Table Model and the user of this function about the data being stored. Typically it will be a pointer to a set of data, or a datum that fits inside a void *.

`e_table_model` : | the table model to operate on.
`col` : | the column where the data will be stored in the model.
`row` : | the row where the data will be stored in the model.
`value` : | the data to be stored.

### e_table_model_is_cell_editable ()

    gboolean    e_table_model_is_cell_editable  (ETableModel *e_table_model,
                                                 int col,
                                                 int row);

`e_table_model` : | the table model to query.
`col` : | column to query.
`row` : | row to query.
Returns : | `TRUE` if the cell in `e_table_model` at `col`,`row` can be edited, `FALSE` otherwise

### e_table_model_append_row ()

    void        e_table_model_append_row        (ETableModel *e_table_model,
                                                 ETableModel *source,
                                                 int row);

`e_table_model` : | the table model to append the a row to.
`source` : |
`row` : |

### e_table_model_row_sort_group ()

    const char* e_table_model_row_sort_group    (ETableModel *e_table_model,
                                                 int row);

`e_table_model` : |
`row` : |
Returns : |

### e_table_model_has_sort_group ()

    gboolean    e_table_model_has_sort_group    (ETableModel *e_table_model);

`e_table_model` : |
Returns : |

### e_table_model_duplicate_value ()

    void*       e_table_model_duplicate_value   (ETableModel *e_table_model,
                                                 int col,
                                                 const void *value);

`e_table_model` : |
`col` : |
`value` : |

### e_table_model_free_value ()

    void        e_table_model_free_value        (ETableModel *e_table_model,
                                                 int col,
                                                 void *value);

`e_table_model` : |
`col` : |
`value` : |

### e_table_model_initialize_value ()

    void*       e_table_model_initialize_value  (ETableModel *e_table_model,
                                                 int col);

`e_table_model` : |
`col` : |

### e_table_model_value_is_empty ()

    gboolean    e_table_model_value_is_empty    (ETableModel *e_table_model,
                                                 int col,
                                                 const void *value);

`e_table_model` : |
`col` : |
`value` : |
Returns : |

### e_table_model_value_to_string ()

    char*       e_table_model_value_to_string   (ETableModel *e_table_model,
                                                 int col,
                                                 const void *value);

`e_table_model` : |
`col` : |
`value` : |
Returns : |

### e_table_model_pre_change ()

    void        e_table_model_pre_change        (ETableModel *e_table_model);

`e_table_model` : |

### e_table_model_changed ()

    void        e_table_model_changed           (ETableModel *e_table_model);

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

It is preferable to use the `e_table_model_row_changed()` and the `e_table_model_cell_changed()` 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.

`e_table_model` : | the table model to notify of the change

### e_table_model_row_changed ()

    void        e_table_model_row_changed       (ETableModel *e_table_model,
                                                 int row);

Use this function to notify any views of the table model that the contents of row `row` have changed in model. This function will emit the "model_row_changed" signal on the `e_table_model` object

`e_table_model` : | the table model to notify of the change
`row` : | the row that was changed in the model.

### e_table_model_cell_changed ()

    void        e_table_model_cell_changed      (ETableModel *e_table_model,
                                                 int col,
                                                 int row);

Use this function to notify any views of the table model that contents of the cell at `col`,`row` has changed. This will emit the "model_cell_changed" signal on the `e_table_model` object

`e_table_model` : | the table model to notify of the change
`col` : | the column.
`row` : | the row

### e_table_model_row_inserted ()

    void        e_table_model_row_inserted      (ETableModel *e_table_model,
                                                 int row);

Use this function to notify any views of the table model that the row `row` has been inserted into the model. This function will emit the "model_rows_inserted" signal on the `e_table_model` object

`e_table_model` : | the table model to notify of the change
`row` : | the row that was inserted into the model.

### e_table_model_row_deleted ()

    void        e_table_model_row_deleted       (ETableModel *e_table_model,
                                                 int row);

Use this function to notify any views of the table model that the row `row` has been deleted from the model. This function will emit the "model_rows_deleted" signal on the `e_table_model` object

`e_table_model` : | the table model to notify of the change
`row` : | the row that was deleted

## Signals

### The "model-changed" signal

    void        user_function                  (ETableModel *etablemodel,
                                                gpointer user_data);

`etablemodel` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The "model-pre-change" signal

    void        user_function                  (ETableModel *etablemodel,
                                                gpointer user_data);

`etablemodel` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The "model-row-changed" signal

    void        user_function                  (ETableModel *etablemodel,
                                                gint arg1,
                                                gpointer user_data);

`etablemodel` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "model-cell-changed" signal

    void        user_function                  (ETableModel *etablemodel,
                                                gint arg1,
                                                gint arg2,
                                                gpointer user_data);

`etablemodel` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.

### The "model-row-inserted" signal

    void        user_function                  (ETableModel *etablemodel,
                                                gint arg1,
                                                gpointer user_data);

`etablemodel` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "model-row-deleted" signal

    void        user_function                  (ETableModel *etablemodel,
                                                gint arg1,
                                                gpointer user_data);

`etablemodel` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.