Ardour  8.7-14-g57a6773833
gtktextbuffer.h
Go to the documentation of this file.
1 /* GTK - The GIMP Toolkit
2  * gtktextbuffer.h Copyright (C) 2000 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser 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 
20 /*
21  * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22  * file for a list of people on the GTK+ Team. See the ChangeLog
23  * files for a list of changes. These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26 
27 #ifndef __GTK_TEXT_BUFFER_H__
28 #define __GTK_TEXT_BUFFER_H__
29 
30 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
31 #error "Only <gtk/gtk.h> can be included directly."
32 #endif
33 
34 #include <gtk/gtkwidget.h>
35 #include <gtk/gtkclipboard.h>
36 #include <gtk/gtktexttagtable.h>
37 #include <gtk/gtktextiter.h>
38 #include <gtk/gtktextmark.h>
39 #include <gtk/gtktextchild.h>
40 
41 G_BEGIN_DECLS
42 
43 /*
44  * This is the PUBLIC representation of a text buffer.
45  * GtkTextBTree is the PRIVATE internal representation of it.
46  */
47 
48 /* these values are used as "info" for the targets contained in the
49  * lists returned by gtk_text_buffer_get_copy,paste_target_list()
50  *
51  * the enum counts down from G_MAXUINT to avoid clashes with application
52  * added drag destinations which usually start at 0.
53  */
54 typedef enum
55 {
60 
61 typedef struct _GtkTextBTree GtkTextBTree;
62 
63 typedef struct _GtkTextLogAttrCache GtkTextLogAttrCache;
64 
65 #define GTK_TYPE_TEXT_BUFFER (gtk_text_buffer_get_type ())
66 #define GTK_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_BUFFER, GtkTextBuffer))
67 #define GTK_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_BUFFER, GtkTextBufferClass))
68 #define GTK_IS_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_BUFFER))
69 #define GTK_IS_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_BUFFER))
70 #define GTK_TEXT_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_BUFFER, GtkTextBufferClass))
71 
73 
75 {
76  GObject parent_instance;
77 
78  GtkTextTagTable *GSEAL (tag_table);
79  GtkTextBTree *GSEAL (btree);
80 
81  GSList *GSEAL (clipboard_contents_buffers);
82  GSList *GSEAL (selection_clipboards);
83 
84  GtkTextLogAttrCache *GSEAL (log_attr_cache);
85 
86  guint GSEAL (user_action_count);
87 
88  /* Whether the buffer has been modified since last save */
89  guint GSEAL (modified) : 1;
90 
91  guint GSEAL (has_selection) : 1;
92 };
93 
95 {
96  GObjectClass parent_class;
97 
98  void (* insert_text) (GtkTextBuffer *buffer,
99  GtkTextIter *pos,
100  const gchar *text,
101  gint length);
102 
103  void (* insert_pixbuf) (GtkTextBuffer *buffer,
104  GtkTextIter *pos,
105  GdkPixbuf *pixbuf);
106 
108  GtkTextIter *pos,
109  GtkTextChildAnchor *anchor);
110 
111  void (* delete_range) (GtkTextBuffer *buffer,
113  GtkTextIter *end);
114 
115  /* Only for text/widgets/pixbuf changed, marks/tags don't cause this
116  * to be emitted
117  */
118  void (* changed) (GtkTextBuffer *buffer);
119 
120 
121  /* New value for the modified flag */
122  void (* modified_changed) (GtkTextBuffer *buffer);
123 
124  /* Mark moved or created */
125  void (* mark_set) (GtkTextBuffer *buffer,
126  const GtkTextIter *location,
127  GtkTextMark *mark);
128 
129  void (* mark_deleted) (GtkTextBuffer *buffer,
130  GtkTextMark *mark);
131 
132  void (* apply_tag) (GtkTextBuffer *buffer,
133  GtkTextTag *tag,
134  const GtkTextIter *start_char,
135  const GtkTextIter *end_char);
136 
137  void (* remove_tag) (GtkTextBuffer *buffer,
138  GtkTextTag *tag,
139  const GtkTextIter *start_char,
140  const GtkTextIter *end_char);
141 
142  /* Called at the start and end of an atomic user action */
143  void (* begin_user_action) (GtkTextBuffer *buffer);
144  void (* end_user_action) (GtkTextBuffer *buffer);
145 
146  void (* paste_done) (GtkTextBuffer *buffer,
147  GtkClipboard *clipboard);
148 
149  /* Padding for future expansion */
150  void (*_gtk_reserved1) (void);
151  void (*_gtk_reserved2) (void);
152  void (*_gtk_reserved3) (void);
153  void (*_gtk_reserved4) (void);
154  void (*_gtk_reserved5) (void);
155 };
156 
157 GType gtk_text_buffer_get_type (void) G_GNUC_CONST;
158 
159 
160 
161 /* table is NULL to create a new one */
165 
166 
168 
169 /* Delete whole buffer, then insert */
171  const gchar *text,
172  gint len);
173 
174 /* Insert into the buffer */
176  GtkTextIter *iter,
177  const gchar *text,
178  gint len);
180  const gchar *text,
181  gint len);
182 
184  GtkTextIter *iter,
185  const gchar *text,
186  gint len,
187  gboolean default_editable);
189  const gchar *text,
190  gint len,
191  gboolean default_editable);
192 
194  GtkTextIter *iter,
195  const GtkTextIter *start,
196  const GtkTextIter *end);
198  GtkTextIter *iter,
199  const GtkTextIter *start,
200  const GtkTextIter *end,
201  gboolean default_editable);
202 
204  GtkTextIter *iter,
205  const gchar *text,
206  gint len,
207  GtkTextTag *first_tag,
208  ...) G_GNUC_NULL_TERMINATED;
209 
211  GtkTextIter *iter,
212  const gchar *text,
213  gint len,
214  const gchar *first_tag_name,
215  ...) G_GNUC_NULL_TERMINATED;
216 
217 /* Delete from the buffer */
220  GtkTextIter *end);
222  GtkTextIter *start_iter,
223  GtkTextIter *end_iter,
224  gboolean default_editable);
226  GtkTextIter *iter,
227  gboolean interactive,
228  gboolean default_editable);
229 
230 /* Obtain strings from the buffer */
232  const GtkTextIter *start,
233  const GtkTextIter *end,
234  gboolean include_hidden_chars);
235 
237  const GtkTextIter *start,
238  const GtkTextIter *end,
239  gboolean include_hidden_chars);
240 
241 /* Insert a pixbuf */
243  GtkTextIter *iter,
244  GdkPixbuf *pixbuf);
245 
246 /* Insert a child anchor */
248  GtkTextIter *iter,
249  GtkTextChildAnchor *anchor);
250 
251 /* Convenience, create and insert a child anchor */
253  GtkTextIter *iter);
254 
255 /* Mark manipulation */
257  GtkTextMark *mark,
258  const GtkTextIter *where);
260  const gchar *mark_name,
261  const GtkTextIter *where,
262  gboolean left_gravity);
264  GtkTextMark *mark,
265  const GtkTextIter *where);
267  GtkTextMark *mark);
269  const gchar *name);
270 
272  const gchar *name,
273  const GtkTextIter *where);
275  const gchar *name);
276 
279 
280 /* efficiently move insert and selection_bound at the same time */
282  const GtkTextIter *where);
284  const GtkTextIter *ins,
285  const GtkTextIter *bound);
286 
287 
288 
289 /* Tag manipulation */
291  GtkTextTag *tag,
292  const GtkTextIter *start,
293  const GtkTextIter *end);
295  GtkTextTag *tag,
296  const GtkTextIter *start,
297  const GtkTextIter *end);
299  const gchar *name,
300  const GtkTextIter *start,
301  const GtkTextIter *end);
303  const gchar *name,
304  const GtkTextIter *start,
305  const GtkTextIter *end);
307  const GtkTextIter *start,
308  const GtkTextIter *end);
309 
310 
311 /* You can either ignore the return value, or use it to
312  * set the attributes of the tag. tag_name can be NULL
313  */
315  const gchar *tag_name,
316  const gchar *first_property_name,
317  ...);
318 
319 /* Obtain iterators pointed at various places, then you can move the
320  * iterator around using the GtkTextIter operators
321  */
323  GtkTextIter *iter,
324  gint line_number,
325  gint char_offset);
327  GtkTextIter *iter,
328  gint line_number,
329  gint byte_index);
331  GtkTextIter *iter,
332  gint char_offset);
334  GtkTextIter *iter,
335  gint line_number);
337  GtkTextIter *iter);
339  GtkTextIter *iter);
342  GtkTextIter *end);
344  GtkTextIter *iter,
345  GtkTextMark *mark);
346 
348  GtkTextIter *iter,
349  GtkTextChildAnchor *anchor);
350 
351 /* There's no get_first_iter because you just get the iter for
352  line or char 0 */
353 
354 /* Used to keep track of whether the buffer needs saving; anytime the
355  buffer contents change, the modified flag is turned on. Whenever
356  you save, turn it off. Tags and marks do not affect the modified
357  flag, but if you would like them to you can connect a handler to
358  the tag/mark signals and call set_modified in your handler */
359 
362  gboolean setting);
363 
365 
367  GtkClipboard *clipboard);
369  GtkClipboard *clipboard);
370 
372  GtkClipboard *clipboard,
373  gboolean default_editable);
375  GtkClipboard *clipboard);
377  GtkClipboard *clipboard,
378  GtkTextIter *override_location,
379  gboolean default_editable);
380 
383  GtkTextIter *end);
385  gboolean interactive,
386  gboolean default_editable);
387 
388 /* Called to specify atomic user actions, used to implement undo */
391 
394 
395 /* INTERNAL private stuff */
397 
399 
401  const GtkTextIter *anywhere_in_line,
402  gint *char_len);
403 
405  GtkTextTag *tag);
406 
407 G_END_DECLS
408 
409 #endif
GtkImageIconNameData name
Definition: gtkimage.h:6
GtkImagePixbufData pixbuf
Definition: gtkimage.h:2
typedefG_BEGIN_DECLS struct _GtkTargetList GtkTargetList
Definition: gtkselection.h:41
const PangoLogAttr * _gtk_text_buffer_get_line_log_attrs(GtkTextBuffer *buffer, const GtkTextIter *anywhere_in_line, gint *char_len)
gboolean gtk_text_buffer_delete_selection(GtkTextBuffer *buffer, gboolean interactive, gboolean default_editable)
void gtk_text_buffer_select_range(GtkTextBuffer *buffer, const GtkTextIter *ins, const GtkTextIter *bound)
void gtk_text_buffer_insert(GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len)
void gtk_text_buffer_add_selection_clipboard(GtkTextBuffer *buffer, GtkClipboard *clipboard)
gint gtk_text_buffer_get_line_count(GtkTextBuffer *buffer)
gboolean gtk_text_buffer_insert_interactive(GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, gboolean default_editable)
void gtk_text_buffer_insert_with_tags(GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, GtkTextTag *first_tag,...) G_GNUC_NULL_TERMINATED
void gtk_text_buffer_get_end_iter(GtkTextBuffer *buffer, GtkTextIter *iter)
gboolean gtk_text_buffer_insert_interactive_at_cursor(GtkTextBuffer *buffer, const gchar *text, gint len, gboolean default_editable)
void gtk_text_buffer_place_cursor(GtkTextBuffer *buffer, const GtkTextIter *where)
GtkTextMark * gtk_text_buffer_get_selection_bound(GtkTextBuffer *buffer)
void gtk_text_buffer_get_iter_at_mark(GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextMark *mark)
void gtk_text_buffer_remove_tag(GtkTextBuffer *buffer, GtkTextTag *tag, const GtkTextIter *start, const GtkTextIter *end)
gchar * gtk_text_buffer_get_text(GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end, gboolean include_hidden_chars)
GtkTextBufferTargetInfo
Definition: gtktextbuffer.h:55
@ GTK_TEXT_BUFFER_TARGET_INFO_BUFFER_CONTENTS
Definition: gtktextbuffer.h:56
@ GTK_TEXT_BUFFER_TARGET_INFO_TEXT
Definition: gtktextbuffer.h:58
@ GTK_TEXT_BUFFER_TARGET_INFO_RICH_TEXT
Definition: gtktextbuffer.h:57
void gtk_text_buffer_cut_clipboard(GtkTextBuffer *buffer, GtkClipboard *clipboard, gboolean default_editable)
gboolean gtk_text_buffer_backspace(GtkTextBuffer *buffer, GtkTextIter *iter, gboolean interactive, gboolean default_editable)
GtkTextTagTable * gtk_text_buffer_get_tag_table(GtkTextBuffer *buffer)
GtkTargetList * gtk_text_buffer_get_paste_target_list(GtkTextBuffer *buffer)
void gtk_text_buffer_delete_mark_by_name(GtkTextBuffer *buffer, const gchar *name)
void gtk_text_buffer_add_mark(GtkTextBuffer *buffer, GtkTextMark *mark, const GtkTextIter *where)
GtkTextMark * gtk_text_buffer_get_mark(GtkTextBuffer *buffer, const gchar *name)
GType gtk_text_buffer_get_type(void) G_GNUC_CONST
gchar * gtk_text_buffer_get_slice(GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end, gboolean include_hidden_chars)
void gtk_text_buffer_paste_clipboard(GtkTextBuffer *buffer, GtkClipboard *clipboard, GtkTextIter *override_location, gboolean default_editable)
void gtk_text_buffer_insert_at_cursor(GtkTextBuffer *buffer, const gchar *text, gint len)
void gtk_text_buffer_insert_pixbuf(GtkTextBuffer *buffer, GtkTextIter *iter, GdkPixbuf *pixbuf)
void gtk_text_buffer_get_start_iter(GtkTextBuffer *buffer, GtkTextIter *iter)
gboolean gtk_text_buffer_get_modified(GtkTextBuffer *buffer)
void gtk_text_buffer_set_text(GtkTextBuffer *buffer, const gchar *text, gint len)
void gtk_text_buffer_set_modified(GtkTextBuffer *buffer, gboolean setting)
void gtk_text_buffer_get_iter_at_line_offset(GtkTextBuffer *buffer, GtkTextIter *iter, gint line_number, gint char_offset)
gint gtk_text_buffer_get_char_count(GtkTextBuffer *buffer)
void gtk_text_buffer_remove_selection_clipboard(GtkTextBuffer *buffer, GtkClipboard *clipboard)
void gtk_text_buffer_move_mark_by_name(GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *where)
GtkTargetList * gtk_text_buffer_get_copy_target_list(GtkTextBuffer *buffer)
void gtk_text_buffer_insert_with_tags_by_name(GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, const gchar *first_tag_name,...) G_GNUC_NULL_TERMINATED
GtkTextMark * gtk_text_buffer_get_insert(GtkTextBuffer *buffer)
void gtk_text_buffer_insert_range(GtkTextBuffer *buffer, GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end)
struct _GtkTextBTree GtkTextBTree
Definition: gtktextbuffer.h:61
void gtk_text_buffer_insert_child_anchor(GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextChildAnchor *anchor)
gboolean gtk_text_buffer_get_has_selection(GtkTextBuffer *buffer)
gboolean gtk_text_buffer_delete_interactive(GtkTextBuffer *buffer, GtkTextIter *start_iter, GtkTextIter *end_iter, gboolean default_editable)
void gtk_text_buffer_remove_tag_by_name(GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *start, const GtkTextIter *end)
void gtk_text_buffer_remove_all_tags(GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end)
GtkTextBuffer * gtk_text_buffer_new(GtkTextTagTable *table)
void gtk_text_buffer_move_mark(GtkTextBuffer *buffer, GtkTextMark *mark, const GtkTextIter *where)
GtkTextMark * gtk_text_buffer_create_mark(GtkTextBuffer *buffer, const gchar *mark_name, const GtkTextIter *where, gboolean left_gravity)
GtkTextTag * gtk_text_buffer_create_tag(GtkTextBuffer *buffer, const gchar *tag_name, const gchar *first_property_name,...)
GtkTextChildAnchor * gtk_text_buffer_create_child_anchor(GtkTextBuffer *buffer, GtkTextIter *iter)
void gtk_text_buffer_get_iter_at_line_index(GtkTextBuffer *buffer, GtkTextIter *iter, gint line_number, gint byte_index)
void gtk_text_buffer_get_iter_at_child_anchor(GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextChildAnchor *anchor)
void gtk_text_buffer_copy_clipboard(GtkTextBuffer *buffer, GtkClipboard *clipboard)
void _gtk_text_buffer_spew(GtkTextBuffer *buffer)
void gtk_text_buffer_delete_mark(GtkTextBuffer *buffer, GtkTextMark *mark)
void gtk_text_buffer_delete(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end)
void gtk_text_buffer_get_iter_at_offset(GtkTextBuffer *buffer, GtkTextIter *iter, gint char_offset)
void gtk_text_buffer_apply_tag(GtkTextBuffer *buffer, GtkTextTag *tag, const GtkTextIter *start, const GtkTextIter *end)
void _gtk_text_buffer_notify_will_remove_tag(GtkTextBuffer *buffer, GtkTextTag *tag)
void gtk_text_buffer_begin_user_action(GtkTextBuffer *buffer)
gboolean gtk_text_buffer_get_selection_bounds(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end)
GtkTextBTree * _gtk_text_buffer_get_btree(GtkTextBuffer *buffer)
void gtk_text_buffer_get_iter_at_line(GtkTextBuffer *buffer, GtkTextIter *iter, gint line_number)
void gtk_text_buffer_apply_tag_by_name(GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *start, const GtkTextIter *end)
gboolean gtk_text_buffer_insert_range_interactive(GtkTextBuffer *buffer, GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end, gboolean default_editable)
void gtk_text_buffer_get_bounds(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end)
struct _GtkTextLogAttrCache GtkTextLogAttrCache
Definition: gtktextbuffer.h:63
void gtk_text_buffer_end_user_action(GtkTextBuffer *buffer)
typedefG_BEGIN_DECLS struct _GtkTextChildAnchor GtkTextChildAnchor
Definition: gtktextchild.h:45
typedefG_BEGIN_DECLS struct _GtkTextMark GtkTextMark
Definition: gtktextmark.h:61
typedefG_BEGIN_DECLS struct _GtkTextIter GtkTextIter
Definition: gtktexttag.h:67
struct _GtkClipboard GtkClipboard
Definition: gtkwidget.h:483
PBD::PropertyDescriptor< timecnt_t > length
PBD::PropertyDescriptor< timepos_t > start
void(* changed)(GtkTextBuffer *buffer)
void(* modified_changed)(GtkTextBuffer *buffer)
void(* mark_deleted)(GtkTextBuffer *buffer, GtkTextMark *mark)
void(* apply_tag)(GtkTextBuffer *buffer, GtkTextTag *tag, const GtkTextIter *start_char, const GtkTextIter *end_char)
void(* insert_child_anchor)(GtkTextBuffer *buffer, GtkTextIter *pos, GtkTextChildAnchor *anchor)
void(* insert_text)(GtkTextBuffer *buffer, GtkTextIter *pos, const gchar *text, gint length)
Definition: gtktextbuffer.h:98
GObjectClass parent_class
Definition: gtktextbuffer.h:96
void(* delete_range)(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end)
void(* begin_user_action)(GtkTextBuffer *buffer)
void(* _gtk_reserved3)(void)
void(* paste_done)(GtkTextBuffer *buffer, GtkClipboard *clipboard)
void(* remove_tag)(GtkTextBuffer *buffer, GtkTextTag *tag, const GtkTextIter *start_char, const GtkTextIter *end_char)
void(* _gtk_reserved5)(void)
void(* _gtk_reserved1)(void)
void(* insert_pixbuf)(GtkTextBuffer *buffer, GtkTextIter *pos, GdkPixbuf *pixbuf)
void(* end_user_action)(GtkTextBuffer *buffer)
void(* _gtk_reserved2)(void)
void(* _gtk_reserved4)(void)
void(* mark_set)(GtkTextBuffer *buffer, const GtkTextIter *location, GtkTextMark *mark)
GtkTextTagTable * GSEAL(tag_table)
GtkTextLogAttrCache * GSEAL(log_attr_cache)
guint GSEAL(user_action_count)
GSList * GSEAL(clipboard_contents_buffers)
GSList * GSEAL(selection_clipboards)
GObject parent_instance
Definition: gtktextbuffer.h:76
GtkTextBTree * GSEAL(btree)