clutter-text.h 15.6 KB
Newer Older
1 2 3 4 5
/*
 * Clutter.
 *
 * An OpenGL based 'interactive canvas' library.
 *
6
 * Copyright (C) 2008  Intel Corporation.
7
 *
8 9
 * Authored By: Øyvind Kolås <pippin@o-hand.com>
 *              Emmanuele Bassi <ebassi@linux.intel.com>
10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * 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 26 27
#ifndef __CLUTTER_TEXT_H__
#define __CLUTTER_TEXT_H__

28 29 30 31
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif

32
#include <clutter/clutter-actor.h>
33
#include <clutter/clutter-text-buffer.h>
34
#include <pango/pango.h>
35 36 37

G_BEGIN_DECLS

38 39 40 41 42 43
#define CLUTTER_TYPE_TEXT               (clutter_text_get_type ())
#define CLUTTER_TEXT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXT, ClutterText))
#define CLUTTER_TEXT_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXT, ClutterTextClass))
#define CLUTTER_IS_TEXT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXT))
#define CLUTTER_IS_TEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXT))
#define CLUTTER_TEXT_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXT, ClutterTextClass))
44 45 46 47 48

typedef struct _ClutterText        ClutterText;
typedef struct _ClutterTextPrivate ClutterTextPrivate;
typedef struct _ClutterTextClass   ClutterTextClass;

49 50 51 52 53 54 55
/**
 * ClutterText:
 *
 * The #ClutterText struct contains only private data.
 *
 * Since: 1.0
 */
56 57 58
struct _ClutterText
{
  /*< private >*/
59 60
  ClutterActor parent_instance;

61 62 63
  ClutterTextPrivate *priv;
};

64 65 66 67
/**
 * ClutterTextClass:
 * @text_changed: class handler for the #ClutterText::text-changed signal
 * @activate: class handler for the #ClutterText::activate signal
68 69
 * @cursor_event: class handler for the #ClutterText::cursor-event signal
 * @cursor_changed: class handler for the #ClutterText::cursor-changed signal
70 71 72 73 74
 *
 * The #ClutterTextClass struct contains only private data.
 *
 * Since: 1.0
 */
75 76
struct _ClutterTextClass
{
77
  /*< private >*/
78
  ClutterActorClass parent_class;
79

80
  /*< public >*/
81
  /* signals, not vfuncs */
82 83 84 85 86
  void (* text_changed)   (ClutterText           *self);
  void (* activate)       (ClutterText           *self);
  void (* cursor_event)   (ClutterText           *self,
                           const ClutterGeometry *geometry);
  void (* cursor_changed) (ClutterText           *self);
87

88 89
  /*< private >*/
  /* padding for future expansion */
90 91 92 93 94 95 96
  void (* _clutter_reserved1) (void);
  void (* _clutter_reserved2) (void);
  void (* _clutter_reserved3) (void);
  void (* _clutter_reserved4) (void);
  void (* _clutter_reserved5) (void);
  void (* _clutter_reserved6) (void);
  void (* _clutter_reserved7) (void);
97 98
};

99
CLUTTER_AVAILABLE_IN_1_0
100 101
GType clutter_text_get_type (void) G_GNUC_CONST;

102
CLUTTER_AVAILABLE_IN_1_0
103
ClutterActor *        clutter_text_new                  (void);
104
CLUTTER_AVAILABLE_IN_1_0
105 106 107
ClutterActor *        clutter_text_new_full             (const gchar          *font_name,
                                                         const gchar          *text,
                                                         const ClutterColor   *color);
108
CLUTTER_AVAILABLE_IN_1_0
109 110
ClutterActor *        clutter_text_new_with_text        (const gchar          *font_name,
                                                         const gchar          *text);
111
CLUTTER_AVAILABLE_IN_1_10
112
ClutterActor *        clutter_text_new_with_buffer      (ClutterTextBuffer    *buffer);
113
CLUTTER_AVAILABLE_IN_1_10
114
ClutterTextBuffer *   clutter_text_get_buffer           (ClutterText          *self);
115
CLUTTER_AVAILABLE_IN_1_10
116 117
void                  clutter_text_set_buffer           (ClutterText          *self,
                                                         ClutterTextBuffer    *buffer);
118
CLUTTER_AVAILABLE_IN_1_0
119
const gchar *         clutter_text_get_text             (ClutterText          *self);
120
CLUTTER_AVAILABLE_IN_1_0
121 122
void                  clutter_text_set_text             (ClutterText          *self,
                                                         const gchar          *text);
123
CLUTTER_AVAILABLE_IN_1_0
124 125
void                  clutter_text_set_markup           (ClutterText          *self,
                                                         const gchar          *markup);
126
CLUTTER_AVAILABLE_IN_1_0
127 128
void                  clutter_text_set_color            (ClutterText          *self,
                                                         const ClutterColor   *color);
129
CLUTTER_AVAILABLE_IN_1_0
130 131
void                  clutter_text_get_color            (ClutterText          *self,
                                                         ClutterColor         *color);
