1 /* gsheet-uniform-column.c
3 * PSPPIRE --- A Graphical User Interface for PSPP
4 * Copyright (C) 2006 Free Software Foundation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "gsheet-column-iface.h"
24 #include "gsheet-uniform-column.h"
27 static void g_sheet_uniform_column_init (GSheetUniformColumn *ug);
28 static void g_sheet_uniform_column_class_init (GSheetUniformColumnClass *class);
29 static void g_sheet_uniform_column_finalize (GObject *object);
31 static void g_sheet_column_init (GSheetColumnIface *iface);
34 static GObjectClass *parent_class = NULL;
37 g_sheet_uniform_column_get_type (void)
39 static GType uniform_column_type = 0;
41 if (!uniform_column_type)
43 static const GTypeInfo uniform_column_info =
45 sizeof (GSheetUniformColumnClass),
47 NULL, /* base_finalize */
48 (GClassInitFunc) g_sheet_uniform_column_class_init,
49 NULL, /* class_finalize */
50 NULL, /* class_data */
51 sizeof (GSheetUniformColumn),
53 (GInstanceInitFunc) g_sheet_uniform_column_init,
56 static const GInterfaceInfo column_info =
58 (GInterfaceInitFunc) g_sheet_column_init,
64 g_type_register_static (G_TYPE_OBJECT, "g_sheet_uniform_column",
65 &uniform_column_info, 0);
67 g_type_add_interface_static (uniform_column_type,
72 return uniform_column_type;
77 * g_sheet_uniform_column_new:
78 * @width: The size of columns in this uniform column
80 * Return value: a new #g_sheet_uniform_column
83 g_sheet_uniform_column_new (gint width, gint n_columns)
85 GSheetUniformColumn *ug;
88 retval = g_object_new (G_TYPE_SHEET_UNIFORM_COLUMN, NULL);
90 ug = G_SHEET_UNIFORM_COLUMN(retval);
91 ug->n_columns = n_columns;
93 ug->is_visible = TRUE;
94 ug->is_sensitive = FALSE;
100 g_sheet_uniform_column_get_width (const GSheetColumn *geom, glong u)
102 GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
108 g_sheet_uniform_column_get_sensitivity (const GSheetColumn *geom, glong u)
110 GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
112 return ug->is_sensitive;
117 g_sheet_uniform_column_get_visibility (const GSheetColumn *geom, glong u)
119 GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
121 return ug->is_visible;
126 g_sheet_uniform_column_get_button_label (const GSheetColumn *geom, glong u)
128 gchar *label = g_strdup_printf ("%ld", u);
134 static GtkJustification
135 g_sheet_uniform_column_get_justification (const GSheetColumn *geom, glong u)
137 return GTK_JUSTIFY_FILL;
143 g_sheet_uniform_column_get_column_count (const GSheetColumn *geom)
145 GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
147 return ug->n_columns;
151 g_sheet_uniform_column_class_init (GSheetUniformColumnClass *class)
153 GObjectClass *object_class;
155 parent_class = g_type_class_peek_parent (class);
156 object_class = (GObjectClass*) class;
158 object_class->finalize = g_sheet_uniform_column_finalize;
164 g_sheet_uniform_column_init (GSheetUniformColumn *o)
169 g_sheet_uniform_column_finalize (GObject *object)
175 g_sheet_column_init (GSheetColumnIface *iface)
177 iface->get_width = g_sheet_uniform_column_get_width ;
178 iface->get_sensitivity = g_sheet_uniform_column_get_sensitivity ;
179 iface->get_visibility = g_sheet_uniform_column_get_visibility ;
180 iface->get_justification = g_sheet_uniform_column_get_justification;
181 iface->get_column_count = g_sheet_uniform_column_get_column_count;
182 iface->get_button_label = g_sheet_uniform_column_get_button_label;