diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-14 22:31:22 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-14 22:31:22 +0800 |
commit | 32471accadcf2099f9d3567f51add9fab197ec24 (patch) | |
tree | 8b070bcbdbcd962de9016b0fceaa15ec45848310 /widgets/e-table/e-table-group-leaf.c | |
parent | 623ba9a279db035339ac8ae5030683c1e79b8618 (diff) | |
download | gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.gz gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.zst gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.zip |
From widgets/e-table/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com>
* Implemented the feature where the ETable columns automatically
fill the given space.
* e-cell-text.c, e-cell-text.h: Moved #include
e-text-event-processor.h from the .h to the .c.
* e-table-col.c, e-table-col.h: Added an expansion variable, and
made it so that width isn't set by the programmer but instead by
the e-table-header.
* e-table-example-1.c, e-table-example-2.c, e-table-size-test.c,
test-check.c, test-cols.c, test-table.c: Fixed to handle new
ETable column resizing.
* e-table-group-container.c, e-table-group-container.h,
e-table-group-leaf.c, e-table-group-leaf.h, e-table-group.c,
e-table-group.h, e-table-item.c, e-table-item.h: Fixed these to do
a proper canvas reflow/update loop. Changed them to take a
minimum width and return a width and a height.
* e-table-header-item.c, e-table-header-item.h: Made this so that
it depends on e-table-header.c for deciding the actual size of
columns during resize (it was making incorrect decisions on its
own.)
* e-table-header.c, e-table-header.h: Changed this to make sure
that the sum of the widths of the columns was always as close as
possible to the width of the window. This is done by taking a
full width and having each of the columns have an "expansion"
field. This field is what makes each column have approximately
the same portion of its part of the screen that it used to.
* e-table.c: Changed this to set the width on the ETableHeader as
well as set the proper minimum width on the ETableGroup and get
the width and height it reports.
From addressbook/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/Makefile.am: Added libeutil for e-card's support
for categories.
* backend/ebook/e-card-list.c, backend/ebook/e-card-list.h: Added
a function to get the length.
* backend/ebook/e-card.c, backend/ebook/e-card.h: Added categories
support (accessible either as "categories" or "category_list".)
* contact-editor/Makefile.am: Added e-table and all of the
categories files.
* contact-editor/categories.glade,
contact-editor/categories-strings.h,
contact-editor/e-contact-editor-categories.c,
contact-editor/e-contact-editor-categories.h:
* contact-editor/contact-editor.glade,
contact-editor/e-contact-editor-strings.h: Rearranged this dialog.
* contact-editor/e-contact-editor.c: Rearranged dialog a bit.
Added opening of categories dialog.
* gui/component/Makefile.am: Rearranged libraries so that
libetable would be available for the contact editor categories
dialog.
* gui/component/addressbook.c: Fix for new ETable resizing. Make
contact editor dialog resizable.
* gui/minicard/Makefile.am: Added libetable contact editor
categories dialog.
* gui/minicard/e-minicard.c: Make contact editor dialog resizable.
From mail/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com>
* message-list.c: Updated to work with new ETable resizing.
svn path=/trunk/; revision=3027
Diffstat (limited to 'widgets/e-table/e-table-group-leaf.c')
-rw-r--r-- | widgets/e-table/e-table-group-leaf.c | 130 |
1 files changed, 43 insertions, 87 deletions
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c index e39afa7f88..caa0125a78 100644 --- a/widgets/e-table/e-table-group-leaf.c +++ b/widgets/e-table/e-table-group-leaf.c @@ -10,7 +10,6 @@ #include <config.h> #include <gtk/gtksignal.h> -#include "e-table-group-container.h" #include "e-table-group-leaf.h" #include "e-table-item.h" #include <libgnomeui/gnome-canvas-rect-ellipse.h> @@ -29,7 +28,8 @@ enum { ARG_0, ARG_HEIGHT, ARG_WIDTH, - ARG_FROZEN + ARG_MINIMUM_WIDTH, + ARG_FROZEN, }; static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); @@ -48,21 +48,23 @@ etgl_destroy (GtkObject *object) } static void -e_table_group_leaf_construct (GnomeCanvasGroup *parent, ETableGroupLeaf *etgl, - ETableHeader *full_header, +e_table_group_leaf_construct (GnomeCanvasGroup *parent, + ETableGroupLeaf *etgl, + ETableHeader *full_header, ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info) + ETableModel *model, + ETableSortInfo *sort_info) { etgl->subset = E_TABLE_SUBSET_VARIABLE(e_table_sorted_variable_new (model, full_header, sort_info)); e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); } ETableGroup * -e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_header, +e_table_group_leaf_new (GnomeCanvasGroup *parent, + ETableHeader *full_header, ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info) + ETableModel *model, + ETableSortInfo *sort_info) { ETableGroupLeaf *etgl; @@ -85,6 +87,13 @@ etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupL static void etgl_reflow (GnomeCanvasItem *item, gint flags) { + ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF(item); + gtk_object_get(GTK_OBJECT(leaf->item), + "height", &leaf->height, + NULL); + gtk_object_get(GTK_OBJECT(leaf->item), + "width", &leaf->width, + NULL); e_canvas_item_request_parent_reflow (item); } @@ -103,31 +112,13 @@ etgl_realize (GnomeCanvasItem *item) "drawgrid", TRUE, "drawfocus", TRUE, "spreadsheet", TRUE, - "width", etgl->width, + "minimum_width", etgl->minimum_width, "length_threshold", 200, NULL)); - + gtk_signal_connect (GTK_OBJECT(etgl->item), "row_selection", - GTK_SIGNAL_FUNC(etgl_row_selection), etgl); - e_canvas_item_request_parent_reflow (item); -} - -static int -etgl_event (GnomeCanvasItem *item, GdkEvent *event) -{ - gboolean return_val = TRUE; - - switch (event->type) { - - default: - return_val = FALSE; - } - if (return_val == FALSE){ - if (GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event (item, event); - } - return return_val; - + GTK_SIGNAL_FUNC(etgl_row_selection), etgl); + e_canvas_item_request_reflow(item); } static void @@ -177,47 +168,10 @@ etgl_get_focus_column (ETableGroup *etg) } static void -etgl_set_width (ETableGroup *etg, gdouble width) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - etgl->width = width; -#if 0 - if (etgl->item){ - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "width", width, - NULL); - } -#endif -} - -static gdouble -etgl_get_width (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - gtk_object_get (GTK_OBJECT(etgl->item), - "width", &etgl->width, - NULL); - return etgl->width; -} - -static gdouble -etgl_get_height (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - gdouble height; - if (etgl->item) - gtk_object_get (GTK_OBJECT(etgl->item), - "height", &height, - NULL); - else - height = 1; - return height; -} - -static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { ETableGroup *etg = E_TABLE_GROUP (object); + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); switch (arg_id) { case ARG_FROZEN: @@ -227,9 +181,13 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) etg->frozen = FALSE; } break; - case ARG_WIDTH: - if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width) - E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width (etg, GTK_VALUE_DOUBLE (*arg)); + case ARG_MINIMUM_WIDTH: + etgl->minimum_width = GTK_VALUE_DOUBLE(*arg); + if (etgl->item) { + gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), + "minimum_width", etgl->minimum_width, + NULL); + } break; default: break; @@ -240,22 +198,20 @@ static void etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { ETableGroup *etg = E_TABLE_GROUP (object); + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); switch (arg_id) { case ARG_FROZEN: GTK_VALUE_BOOL (*arg) = etg->frozen; break; case ARG_HEIGHT: - if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height (etg); - else - arg->type = GTK_TYPE_INVALID; + GTK_VALUE_DOUBLE (*arg) = etgl->height; break; - case ARG_WIDTH: - if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width (etg); - else - arg->type = GTK_TYPE_INVALID; + case ARG_WIDTH: + GTK_VALUE_DOUBLE (*arg) = etgl->width; + break; + case ARG_MINIMUM_WIDTH: + GTK_VALUE_DOUBLE (*arg) = etgl->minimum_width; break; default: arg->type = GTK_TYPE_INVALID; @@ -274,7 +230,6 @@ etgl_class_init (GtkObjectClass *object_class) object_class->get_arg = etgl_get_arg; item_class->realize = etgl_realize; - item_class->event = etgl_event; etgl_parent_class = gtk_type_class (PARENT_TYPE); @@ -285,14 +240,12 @@ etgl_class_init (GtkObjectClass *object_class) e_group_class->set_focus = etgl_set_focus; e_group_class->get_focus_column = etgl_get_focus_column; - e_group_class->get_width = etgl_get_width; - e_group_class->set_width = etgl_set_width; - e_group_class->get_height = etgl_get_height; - gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT); gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); + GTK_ARG_READABLE, ARG_WIDTH); + gtk_object_add_arg_type ("ETableGroupLeaf::minimum_width", GTK_TYPE_DOUBLE, + GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_FROZEN); } @@ -303,6 +256,9 @@ etgl_init (GtkObject *object) ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); etgl->width = 1; + etgl->height = 1; + etgl->minimum_width = 0; + etgl->subset = NULL; etgl->item = NULL; |