New function that returns the total minimum width of all the columns.
2002-03-15 Christopher James Lahey <clahey@ximian.com> * e-table-header.c, e-table-header.h (e_table_header_min_width): New function that returns the total minimum width of all the columns. * e-table.c, e-table.h (set_header_width): Call e_table_header_min_width here instead of total_width. (et_size_request): Override the size_request method instead of doing set_usize. svn path=/trunk/; revision=16175
This commit is contained in:

committed by
Chris Lahey

parent
cbbaa07125
commit
a17d29d26c
@ -569,6 +569,27 @@ e_table_header_total_width (ETableHeader *eth)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* e_table_header_min_width:
|
||||||
|
* @eth: The ETableHeader to query
|
||||||
|
*
|
||||||
|
* Returns: the minimum number of pixels required by the @eth object.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
e_table_header_min_width (ETableHeader *eth)
|
||||||
|
{
|
||||||
|
int total, i;
|
||||||
|
|
||||||
|
g_return_val_if_fail (eth != NULL, 0);
|
||||||
|
g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
|
||||||
|
|
||||||
|
total = 0;
|
||||||
|
for (i = 0; i < eth->col_count; i++)
|
||||||
|
total += eth->columns [i]->min_width;
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* e_table_header_move:
|
* e_table_header_move:
|
||||||
* @eth: The ETableHeader to operate on.
|
* @eth: The ETableHeader to operate on.
|
||||||
|
@ -90,6 +90,7 @@ ETableCol **e_table_header_get_columns (ETableHeader *eth);
|
|||||||
int e_table_header_get_selected (ETableHeader *eth);
|
int e_table_header_get_selected (ETableHeader *eth);
|
||||||
|
|
||||||
int e_table_header_total_width (ETableHeader *eth);
|
int e_table_header_total_width (ETableHeader *eth);
|
||||||
|
int e_table_header_min_width (ETableHeader *eth);
|
||||||
void e_table_header_move (ETableHeader *eth,
|
void e_table_header_move (ETableHeader *eth,
|
||||||
int source_index,
|
int source_index,
|
||||||
int target_index);
|
int target_index);
|
||||||
|
@ -194,14 +194,22 @@ e_table_state_change (ETable *et)
|
|||||||
|
|
||||||
#define CHECK_HORIZONTAL(et) if ((et)->horizontal_scrolling || (et)->horizontal_resize) e_table_header_update_horizontal (et->header);
|
#define CHECK_HORIZONTAL(et) if ((et)->horizontal_scrolling || (et)->horizontal_resize) e_table_header_update_horizontal (et->header);
|
||||||
|
|
||||||
|
static void
|
||||||
|
et_size_request (GtkWidget *widget, GtkRequisition *request)
|
||||||
|
{
|
||||||
|
ETable *et = E_TABLE (widget);
|
||||||
|
if (GTK_WIDGET_CLASS (parent_class)->size_request)
|
||||||
|
GTK_WIDGET_CLASS (parent_class)->size_request (widget, request);
|
||||||
|
if (et->horizontal_resize)
|
||||||
|
request->width = MAX (request->width, et->header_width);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_header_width (ETable *et)
|
set_header_width (ETable *et)
|
||||||
{
|
{
|
||||||
if (et->horizontal_resize) {
|
if (et->horizontal_resize) {
|
||||||
int width = e_table_header_total_width (et->header);
|
et->header_width = e_table_header_min_width (et->header);
|
||||||
gtk_widget_set_usize (GTK_WIDGET (et->table_canvas), width,
|
gtk_widget_queue_resize (GTK_WIDGET (et));
|
||||||
-2);
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (et->table_canvas));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,6 +471,8 @@ e_table_init (GtkObject *object)
|
|||||||
|
|
||||||
e_table->current_search = NULL;
|
e_table->current_search = NULL;
|
||||||
e_table->current_search_col = -1;
|
e_table->current_search_col = -1;
|
||||||
|
|
||||||
|
e_table->header_width = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grab_focus handler for the ETable */
|
/* Grab_focus handler for the ETable */
|
||||||
@ -2898,6 +2908,7 @@ e_table_class_init (ETableClass *class)
|
|||||||
|
|
||||||
widget_class->grab_focus = et_grab_focus;
|
widget_class->grab_focus = et_grab_focus;
|
||||||
widget_class->unrealize = et_unrealize;
|
widget_class->unrealize = et_unrealize;
|
||||||
|
widget_class->size_request = et_size_request;
|
||||||
|
|
||||||
container_class->focus = et_focus;
|
container_class->focus = et_focus;
|
||||||
|
|
||||||
|
@ -152,6 +152,8 @@ typedef struct {
|
|||||||
int drag_row;
|
int drag_row;
|
||||||
int drag_col;
|
int drag_col;
|
||||||
ETableDragSourceSite *site;
|
ETableDragSourceSite *site;
|
||||||
|
|
||||||
|
int header_width;
|
||||||
} ETable;
|
} ETable;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user