132
CLUTTER_AVAILABLE_IN_1_0
133 134
void                  clutter_text_set_font_name        (ClutterText          *self,
                                                         const gchar          *font_name);
135
CLUTTER_AVAILABLE_IN_1_0
136
const gchar *         clutter_text_get_font_name        (ClutterText          *self);
137
CLUTTER_AVAILABLE_IN_1_2
138 139
void                  clutter_text_set_font_description (ClutterText          *self,
                                                         PangoFontDescription *font_desc);
140
CLUTTER_AVAILABLE_IN_1_2
141 142
PangoFontDescription *clutter_text_get_font_description (ClutterText          *self);

143
CLUTTER_AVAILABLE_IN_1_0
144 145
void                  clutter_text_set_ellipsize        (ClutterText          *self,
                                                         PangoEllipsizeMode    mode);
146
CLUTTER_AVAILABLE_IN_1_0
147
PangoEllipsizeMode    clutter_text_get_ellipsize        (ClutterText          *self);
148
CLUTTER_AVAILABLE_IN_1_0
149 150
void                  clutter_text_set_line_wrap        (ClutterText          *self,
                                                         gboolean              line_wrap);
151
CLUTTER_AVAILABLE_IN_1_0
152
gboolean              clutter_text_get_line_wrap        (ClutterText          *self);
153
CLUTTER_AVAILABLE_IN_1_0
154 155
void                  clutter_text_set_line_wrap_mode   (ClutterText          *self,
                                                         PangoWrapMode         wrap_mode);
156
CLUTTER_AVAILABLE_IN_1_0
157
PangoWrapMode         clutter_text_get_line_wrap_mode   (ClutterText          *self);
158
CLUTTER_AVAILABLE_IN_1_0
159
PangoLayout *         clutter_text_get_layout           (ClutterText          *self);
160
CLUTTER_AVAILABLE_IN_1_0
161 162
void                  clutter_text_set_attributes       (ClutterText          *self,
                                                         PangoAttrList        *attrs);
163
CLUTTER_AVAILABLE_IN_1_0
164
PangoAttrList *       clutter_text_get_attributes       (ClutterText          *self);
165
CLUTTER_AVAILABLE_IN_1_0
166 167
void                  clutter_text_set_use_markup       (ClutterText          *self,
                                                         gboolean              setting);
168
CLUTTER_AVAILABLE_IN_1_0
169
gboolean              clutter_text_get_use_markup       (ClutterText          *self);
170
CLUTTER_AVAILABLE_IN_1_0
171 172
void                  clutter_text_set_line_alignment   (ClutterText          *self,
                                                         PangoAlignment        alignment);
173
CLUTTER_AVAILABLE_IN_1_0
174
PangoAlignment        clutter_text_get_line_alignment   (ClutterText          *self);
175
CLUTTER_AVAILABLE_IN_1_0
176 177
void                  clutter_text_set_justify          (ClutterText          *self,
                                                         gboolean              justify);
178
CLUTTER_AVAILABLE_IN_1_0
179 180
gboolean              clutter_text_get_justify          (ClutterText          *self);

181
CLUTTER_AVAILABLE_IN_1_0
182 183
void                  clutter_text_insert_unichar       (ClutterText          *self,
                                                         gunichar              wc);
184
CLUTTER_AVAILABLE_IN_1_0
185 186
void                  clutter_text_delete_chars         (ClutterText          *self,
                                                         guint                 n_chars);
187
CLUTTER_AVAILABLE_IN_1_0
188 189 190
void                  clutter_text_insert_text          (ClutterText          *self,
                                                         const gchar          *text,
                                                         gssize                position);
191
CLUTTER_AVAILABLE_IN_1_0
192 193 194
void                  clutter_text_delete_text          (ClutterText          *self,
                                                         gssize                start_pos,
                                                         gssize                end_pos);
195
CLUTTER_AVAILABLE_IN_1_0
196 197 198
gchar *               clutter_text_get_chars            (ClutterText          *self,
                                                         gssize                start_pos,
                                                         gssize                end_pos);
199
CLUTTER_AVAILABLE_IN_1_0
200 201
void                  clutter_text_set_editable         (ClutterText          *self,
                                                         gboolean              editable);
202
CLUTTER_AVAILABLE_IN_1_0
203
gboolean              clutter_text_get_editable         (ClutterText          *self);
204
CLUTTER_AVAILABLE_IN_1_0
205 206
void                  clutter_text_set_activatable      (ClutterText          *self,
                                                         gboolean              activatable);
207
CLUTTER_AVAILABLE_IN_1_0
208 209
gboolean              clutter_text_get_activatable      (ClutterText          *self);

210
CLUTTER_AVAILABLE_IN_1_0
211
gint                  clutter_text_get_cursor_position  (ClutterText          *self);
212
CLUTTER_AVAILABLE_IN_1_0
213 214
void                  clutter_text_set_cursor_position  (ClutterText          *self,
                                                         gint                  position);
215
CLUTTER_AVAILABLE_IN_1_0
216 217
void                  clutter_text_set_cursor_visible   (ClutterText          *self,
                                                         gboolean              cursor_visible);
