# ETableItem

## Name

ETableItem --

## Synopsis

    #define     E_TABLE_ITEM_TYPE
    typedef     ETableItem;
    void        e_table_item_set_cursor         (ETableItem *eti,
                                                 int col,
                                                 int row);
    gint        e_table_item_get_focused_column (ETableItem *eti);
    gboolean    e_table_item_is_row_selected    (ETableItem *e_table_Item,
                                                 int row);
    void        e_table_item_selected_row_foreach
                                                (ETableItem *eti,
                                                 ETableForeachFunc func,
                                                 gpointer closure);
    void        e_table_item_leave_edit         (ETableItem *eti);
    void        e_table_item_enter_edit         (ETableItem *eti,
                                                 int col,
                                                 int row);
    void        e_table_item_redraw_range       (ETableItem *eti,
                                                 int start_col,
                                                 int start_row,
                                                 int end_col,
                                                 int end_row);
    EPrintable* e_table_item_get_printable      (ETableItem *eti);
    void        e_table_item_print_height       (ETableItem *eti,
                                                 GnomePrintContext *context,
                                                 gdouble width);
    void        e_table_item_compute_location   (ETableItem *eti,
                                                 int *x,
                                                 int *y,
                                                 int *row,
                                                 int *col);

## Object Hierarchy

      GtkObject
       +----GnomeCanvasItem
             +----ETableItem

## Properties

      "ETableHeader"         GtkObject             : Write
      "ETableModel"          GtkObject             : Write
      "table-selection-model" GtkObject             : Write
      "drawgrid"             gboolean              : Write
      "drawfocus"            gboolean              : Write
      "cursor-mode"          gint                  : Write
      "length-threshold"     gint                  : Write
      "minimum-width"        gdouble               : Read / Write
      "width"                gdouble               : Read / Write
      "height"               gdouble               : Read
      "cursor-row"           gint                  : Read / Write

## Signal Prototypes

    "cursor-change"
                void        user_function      (ETableItem *etableitem,
                                                gint arg1,
                                                gpointer user_data);
    "double-click"
                void        user_function      (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);
    "right-click"
                gint        user_function      (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);
    "click"     gint        user_function      (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);
    "key-press" gint        user_function      (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);

## Description

## Details

### E_TABLE_ITEM_TYPE

    #define E_TABLE_ITEM_TYPE        (e_table_item_get_type ())

### ETableItem

    typedef struct {
    	GnomeCanvasItem  parent;
    	ETableModel     *table_model;
    	ETableHeader    *header;

    	ETableModel     *source_model;
    	ETableSelectionModel *selection;

    	int              x1, y1;
    	int              minimum_width, width, height;

    	int              cols, rows;

    	/*
    	 * Ids for the signals we connect to
    	 */
    	int              header_dim_change_id;
    	int              header_structure_change_id;
    	int              header_request_width_id;
    	int              table_model_pre_change_id;
    	int              table_model_change_id;
    	int              table_model_row_change_id;
    	int              table_model_cell_change_id;
    	int              table_model_row_inserted_id;
    	int              table_model_row_deleted_id;

    	int              selection_change_id;
    	int              cursor_change_id;

    	GdkGC           *fill_gc;
    	GdkGC           *grid_gc;
    	GdkGC           *focus_gc;
    	GdkBitmap       *stipple;

    	guint 		 draw_grid:1;
    	guint 		 draw_focus:1;
    	guint 		 renderers_can_change_size:1;
    	guint 		 cell_views_realized:1;

    	guint 		 needs_redraw : 1;
    	guint 		 needs_compute_height : 1;
    	guint 		 needs_compute_width : 1;

    	guint            uses_source_model : 1;

    	/*
    	 * Realized views, per column
    	 */
    	ECellView      **cell_views;
    	int              n_cells;

    	int             *height_cache;
    	int              height_cache_idle_id;
    	int              height_cache_idle_count;

    	/*
    	 * Lengh Threshold: above this, we stop computing correctly
    	 * the size
    	 */
    	int              length_threshold;

    	gint             row_guess;
    	ETableCursorMode cursor_mode;

    	/*
    	 * During editing
    	 */
    	int              editing_col, editing_row;
    	void            *edit_ctx;

    	/*
    	 * Tooltip
    	 */
    	ETableTooltip *tooltip;

    } ETableItem;

### e_table_item_set_cursor ()

    void        e_table_item_set_cursor         (ETableItem *eti,
                                                 int col,
                                                 int row);

