aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-06-27 08:51:06 +0800
committerChris Lahey <clahey@src.gnome.org>2000-06-27 08:51:06 +0800
commite4de45da5f6021db9a009f112c91e21493a87e1f (patch)
tree8e481cf3ba0b08eede834c97820476a3dd5e87c9 /e-util
parent9d5faecef3b9e0f8fff68a2d4ddd9dab91b2f66d (diff)
downloadgsoc2013-evolution-e4de45da5f6021db9a009f112c91e21493a87e1f.tar.gz
gsoc2013-evolution-e4de45da5f6021db9a009f112c91e21493a87e1f.tar.zst
gsoc2013-evolution-e4de45da5f6021db9a009f112c91e21493a87e1f.zip
Calculate height including if clip_height is set to -1.
2000-06-26 Christopher James Lahey <clahey@helixcode.com> * widgets/e-text/e-text.c: Calculate height including if clip_height is set to -1. From addressbook/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * contact-editor/e-contact-editor-categories.c, addressbook/gui/component/e-cardlist-model.c: Added value_to_string handlers. * demo/addressbook-widget.c, demo/demo.c: Removed usage of "x" and "y" arguments. * addressbook/gui/component/addressbook.c: Activated Click To Add and set the click to add message. * addressbook/gui/component/e-addressbook-model.c: Added value_to_string and append_row handlers. * addressbook/gui/component/e-select-names.c: Added a column. From calendar/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * gui/calendar-model.c: Added an #ifdefed value_to_string handler assignment. From camel/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * providers/mbox/camel-mbox-summary.c: Added debugging information. From composer/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * Makefile.am: Added e-msg-composer-select-file.h for make distcheck. From e-util/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * Makefile.am: Added e-canvas-vbox.c and e-canvas-vbox.h. * e-canvas-vbox.c, e-canvas-vbox.h: New canvas object to act like a vbox using the reflow system. From mail/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * message-list.c: Added a value_to_string handler. From shell/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * glade/Makefile.am: Added EXTRA_DIST for make distcheck. From widgets/e-table/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * Makefile.am: Added e-table-click-to-add.c, e-table-click-to-add.h, e-table-one.c, and e-table-one.h. * e-table-click-to-add.c, e-table-click-to-add.h: A new canvas item that represents a single row that sometimes exists. It's for adding new rows to your table. * e-table-example-1.c, e-table-example-2.c, e-table-size-test.c, test-check.c, test-cols.c, test-table.c: Added value_to_string handlers. * e-table-group-container.c: Use value_to_string to make grouping not crash for non string columns. Made some changes to work properly in an ECanvasVbox. * e-table-group-leaf.c, e-table-item.c: Made some changes to work properly in an ECanvasVbox. * e-table-model.c, e-table-model.h: Added append_row and value_to_string methods. * e-table-one.c, e-table-one.h: Given a source ETableModel, this provides a single row model that uses the initialize_value, duplicate_value, free_value, and value_is_empty methods of the original source to implement set_value and value_at (and proxies most of the other methods.) This is used for ETableClickToAdd. * e-table-simple.c, e-table-simple.h: Added append_row and value_to_string handlers. append_row uses a GtkArg instead of a parameter to e_table_simple_new. * e-table-subset.c: Added append_row and value_to_string handlers. * e-table.c, e-table.h: Use a vbox containing an ETableClickToAdd and an ETableItem instead of an ETableItem directly. Only show the ETableClickToAdd if the top level of the xml SPEC has the attribute click-to-add set to some non-zero integer. (click-to-add="1"). Add a "click_to_add_message" argument. * e-tree-model.c: Add a commented out value_to_string handler. From widgets/meeting-time-sel/ChangeLog: 2000-06-26 Christopher James Lahey <clahey@helixcode.com> * Makefile.am: Added the include path to top_srcdir. svn path=/trunk/; revision=3744
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog7
-rw-r--r--e-util/Makefile.am2
-rw-r--r--e-util/e-canvas-vbox.c323
-rw-r--r--e-util/e-canvas-vbox.h86
4 files changed, 418 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 728281dac0..93f2fb4828 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,10 @@
+2000-06-26 Christopher James Lahey <clahey@helixcode.com>
+
+ * Makefile.am: Added e-canvas-vbox.c and e-canvas-vbox.h.
+
+ * e-canvas-vbox.c, e-canvas-vbox.h: New canvas object to act like
+ a vbox using the reflow system.
+
2000-06-20 Christopher James Lahey <clahey@helixcode.com>
* e-canvas.c, e-canvas.h: Added a variable to keep track of the
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 136e76aaa9..11066ec89d 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -12,6 +12,8 @@ libeutil_la_SOURCES = \
e-canvas.h \
e-canvas-utils.c \
e-canvas-utils.h \
+ e-canvas-vbox.c \
+ e-canvas-vbox.h \
e-cursors.c \
e-cursors.h \
e-dialog-widgets.c \
diff --git a/e-util/e-canvas-vbox.c b/e-util/e-canvas-vbox.c
new file mode 100644
index 0000000000..f42fca4a30
--- /dev/null
+++ b/e-util/e-canvas-vbox.c
@@ -0,0 +1,323 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * e-canvas-vbox.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <math.h>
+#include "e-canvas-vbox.h"
+#include <e-util/e-canvas-utils.h>
+#include <e-util/e-canvas.h>
+#include <e-util/e-util.h>
+
+static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox);
+static void e_canvas_vbox_class_init (ECanvasVboxClass *klass);
+static void e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_canvas_vbox_destroy (GtkObject *object);
+
+static gint e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event);
+static void e_canvas_vbox_realize (GnomeCanvasItem *item);
+
+static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags);
+
+static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
+static void e_canvas_vbox_resize_children (GnomeCanvasItem *item);
+
+static GnomeCanvasGroupClass *parent_class = NULL;
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_WIDTH,
+ ARG_HEIGHT,
+ ARG_SPACING,
+};
+
+GtkType
+e_canvas_vbox_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type)
+ {
+ static const GtkTypeInfo info =
+ {
+ "ECanvasVbox",
+ sizeof (ECanvasVbox),
+ sizeof (ECanvasVboxClass),
+ (GtkClassInitFunc) e_canvas_vbox_class_init,
+ (GtkObjectInitFunc) e_canvas_vbox_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ type = gtk_type_unique (gnome_canvas_group_get_type (), &info);
+ }
+
+ return type;
+}
+
+static void
+e_canvas_vbox_class_init (ECanvasVboxClass *klass)
+{
+ GtkObjectClass *object_class;
+ GnomeCanvasItemClass *item_class;
+
+ object_class = (GtkObjectClass*) klass;
+ item_class = (GnomeCanvasItemClass *) klass;
+
+ parent_class = gtk_type_class (gnome_canvas_group_get_type ());
+
+ gtk_object_add_arg_type ("ECanvasVbox::width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ECanvasVbox::height", GTK_TYPE_DOUBLE,
+ GTK_ARG_READABLE, ARG_HEIGHT);
+ gtk_object_add_arg_type ("ECanvasVbox::spacing", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_SPACING);
+
+ klass->add_item = e_canvas_vbox_real_add_item;
+
+ object_class->set_arg = e_canvas_vbox_set_arg;
+ object_class->get_arg = e_canvas_vbox_get_arg;
+ object_class->destroy = e_canvas_vbox_destroy;
+
+ /* GnomeCanvasItem method overrides */
+ item_class->event = e_canvas_vbox_event;
+ item_class->realize = e_canvas_vbox_realize;
+}
+
+static void
+e_canvas_vbox_init (ECanvasVbox *vbox)
+{
+ vbox->items = NULL;
+
+ vbox->width = 10;
+ vbox->height = 10;
+ vbox->spacing = 0;
+
+ e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(vbox), e_canvas_vbox_reflow);
+}
+
+static void
+e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+{
+ GnomeCanvasItem *item;
+ ECanvasVbox *e_canvas_vbox;
+
+ item = GNOME_CANVAS_ITEM (o);
+ e_canvas_vbox = E_CANVAS_VBOX (o);
+
+ switch (arg_id){
+ case ARG_WIDTH:
+ e_canvas_vbox->width = GTK_VALUE_DOUBLE (*arg);
+ e_canvas_vbox_resize_children(item);
+ e_canvas_item_request_reflow(item);
+ break;
+ case ARG_SPACING:
+ e_canvas_vbox->spacing = GTK_VALUE_DOUBLE (*arg);
+ e_canvas_item_request_reflow(item);
+ break;
+ }
+}
+
+static void
+e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ ECanvasVbox *e_canvas_vbox;
+
+ e_canvas_vbox = E_CANVAS_VBOX (object);
+
+ switch (arg_id) {
+ case ARG_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->width;
+ break;
+ case ARG_HEIGHT:
+ GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->height;
+ break;
+ case ARG_SPACING:
+ GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->spacing;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
+static void
+e_canvas_vbox_destroy (GtkObject *object)
+{
+ ECanvasVbox *vbox = E_CANVAS_VBOX(object);
+
+ g_list_foreach(vbox->items, (GFunc) gtk_object_unref, NULL);
+ g_list_free(vbox->items);
+ vbox->items = NULL;
+
+ GTK_OBJECT_CLASS(parent_class)->destroy (object);
+}
+
+static gint
+e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event)
+{
+ gint return_val = TRUE;
+
+ switch (event->type) {
+ case GDK_KEY_PRESS:
+ switch (event->key.keyval) {
+ case GDK_Tab:
+ case GDK_KP_Tab:
+ case GDK_ISO_Left_Tab:
+ case GDK_Left:
+ case GDK_KP_Left:
+ case GDK_Right:
+ case GDK_KP_Right:
+ case GDK_Down:
+ case GDK_KP_Down:
+ case GDK_Up:
+ case GDK_KP_Up:
+ case GDK_Return:
+ case GDK_KP_Enter:
+ return_val = TRUE;
+ break;
+ default:
+ return_val = FALSE;
+ break;
+ }
+ break;
+ default:
+ return_val = FALSE;
+ break;
+ }
+ if (!return_val) {
+ if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
+ return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event);
+ }
+ return return_val;
+
+}
+
+static void
+e_canvas_vbox_realize (GnomeCanvasItem *item)
+{
+ if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
+ (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
+
+ e_canvas_vbox_resize_children(item);
+ e_canvas_item_request_reflow(item);
+}
+
+static void
+e_canvas_vbox_remove_item (GnomeCanvasItem *item, ECanvasVbox *vbox)
+{
+ vbox->items = g_list_remove(vbox->items, item);
+ gtk_object_unref(GTK_OBJECT(vbox));
+}
+
+static void
+e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
+{
+ e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item);
+ gtk_object_ref(GTK_OBJECT(item));
+ gtk_object_ref(GTK_OBJECT(e_canvas_vbox));
+ gtk_signal_connect(GTK_OBJECT(item), "destroy",
+ GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox);
+ if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
+ gnome_canvas_item_set(item,
+ "width", (double) e_canvas_vbox->width,
+ NULL);
+ e_canvas_item_request_reflow(item);
+ }
+
+}
+
+static void
+e_canvas_vbox_resize_children (GnomeCanvasItem *item)
+{
+ GList *list;
+ ECanvasVbox *e_canvas_vbox;
+
+ e_canvas_vbox = E_CANVAS_VBOX (item);
+ for ( list = e_canvas_vbox->items; list; list = list->next ) {
+ GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data);
+ gnome_canvas_item_set(child,
+ "width", (double) e_canvas_vbox->width,
+ NULL);
+ }
+}
+
+static void
+e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags )
+{
+ ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item);
+ if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
+
+ gdouble old_height;
+ gdouble running_height;
+
+ old_height = e_canvas_vbox->height;
+
+ running_height = 0;
+
+ if (e_canvas_vbox->items == NULL) {
+ } else {
+ GList *list;
+ gdouble item_height;
+
+ list = e_canvas_vbox->items;
+ gtk_object_get (GTK_OBJECT(list->data),
+ "height", &item_height,
+ NULL);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
+ (double) 0,
+ (double) running_height);
+ running_height += item_height;
+ list = g_list_next(list);
+
+ for( ; list; list = g_list_next(list)) {
+ running_height += e_canvas_vbox->spacing;
+
+ gtk_object_get (GTK_OBJECT(list->data),
+ "height", &item_height,
+ NULL);
+
+ g_print ("%f\n", running_height);
+
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
+ (double) 0,
+ (double) running_height);
+
+ running_height += item_height;
+ }
+
+ }
+ e_canvas_vbox->height = running_height;
+ if (old_height != e_canvas_vbox->height)
+ e_canvas_item_request_parent_reflow(item);
+ }
+}
+
+void
+e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
+{
+ if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item)
+ (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) (e_canvas_vbox, item);
+}
diff --git a/e-util/e-canvas-vbox.h b/e-util/e-canvas-vbox.h
new file mode 100644
index 0000000000..c45baa0b0a
--- /dev/null
+++ b/e-util/e-canvas-vbox.h
@@ -0,0 +1,86 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* e-canvas-vbox.h
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __E_CANVAS_VBOX_H__
+#define __E_CANVAS_VBOX_H__
+
+#include <gnome.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+/* ECanvasVbox - A canvas item container.
+ *
+ * The following arguments are available:
+ *
+ * name type read/write description
+ * --------------------------------------------------------------------------------
+ * width double RW width of the CanvasVbox
+ * height double R height of the CanvasVbox
+ * spacing double RW Spacing between items.
+ */
+
+#define E_CANVAS_VBOX_TYPE (e_canvas_vbox_get_type ())
+#define E_CANVAS_VBOX(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox))
+#define E_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass))
+#define E_IS_CANVAS_VBOX(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_VBOX_TYPE))
+#define E_IS_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_VBOX_TYPE))
+
+
+typedef struct _ECanvasVbox ECanvasVbox;
+typedef struct _ECanvasVboxClass ECanvasVboxClass;
+
+struct _ECanvasVbox
+{
+ GnomeCanvasGroup parent;
+
+ /* item specific fields */
+ GList *items; /* Of type GnomeCanvasItem */
+
+ double width;
+ double height;
+ double spacing;
+};
+
+struct _ECanvasVboxClass
+{
+ GnomeCanvasGroupClass parent_class;
+
+ /* Virtual methods. */
+ void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
+};
+
+/*
+ * To be added to a CanvasVbox, an item must have the argument "width" as
+ * a Read/Write argument and "height" as a Read Only argument. It
+ * should also do an ECanvas parent CanvasVbox request if its size
+ * changes.
+ */
+void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
+GtkType e_canvas_vbox_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __E_CANVAS_VBOX_H__ */