]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellareabox.c
Removed attribute handling from class vfuncs of GtkCellArea.
[~andy/gtk] / gtk / gtkcellareabox.c
1 /* gtkcellarea.c
2  *
3  * Copyright (C) 2010 Openismus GmbH
4  *
5  * Authors:
6  *      Tristan Van Berkom <tristanvb@openismus.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #include "gtkorientable.h"
25 #include "gtkcellareabox.h"
26
27 /* GObjectClass */
28 static void      gtk_cell_area_box_finalize                       (GObject            *object);
29 static void      gtk_cell_area_box_dispose                        (GObject            *object);
30 static void      gtk_cell_area_box_set_property                   (GObject            *object,
31                                                                    guint               prop_id,
32                                                                    const GValue       *value,
33                                                                    GParamSpec         *pspec);
34 static void      gtk_cell_area_box_get_property                   (GObject            *object,
35                                                                    guint               prop_id,
36                                                                    GValue             *value,
37                                                                    GParamSpec         *pspec);
38
39 /* GtkCellAreaClass */
40 static void      gtk_cell_area_box_add                            (GtkCellArea        *area,
41                                                                    GtkCellRenderer    *renderer);
42 static void      gtk_cell_area_box_remove                         (GtkCellArea        *area,
43                                                                    GtkCellRenderer    *renderer);
44 static void      gtk_cell_area_box_forall                         (GtkCellArea        *area,
45                                                                    GtkCellCallback     callback,
46                                                                    gpointer            callback_data);
47 static gint      gtk_cell_area_box_event                          (GtkCellArea        *area,
48                                                                    GtkWidget          *widget,
49                                                                    GdkEvent           *event,
50                                                                    const GdkRectangle *cell_area);
51 static void      gtk_cell_area_box_render                         (GtkCellArea        *area,
52                                                                    cairo_t            *cr,
53                                                                    GtkWidget          *widget,
54                                                                    const GdkRectangle *cell_area);
55
56 static GtkSizeRequestMode gtk_cell_area_box_get_request_mode      (GtkCellArea        *area);
57 static void      gtk_cell_area_box_get_preferred_width            (GtkCellArea        *area,
58                                                                    GtkWidget          *widget,
59                                                                    gint               *minimum_width,
60                                                                    gint               *natural_width);
61 static void      gtk_cell_area_box_get_preferred_height           (GtkCellArea        *area,
62                                                                    GtkWidget          *widget,
63                                                                    gint               *minimum_height,
64                                                                    gint               *natural_height);
65 static void      gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea        *area,
66                                                                    GtkWidget          *widget,
67                                                                    gint                width,
68                                                                    gint               *minimum_height,
69                                                                    gint               *natural_height);
70 static void      gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea        *area,
71                                                                    GtkWidget          *widget,
72                                                                    gint                height,
73                                                                    gint               *minimum_width,
74                                                                    gint               *natural_width);
75
76
77 struct _GtkCellAreaBoxPrivate
78 {
79   GtkOrientation orientation;
80
81 };
82
83 enum {
84   PROP_0,
85   PROP_ORIENTATION
86 };
87
88 G_DEFINE_TYPE_WITH_CODE (GtkCellAreaBox, gtk_cell_area_box, GTK_TYPE_CELL_AREA,
89                          G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL));
90
91
92 static void
93 gtk_cell_area_box_init (GtkCellAreaBox *box)
94 {
95   GtkCellAreaBoxPrivate *priv;
96
97   box->priv = G_TYPE_INSTANCE_GET_PRIVATE (box,
98                                            GTK_TYPE_CELL_AREA_BOX,
99                                            GtkCellAreaBoxPrivate);
100   priv = box->priv;
101
102   priv->orientation = GTK_ORIENTATION_HORIZONTAL;
103 }
104
105 static void 
106 gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class)
107 {
108   GObjectClass     *object_class = G_OBJECT_CLASS (class);
109   GtkCellAreaClass *area_class   = GTK_CELL_AREA_CLASS (class);
110
111   /* GObjectClass */
112   object_class->finalize     = gtk_cell_area_box_finalize;
113   object_class->dispose      = gtk_cell_area_box_dispose;
114   object_class->set_property = gtk_cell_area_box_set_property;
115   object_class->get_property = gtk_cell_area_box_get_property;
116
117   /* GtkCellAreaClass */
118   area_class->add                            = gtk_cell_area_box_add;
119   area_class->remove                         = gtk_cell_area_box_remove;
120   area_class->forall                         = gtk_cell_area_box_forall;
121   area_class->event                          = gtk_cell_area_box_event;
122   area_class->render                         = gtk_cell_area_box_render;
123   
124   area_class->get_request_mode               = gtk_cell_area_box_get_request_mode;
125   area_class->get_preferred_width            = gtk_cell_area_box_get_preferred_width;
126   area_class->get_preferred_height           = gtk_cell_area_box_get_preferred_height;
127   area_class->get_preferred_height_for_width = gtk_cell_area_box_get_preferred_height_for_width;
128   area_class->get_preferred_width_for_height = gtk_cell_area_box_get_preferred_width_for_height;
129
130   g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation");
131
132
133   g_type_class_add_private (object_class, sizeof (GtkCellAreaBoxPrivate));
134 }
135
136
137 /*************************************************************
138  *                      GObjectClass                         *
139  *************************************************************/
140 static void
141 gtk_cell_area_box_finalize (GObject *object)
142 {
143   G_OBJECT_CLASS (gtk_cell_area_box_parent_class)->finalize (object);
144 }
145
146 static void
147 gtk_cell_area_box_dispose (GObject *object)
148 {
149   G_OBJECT_CLASS (gtk_cell_area_box_parent_class)->dispose (object);
150 }
151
152 static void
153 gtk_cell_area_box_set_property (GObject       *object,
154                                 guint          prop_id,
155                                 const GValue  *value,
156                                 GParamSpec    *pspec)
157 {
158
159 }
160
161 static void
162 gtk_cell_area_box_get_property (GObject     *object,
163                                 guint        prop_id,
164                                 GValue      *value,
165                                 GParamSpec  *pspec)
166 {
167
168 }
169
170 /*************************************************************
171  *                    GtkCellAreaClass                       *
172  *************************************************************/
173 static void      
174 gtk_cell_area_box_add (GtkCellArea        *area,
175                        GtkCellRenderer    *renderer)
176 {
177
178 }
179
180 static void
181 gtk_cell_area_box_remove (GtkCellArea        *area,
182                           GtkCellRenderer    *renderer)
183 {
184
185 }
186
187 static void
188 gtk_cell_area_box_forall (GtkCellArea        *area,
189                           GtkCellCallback     callback,
190                           gpointer            callback_data)
191 {
192
193 }
194
195 static gint
196 gtk_cell_area_box_event (GtkCellArea        *area,
197                          GtkWidget          *widget,
198                          GdkEvent           *event,
199                          const GdkRectangle *cell_area)
200 {
201
202
203   return 0;
204 }
205
206 static void
207 gtk_cell_area_box_render (GtkCellArea        *area,
208                           cairo_t            *cr,
209                           GtkWidget          *widget,
210                           const GdkRectangle *cell_area)
211 {
212
213 }
214
215 static GtkSizeRequestMode 
216 gtk_cell_area_box_get_request_mode (GtkCellArea *area)
217 {
218   GtkCellAreaBox        *box  = GTK_CELL_AREA_BOX (area);
219   GtkCellAreaBoxPrivate *priv = box->priv;
220
221   return (priv->orientation) == GTK_ORIENTATION_HORIZONTAL ?
222     GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH :
223     GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
224 }
225
226 static void
227 gtk_cell_area_box_get_preferred_width (GtkCellArea        *area,
228                                        GtkWidget          *widget,
229                                        gint               *minimum_width,
230                                        gint               *natural_width)
231 {
232
233 }
234
235 static void
236 gtk_cell_area_box_get_preferred_height (GtkCellArea        *area,
237                                         GtkWidget          *widget,
238                                         gint               *minimum_height,
239                                         gint               *natural_height)
240 {
241
242
243 }
244
245 static void
246 gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea        *area,
247                                                   GtkWidget          *widget,
248                                                   gint                width,
249                                                   gint               *minimum_height,
250                                                   gint               *natural_height)
251 {
252
253 }
254
255 static void
256 gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea        *area,
257                                                   GtkWidget          *widget,
258                                                   gint                height,
259                                                   gint               *minimum_width,
260                                                   gint               *natural_width)
261 {
262
263 }
264
265 /*************************************************************
266  *                            API                            *
267  *************************************************************/