218
CLUTTER_AVAILABLE_IN_1_0
219
gboolean              clutter_text_get_cursor_visible   (ClutterText          *self);
220
CLUTTER_AVAILABLE_IN_1_0
221 222
void                  clutter_text_set_cursor_color     (ClutterText          *self,
                                                         const ClutterColor   *color);
223
CLUTTER_AVAILABLE_IN_1_0
224 225
void                  clutter_text_get_cursor_color     (ClutterText          *self,
                                                         ClutterColor         *color);
226
CLUTTER_AVAILABLE_IN_1_0
227 228
void                  clutter_text_set_cursor_size      (ClutterText          *self,
                                                         gint                  size);
229
CLUTTER_AVAILABLE_IN_1_0
230
guint                 clutter_text_get_cursor_size      (ClutterText          *self);
231
CLUTTER_AVAILABLE_IN_1_16
232 233
void                  clutter_text_get_cursor_rect      (ClutterText          *self,
                                                         ClutterRect          *rect);
234
CLUTTER_AVAILABLE_IN_1_0
235 236
void                  clutter_text_set_selectable       (ClutterText          *self,
                                                         gboolean              selectable);
237
CLUTTER_AVAILABLE_IN_1_0
238
gboolean              clutter_text_get_selectable       (ClutterText          *self);
239
CLUTTER_AVAILABLE_IN_1_0
240 241
void                  clutter_text_set_selection_bound  (ClutterText          *self,
                                                         gint                  selection_bound);
242
CLUTTER_AVAILABLE_IN_1_0
243
gint                  clutter_text_get_selection_bound  (ClutterText          *self);
244
CLUTTER_AVAILABLE_IN_1_0
245 246 247
void                  clutter_text_set_selection        (ClutterText          *self,
                                                         gssize                start_pos,
                                                         gssize                end_pos);
248
CLUTTER_AVAILABLE_IN_1_0
249
gchar *               clutter_text_get_selection        (ClutterText          *self);
250
CLUTTER_AVAILABLE_IN_1_0
251 252
void                  clutter_text_set_selection_color  (ClutterText          *self,
                                                         const ClutterColor   *color);
253
CLUTTER_AVAILABLE_IN_1_0
254 255
void                  clutter_text_get_selection_color  (ClutterText          *self,
                                                         ClutterColor         *color);
256
CLUTTER_AVAILABLE_IN_1_0
257
gboolean              clutter_text_delete_selection     (ClutterText          *self);
258
CLUTTER_AVAILABLE_IN_1_0
259 260
void                  clutter_text_set_password_char    (ClutterText          *self,
                                                         gunichar              wc);
261
CLUTTER_AVAILABLE_IN_1_0
262
gunichar              clutter_text_get_password_char    (ClutterText          *self);
263
CLUTTER_AVAILABLE_IN_1_0
264 265
void                  clutter_text_set_max_length       (ClutterText          *self,
                                                         gint                  max);
266
CLUTTER_AVAILABLE_IN_1_0
267
gint                  clutter_text_get_max_length       (ClutterText          *self);
268
CLUTTER_AVAILABLE_IN_1_0
269 270
void                  clutter_text_set_single_line_mode (ClutterText          *self,
                                                         gboolean              single_line);
271
CLUTTER_AVAILABLE_IN_1_0
272 273
gboolean              clutter_text_get_single_line_mode (ClutterText          *self);

274
CLUTTER_AVAILABLE_IN_1_8
275 276
void                  clutter_text_set_selected_text_color  (ClutterText          *self,
                                                             const ClutterColor   *color);
277
CLUTTER_AVAILABLE_IN_1_8
278 279 280
void                  clutter_text_get_selected_text_color  (ClutterText          *self,
                                                             ClutterColor         *color);

281
CLUTTER_AVAILABLE_IN_1_0
282
gboolean              clutter_text_activate             (ClutterText          *self);
283
CLUTTER_AVAILABLE_IN_1_10
284 285 286
gint                  clutter_text_coords_to_position   (ClutterText          *self,
                                                         gfloat                x,
                                                         gfloat                y);
287
CLUTTER_AVAILABLE_IN_1_0
288 289 290 291 292 293
gboolean              clutter_text_position_to_coords   (ClutterText          *self,
                                                         gint                  position,
                                                         gfloat               *x,
                                                         gfloat               *y,
                                                         gfloat               *line_height);

294
CLUTTER_AVAILABLE_IN_1_2
295 296 297 298
void                  clutter_text_set_preedit_string   (ClutterText          *self,
                                                         const gchar          *preedit_str,
                                                         PangoAttrList        *preedit_attrs,
                                                         guint                 cursor_pos);
299

300
CLUTTER_AVAILABLE_IN_1_8
301 302 303 304
void                  clutter_text_get_layout_offsets   (ClutterText           *self,
                                                         gint                  *x,
                                                         gint                  *y);

305 306 307
G_END_DECLS

#endif /* __CLUTTER_TEXT_H__ */