aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-header-utils.c10
-rw-r--r--widgets/table/e-table-header-utils.h38
-rw-r--r--widgets/table/e-table-header.c40
-rw-r--r--widgets/table/e-table-header.h1
-rw-r--r--widgets/table/e-table-item.c15
-rw-r--r--widgets/table/e-table.c5
6 files changed, 82 insertions, 27 deletions
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 990a7a09f7..b6d35507bf 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -41,7 +41,7 @@
*
* Return value: The height of the button, in pixels.
**/
-int
+double
e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font)
{
int ythick;
@@ -70,6 +70,14 @@ e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font)
return height;
}
+double
+e_table_header_width_extras (GtkStyle *style)
+{
+ g_return_val_if_fail (style != NULL, -1);
+
+ return 2 * (style->klass->xthickness + HEADER_PADDING);
+}
+
/* Creates a pixmap that is a composite of a background color and the upper-left
* corner rectangle of a pixbuf.
*/
diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h
index bbfb1ee17b..105a14f86a 100644
--- a/widgets/table/e-table-header-utils.h
+++ b/widgets/table/e-table-header-utils.h
@@ -25,18 +25,32 @@
#define E_TABLE_HEADER_UTILS_H
#include <gal/e-table/e-table-col.h>
-
-int e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font);
-
-void e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
- GtkStyle *style, GdkFont *font, GtkStateType state,
- GtkWidget *widget, GdkGC *gc,
- int x, int y, int width, int height,
- int button_width, int button_height,
- ETableColArrow arrow);
-
-void e_table_draw_elided_string (GdkDrawable *drawable, GdkFont *font, GdkGC *gc,
- int x, int y, const char *str, int max_width, gboolean center);
+double e_table_header_compute_height (ETableCol *ecol,
+ GtkStyle *style,
+ GdkFont *font);
+double e_table_header_width_extras (GtkStyle *style);
+void e_table_header_draw_button (GdkDrawable *drawable,
+ ETableCol *ecol,
+ GtkStyle *style,
+ GdkFont *font,
+ GtkStateType state,
+ GtkWidget *widget,
+ GdkGC *gc,
+ int x,
+ int y,
+ int width,
+ int height,
+ int button_width,
+ int button_height,
+ ETableColArrow arrow);
+void e_table_draw_elided_string (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ int x,
+ int y,
+ const char *str,
+ int max_width,
+ gboolean center);
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index 9771a0d70d..6c1431863a 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -19,6 +19,7 @@ enum {
ARG_0,
ARG_SORT_INFO,
ARG_WIDTH,
+ ARG_WIDTH_EXTRAS,
};
enum {
@@ -169,6 +170,10 @@ eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
eth->nominal_width = GTK_VALUE_DOUBLE (*arg);
enqueue(eth, -1, GTK_VALUE_DOUBLE (*arg));
break;
+ case ARG_WIDTH_EXTRAS:
+ eth->width_extras = GTK_VALUE_DOUBLE (*arg);
+ enqueue(eth, -1, eth->nominal_width);
+ break;
case ARG_SORT_INFO:
if (eth->sort_info) {
if (eth->sort_info_group_change_id)
@@ -201,6 +206,9 @@ eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_WIDTH:
GTK_VALUE_DOUBLE (*arg) = eth->nominal_width;
break;
+ case ARG_WIDTH_EXTRAS:
+ GTK_VALUE_DOUBLE (*arg) = eth->width_extras;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -219,6 +227,8 @@ e_table_header_class_init (GtkObjectClass *object_class)
gtk_object_add_arg_type ("ETableHeader::width", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableHeader::width_extras", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_WIDTH_EXTRAS);
gtk_object_add_arg_type ("ETableHeader::sort_info", GTK_TYPE_OBJECT,
GTK_ARG_READWRITE, ARG_SORT_INFO);
@@ -250,16 +260,18 @@ e_table_header_class_init (GtkObjectClass *object_class)
static void
e_table_header_init (ETableHeader *eth)
{
- eth->col_count = 0;
- eth->width = 0;
+ eth->col_count = 0;
+ eth->width = 0;
- eth->sort_info = NULL;
+ eth->sort_info = NULL;
eth->sort_info_group_change_id = 0;
- eth->columns = NULL;
+ eth->columns = NULL;
- eth->change_queue = NULL;
- eth->change_tail = NULL;
+ eth->change_queue = NULL;
+ eth->change_tail = NULL;
+
+ eth->width_extras = 0;
}
/**
@@ -606,7 +618,7 @@ eth_set_size (ETableHeader *eth, int idx, int size)
* total usable expansion on the right.
*/
for (; i < eth->col_count; i++) {
- min_width += eth->columns[i]->min_width;
+ min_width += eth->columns[i]->min_width + eth->width_extras;
if (eth->columns[i]->resizeable) {
expansion += eth->columns[i]->expansion;
expandable_count ++;
@@ -638,13 +650,13 @@ eth_set_size (ETableHeader *eth, int idx, int size)
/* If you try to resize smaller than the minimum width, it
* uses the minimum. */
- if (size < eth->columns[idx]->min_width)
- size = eth->columns[idx]->min_width;
+ if (size < eth->columns[idx]->min_width + eth->width_extras)
+ size = eth->columns[idx]->min_width + eth->width_extras;
/* If all the extra space will be used up in this column, use
* all the expansion and set all others to 0.
*/
- if (size >= total_extra + eth->columns[idx]->min_width) {
+ if (size >= total_extra + eth->columns[idx]->min_width + eth->width_extras) {
eth->columns[idx]->expansion = expansion;
for (i = idx + 1; i < eth->col_count; i++) {
eth->columns[i]->expansion = 0;
@@ -656,7 +668,7 @@ eth_set_size (ETableHeader *eth, int idx, int size)
old_expansion = expansion;
old_expansion -= eth->columns[idx]->expansion;
/* Set the new expansion so that it will generate the desired size. */
- eth->columns[idx]->expansion = expansion * (((double)(size - eth->columns[idx]->min_width))/((double)total_extra));
+ eth->columns[idx]->expansion = expansion * (((double)(size - (eth->columns[idx]->min_width + eth->width_extras)))/((double)total_extra));
/* The expansion left for the columns on the right. */
expansion -= eth->columns[idx]->expansion;
@@ -677,7 +689,7 @@ eth_set_size (ETableHeader *eth, int idx, int size)
}
/* Remove from total_extra the amount used for this column. */
- total_extra -= size - eth->columns[idx]->min_width;
+ total_extra -= size - (eth->columns[idx]->min_width + eth->width_extras);
for (i = idx + 1; i < eth->col_count; i++) {
if (eth->columns[idx]->resizeable) {
/* old_expansion != 0 by (2) */
@@ -733,11 +745,11 @@ eth_calc_widths (ETableHeader *eth)
extra = eth->width - 1;
expansion = 0;
for (i = 0; i < eth->col_count; i++) {
- extra -= eth->columns[i]->min_width;
+ extra -= eth->columns[i]->min_width + eth->width_extras;
if (eth->columns[i]->resizeable && eth->columns[i]->expansion > 0)
last_resizable = i;
expansion += eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0;
- eth->columns[i]->width = eth->columns[i]->min_width;
+ eth->columns[i]->width = eth->columns[i]->min_width + eth->width_extras;
}
if (eth->sort_info)
extra -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
index 2c2b6266c1..34d79e6b11 100644
--- a/widgets/table/e-table-header.h
+++ b/widgets/table/e-table-header.h
@@ -24,6 +24,7 @@ struct _ETableHeader {
int col_count;
int width;
int nominal_width;
+ int width_extras;
ETableSortInfo *sort_info;
int sort_info_group_change_id;
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 352037a249..7eb0b07421 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1474,6 +1474,11 @@ _do_tooltip (ETableItem *eti)
int x = 0, y = 0;
int i;
+ if (eti->tooltip->window) {
+ gtk_widget_destroy (eti->tooltip->window);
+ eti->tooltip->window = NULL;
+ }
+
if (eti_editing (eti))
return FALSE;
@@ -1723,6 +1728,11 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
"cursor_col", &cursor_col,
NULL);
+ if (eti->tooltip->window) {
+ gtk_widget_destroy (eti->tooltip->window);
+ eti->tooltip->window = NULL;
+ }
+
if (cursor_col == -1)
return FALSE;
@@ -1764,6 +1774,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_Tab:
case GDK_KP_Tab:
case GDK_ISO_Left_Tab:
+ /* Let tab send you to the next widget. */
+ return_val = FALSE;
+ break;
+#if 0
if ((e->key.state & GDK_SHIFT_MASK) != 0){
/* shift tab */
if (cursor_col != view_to_model_col(eti, 0))
@@ -1790,6 +1804,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row));
}
break;
+#endif
case GDK_Return:
case GDK_KP_Enter:
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index d0404525a8..dbf301994b 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -24,6 +24,7 @@
#include "gal/widgets/e-canvas-vbox.h"
#include "e-table.h"
#include "e-table-header-item.h"
+#include "e-table-header-utils.h"
#include "e-table-subset.h"
#include "e-table-item.h"
#include "e-table-group.h"
@@ -708,6 +709,10 @@ et_state_to_header (ETable *e_table, ETableHeader *full_header, ETableState *sta
nh = e_table_header_new ();
+ gtk_object_set(GTK_OBJECT(nh),
+ "width_extras", e_table_header_width_extras(GTK_WIDGET(e_table)->style),
+ NULL);
+
for (column = 0; column < state->col_count; column++) {
int col;