update to 1.10.4
[profile/ivi/clutter.git] / clutter / clutter-text-buffer.h
1 /* clutter-text-buffer.h
2  * Copyright (C) 2011 Collabora Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Author: Stef Walter <stefw@collabora.co.uk>
20  */
21
22 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
23 #error "Only <clutter/clutter.h> can be included directly."
24 #endif
25
26 #ifndef __CLUTTER_TEXT_BUFFER_H__
27 #define __CLUTTER_TEXT_BUFFER_H__
28
29 #include <clutter/clutter-types.h>
30
31 G_BEGIN_DECLS
32
33 #define CLUTTER_TYPE_TEXT_BUFFER            (clutter_text_buffer_get_type ())
34 #define CLUTTER_TEXT_BUFFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBuffer))
35 #define CLUTTER_TEXT_BUFFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBufferClass))
36 #define CLUTTER_IS_TEXT_BUFFER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXT_BUFFER))
37 #define CLUTTER_IS_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXT_BUFFER))
38 #define CLUTTER_TEXT_BUFFER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBufferClass))
39
40 /**
41  * CLUTTER_TEXT_BUFFER_MAX_SIZE:
42  *
43  * Maximum size of text buffer, in bytes.
44  *
45  * Since: 1.10
46  */
47 #define CLUTTER_TEXT_BUFFER_MAX_SIZE        G_MAXUSHORT
48
49 typedef struct _ClutterTextBuffer            ClutterTextBuffer;
50 typedef struct _ClutterTextBufferClass       ClutterTextBufferClass;
51 typedef struct _ClutterTextBufferPrivate     ClutterTextBufferPrivate;
52
53 /**
54  * ClutterTextBuffer:
55  *
56  * The <structname>ClutterTextBuffer</structname> structure contains private
57  * data and it should only be accessed using the provided API.
58  *
59  * Since: 1.10
60  */
61 struct _ClutterTextBuffer
62 {
63   /*< private >*/
64   GObject parent_instance;
65
66   ClutterTextBufferPrivate *priv;
67 };
68
69 /**
70  * ClutterTextBufferClass:
71  * @inserted_text: default handler for the #ClutterTextBuffer::inserted-text signal
72  * @deleted_text: default hanlder for the #ClutterTextBuffer::deleted-text signal
73  * @get_text: virtual function
74  * @get_length: virtual function
75  * @insert_text: virtual function
76  * @delete_text: virtual function
77  *
78  * The <structname>ClutterTextBufferClass</structname> structure contains
79  * only private data.
80  *
81  * Since: 1.10
82  */
83 struct _ClutterTextBufferClass
84 {
85   /*< private >*/
86   GObjectClass parent_class;
87
88   /*< public >*/
89   /* Signals */
90   void         (*inserted_text)          (ClutterTextBuffer *buffer,
91                                           guint              position,
92                                           const gchar       *chars,
93                                           guint              n_chars);
94
95   void         (*deleted_text)           (ClutterTextBuffer *buffer,
96                                           guint              position,
97                                           guint              n_chars);
98
99   /* Virtual Methods */
100   const gchar* (*get_text)               (ClutterTextBuffer *buffer,
101                                           gsize             *n_bytes);
102
103   guint        (*get_length)             (ClutterTextBuffer *buffer);
104
105   guint        (*insert_text)            (ClutterTextBuffer *buffer,
106                                           guint              position,
107                                           const gchar       *chars,
108                                           guint              n_chars);
109
110   guint        (*delete_text)            (ClutterTextBuffer *buffer,
111                                           guint              position,
112                                           guint              n_chars);
113
114   /*< private >*/
115   /* Padding for future expansion */
116   void (*_clutter_reserved1) (void);
117   void (*_clutter_reserved2) (void);
118   void (*_clutter_reserved3) (void);
119   void (*_clutter_reserved4) (void);
120   void (*_clutter_reserved5) (void);
121   void (*_clutter_reserved6) (void);
122   void (*_clutter_reserved7) (void);
123   void (*_clutter_reserved8) (void);
124 };
125
126 CLUTTER_AVAILABLE_IN_1_10
127 GType               clutter_text_buffer_get_type            (void) G_GNUC_CONST;
128
129 CLUTTER_AVAILABLE_IN_1_10
130 ClutterTextBuffer*  clutter_text_buffer_new                 (void);
131 CLUTTER_AVAILABLE_IN_1_10
132 ClutterTextBuffer*  clutter_text_buffer_new_with_text       (const gchar       *text,
133                                                              gssize             text_len);
134
135 CLUTTER_AVAILABLE_IN_1_10
136 gsize               clutter_text_buffer_get_bytes           (ClutterTextBuffer *buffer);
137 CLUTTER_AVAILABLE_IN_1_10
138 guint               clutter_text_buffer_get_length          (ClutterTextBuffer *buffer);
139 CLUTTER_AVAILABLE_IN_1_10
140 const gchar*        clutter_text_buffer_get_text            (ClutterTextBuffer *buffer);
141 CLUTTER_AVAILABLE_IN_1_10
142 void                clutter_text_buffer_set_text            (ClutterTextBuffer *buffer,
143                                                              const gchar       *chars,
144                                                              gint               n_chars);
145 CLUTTER_AVAILABLE_IN_1_10
146 void                clutter_text_buffer_set_max_length      (ClutterTextBuffer *buffer,
147                                                              gint               max_length);
148 CLUTTER_AVAILABLE_IN_1_10
149 gint                clutter_text_buffer_get_max_length      (ClutterTextBuffer  *buffer);
150
151 CLUTTER_AVAILABLE_IN_1_10
152 guint               clutter_text_buffer_insert_text         (ClutterTextBuffer *buffer,
153                                                              guint              position,
154                                                              const gchar       *chars,
155                                                              gint               n_chars);
156 CLUTTER_AVAILABLE_IN_1_10
157 guint               clutter_text_buffer_delete_text         (ClutterTextBuffer *buffer,
158                                                              guint              position,
159                                                              gint               n_chars);
160 CLUTTER_AVAILABLE_IN_1_10
161 void                clutter_text_buffer_emit_inserted_text  (ClutterTextBuffer *buffer,
162                                                              guint              position,
163                                                              const gchar       *chars,
164                                                              guint              n_chars);
165 CLUTTER_AVAILABLE_IN_1_10
166 void                clutter_text_buffer_emit_deleted_text   (ClutterTextBuffer *buffer,
167                                                              guint              position,
168                                                              guint              n_chars);
169
170 G_END_DECLS
171
172 #endif /* __CLUTTER_TEXT_BUFFER_H__ */