Add LaughSize, a type that handles absolute and relative values
[laugh.git] / src / laugh-layout.h
blobf884478e9c0b8c5db26d5f45784b5e079d949562
1 /*
2 * Laugh.
4 * An glib SMIL library.
6 * Authored By Koos Vriezen <koos.vriezen@gmail.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser 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.
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 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser 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.
24 #ifndef _LAUGH_LAYOUT_H
25 #define _LAUGH_LAYOUT_H
27 #include "laugh-dom.h"
29 G_BEGIN_DECLS
31 #define LAUGH_TYPE_LAYOUT laugh_layout_get_type()
33 #define LAUGH_LAYOUT(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
35 LAUGH_TYPE_LAYOUT, LaughLayout))
37 #define LAUGH_TYPE_LAYOUT_CLASS(klass) \
38 (G_TYPE_CHECK_CLASS_CAST ((klass), \
39 LAUGH_TYPE_LAYOUT, LaughLayoutClass))
41 #define LAUGH_IS_LAYOUT(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
43 LAUGH_TYPE_LAYOUT))
45 #define LAUGH_IS_LAYOUT_CLASS(klass) \
46 (G_TYPE_CHECK_CLASS_TYPE ((klass), \
47 LAUGH_TYPE_LAYOUT))
49 #define LAUGH_LAYOUT_GET_CLASS(obj) \
50 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
51 LAUGH_TYPE_LAYOUT, LaughLayoutClass))
53 typedef struct _LaughLayout LaughLayout;
54 typedef struct _LaughLayoutClass LaughLayoutClass;
55 typedef struct _LaughLayoutPrivate LaughLayoutPrivate;
56 typedef struct _LaughSize LaughSize;
57 typedef struct _LaughSizeSetting LaughSizeSetting;
59 struct _LaughSize
61 float perc_size;
62 float abs_size;
63 gboolean is_set;
66 struct _LaughSizeSetting
68 LaughSize left;
69 LaughSize top;
70 LaughSize width;
71 LaughSize height;
72 LaughSize right;
73 LaughSize bottom;
76 struct _LaughLayout
78 LaughNode parent;
80 /*< public >*/
81 LaughSizeSetting size_setting;
83 /*< private >*/
84 LaughLayoutPrivate *priv;
87 struct _LaughLayoutClass
89 LaughNodeClass parent_class;
92 GType laugh_layout_get_type (void) G_GNUC_CONST;
94 void laugh_size_set_string (LaughSize *size, const gchar *value);
96 float laugh_size_get_size (LaughSize *size, float relative_to);
98 void laugh_size_setting_get (LaughSizeSetting *sizes, float pw, float ph,
99 float *x, float *y, float *w, float *h);
101 LaughNode *laugh_layout_new (LaughDocument *doc, LaughNodeTagId id,
102 GHashTable *attributes);
104 G_END_DECLS
106 #endif