Fixed bug reporting the significance of paired value t-test.
[pspp-builds.git] / lib / gtksheet / gsheet-uniform-column.c
1 /* gsheet-uniform-column.c
2  *
3  * PSPPIRE --- A Graphical User Interface for PSPP
4  * Copyright (C) 2006  Free Software Foundation
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <config.h>
22
23 #include "gsheet-column-iface.h"
24 #include "gsheet-uniform-column.h"
25
26
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);
30
31 static void g_sheet_column_init (GSheetColumnIface *iface);
32
33
34 static GObjectClass *parent_class = NULL;
35
36 GType
37 g_sheet_uniform_column_get_type (void)
38 {
39   static GType uniform_column_type = 0;
40
41   if (!uniform_column_type)
42     {
43       static const GTypeInfo uniform_column_info =
44       {
45         sizeof (GSheetUniformColumnClass),
46         NULL,           /* base_init */
47         NULL,           /* base_finalize */
48         (GClassInitFunc) g_sheet_uniform_column_class_init,
49         NULL,           /* class_finalize */
50         NULL,           /* class_data */
51         sizeof (GSheetUniformColumn),
52         0,
53         (GInstanceInitFunc) g_sheet_uniform_column_init,
54       };
55
56       static const GInterfaceInfo column_info =
57       {
58         (GInterfaceInitFunc) g_sheet_column_init,
59         NULL,
60         NULL
61       };
62
63       uniform_column_type =
64         g_type_register_static (G_TYPE_OBJECT, "g_sheet_uniform_column",
65                                 &uniform_column_info, 0);
66
67       g_type_add_interface_static (uniform_column_type,
68                                    G_TYPE_SHEET_COLUMN,
69                                    &column_info);
70     }
71
72   return uniform_column_type;
73 }
74
75
76 /**
77  * g_sheet_uniform_column_new:
78  * @width: The size of columns in this uniform column
79  *
80  * Return value: a new #g_sheet_uniform_column
81  **/
82 GObject *
83 g_sheet_uniform_column_new (gint width, gint n_columns)
84 {
85   GSheetUniformColumn *ug;
86   GObject *retval;
87
88   retval = g_object_new (G_TYPE_SHEET_UNIFORM_COLUMN, NULL);
89
90   ug = G_SHEET_UNIFORM_COLUMN(retval);
91   ug->n_columns = n_columns;
92   ug->width = width;
93   ug->is_visible = TRUE;
94   ug->is_sensitive = FALSE;
95
96   return retval;
97 }
98
99 static gint
100 g_sheet_uniform_column_get_width (const GSheetColumn *geom, glong u)
101 {
102   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
103
104   return ug->width;
105 }
106
107 static gboolean
108 g_sheet_uniform_column_get_sensitivity (const GSheetColumn *geom, glong u)
109 {
110   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
111
112   return ug->is_sensitive;
113 }
114
115
116 static gboolean
117 g_sheet_uniform_column_get_visibility (const GSheetColumn *geom, glong u)
118 {
119   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
120
121   return ug->is_visible;
122 }
123
124
125 static gchar *
126 g_sheet_uniform_column_get_button_label (const GSheetColumn *geom, glong u)
127 {
128   gchar *label = g_strdup_printf ("%ld", u);
129
130   return label;
131 }
132
133
134 static GtkJustification
135 g_sheet_uniform_column_get_justification (const GSheetColumn *geom, glong u)
136 {
137   return GTK_JUSTIFY_FILL;
138 }
139
140
141
142 static glong
143 g_sheet_uniform_column_get_column_count (const GSheetColumn *geom)
144 {
145   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN (geom);
146
147   return ug->n_columns;
148 }
149
150 static void
151 g_sheet_uniform_column_class_init (GSheetUniformColumnClass *class)
152 {
153   GObjectClass *object_class;
154
155   parent_class = g_type_class_peek_parent (class);
156   object_class = (GObjectClass*) class;
157
158   object_class->finalize = g_sheet_uniform_column_finalize;
159
160 }
161
162
163 static void
164 g_sheet_uniform_column_init (GSheetUniformColumn *o)
165 {
166 }
167
168 static void
169 g_sheet_uniform_column_finalize (GObject *object)
170 {
171 }
172
173
174 static void
175 g_sheet_column_init (GSheetColumnIface *iface)
176 {
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;
183 }
184