This routine sets the cursor of the `ETableItem` canvas item.

`eti` : | `ETableItem` which will have the cursor set.
`col` : | Column to select. -1 means the last column.
`row` : | Row to select. -1 means the last row.

### e_table_item_get_focused_column ()

    gint        e_table_item_get_focused_column (ETableItem *eti);

This routine gets the cursor of the `ETableItem` canvas item.

`eti` : | `ETableItem` which will have the cursor retrieved.
Returns : | The current cursor column.

### e_table_item_is_row_selected ()

    gboolean    e_table_item_is_row_selected    (ETableItem *e_table_Item,
                                                 int row);

`e_table_Item` : |
`row` : |
Returns : |

### e_table_item_selected_row_foreach ()

    void        e_table_item_selected_row_foreach
                                                (ETableItem *eti,
                                                 ETableForeachFunc func,
                                                 gpointer closure);

`eti` : |
`func` : |
`closure` : |

### e_table_item_leave_edit ()

    void        e_table_item_leave_edit         (ETableItem *eti);

`eti` : |

### e_table_item_enter_edit ()

    void        e_table_item_enter_edit         (ETableItem *eti,
                                                 int col,
                                                 int row);

This routine starts the given `ETableItem` editing at the given view column and row.

`eti` : | `ETableItem` which will start being edited
`col` : | The view col to edit.
`row` : | The view row to edit.

### e_table_item_redraw_range ()

    void        e_table_item_redraw_range       (ETableItem *eti,
                                                 int start_col,
                                                 int start_row,
                                                 int end_col,
                                                 int end_row);

This routine redraws the given `ETableItem` in the range given. The range is inclusive at both ends.

`eti` : | `ETableItem` which will be redrawn
`start_col` : | The first col to redraw.
`start_row` : | The first row to redraw.
`end_col` : | The last col to redraw.
`end_row` : | The last row to redraw.

### e_table_item_get_printable ()

    EPrintable* e_table_item_get_printable      (ETableItem *eti);

This routine creates and returns an `EPrintable` that can be used to print the given `ETableItem`.

`eti` : | `ETableItem` which will be printed
Returns : | The `EPrintable`.

### e_table_item_print_height ()

    void        e_table_item_print_height       (ETableItem *eti,
                                                 GnomePrintContext *context,
                                                 gdouble width);

`eti` : |
`context` : |
`width` : |

### e_table_item_compute_location ()

    void        e_table_item_compute_location   (ETableItem *eti,
                                                 int *x,
                                                 int *y,
                                                 int *row,
                                                 int *col);

This routine locates the pixel location (*x, *y) in the `ETableItem`. If that location is in the `ETableItem`, *row and *col are set to the view row and column where it was found. If that location is not in the `ETableItem`, the height of the `ETableItem` is removed from the value y points to.

`eti` : | `ETableItem` to look in.
`x` : | A pointer to the x location to find in the `ETableItem`.
`y` : | A pointer to the y location to find in the `ETableItem`.
`row` : | A pointer to the location to store the found row in.
`col` : | A pointer to the location to store the found col in.

## Properties

### The "`ETableHeader`" property

      "ETableHeader"         GtkObject             : Write

### The "`ETableModel`" property

      "ETableModel"          GtkObject             : Write

### The "`table-selection-model`" property

      "table-selection-model" GtkObject             : Write

### The "`drawgrid`" property

      "drawgrid"             gboolean              : Write

### The "`drawfocus`" property

      "drawfocus"            gboolean              : Write

### The "`cursor-mode`" property

      "cursor-mode"          gint                  : Write

### The "`length-threshold`" property

      "length-threshold"     gint                  : Write

### The "`minimum-width`" property

      "minimum-width"        gdouble               : Read / Write

### The "`width`" property

      "width"                gdouble               : Read / Write

### The "`height`" property

      "height"               gdouble               : Read

### The "`cursor-row`" property

      "cursor-row"           gint                  : Read / Write

## Signals

### The "cursor-change" signal

    void        user_function                  (ETableItem *etableitem,
                                                gint arg1,
                                                gpointer user_data);

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

### The "double-click" signal

    void        user_function                  (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);

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

### The "right-click" signal

    gint        user_function                  (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);

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

### The "click" signal

    gint        user_function                  (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);

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

### The "key-press" signal

    gint        user_function                  (ETableItem *etableitem,
                                                gint arg1,
                                                gint arg2,
                                                gpointer arg3,
                                                gpointer user_data);

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