diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-03-12 15:59:42 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-03-12 15:59:42 +0800 |
commit | 1f7ba945b16cd5f8c01641dd864a9671d791a651 (patch) | |
tree | b673bc2f8f4b07554ca42cbd714ccc98efd14f9b /widgets/e-minicard/e-minicard-label.c | |
parent | f669ff481f57cf5b609ea2e8fe30cfb8dece8587 (diff) | |
download | gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.tar gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.tar.gz gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.tar.bz2 gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.tar.lz gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.tar.xz gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.tar.zst gsoc2013-evolution-1f7ba945b16cd5f8c01641dd864a9671d791a651.zip |
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
Diffstat (limited to 'widgets/e-minicard/e-minicard-label.c')
-rw-r--r-- | widgets/e-minicard/e-minicard-label.c | 162 |
1 files changed, 77 insertions, 85 deletions
diff --git a/widgets/e-minicard/e-minicard-label.c b/widgets/e-minicard/e-minicard-label.c index 25f7f939fc..799eb87cd1 100644 --- a/widgets/e-minicard/e-minicard-label.c +++ b/widgets/e-minicard/e-minicard-label.c @@ -46,7 +46,8 @@ enum { ARG_HEIGHT, ARG_HAS_FOCUS, ARG_FIELD, - ARG_FIELDNAME + ARG_FIELDNAME, + ARG_TEXT_MODEL }; GtkType @@ -95,6 +96,8 @@ e_minicard_label_class_init (EMinicardLabelClass *klass) GTK_ARG_READWRITE, ARG_FIELD); gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FIELDNAME); + gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT, + GTK_ARG_READWRITE, ARG_TEXT_MODEL); object_class->set_arg = e_minicard_label_set_arg; object_class->get_arg = e_minicard_label_get_arg; @@ -114,8 +117,6 @@ e_minicard_label_init (EMinicardLabel *minicard_label) minicard_label->rect = NULL; minicard_label->fieldname = NULL; minicard_label->field = NULL; - minicard_label->fieldname_text = NULL; - minicard_label->field_text = NULL; e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow); } @@ -131,26 +132,23 @@ e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - e_minicard_label_resize_children(e_minicard_label); - e_canvas_item_request_reflow (item); - break; + e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); + e_minicard_label_resize_children(e_minicard_label); + e_canvas_item_request_reflow (item); + break; case ARG_HAS_FOCUS: if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) e_canvas_item_grab_focus(e_minicard_label->field); break; case ARG_FIELD: - if ( e_minicard_label->field ) - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->field_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; + gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); + break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->fieldname_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; + gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); + break; + case ARG_TEXT_MODEL: + gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL); + break; } } @@ -159,32 +157,31 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { EMinicardLabel *e_minicard_label; char *temp; + ETextModel *tempmodel; e_minicard_label = E_MINICARD_LABEL (object); switch (arg_id) { case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; + GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; + break; case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; + GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; + break; case ARG_HAS_FOCUS: GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; break; case ARG_FIELD: - if ( e_minicard_label->field ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); + gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + break; + case ARG_TEXT_MODEL: + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL ); + GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel); break; default: arg->type = GTK_TYPE_INVALID; @@ -195,6 +192,19 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) static void e_minicard_label_realize (GnomeCanvasItem *item) { + if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) + (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); + + e_canvas_item_request_reflow(item); + + if (!item->canvas->aa) + { + } +} + +void +e_minicard_label_construct (GnomeCanvasItem *item) +{ EMinicardLabel *e_minicard_label; GnomeCanvasGroup *group; static GdkFont *font = NULL; @@ -206,9 +216,6 @@ e_minicard_label_realize (GnomeCanvasItem *item) e_minicard_label = E_MINICARD_LABEL (item); group = GNOME_CANVAS_GROUP( item ); - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - e_minicard_label->rect = gnome_canvas_item_new( group, gnome_canvas_rect_get_type(), @@ -229,13 +236,6 @@ e_minicard_label_realize (GnomeCanvasItem *item) "fill_color", "black", NULL ); e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1); - if ( e_minicard_label->fieldname_text ) - { - gnome_canvas_item_set( e_minicard_label->fieldname, - "text", e_minicard_label->fieldname_text, - NULL ); - g_free( e_minicard_label->fieldname_text ); - } e_minicard_label->field = gnome_canvas_item_new( group, @@ -249,20 +249,8 @@ e_minicard_label_realize (GnomeCanvasItem *item) "editable", TRUE, NULL ); e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - if ( e_minicard_label->field_text ) - { - gnome_canvas_item_set( e_minicard_label->field, - "text", e_minicard_label->field_text, - NULL ); - g_free( e_minicard_label->field_text ); - } e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) - { - } - } static void @@ -379,49 +367,53 @@ e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) static void e_minicard_label_resize_children(EMinicardLabel *e_minicard_label) { - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) { - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - NULL ); - } + gnome_canvas_item_set( e_minicard_label->fieldname, + "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), + NULL ); + gnome_canvas_item_set( e_minicard_label->field, + "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), + NULL ); } static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags) { EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item); - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) - { - gint old_height; - gdouble text_height; - old_height = e_minicard_label->height; + + gint old_height; + gdouble text_height; + old_height = e_minicard_label->height; - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); + gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), + "text_height", &text_height, + NULL); - e_minicard_label->height = text_height; + e_minicard_label->height = text_height; - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); + gtk_object_get(GTK_OBJECT(e_minicard_label->field), + "text_height", &text_height, + NULL); - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; + if (e_minicard_label->height < text_height) + e_minicard_label->height = text_height; + e_minicard_label->height += 3; - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); + gnome_canvas_item_set( e_minicard_label->rect, + "x2", (double) e_minicard_label->width - 1, + "y2", (double) e_minicard_label->height - 1, + NULL ); + e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - if (old_height != e_minicard_label->height) - e_canvas_item_request_parent_reflow(item); - - } + if (old_height != e_minicard_label->height) + e_canvas_item_request_parent_reflow(item); } + +GnomeCanvasItem * +e_minicard_label_new(GnomeCanvasGroup *parent) +{ + GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL); + e_minicard_label_construct(item); + return item; +} + |