Files
evolution/widgets/table/e-table-column-item.c
Christopher James Lahey 1f7ba945b1 Rearranged SUBDIRS for dependencies.
2000-03-12  Christopher James Lahey  <clahey@helixcode.com>

        * widgets/Makefile.am: Rearranged SUBDIRS for dependencies.

        * widgets/e-text/e-text-model.c, widgets/e-text-model.h: New
        object which stores a piece of text data.  All methods are
        virtual.

        * widgets/e-text/e-text.c, widgets/e-text/e-text.h: Modified this
        to use an ETextModel for its data.

        * widgets/e-text/Makefile.am: Added e-text-model.c and e-text-model.h.

        * widgets/e-minicard/test-minicard-label.c: Made this work again.

        * widgets/e-minicard/e-minicard.c,
        widgets/e-minicard/e-minicard.h: Made this use an ETableModel to
        get its data.

        * widgets/e-minicard/e-minicard-label.c,
        widgets/e-minicard/e-minicard-label.h: Added the ability to set
        the text model used for the contained text widget.

        * widgets/e-minicard/Makefile.am: Added e-table since e-minicard
        is now dependent on an e-table-model for its data.

        * e-util/e-canvas.c, e-util/e-canvas.h: Fixed some bugs here to
        speed up reflow and to make it fail less often.

        * addressbook/demo, addressbook/demo/.cvsignore,
        addressbook/demo/Makefile.am, addressbook/demo/demo.c,
        addressbook/demo/spec: A new program to test ETable and EMinicard
        integration.

        * configure.in: Added addressbook/demo/Makefile.

        * addressbook/Makefile.am: Added the demo/ subdirectory.

in widgets/e-table/:

2000-03-12  Christopher James Lahey  <clahey@helixcode.com>

        * e-table.c: Made this use an ECanvas.  Fixed a bug where
        e_table_new_from_spec_file was calling e_table_construct instead
        of e_table_construct_from_spec_file.

        * e-table-item.c, e-table-header-item.c, e-table-column-item.c:
        Switched these to use GTK_TYPE_OBJECT and GTK_VALUE_OBJECT instead
        of GTK_TYPE_POINTER and GTK_TYPE_OBJECT.

        * e-cell-text.c: Got rid of a crashing bug.

        * e-table-text-model.c, e-table-text-model.h: A new object which
        is an e-text-model which uses an e-table-model for its data.

        * Makefile.am: Added e-table-text-model.c and
        e-table-text-model.h.

        * .cvsignore: Added table-example-1 and table-example-2.

svn path=/trunk/; revision=2101
2000-03-12 07:59:42 +00:00

200 lines
4.3 KiB
C

/*
* E-table-column-view.c: A canvas view of the TableColumn.
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
*
* Copyright 1999, Helix Code, Inc.
*/
#include <config.h>
#include "e-table-column.h"
#include "e-table-column-view.h"
#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
static GnomeCanvasItemClass *etci_parent_class;
enum {
ARG_0,
ARG_TABLE_COLUMN
};
static void
etci_destroy (GtkObject *object)
{
ETableColumnItem *etcv = E_TABLE_COLUMN_VIEW (object);
gtk_object_unref (GTK_OBJECT (etcv));
if (GTK_OBJECT_CLASS (etcv_parent_class)->destroy)
(*GTK_OBJECT_CLASS (etcv_parent_class)->destroy) (object);
}
static void
etci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
{
if (GNOME_CANVAS_ITEM_CLASS(item_bar_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS(item_bar_parent_class)->update)(item, affine, clip_path, flags);
item->x1 = 0;
item->y1 = 0;
item->x2 = INT_MAX;
item->y2 = INT_MAX;
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
}
static void
etci_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
GnomeCanvasItem *item;
ETableColumnItem *etci;
int v;
item = GNOME_CANVAS_ITEM (o);
etci = E_TABLE_COLUMN_ITEM (o);
switch (arg_id){
case ARG_TABLE_COLUMN:
etci->etci = GTK_VALUE_OBJECT (*arg);
break;
}
etci_update (item, NULL, NULL, 0);
}
static void
etci_realize (GnomeCanvasItem *item)
{
ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
GdkWindow *window;
GdkColor c;
if (GNOME_CANVAS_ITEM_CLASS (etci_parent_class)-> realize)
(*GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->realize)(item);
window = GTK_WIDGET (item->canvas)->window;
etci->gc = gdk_gc_new (window);
gnome_canvas_get_color (item->canvas, "black", &c);
gdk_gc_set_foreground (etci->gc, &c);
etci->normal_cursor = gdk_cursor_new (GDK_ARROW);
}
static void
etci_unrealize (GnomeCanvasItem *item)
{
ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
gdk_gc_unref (etci->gc);
etci->gc = NULL;
gdk_cursor_destroy (etci->change_cursor);
etci->change_cursor = NULL;
gdk_cursor_destroy (etci->normal_cursor);
etci->normal_cursor = NULL;
if (GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->unrealize)
(*GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->unrealize)(item);
}
static void
etci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x1, int y1, int width, int height)
{
ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
GnomeCanvas *canvas = item->canvas;
GdkGC *gc;
const int cols = e_table_column_count (etci->etc);
int x2 = x1 + width;
int col, total;
total = 0;
for (col = 0; col < cols; col++){
ETableCol *col = e_table_column_get_column (etci->etc, col);
const int col_width = col->width;
if (x1 > total + col_width)
continue;
if (x2 < total)
return;
gc = canvas->style->bg_gc [GTK_STATE_ACTIVE];
gdk_draw_rectangle (drawble, gc, TRUE,
gtk_draw_shadow (canvas->style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
x, y, width, height
}
}
static double
etci_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
GnomeCanvasItem **actual_item)
{
*actual_item = *item;
return 0.0;
}
static void
etci_event (GnomeCanvasItem *item, GdkEvent *e)
{
switch (e->type){
default:
return FALSE;
}
return TRUE;
}
static void
etci_class_init (GtkObjectClass *object_class)
{
GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
object_class->destroy = etci_destroy;
object_class->set_arg = etci_set_arg;
item_class->update = etci_update;
item_class->realize = etci_realize;
item_class->unrealize = etci_unrealize;
item_class->draw = etci_draw;
item_class->point = etci_point;
item_class->event = etci_event;
gtk_object_add_arg_type ("ETableColumnItem::ETableColumn", GTK_TYPE_OBJECT,
GTK_ARG_WRITABLE, ARG_TABLE_COLUMN);
}
static void
etci_init (GnomeCanvasItem *item)
{
item->x1 = 0;
item->y1 = 0;
item->x2 = 0;
item->y2 = 0;
}
GtkType
e_table_column_view_get_type (void)
{
static GtkType type = 0;
if (!type){
GtkTypeInfo info = {
"ETableColumnItem",
sizeof (ETableColumnItem),
sizeof (ETableColumnItemClass),
(GtkClassInitFunc) etci_class_init,
(GtkObjectInitFunc) etci_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
}
return type;
}