/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * e-table-field-chooser.c * Copyright (C) 2000 Ximian, Inc. * Author: Chris Lahey * * 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 #include #include "e-table-field-chooser.h" #include "e-table-field-chooser-item.h" static void e_table_field_chooser_init (ETableFieldChooser *card); static void e_table_field_chooser_class_init (ETableFieldChooserClass *klass); static void e_table_field_chooser_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); static void e_table_field_chooser_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static void e_table_field_chooser_destroy (GtkObject *object); static GtkVBoxClass *parent_class = NULL; /* The arguments we take */ enum { ARG_0, ARG_FULL_HEADER, ARG_DND_CODE, }; GtkType e_table_field_chooser_get_type (void) { static GtkType table_field_chooser_type = 0; if (!table_field_chooser_type) { static const GtkTypeInfo table_field_chooser_info = { "ETableFieldChooser", sizeof (ETableFieldChooser), sizeof (ETableFieldChooserClass), (GtkClassInitFunc) e_table_field_chooser_class_init, (GtkObjectInitFunc) e_table_field_chooser_init, /* reserved_1 */ NULL, /* reserved_2 */ NULL, (GtkClassInitFunc) NULL, }; table_field_chooser_type = gtk_type_unique (gtk_vbox_get_type (), &table_field_chooser_info); } return table_field_chooser_type; } static void e_table_field_chooser_class_init (ETableFieldChooserClass *klass) { GtkObjectClass *object_class; GtkVBoxClass *vbox_class; object_class = (GtkObjectClass*) klass; vbox_class = (GtkVBoxClass *) klass; glade_gnome_init(); parent_class = gtk_type_class (gtk_vbox_get_type ()); object_class->set_arg = e_table_field_chooser_set_arg; object_class->get_arg = e_table_field_chooser_get_arg; object_class->destroy = e_table_field_chooser_destroy; gtk_object_add_arg_type ("ETableFieldChooser::dnd_code", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_DND_CODE); gtk_object_add_arg_type ("ETableFieldChooser::full_header", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_FULL_HEADER); } static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, ETableFieldChooser *etfc) { double height; etfc->last_alloc = *allocation; gnome_canvas_item_set( etfc->item, "width", (double) allocation->width, NULL ); gtk_object_get(GTK_OBJECT(etfc->item), "height", &height, NULL); height = MAX(height, allocation->height); gnome_canvas_set_scroll_region(GNOME_CANVAS( etfc->canvas ), 0, 0, allocation->width - 1, height - 1); gnome_canvas_item_set( etfc->rect, "x2", (double) allocation->width, "y2", (double) height, NULL ); } static void resize(GnomeCanvas *canvas, ETableFieldChooser *etfc) { double height; gtk_object_get(GTK_OBJECT(etfc->item), "height", &height, NULL); height = MAX(height, etfc->last_alloc.height); gnome_canvas_set_scroll_region (GNOME_CANVAS(etfc->canvas), 0, 0, etfc->last_alloc.width - 1, height - 1); gnome_canvas_item_set( etfc->rect, "x2", (double) etfc->last_alloc.width, "y2", (double) height, NULL ); } static void e_table_field_chooser_init (ETableFieldChooser *etfc) { GladeXML *gui; GtkWidget *widget; gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL); etfc->gui = gui; widget = glade_xml_get_widget(gui, "vbox-top"); if (!widget) { return; } gtk_widget_reparent(widget, GTK_WIDGET(etfc)); gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); etfc->canvas = GNOME_CANVAS(glade_xml_get_widget(gui, "canvas-buttons")); etfc->rect = gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS( etfc->canvas ) ), gnome_canvas_rect_get_type(), "x1", (double) 0, "y1", (double) 0, "x2", (double) 100, "y2", (double) 100, "fill_color", "white", NULL ); etfc->item = gnome_canvas_item_new(gnome_canvas_root(etfc->canvas), e_table_field_chooser_item_get_type(), "width", (double) 100, "full_header", etfc->full_header, "dnd_code", etfc->dnd_code, NULL ); gtk_signal_connect( GTK_OBJECT( etfc->canvas ), "reflow", GTK_SIGNAL_FUNC( resize ), etfc); gnome_canvas_set_scroll_region ( GNOME_CANVAS( etfc->canvas ), 0, 0, 100, 100 ); /* Connect the signals */ gtk_signal_connect (GTK_OBJECT (etfc->canvas), "size_allocate", GTK_SIGNAL_FUNC (allocate_callback), etfc); gtk_widget_pop_visual (); gtk_widget_pop_colormap (); gtk_widget_show(widget); } static void e_table_field_chooser_destroy (GtkObject *object) { ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); g_free(etfc->dnd_code); if (etfc->full_header) gtk_object_unref(GTK_OBJECT(etfc->full_header)); if (etfc->gui) gtk_object_unref(GTK_OBJECT(etfc->gui)); } GtkWidget* e_table_field_chooser_new (void) { GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_table_field_chooser_get_type ())); return widget; } static void e_table_field_chooser_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); switch (arg_id){ case ARG_DND_CODE: g_free(etfc->dnd_code); etfc->dnd_code = g_strdup(GTK_VALUE_STRING (*arg)); if (etfc->item) gtk_object_set(GTK_OBJECT(etfc->item), "dnd_code", etfc->dnd_code, NULL); break; case ARG_FULL_HEADER: if (etfc->full_header) gtk_object_unref(GTK_OBJECT(etfc->full_header)); if (GTK_VALUE_OBJECT(*arg)) etfc->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg)); else etfc->full_header = NULL; if (etfc->full_header) gtk_object_ref(GTK_OBJECT(etfc->full_header)); if (etfc->item) gtk_object_set(GTK_OBJECT(etfc->item), "full_header", etfc->full_header, NULL); break; default: break; } } static void e_table_field_chooser_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); switch (arg_id) { case ARG_DND_CODE: GTK_VALUE_STRING (*arg) = g_strdup (etfc->dnd_code); break; case ARG_FULL_HEADER: GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfc->full_header); break; default: arg->type = GTK_TYPE_INVALID; break; } } =244f7fae9a70816d28aa72ccf32ed6a34adbce60'>kde4-l10n
Commit message (Expand)AuthorAgeFilesLines
* kde@freebsd team is pleased to announce KDE 4.1.4, the last bugfix release in...makc2009-01-143-6/+6
* The KDE FreeBSD team is proud to announce the release of KDE 4.1.1miwi2008-09-032-9/+6
* The KDE FreeBSD team is proud to announce the release of KDE 4.1.0miwi2008-08-104-266/+182
* Update to KDE 3.5.8lofi2007-10-302-3/+244
* Update to KDE 3.5.7 / KOffice 1.6.3lofi2007-07-042-4/+3
* - Welcome X.org 7.2 \o/.flz2007-05-201-0/+1
* Update to KDE 3.5.6 / KOffice 1.6.2lofi2007-03-141-3/+3
* Update to KDE 3.5.5 / KOffice 1.6.1lofi2006-12-201-3/+3
* KDE 3.5.4 / KOffice 1.5.2lofi2006-09-132-4/+3
* Update to KDE 3.5.3lofi2006-06-062-10/+9
* Update to KDE 3.5.2lofi2006-03-312-63/+10
* Update to KDE 3.5.1.lofi2006-02-011-3/+3
* Update to KDE 3.5.0lofi2006-01-093-38/+49
* Update to KDE 3.4.3 / KOffice 1.4.2lofi2005-11-051-5/+0
* Update to KDE 3.4.2 / KOffice 1.4.1lofi2005-08-013-3/+18
* Update to KDE 3.4.1lofi2005-06-261-1/+0
* Update to KDE 3.4lofi2005-03-211-0/+1
* Add i18nized doc subdirs to kdehier and adjust i18n port plists accordingly.lofi2004-12-231-1/+1
* Tweak IGNORE string to give a better-worded error message.kris2004-12-191-1/+1
* Update to KDE 3.3.2lofi2004-12-141-1/+1
* Update to KDE 3.3lofi2004-08-312-3/+1
* Pet portlint.lofi2004-07-112-1/+3
* Update to KDE 3.2.1 / QT 3.3.1lofi2004-03-101-0/+1
* Update to KDE 3.2.0lofi2004-02-051-1/+2
* Add USE_GETTEXT and bump PORTREVISION.marcus2004-02-041-2/+1
* Now gettext 0.12.1 is gettext-old.trevor2004-01-241-1/+1
* Upgrade to Qt 3.2.1 / KDE 3.1.4. See x11/kde3/Makefile rev 1.64 for details.will2003-09-181-1/+0
* Update KDE to the latest official release, KDE 3.1.3lofi2003-07-291-0/+1
* Update to KDE 3.1.2lioux2003-05-201-3/+3
* Back out my last commit to pkg-plist.arved2003-04-141-3/+0
* - Nuke obsolete PREV_I18N_VER from Makefile.kdearved2003-04-083-4/+6
* Rejoice, for the long awaited upgrade to kde 3.1.1 is here!alane2003-04-062-1/+10
* Clear moonlight beckons.ade2003-03-072-1/+1
* Upgrade kde-i18n to 3.1. Note that the following modules did not get awill2003-01-292-1/+2
* Fix categories to match dir containing port. bsd.port.mk (and portlint)alane2002-10-301-1/+2
* 1. Removed comments from pkg-plist files per will's request.alane2002-10-112-1/+2
* Update to 3.0.3. Not much changed here: [1] i18n PKGNAMEs converted towill2002-08-252-4/+2
* 1. Changed the lib depends on gettext to a build depends. This will meanalane2002-08-031-2/+2
* Bump PORTREVISION. KDE is fragile enough in its dependencies; we don'talane2002-08-02