## ECell ECell |

## Synopsis

    struct              ECell;
    struct              ECellView;
    ECellView *         e_cell_new_view                     (ECell *ecell,
                                                             ETableModel *table_model,
                                                             gpointer e_table_item_view);
    void                e_cell_kill_view                    (ECellView *ecell_view);
    enum                ECellFlags;
    enum                ECellActions;
    gint                e_cell_event                        (ECellView *ecell_view,
                                                             GdkEvent *event,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             ECellFlags flags,
                                                             ECellActions *actions);
    void                e_cell_realize                      (ECellView *ecell_view);
    void                e_cell_unrealize                    (ECellView *ecell_view);
    void                e_cell_draw                         (ECellView *ecell_view,
                                                             cairo_t *cr,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             ECellFlags flags,
                                                             gint x1,
                                                             gint y1,
                                                             gint x2,
                                                             gint y2);
    void                e_cell_print                        (ECellView *ecell_view,
                                                             GtkPrintContext *context,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gdouble width,
                                                             gdouble height);
    gdouble             e_cell_print_height                 (ECellView *ecell_view,
                                                             GtkPrintContext *context,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gdouble width);
    gint                e_cell_max_width                    (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col);
    gint                e_cell_max_width_by_row             (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row);
    gboolean            e_cell_max_width_by_row_implemented (ECellView *ecell_view);
    gchar *             e_cell_get_bg_color                 (ECellView *ecell_view,
                                                             gint row);
    void                e_cell_style_set                    (ECellView *ecell_view,
                                                             GtkStyle *previous_style);
    void                e_cell_focus                        (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gint x1,
                                                             gint y1,
                                                             gint x2,
                                                             gint y2);
    void                e_cell_unfocus                      (ECellView *ecell_view);
    gint                e_cell_height                       (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row);
    gpointer            e_cell_enter_edit                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row);
    void                e_cell_leave_edit                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer edit_context);
    gpointer            e_cell_save_state                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer edit_context);
    void                e_cell_load_state                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer edit_context,
                                                             gpointer save_state);
    void                e_cell_free_state                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer save_state);

## Object Hierarchy

      GObject
       +----ECell
             +----ECellToggle
             +----ECellPopup
             +----ECellText
             +----ECellHbox
             +----ECellPixbuf
             +----ECellTree
             +----ECellVbox

## Description

## Details

### struct ECell

    struct ECell;

### struct ECellView

    struct ECellView {
    	ECell *ecell;
    	ETableModel *e_table_model;
    	void        *e_table_item_view;

    	gint   focus_x1, focus_y1, focus_x2, focus_y2;
    	gint   focus_col, focus_row;

    	void  (*kill_view_cb) (struct _ECellView *, gpointer);
    	GList *kill_view_cb_data;
    };

### e_cell_new_view ()

    ECellView *         e_cell_new_view                     (ECell *ecell,
                                                             ETableModel *table_model,
                                                             gpointer e_table_item_view);

ECell renderers new to be bound to a table_model and to the actual view during their life time to actually render the data. This method is invoked by the ETableItem canvas item to instatiate a new view of the ECell.

This is invoked when the ETableModel is attached to the ETableItem (a CanvasItem that can render ETableModels in the screen).

`ecell` : | the Ecell that will create the new view
`table_model` : | the table model the ecell is bound to
`e_table_item_view` : | an ETableItem object (the CanvasItem that reprensents the view of the table)
Returns : | a new ECellView for this `ecell` on the `table_model` displayed on the `e_table_item_view`.

### e_cell_kill_view ()

    void                e_cell_kill_view                    (ECellView *ecell_view);

This method it used to destroy a view of an ECell renderer

`ecell_view` : | view to be destroyed.

### enum ECellFlags

    typedef enum {
    	E_CELL_SELECTED = 1 << 0,

    	E_CELL_JUSTIFICATION = 3 << 1,
    	E_CELL_JUSTIFY_CENTER = 0 << 1,
    	E_CELL_JUSTIFY_LEFT = 1 << 1,
    	E_CELL_JUSTIFY_RIGHT = 2 << 1,
    	E_CELL_JUSTIFY_FILL = 3 << 1,

    	E_CELL_ALIGN_LEFT = 1 << 1,
    	E_CELL_ALIGN_RIGHT = 1 << 2,

    	E_CELL_FOCUSED = 1 << 3,

    	E_CELL_EDITING = 1 << 4,

    	E_CELL_CURSOR = 1 << 5,

    	E_CELL_PREEDIT = 1 << 6
    } ECellFlags;

`E_CELL_SELECTED` |
`E_CELL_JUSTIFICATION` |
`E_CELL_JUSTIFY_CENTER` |
`E_CELL_JUSTIFY_LEFT` |
`E_CELL_JUSTIFY_RIGHT` |
`E_CELL_JUSTIFY_FILL` |
`E_CELL_ALIGN_LEFT` |
`E_CELL_ALIGN_RIGHT` |
`E_CELL_FOCUSED` |
`E_CELL_EDITING` |
`E_CELL_CURSOR` |
`E_CELL_PREEDIT` |

### enum ECellActions

    typedef enum {
    	E_CELL_GRAB = 1 << 0,
    	E_CELL_UNGRAB = 1 << 1
    } ECellActions;

`E_CELL_GRAB` |
`E_CELL_UNGRAB` |

### e_cell_event ()

    gint                e_cell_event                        (ECellView *ecell_view,
                                                             GdkEvent *event,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             ECellFlags flags,
                                                             ECellActions *actions);

Dispatches the event `event` to the `ecell_view` for.

