Added get_cell_geometry method.
2001-04-23 Christopher James Lahey <clahey@ximian.com> * e-table-group-container.c, e-table-group-leaf.c, e-table-group.c, e-table-group-.h: Added get_cell_geometry method. * e-table-item.c, e-table-item.h: Added e_table_item_get_cell_geometry. * e-table.c, e-table.h: Added e_table_get_cell_geometry. svn path=/trunk/; revision=9532
This commit is contained in:
committed by
Chris Lahey
parent
fb53364c9c
commit
44c7d23144
@ -665,6 +665,34 @@ etgc_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
etgc_get_cell_geometry (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height)
|
||||
{
|
||||
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
|
||||
|
||||
int ypos;
|
||||
|
||||
ypos = 0;
|
||||
|
||||
if (etgc->children) {
|
||||
GList *list;
|
||||
for (list = etgc->children; list; list = list->next) {
|
||||
ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
|
||||
ETableGroup *child = child_node->child;
|
||||
int thisy;
|
||||
|
||||
e_table_group_get_cell_geometry (child, row, col, x, &thisy, width, height);
|
||||
ypos += thisy;
|
||||
if ((*row == -1) || (*col == -1)) {
|
||||
ypos += TITLE_HEIGHT;
|
||||
*x += GROUP_INDENT;
|
||||
*y = ypos;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void etgc_thaw (ETableGroup *etg)
|
||||
{
|
||||
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(etg));
|
||||
@ -817,6 +845,7 @@ etgc_class_init (GtkObjectClass *object_class)
|
||||
e_group_class->get_focus_column = etgc_get_focus_column;
|
||||
e_group_class->get_printable = etgc_get_printable;
|
||||
e_group_class->compute_location = etgc_compute_location;
|
||||
e_group_class->get_cell_geometry = etgc_get_cell_geometry;
|
||||
|
||||
gtk_object_add_arg_type ("ETableGroupContainer::horizontal_draw_grid", GTK_TYPE_BOOL,
|
||||
GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID);
|
||||
|
||||
@ -294,6 +294,13 @@ etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
|
||||
e_table_item_compute_location (etgl->item, x, y, row, col);
|
||||
}
|
||||
|
||||
static void
|
||||
etgl_get_cell_geometry (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height)
|
||||
{
|
||||
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
|
||||
e_table_item_get_cell_geometry (etgl->item, row, col, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
{
|
||||
@ -427,7 +434,8 @@ etgl_class_init (GtkObjectClass *object_class)
|
||||
e_group_class->get_focus_column = etgl_get_focus_column;
|
||||
e_group_class->get_printable = etgl_get_printable;
|
||||
e_group_class->compute_location = etgl_compute_location;
|
||||
|
||||
e_group_class->get_cell_geometry = etgl_get_cell_geometry;
|
||||
|
||||
gtk_object_add_arg_type ("ETableGroupLeaf::horizontal_draw_grid", GTK_TYPE_BOOL,
|
||||
GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID);
|
||||
gtk_object_add_arg_type ("ETableGroupLeaf::vertical_draw_grid", GTK_TYPE_BOOL,
|
||||
|
||||
@ -381,13 +381,19 @@ e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int
|
||||
* removed from the value row points to.
|
||||
*/
|
||||
void
|
||||
e_table_group_get_position (ETableGroup *etg, int *x, int *y, int *row, int *col)
|
||||
e_table_group_get_cell_geometry (ETableGroup *etg,
|
||||
int *row,
|
||||
int *col,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
g_return_if_fail (etg != NULL);
|
||||
g_return_if_fail (E_IS_TABLE_GROUP (etg));
|
||||
|
||||
if (ETG_CLASS (etg)->get_position)
|
||||
ETG_CLASS (etg)->get_position (etg, x, y, row, col);
|
||||
if (ETG_CLASS (etg)->get_cell_geometry)
|
||||
ETG_CLASS (etg)->get_cell_geometry (etg, row, col, x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -592,7 +598,7 @@ etg_class_init (GtkObjectClass *object_class)
|
||||
klass->get_focus = etg_get_focus;
|
||||
klass->get_printable = NULL;
|
||||
klass->compute_location = NULL;
|
||||
klass->get_position = NULL;
|
||||
klass->get_cell_geometry = NULL;
|
||||
|
||||
etg_parent_class = gtk_type_class (PARENT_TYPE);
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ typedef struct {
|
||||
gint (*get_focus_column) (ETableGroup *etg);
|
||||
EPrintable *(*get_printable) (ETableGroup *etg);
|
||||
void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col);
|
||||
void (*get_position) (ETableGroup *etg, int *x, int *y, int *row, int *col);
|
||||
void (*get_cell_geometry) (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height);
|
||||
|
||||
} ETableGroupClass;
|
||||
|
||||
@ -99,11 +99,13 @@ void e_table_group_compute_location (ETableGroup *etg,
|
||||
int *y,
|
||||
int *row,
|
||||
int *col);
|
||||
void e_table_group_get_position (ETableGroup *etg,
|
||||
void e_table_group_get_cell_geometry (ETableGroup *etg,
|
||||
int *row,
|
||||
int *col,
|
||||
int *x,
|
||||
int *y,
|
||||
int *row,
|
||||
int *col);
|
||||
int *width,
|
||||
int *height);
|
||||
ETableGroup *e_table_group_new (GnomeCanvasGroup *parent,
|
||||
ETableHeader *full_header,
|
||||
ETableHeader *header,
|
||||
|
||||
@ -2415,6 +2415,31 @@ e_table_item_compute_location (ETableItem *eti,
|
||||
eti->grabbed_row = grabbed_row;
|
||||
}
|
||||
|
||||
void
|
||||
e_table_item_get_cell_geometry (ETableItem *eti,
|
||||
int *row,
|
||||
int *col,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
if (eti->rows > *row) {
|
||||
if (x)
|
||||
*x = e_table_header_col_diff (eti->header, 0, *col);
|
||||
if (y)
|
||||
*y = e_table_item_row_diff (eti, 0, *row);
|
||||
if (width)
|
||||
*width = e_table_header_col_diff (eti->header, *col, *col + 1);
|
||||
if (height)
|
||||
*height = ETI_ROW_HEIGHT (eti, *row);
|
||||
*row = -1;
|
||||
*col = -1;
|
||||
} else {
|
||||
*row -= eti->rows;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
ETableItem *item;
|
||||
int rows_printed;
|
||||
|
||||
@ -140,6 +140,13 @@ void e_table_item_compute_location (ETableItem *eti,
|
||||
int *y,
|
||||
int *row,
|
||||
int *col);
|
||||
void e_table_item_get_cell_geometry (ETableItem *eti,
|
||||
int *row,
|
||||
int *col,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
int e_table_item_row_diff (ETableItem *eti,
|
||||
int start_row,
|
||||
|
||||
@ -1522,6 +1522,37 @@ e_table_get_cell_at (ETable *table,
|
||||
e_table_group_compute_location(table->group, &x, &y, row_return, col_return);
|
||||
}
|
||||
|
||||
/**
|
||||
* e_table_get_cell_at:
|
||||
* @table: An ETable widget
|
||||
* @x: X coordinate for the pixel
|
||||
* @y: Y coordinate for the pixel
|
||||
* @row_return: Pointer to return the row value
|
||||
* @col_return: Pointer to return the column value
|
||||
*
|
||||
* Return the row and column for the cell in which the pixel at (@x, @y) is
|
||||
* contained.
|
||||
**/
|
||||
void
|
||||
e_table_get_cell_geometry (ETable *table,
|
||||
int row, int col,
|
||||
int *x_return, int *y_return,
|
||||
int *width_return, int *height_return)
|
||||
{
|
||||
g_return_if_fail (table != NULL);
|
||||
g_return_if_fail (E_IS_TABLE (table));
|
||||
|
||||
/* FIXME it would be nice if it could handle a NULL row_return or
|
||||
* col_return gracefully. */
|
||||
|
||||
e_table_group_get_cell_geometry(table->group, &row, &col, x_return, y_return, width_return, height_return);
|
||||
|
||||
if (x_return)
|
||||
(*x_return) -= GTK_LAYOUT(table->table_canvas)->hadjustment->value;
|
||||
if (y_return)
|
||||
(*y_return) -= GTK_LAYOUT(table->table_canvas)->vadjustment->value;
|
||||
}
|
||||
|
||||
struct _ETableDragSourceSite
|
||||
{
|
||||
GdkModifierType start_button_mask;
|
||||
|
||||
@ -230,6 +230,11 @@ void e_table_get_cell_at (ETable *table,
|
||||
int x, int y,
|
||||
int *row_return, int *col_return);
|
||||
|
||||
void e_table_get_cell_geometry (ETable *table,
|
||||
int row, int col,
|
||||
int *x_return, int *y_return,
|
||||
int *width_return, int *height_return);
|
||||
|
||||
/* Drag & drop stuff. */
|
||||
/* Target */
|
||||
void e_table_drag_get_data (ETable *table,
|
||||
|
||||
Reference in New Issue
Block a user