]> git.sur5r.net Git - glabels/blob - src/label-object.h
Imported Upstream version 3.0.0
[glabels] / src / label-object.h
1 /*
2  *  label-object.h
3  *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of gLabels.
6  *
7  *  gLabels is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  gLabels is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef __LABEL_OBJECT_H__
22 #define __LABEL_OBJECT_H__
23
24 #include <glib-object.h>
25 #include <gtk/gtk.h>
26 #include <pango/pango.h>
27 #include <cairo.h>
28
29 G_BEGIN_DECLS
30
31
32 typedef enum {
33         GL_LABEL_OBJECT_TEXT,
34         GL_LABEL_OBJECT_BOX,
35         GL_LABEL_OBJECT_LINE,
36         GL_LABEL_OBJECT_ELLIPSE,
37         GL_LABEL_OBJECT_IMAGE,
38         GL_LABEL_OBJECT_BARCODE,
39         GL_LABEL_OBJECT_N_TYPES
40 } glLabelObjectType;
41
42
43 typedef enum {
44         GL_LABEL_OBJECT_HANDLE_NONE = 0,
45         GL_LABEL_OBJECT_HANDLE_N,
46         GL_LABEL_OBJECT_HANDLE_E,
47         GL_LABEL_OBJECT_HANDLE_W,
48         GL_LABEL_OBJECT_HANDLE_S,
49         GL_LABEL_OBJECT_HANDLE_NW,
50         GL_LABEL_OBJECT_HANDLE_NE,
51         GL_LABEL_OBJECT_HANDLE_SE,
52         GL_LABEL_OBJECT_HANDLE_SW,
53         GL_LABEL_OBJECT_HANDLE_P1,
54         GL_LABEL_OBJECT_HANDLE_P2
55 } glLabelObjectHandle;
56
57
58 #define GL_TYPE_LABEL_OBJECT              (gl_label_object_get_type ())
59 #define GL_LABEL_OBJECT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_OBJECT, glLabelObject))
60 #define GL_LABEL_OBJECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_OBJECT, glLabelObjectClass))
61 #define GL_IS_LABEL_OBJECT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_OBJECT))
62 #define GL_IS_LABEL_OBJECT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_OBJECT))
63 #define GL_LABEL_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GL_TYPE_LABEL_OBJECT, glLabelObjectClass))
64
65
66 typedef struct _glLabelObject          glLabelObject;
67 typedef struct _glLabelObjectClass     glLabelObjectClass;
68
69 typedef struct _glLabelObjectPrivate   glLabelObjectPrivate;
70
71 #include "label.h"
72 #include "color.h"
73
74 struct _glLabelObject {
75         GObject               object;
76
77         glLabelObjectPrivate *priv;
78 };
79
80 struct _glLabelObjectClass {
81         GObjectClass          parent_class;
82
83         /*
84          * Set/Get Methods
85          */
86
87         void              (*set_size)             (glLabelObject     *object,
88                                                    gdouble            w,
89                                                    gdouble            h,
90                                                    gboolean           checkpoint);
91
92         void              (*set_font_family)      (glLabelObject     *object,
93                                                    const gchar       *font_family,
94                                                    gboolean           checkpoint);
95
96         void              (*set_font_size)        (glLabelObject     *object,
97                                                    gdouble            font_size,
98                                                    gboolean           checkpoint);
99
100         void              (*set_font_weight)      (glLabelObject     *object,
101                                                    PangoWeight        font_weight,
102                                                    gboolean           checkpoint);
103
104         void              (*set_font_italic_flag) (glLabelObject     *object,
105                                                    gboolean           font_italic_flag,
106                                                    gboolean           checkpoint);
107
108         void              (*set_text_alignment)   (glLabelObject     *object,
109                                                    PangoAlignment     text_alignment,
110                                                    gboolean           checkpoint);
111
112         void              (*set_text_line_spacing)(glLabelObject     *object,
113                                                    gdouble            text_line_spacing,
114                                                    gboolean           checkpoint);
115
116         void              (*set_text_color)       (glLabelObject     *object,
117                                                    glColorNode       *text_color_node,
118                                                    gboolean           checkpoint);
119
120         void              (*set_fill_color)       (glLabelObject     *object,
121                                                    glColorNode       *fill_color_node,
122                                                    gboolean           checkpoint);
123
124         void              (*set_line_color)       (glLabelObject     *object,
125                                                    glColorNode       *line_color_node,
126                                                    gboolean           checkpoint);
127
128         void              (*set_line_width)       (glLabelObject     *object,
129                                                    gdouble            line_width,
130                                                    gboolean           checkpoint);
131
132         void              (*get_size)             (glLabelObject     *object,
133                                                    gdouble           *w,
134                                                    gdouble           *h);
135
136         gchar *           (*get_font_family)      (glLabelObject     *object);
137
138         gdouble           (*get_font_size)        (glLabelObject     *object);
139
140         PangoWeight       (*get_font_weight)      (glLabelObject     *object);
141
142         gboolean          (*get_font_italic_flag) (glLabelObject     *object);
143
144         PangoAlignment    (*get_text_alignment)   (glLabelObject     *object);
145
146         gdouble           (*get_text_line_spacing) (glLabelObject    *object);
147
148         glColorNode *     (*get_text_color)       (glLabelObject     *object);
149
150         glColorNode *     (*get_fill_color)       (glLabelObject     *object);
151
152         glColorNode *     (*get_line_color)       (glLabelObject     *object);
153
154         gdouble           (*get_line_width)       (glLabelObject     *object);
155
156         void              (*copy)                 (glLabelObject     *dst_object
157 ,
158                                                    glLabelObject     *src_object);
159
160         /*
161          * Draw methods
162          */
163         void        (*draw_shadow)      (glLabelObject *object,
164                                          cairo_t       *cr,
165                                          gboolean       screen_flag,
166                                          glMergeRecord *record);
167
168         void        (*draw_object)      (glLabelObject *object,
169                                          cairo_t       *cr,
170                                          gboolean       screen_flag,
171                                          glMergeRecord *record);
172
173         void        (*draw_handles)     (glLabelObject *object,
174                                          cairo_t       *cr);
175
176         /*
177          * Cairo context query methods
178          */
179         gboolean            (*object_at) (glLabelObject     *object,
180                                           cairo_t           *cr,
181                                           gdouble            x_pixels,
182                                           gdouble            y_pixels);
183
184         glLabelObjectHandle (*handle_at) (glLabelObject     *object,
185                                           cairo_t           *cr,
186                                           gdouble            x_pixels,
187                                           gdouble            y_pixels);
188
189
190         /*
191          * Signals
192          */
193
194         void        (*changed) (glLabelObject *object,
195                                 gpointer       user_data);
196
197         void        (*moved)   (glLabelObject *object,
198                                 gpointer       user_data);
199
200 };
201
202
203
204 GType          gl_label_object_get_type              (void) G_GNUC_CONST;
205
206 GObject       *gl_label_object_new                   (glLabel           *label);
207
208
209 glLabelObject *gl_label_object_dup                   (glLabelObject     *src_object,
210                                                       glLabel           *label);
211
212
213 void           gl_label_object_emit_changed          (glLabelObject     *object);
214
215 void           gl_label_object_set_parent            (glLabelObject     *object,
216                                                       glLabel           *label);
217
218 glLabel       *gl_label_object_get_parent            (glLabelObject     *object);
219
220
221 void           gl_label_object_select                (glLabelObject     *object);
222 void           gl_label_object_unselect              (glLabelObject     *object);
223 gboolean       gl_label_object_is_selected           (glLabelObject     *object);
224
225 void           gl_label_object_set_name              (glLabelObject     *object,
226                                                       gchar             *name);
227
228 gchar         *gl_label_object_get_name              (glLabelObject     *object);
229
230
231 void           gl_label_object_set_position          (glLabelObject     *object,
232                                                       gdouble            x,
233                                                       gdouble            y,
234                                                       gboolean           checkpoint);
235
236 void           gl_label_object_set_position_relative (glLabelObject     *object,
237                                                       gdouble            dx,
238                                                       gdouble            dy,
239                                                       gboolean           checkpoint);
240
241 void           gl_label_object_set_size              (glLabelObject     *object,
242                                                       gdouble            w,
243                                                       gdouble            h,
244                                                       gboolean           checkpoint);
245
246 void           gl_label_object_set_raw_size          (glLabelObject     *object,
247                                                       gdouble            w,
248                                                       gdouble            h,
249                                                       gboolean           checkpoint);
250
251 void           gl_label_object_set_size_honor_aspect (glLabelObject     *object,
252                                                       gdouble            w,
253                                                       gdouble            h,
254                                                       gboolean           checkpoint);
255
256 void           gl_label_object_set_font_family       (glLabelObject     *object,
257                                                       const gchar       *font_family,
258                                                       gboolean           checkpoint);
259
260 void           gl_label_object_set_font_size         (glLabelObject     *object,
261                                                       gdouble            font_size,
262                                                       gboolean           checkpoint);
263
264 void           gl_label_object_set_font_weight       (glLabelObject     *object,
265                                                       PangoWeight        font_weight,
266                                                       gboolean           checkpoint);
267
268 void           gl_label_object_set_font_italic_flag  (glLabelObject     *object,
269                                                       gboolean           font_italic_flag,
270                                                       gboolean           checkpoint);
271
272 void           gl_label_object_set_text_alignment    (glLabelObject     *object,
273                                                       PangoAlignment     text_alignment,
274                                                       gboolean           checkpoint);
275
276 void           gl_label_object_set_text_color        (glLabelObject     *object,
277                                                       glColorNode       *text_color_node,
278                                                       gboolean           checkpoint);
279
280 void           gl_label_object_set_text_line_spacing (glLabelObject     *object,
281                                                       gdouble            text_line_spacing,
282                                                       gboolean           checkpoint);
283
284 void           gl_label_object_set_fill_color        (glLabelObject     *object,
285                                                       glColorNode       *fill_color_node,
286                                                       gboolean           checkpoint);
287
288 void           gl_label_object_set_line_color        (glLabelObject     *object,
289                                                       glColorNode       *line_color_node,
290                                                       gboolean           checkpoint);
291
292 void           gl_label_object_set_line_width        (glLabelObject     *object,
293                                                       gdouble            line_width,
294                                                       gboolean           checkpoint);
295
296
297 void           gl_label_object_set_shadow_state      (glLabelObject     *object,
298                                                       gboolean           state,
299                                                       gboolean           checkpoint);
300
301 void           gl_label_object_set_shadow_offset     (glLabelObject     *object,
302                                                       gdouble            x,
303                                                       gdouble            y,
304                                                       gboolean           checkpoint);
305
306 void           gl_label_object_set_shadow_color      (glLabelObject     *object,
307                                                       glColorNode       *color_node,
308                                                       gboolean           checkpoint);
309
310 void           gl_label_object_set_shadow_opacity    (glLabelObject     *object,
311                                                       gdouble            alpha,
312                                                       gboolean           checkpoint);
313
314
315 void           gl_label_object_flip_horiz            (glLabelObject     *object);
316
317 void           gl_label_object_flip_vert             (glLabelObject     *object);
318
319 void           gl_label_object_rotate                (glLabelObject     *object,
320                                                       gdouble            theta_degs);
321
322 void           gl_label_object_set_matrix            (glLabelObject     *object,
323                                                       cairo_matrix_t    *matrix);
324
325
326 void           gl_label_object_get_position          (glLabelObject     *object,
327                                                       gdouble           *x,
328                                                       gdouble           *y);
329
330 void           gl_label_object_get_size              (glLabelObject     *object,
331                                                       gdouble           *w,
332                                                       gdouble           *h);
333
334 void           gl_label_object_get_raw_size          (glLabelObject     *object,
335                                                       gdouble           *w,
336                                                       gdouble           *h);
337
338 void           gl_label_object_get_extent            (glLabelObject     *object,
339                                                       glLabelRegion     *region);
340
341 gboolean       gl_label_object_can_text              (glLabelObject     *object);
342
343
344 gchar         *gl_label_object_get_font_family       (glLabelObject     *object);
345
346 gdouble        gl_label_object_get_font_size         (glLabelObject     *object);
347
348 PangoWeight    gl_label_object_get_font_weight       (glLabelObject     *object);
349
350 gboolean       gl_label_object_get_font_italic_flag  (glLabelObject     *object);
351
352 PangoAlignment gl_label_object_get_text_alignment    (glLabelObject     *object);
353
354 gdouble        gl_label_object_get_text_line_spacing (glLabelObject     *object);
355
356 glColorNode   *gl_label_object_get_text_color        (glLabelObject     *object);
357
358
359 gboolean       gl_label_object_can_fill              (glLabelObject     *object);
360
361 glColorNode*   gl_label_object_get_fill_color        (glLabelObject     *object);
362
363
364 gboolean       gl_label_object_can_line_color        (glLabelObject     *object);
365
366 glColorNode   *gl_label_object_get_line_color        (glLabelObject     *object);
367
368 gboolean       gl_label_object_can_line_width        (glLabelObject     *object);
369
370 gdouble        gl_label_object_get_line_width        (glLabelObject     *object);
371
372
373 void           gl_label_object_get_matrix            (glLabelObject     *object,
374                                                       cairo_matrix_t    *matrix);
375
376 gboolean       gl_label_object_get_shadow_state      (glLabelObject     *object);
377
378 void           gl_label_object_get_shadow_offset     (glLabelObject     *object,
379                                                       gdouble           *x,
380                                                       gdouble           *y);
381
382 glColorNode*   gl_label_object_get_shadow_color      (glLabelObject     *object);
383
384 gdouble        gl_label_object_get_shadow_opacity    (glLabelObject     *object);
385
386
387 void           gl_label_object_draw                  (glLabelObject     *object,
388                                                       cairo_t           *cr,
389                                                       gboolean           screen_flag,
390                                                       glMergeRecord     *record);
391
392 gboolean       gl_label_object_is_located_at         (glLabelObject     *object,
393                                                       cairo_t           *cr,
394                                                       gdouble            x_pixels,
395                                                       gdouble            y_pixels);
396
397 void           gl_label_object_draw_handles          (glLabelObject     *object,
398                                                       cairo_t           *cr);
399
400 glLabelObjectHandle gl_label_object_handle_at        (glLabelObject     *object,
401                                                       cairo_t           *cr,
402                                                       gdouble            x_pixels,
403                                                       gdouble            y_pixels);
404
405
406 /*
407  * Specific handle drawing methods.
408  */
409 void           gl_label_object_draw_handles_box      (glLabelObject     *object,
410                                                       cairo_t           *cr);
411
412 void           gl_label_object_draw_handles_line     (glLabelObject     *object,
413                                                       cairo_t           *cr);
414
415
416 /*
417  * Specific handle query methods.
418  */
419 glLabelObjectHandle gl_label_object_box_handle_at    (glLabelObject     *object,
420                                                       cairo_t           *cr,
421                                                       gdouble            x,
422                                                       gdouble            y);
423
424 glLabelObjectHandle gl_label_object_line_handle_at   (glLabelObject     *object,
425                                                       cairo_t           *cr,
426                                                       gdouble            x,
427                                                       gdouble            y);
428
429
430
431 G_END_DECLS
432
433 #endif /* __LABEL_OBJECT_H__ */
434
435
436
437
438 /*
439  * Local Variables:       -- emacs
440  * mode: C                -- emacs
441  * c-basic-offset: 8      -- emacs
442  * tab-width: 8           -- emacs
443  * indent-tabs-mode: nil  -- emacs
444  * End:                   -- emacs
445  */