`ecell_view` : | The ECellView where the event will be dispatched
`event` : | The GdkEvent.
`model_col` : | the column in the model
`view_col` : | the column in the view
`row` : | the row
`flags` : | flags about the current state
`actions` : | a second return value in case the cell wants to take some action (specifically grabbing & ungrabbing)
Returns : | processing state from the GdkEvent handling.

### e_cell_realize ()

    void                e_cell_realize                      (ECellView *ecell_view);

This function is invoked to give a chance to the ECellView to allocate any resources it needs from Gdk, equivalent to the GtkWidget::realize signal.

`ecell_view` : | The ECellView to be realized.

### e_cell_unrealize ()

    void                e_cell_unrealize                    (ECellView *ecell_view);

This function is invoked to give a chance to the ECellView to release any resources it allocated during the realize method, equivalent to the GtkWidget::unrealize signal.

`ecell_view` : | The ECellView to be unrealized.

### e_cell_draw ()

    void                e_cell_draw                         (ECellView *ecell_view,
                                                             cairo_t *cr,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             ECellFlags flags,
                                                             gint x1,
                                                             gint y1,
                                                             gint x2,
                                                             gint y2);

This instructs the ECellView to render itself into the Cairo context. The region to be drawn in given by (x1,y1)-(x2,y2).

The most important flags are `E_CELL_SELECTED` and `E_CELL_FOCUSED`, other flags include alignments and justifications.

`ecell_view` : | the ECellView to redraw
`cr` : | a Cairo context
`model_col` : | the column in the model being drawn.
`view_col` : | the column in the view being drawn (what the model maps to).
`row` : | the row being drawn
`flags` : | rendering flags.
`x1` : | boudary for the rendering
`y1` : | boudary for the rendering
`x2` : | boudary for the rendering
`y2` : | boudary for the rendering

### e_cell_print ()

    void                e_cell_print                        (ECellView *ecell_view,
                                                             GtkPrintContext *context,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gdouble width,
                                                             gdouble height);

FIXME:

### e_cell_print_height ()

    gdouble             e_cell_print_height                 (ECellView *ecell_view,
                                                             GtkPrintContext *context,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gdouble width);

### e_cell_max_width ()

    gint                e_cell_max_width                    (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col);

`ecell_view` : | the ECellView that will leave editing
`model_col` : | the column in the model
`view_col` : | the column in the view.
Returns : | the maximum width for the ECellview at `model_col` which is being rendered as `view_col`

### e_cell_max_width_by_row ()

    gint                e_cell_max_width_by_row             (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row);

`ecell_view` : | the ECellView that we are curious about
`model_col` : | the column in the model
`view_col` : | the column in the view.
`row` : | The row in the model.
Returns : | the maximum width for the ECellview at `model_col` which is being rendered as `view_col` for the data in `row`.

### e_cell_max_width_by_row_implemented ()

    gboolean            e_cell_max_width_by_row_implemented (ECellView *ecell_view);

`ecell_view` : | the ECellView that we are curious about
Returns : | the maximum width for the ECellview at `model_col` which is being rendered as `view_col` for the data in `row`.

### e_cell_get_bg_color ()

    gchar *             e_cell_get_bg_color                 (ECellView *ecell_view,
                                                             gint row);

### e_cell_style_set ()

    void                e_cell_style_set                    (ECellView *ecell_view,
                                                             GtkStyle *previous_style);

### e_cell_focus ()

    void                e_cell_focus                        (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gint x1,
                                                             gint y1,
                                                             gint x2,
                                                             gint y2);

### e_cell_unfocus ()

    void                e_cell_unfocus                      (ECellView *ecell_view);

### e_cell_height ()

    gint                e_cell_height                       (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row);

`ecell_view` : | the ECellView.
`model_col` : | the column in the model
`view_col` : | the column in the view.
`row` : | the row to me measured
Returns : | the height of the cell at `model_col`, `row` rendered at `view_col`, `row`.

### e_cell_enter_edit ()

    gpointer            e_cell_enter_edit                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row);

Notifies the ECellView that it is about to enter editing mode for `model_col`, `row` rendered at `view_col`, `row`.

`ecell_view` : | the ECellView that will enter editing
`model_col` : | the column in the model
`view_col` : | the column in the view
`row` : | the row

### e_cell_leave_edit ()

    void                e_cell_leave_edit                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer edit_context);

Notifies the ECellView that editing is finished at `model_col`, `row` rendered at `view_col`, `row`.

`ecell_view` : | the ECellView that will leave editing
`model_col` : | the column in the model
`view_col` : | the column in the view
`row` : | the row
`edit_context` : | the editing context

### e_cell_save_state ()

    gpointer            e_cell_save_state                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer edit_context);

`ecell_view` : | the ECellView to save
`model_col` : | the column in the model
`view_col` : | the column in the view
`row` : | the row
`edit_context` : | the editing context
Returns : | The save state. Requests that the ECellView return a gpointer representing the state of the ECell. This is primarily intended for things like selection or scrolling.

### e_cell_load_state ()

    void                e_cell_load_state                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer edit_context,
                                                             gpointer save_state);

Requests that the ECellView load from the given save state.

`ecell_view` : | the ECellView to load
`model_col` : | the column in the model
`view_col` : | the column in the view
`row` : | the row
`edit_context` : | the editing context
`save_state` : | the save state to load from

### e_cell_free_state ()

    void                e_cell_free_state                   (ECellView *ecell_view,
                                                             gint model_col,
                                                             gint view_col,
                                                             gint row,
                                                             gpointer save_state);

Requests that the ECellView free the given save state.

`ecell_view` : | the ECellView
`model_col` : | the column in the model
`view_col` : | the column in the view
`row` : | the row
`save_state` : | the save state to free