Release Clutter 1.11.4 (snapshot)
[profile/ivi/clutter.git] / clutter / clutter-text.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2008  Intel Corporation.
7  *
8  * Authored By: Øyvind Kolås <pippin@o-hand.com>
9  *              Emmanuele Bassi <ebassi@linux.intel.com>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23  */
24
25 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
26 #error "Only <clutter/clutter.h> can be included directly."
27 #endif
28
29 #ifndef __CLUTTER_TEXT_H__
30 #define __CLUTTER_TEXT_H__
31
32 #include <clutter/clutter-actor.h>
33 #include <clutter/clutter-text-buffer.h>
34 #include <pango/pango.h>
35
36 G_BEGIN_DECLS
37
38 #define CLUTTER_TYPE_TEXT               (clutter_text_get_type ())
39 #define CLUTTER_TEXT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXT, ClutterText))
40 #define CLUTTER_TEXT_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXT, ClutterTextClass))
41 #define CLUTTER_IS_TEXT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXT))
42 #define CLUTTER_IS_TEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXT))
43 #define CLUTTER_TEXT_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXT, ClutterTextClass))
44
45 typedef struct _ClutterText        ClutterText;
46 typedef struct _ClutterTextPrivate ClutterTextPrivate;
47 typedef struct _ClutterTextClass   ClutterTextClass;
48
49 /**
50  * ClutterText:
51  *
52  * The #ClutterText struct contains only private data.
53  *
54  * Since: 1.0
55  */
56 struct _ClutterText
57 {
58   /*< private >*/
59   ClutterActor parent_instance;
60
61   ClutterTextPrivate *priv;
62 };
63
64 /**
65  * ClutterTextClass:
66  * @text_changed: class handler for the #ClutterText::text-changed signal
67  * @activate: class handler for the #ClutterText::activate signal
68  * @cursor_event: class handler for the #ClutterText::cursor_event signal
69  *
70  * The #ClutterTextClass struct contains only private data.
71  *
72  * Since: 1.0
73  */
74 struct _ClutterTextClass
75 {
76   /*< private >*/
77   ClutterActorClass parent_class;
78
79   /*< public >*/
80   /* signals, not vfuncs */
81   void (* text_changed) (ClutterText           *self);
82   void (* activate)     (ClutterText           *self);
83   void (* cursor_event) (ClutterText           *self,
84                          const ClutterGeometry *geometry);
85
86   /*< private >*/
87   /* padding for future expansion */
88   void (* _clutter_reserved1) (void);
89   void (* _clutter_reserved2) (void);
90   void (* _clutter_reserved3) (void);
91   void (* _clutter_reserved4) (void);
92   void (* _clutter_reserved5) (void);
93   void (* _clutter_reserved6) (void);
94   void (* _clutter_reserved7) (void);
95   void (* _clutter_reserved8) (void);
96 };
97
98 GType clutter_text_get_type (void) G_GNUC_CONST;
99
100 ClutterActor *        clutter_text_new                  (void);
101 ClutterActor *        clutter_text_new_full             (const gchar          *font_name,
102                                                          const gchar          *text,
103                                                          const ClutterColor   *color);
104 ClutterActor *        clutter_text_new_with_text        (const gchar          *font_name,
105                                                          const gchar          *text);
106 CLUTTER_AVAILABLE_IN_1_10
107 ClutterActor *        clutter_text_new_with_buffer      (ClutterTextBuffer    *buffer);
108 CLUTTER_AVAILABLE_IN_1_10
109 ClutterTextBuffer *   clutter_text_get_buffer           (ClutterText          *self);
110 CLUTTER_AVAILABLE_IN_1_10
111 void                  clutter_text_set_buffer           (ClutterText          *self,
112                                                          ClutterTextBuffer    *buffer);
113 const gchar *         clutter_text_get_text             (ClutterText          *self);
114 void                  clutter_text_set_text             (ClutterText          *self,
115                                                          const gchar          *text);
116 void                  clutter_text_set_markup           (ClutterText          *self,
117                                                          const gchar          *markup);
118 void                  clutter_text_set_color            (ClutterText          *self,
119                                                          const ClutterColor   *color);
120 void                  clutter_text_get_color            (ClutterText          *self,
121                                                          ClutterColor         *color);
122 void                  clutter_text_set_font_name        (ClutterText          *self,
123                                                          const gchar          *font_name);
124 const gchar *         clutter_text_get_font_name        (ClutterText          *self);
125 void                  clutter_text_set_font_description (ClutterText          *self,
126                                                          PangoFontDescription *font_desc);
127 PangoFontDescription *clutter_text_get_font_description (ClutterText          *self);
128
129 void                  clutter_text_set_ellipsize        (ClutterText          *self,
130                                                          PangoEllipsizeMode    mode);
131 PangoEllipsizeMode    clutter_text_get_ellipsize        (ClutterText          *self);
132 void                  clutter_text_set_line_wrap        (ClutterText          *self,
133                                                          gboolean              line_wrap);
134 gboolean              clutter_text_get_line_wrap        (ClutterText          *self);
135 void                  clutter_text_set_line_wrap_mode   (ClutterText          *self,
136                                                          PangoWrapMode         wrap_mode);
137 PangoWrapMode         clutter_text_get_line_wrap_mode   (ClutterText          *self);
138 PangoLayout *         clutter_text_get_layout           (ClutterText          *self);
139 void                  clutter_text_set_attributes       (ClutterText          *self,
140                                                          PangoAttrList        *attrs);
141 PangoAttrList *       clutter_text_get_attributes       (ClutterText          *self);
142 void                  clutter_text_set_use_markup       (ClutterText          *self,
143                                                          gboolean              setting);
144 gboolean              clutter_text_get_use_markup       (ClutterText          *self);
145 void                  clutter_text_set_line_alignment   (ClutterText          *self,
146                                                          PangoAlignment        alignment);
147 PangoAlignment        clutter_text_get_line_alignment   (ClutterText          *self);
148 void                  clutter_text_set_justify          (ClutterText          *self,
149                                                          gboolean              justify);
150 gboolean              clutter_text_get_justify          (ClutterText          *self);
151
152 void                  clutter_text_insert_unichar       (ClutterText          *self,
153                                                          gunichar              wc);
154 void                  clutter_text_delete_chars         (ClutterText          *self,
155                                                          guint                 n_chars);
156 void                  clutter_text_insert_text          (ClutterText          *self,
157                                                          const gchar          *text,
158                                                          gssize                position);
159 void                  clutter_text_delete_text          (ClutterText          *self,
160                                                          gssize                start_pos,
161                                                          gssize                end_pos);
162 gchar *               clutter_text_get_chars            (ClutterText          *self,
163                                                          gssize                start_pos,
164                                                          gssize                end_pos);
165 void                  clutter_text_set_editable         (ClutterText          *self,
166                                                          gboolean              editable);
167 gboolean              clutter_text_get_editable         (ClutterText          *self);
168 void                  clutter_text_set_activatable      (ClutterText          *self,
169                                                          gboolean              activatable);
170 gboolean              clutter_text_get_activatable      (ClutterText          *self);
171
172 gint                  clutter_text_get_cursor_position  (ClutterText          *self);
173 void                  clutter_text_set_cursor_position  (ClutterText          *self,
174                                                          gint                  position);
175 void                  clutter_text_set_cursor_visible   (ClutterText          *self,
176                                                          gboolean              cursor_visible);
177 gboolean              clutter_text_get_cursor_visible   (ClutterText          *self);
178 void                  clutter_text_set_cursor_color     (ClutterText          *self,
179                                                          const ClutterColor   *color);
180 void                  clutter_text_get_cursor_color     (ClutterText          *self,
181                                                          ClutterColor         *color);
182 void                  clutter_text_set_cursor_size      (ClutterText          *self,
183                                                          gint                  size);
184 guint                 clutter_text_get_cursor_size      (ClutterText          *self);
185 void                  clutter_text_set_selectable       (ClutterText          *self,
186                                                          gboolean              selectable);
187 gboolean              clutter_text_get_selectable       (ClutterText          *self);
188 void                  clutter_text_set_selection_bound  (ClutterText          *self,
189                                                          gint                  selection_bound);
190 gint                  clutter_text_get_selection_bound  (ClutterText          *self);
191 void                  clutter_text_set_selection        (ClutterText          *self,
192                                                          gssize                start_pos,
193                                                          gssize                end_pos);
194 gchar *               clutter_text_get_selection        (ClutterText          *self);
195 void                  clutter_text_set_selection_color  (ClutterText          *self,
196                                                          const ClutterColor   *color);
197 void                  clutter_text_get_selection_color  (ClutterText          *self,
198                                                          ClutterColor         *color);
199 gboolean              clutter_text_delete_selection     (ClutterText          *self);
200 void                  clutter_text_set_password_char    (ClutterText          *self,
201                                                          gunichar              wc);
202 gunichar              clutter_text_get_password_char    (ClutterText          *self);
203 void                  clutter_text_set_max_length       (ClutterText          *self,
204                                                          gint                  max);
205 gint                  clutter_text_get_max_length       (ClutterText          *self);
206 void                  clutter_text_set_single_line_mode (ClutterText          *self,
207                                                          gboolean              single_line);
208 gboolean              clutter_text_get_single_line_mode (ClutterText          *self);
209
210 void                  clutter_text_set_selected_text_color  (ClutterText          *self,
211                                                              const ClutterColor   *color);
212 void                  clutter_text_get_selected_text_color  (ClutterText          *self,
213                                                              ClutterColor         *color);
214
215 gboolean              clutter_text_activate             (ClutterText          *self);
216 CLUTTER_AVAILABLE_IN_1_10
217 gint                  clutter_text_coords_to_position   (ClutterText          *self,
218                                                          gfloat                x,
219                                                          gfloat                y);
220 gboolean              clutter_text_position_to_coords   (ClutterText          *self,
221                                                          gint                  position,
222                                                          gfloat               *x,
223                                                          gfloat               *y,
224                                                          gfloat               *line_height);
225
226 void                  clutter_text_set_preedit_string   (ClutterText          *self,
227                                                          const gchar          *preedit_str,
228                                                          PangoAttrList        *preedit_attrs,
229                                                          guint                 cursor_pos);
230
231 void                  clutter_text_get_layout_offsets   (ClutterText           *self,
232                                                          gint                  *x,
233                                                          gint                  *y);
234
235 G_END_DECLS
236
237 #endif /* __CLUTTER_TEXT_H__ */