diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-02-24 14:51:23 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-02-24 14:51:23 +0800 |
commit | 7699b8996aa2d9ae3fea0e94981637c98e89a273 (patch) | |
tree | f4321790cd8c8619babfac9e2d4f38ca621d7e2d /widgets/e-table/e-table-group-leaf.c | |
parent | 6b338ae8ecd1332f574e33620e0765a16aab03a3 (diff) | |
download | gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.gz gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.bz2 gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.lz gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.xz gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.zst gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.zip |
This were moved to widgets/e-text/ a while ago but never removed. They
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* widgets/e-text.c, widgets/e-text.h, e-text-event-processor.c,
e-text-event-processor.h, e-text-event-processor-emacs-like.c,
e-text-event-processor-emacs-like.h,
e-text-event-processor-types.h: This were moved to widgets/e-text/
a while ago but never removed. They have now been removed.
* widgets/e-text/e-text.c, widgets/e-text/e-text.h: Removed some
warnings from this file. Made tooltips disappear when you're
finished with them.
* widgets/e-minicard/test-reflow.c,
widgets/e-minicard/test-minicard.c,
widgets/e-minicard/test-minicard-label.c: Commented out unused
about_callback functions.
* widgets/e-minicard/e-reflow.c: Made e-reflow pass an EFocus to
its e-minicard children.
* widgets/e-minicard/e-minicard.c: Made e-minicard take and return
an EFocus for its "has_focus" argument. This makes shift-tab work properly.
* widgets/e-minicard/e-minicard-label.c: Made e-minicard-label take and return
an EFocus for its "has_focus" argument. Made the font that
e-minicard-label uses only be allocated once.
* e-util/e-canvas-utils.h: Fixed the comment at the top and added
#ifndef __E_CANVAS_UTILS__.
* e-util/Makefile.am: Added e-xml-utils.c and
e-xml-utils.h.
* e-util/e-xml-utils.h, e-util/e-xml-utils.c: Added files for some
xml utilities.
* e-util/e-util.h: Added type EFocus which describes which
direction the focus will be coming from.
in mail:
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* message-list.c: Changed this to not use the "x" and "y"
arguments to e-table-item.
in widgets/e-table:
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* e-table-subset-variable.c, e-table-subset-variable.h: A new
model which is a subset, but you can add and remove rows.
* test-table.c: Added a thaw method for use with the
e-table-subset (emits model_changed.) Adapted to the changes to
e_table_item. Properly parse headers. Adapted to the changes to
e_table, including creating example xml spec data.
* test-cols.c, test-check.c: Added a thaw method for use with the
e-table-subset (emits model_changed.) Adapted to the changes to
e_table_item.
* e-table.c, e-table.h: Reworked e-table to use the ETable
grouping system. The only difference for the interface is that
instead of passing in a column_spec and a grouping_spec, you pass
in a single string that is an xml format that includes both pieces
of information.
* e-table-subset.h: Added rules for emacs to do correct
indentation.
* e-table-subset.c: Implemented freezing. No signals are emitted
while frozen and "model_changed" is emitted when thawed.
* e-table-sorted.h: ETableSortedClass has ETableSubset as its
parent object instead of ETableSubsetClass. Fixed this.
* e-table-simple.c, e-table-simple.h: Implemented the thaw method.
Use of simple now requires an extra argument (the thaw method.)
* e-table-model.h, e-table-model.c: Added e_table_model_freeze and
e_table_model_thaw.
* e-table-item.h, e-table-item.c: Reworked this a bit to make it
provide some things the new group system needed and to make
inter-item keyboard focus work. Changed the external interface
only in the list of arguments it recognizes and signals it emits.
Instead of "x" and "y", you have to use
e_canvas_item_move_absolute and instead of emitting a
"height_changed" signal, it emits a "resize" signal. There's new
"has_focus", "width", and "height" arguments and a function to get
the currently focused column.
* e-table-header-item.c: Got rid of some warnings here. Changed
the
* e-table-group-leaf.h, e-table-group-leaf.c,
e-table-group-container.h, e-table-group-container.c: New types to
make e_table_group work properly.
* e-table-group.h, e-table-group.c: Completely reworked e-table
grouping. e-table-group now uses a hierarchical structure.
* e-cell.h: Added e_cell_print. This doesn't work yet.
* e-cell.c: Made e_cell_realize exist. (It was improperly named
e_cell_view_realize in the .c.)
* e-cell-text.c: Made the blinking cursor disappear properly.
* check-filled.xpm, check-empty.xpm: Made these const char *[]
instead of char *[] to avoid compiler warnings.
* Makefile.am: Added e-table-group-container.c,
e-table-group-container.h, e-table-group-leaf.c,
e-table-group-leaf.h, e-table-subset-variable.c,
e-table-subset-variable.h.
svn path=/trunk/; revision=1915
Diffstat (limited to 'widgets/e-table/e-table-group-leaf.c')
-rw-r--r-- | widgets/e-table/e-table-group-leaf.c | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c new file mode 100644 index 0000000000..ba73ad9886 --- /dev/null +++ b/widgets/e-table/e-table-group-leaf.c @@ -0,0 +1,288 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * E-Table-Group.c: Implements the grouping objects for elements on a table + * + * Author: + * Miguel de Icaza (miguel@gnu.org() + * + * Copyright 1999, Helix Code, Inc. + */ + +#include <config.h> +#include <gtk/gtksignal.h> +#include "e-table-group-leaf.h" +#include "e-table-item.h" +#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include "e-util/e-util.h" + +#define TITLE_HEIGHT 16 +#define GROUP_INDENT 10 + +#define PARENT_TYPE e_table_group_get_type () + +static GnomeCanvasGroupClass *etgl_parent_class; + +/* The arguments we take */ +enum { + ARG_0, + ARG_HEIGHT, + ARG_WIDTH, + ARG_FROZEN +}; + +static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); + +static void +etgl_destroy (GtkObject *object) +{ + GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object); +} + +static void +e_table_group_leaf_construct (GnomeCanvasGroup *parent, ETableGroupLeaf *etgl, + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model) +{ + e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); + etgl->subset = E_TABLE_SUBSET_VARIABLE(e_table_subset_variable_new(model)); +} + +ETableGroup * +e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_header, + ETableHeader *header, + ETableModel *model) +{ + ETableGroupLeaf *etgl; + + g_return_val_if_fail (parent != NULL, NULL); + + etgl = gtk_type_new (e_table_group_leaf_get_type ()); + + e_table_group_leaf_construct (parent, etgl, full_header, + header, model); + return E_TABLE_GROUP (etgl); +} + +static void +etgl_resize (GtkObject *object, gpointer data) +{ + e_table_group_resize (E_TABLE_GROUP(data)); +} + +static void +etgl_realize (GnomeCanvasItem *item) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item); + gdouble height; + + if ( GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize ) + GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item); + + etgl->item = E_TABLE_ITEM(gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgl), + e_table_item_get_type (), + "ETableHeader", E_TABLE_GROUP(etgl)->header, + "ETableModel", etgl->subset, + "drawgrid", TRUE, + "drawfocus", TRUE, + "spreadsheet", TRUE, + "width", etgl->width, + NULL)); + gtk_signal_connect(GTK_OBJECT(etgl->item), + "resize", etgl_resize, etgl); + gtk_object_get(GTK_OBJECT(etgl->item), + "height", &height, + NULL); + if ( height != 1 ) + e_table_group_resize(E_TABLE_GROUP(etgl)); +} + +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; + +} + +static void +etgl_add (ETableGroup *etg, gint row) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + e_table_subset_variable_add(etgl->subset, row); +} + +static gboolean +etgl_remove (ETableGroup *etg, gint row) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + return e_table_subset_variable_remove(etgl->subset, row); +} + +static void +etgl_increment (ETableGroup *etg, gint position, gint amount) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + e_table_subset_variable_increment(etgl->subset, position, amount); +} + +static void +etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + if (direction == E_FOCUS_END) { + e_table_item_focus(etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->subset)) - 1); + } else { + e_table_item_focus(etgl->item, view_col, 0); + } +} + +static gint +etgl_get_focus_column (ETableGroup *etg) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + return e_table_item_get_focused_column(etgl->item); +} + +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); + + switch (arg_id) { + case ARG_FROZEN: + if ( GTK_VALUE_BOOL (*arg) ) + etg->frozen = TRUE; + else { + 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)); + break; + default: + break; + } +} + +static void +etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ETableGroup *etg = E_TABLE_GROUP (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; + 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; + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} + +static void +etgl_class_init (GtkObjectClass *object_class) +{ + GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; + ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS( object_class ); + + object_class->destroy = etgl_destroy; + object_class->set_arg = etgl_set_arg; + 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); + + e_group_class->add = etgl_add; + e_group_class->remove = etgl_remove; + e_group_class->increment = etgl_increment; + 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_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_FROZEN); +} + +static void +etgl_init (GtkObject *object) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); + + etgl->width = 1; + etgl->subset = NULL; + etgl->item = NULL; +} + +E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE); |