Ardour  9.0-pre0-582-g084a23a80d
gtktextview.h
Go to the documentation of this file.
1 /* GTK - The GIMP Toolkit
2  * gtktextview.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_VIEW_H__
28 #define __GTK_TEXT_VIEW_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/gtkcontainer.h>
35 #include <gtk/gtkimcontext.h>
36 #include <gtk/gtktextbuffer.h>
37 #include <gtk/gtkmenu.h>
38 
39 G_BEGIN_DECLS
40 
41 #define GTK_TYPE_TEXT_VIEW (gtk_text_view_get_type ())
42 #define GTK_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_VIEW, GtkTextView))
43 #define GTK_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_VIEW, GtkTextViewClass))
44 #define GTK_IS_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_VIEW))
45 #define GTK_IS_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_VIEW))
46 #define GTK_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_VIEW, GtkTextViewClass))
47 
48 typedef enum
49 {
58 
59 #define GTK_TEXT_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
60 
61 typedef struct _GtkTextView GtkTextView;
62 typedef struct _GtkTextViewClass GtkTextViewClass;
63 
64 /* Internal private types. */
65 typedef struct _GtkTextWindow GtkTextWindow;
66 typedef struct _GtkTextPendingScroll GtkTextPendingScroll;
67 
69 {
71 
72  struct _GtkTextLayout *GSEAL (layout);
74 
75  guint GSEAL (selection_drag_handler);
76  guint GSEAL (scroll_timeout);
77 
78  /* Default style settings */
79  gint GSEAL (pixels_above_lines);
80  gint GSEAL (pixels_below_lines);
81  gint GSEAL (pixels_inside_wrap);
82  GtkWrapMode GSEAL (wrap_mode);
84  gint GSEAL (left_margin);
85  gint GSEAL (right_margin);
86  gint GSEAL (indent);
87  PangoTabArray *GSEAL (tabs);
88  guint GSEAL (editable) : 1;
89 
90  guint GSEAL (overwrite_mode) : 1;
91  guint GSEAL (cursor_visible) : 1;
92 
93  /* if we have reset the IM since the last character entered */
94  guint GSEAL (need_im_reset) : 1;
95 
96  guint GSEAL (accepts_tab) : 1;
97 
98  guint GSEAL (width_changed) : 1;
99 
100  /* debug flag - means that we've validated onscreen since the
101  * last "invalidate" signal from the layout
102  */
103  guint GSEAL (onscreen_validated) : 1;
104 
105  guint GSEAL (mouse_cursor_obscured) : 1;
106 
107  GtkTextWindow *GSEAL (text_window);
108  GtkTextWindow *GSEAL (left_window);
109  GtkTextWindow *GSEAL (right_window);
110  GtkTextWindow *GSEAL (top_window);
111  GtkTextWindow *GSEAL (bottom_window);
112 
113  GtkAdjustment *GSEAL (hadjustment);
114  GtkAdjustment *GSEAL (vadjustment);
115 
116  gint GSEAL (xoffset); /* Offsets between widget coordinates and buffer coordinates */
117  gint GSEAL (yoffset);
118  gint GSEAL (width); /* Width and height of the buffer */
119  gint GSEAL (height);
120 
121  /* The virtual cursor position is normally the same as the
122  * actual (strong) cursor position, except in two circumstances:
123  *
124  * a) When the cursor is moved vertically with the keyboard
125  * b) When the text view is scrolled with the keyboard
126  *
127  * In case a), virtual_cursor_x is preserved, but not virtual_cursor_y
128  * In case b), both virtual_cursor_x and virtual_cursor_y are preserved.
129  */
130  gint GSEAL (virtual_cursor_x); /* -1 means use actual cursor position */
131  gint GSEAL (virtual_cursor_y); /* -1 means use actual cursor position */
132 
133  GtkTextMark *GSEAL (first_para_mark); /* Mark at the beginning of the first onscreen paragraph */
134  gint GSEAL (first_para_pixels); /* Offset of top of screen in the first onscreen paragraph */
135 
136  GtkTextMark *GSEAL (dnd_mark);
137  guint GSEAL (blink_timeout);
138 
139  guint GSEAL (first_validate_idle); /* Idle to revalidate onscreen portion, runs before resize */
140  guint GSEAL (incremental_validate_idle); /* Idle to revalidate offscreen portions, runs after redraw */
141 
142  GtkIMContext *GSEAL (im_context);
143  GtkWidget *GSEAL (popup_menu);
144 
145  gint GSEAL (drag_start_x);
146  gint GSEAL (drag_start_y);
147 
148  GSList *GSEAL (children);
149 
150  GtkTextPendingScroll *GSEAL (pending_scroll);
151 
152  gint GSEAL (pending_place_cursor_button);
153 };
154 
156 {
158 
159  void (* set_scroll_adjustments) (GtkTextView *text_view,
160  GtkAdjustment *hadjustment,
161  GtkAdjustment *vadjustment);
162 
163  void (* populate_popup) (GtkTextView *text_view,
164  GtkMenu *menu);
165 
166  /* These are all RUN_ACTION signals for keybindings */
167 
168  /* move insertion point */
169  void (* move_cursor) (GtkTextView *text_view,
170  GtkMovementStep step,
171  gint count,
172  gboolean extend_selection);
173 
174  /* FIXME should be deprecated in favor of adding GTK_MOVEMENT_HORIZONTAL_PAGES
175  * or something in GTK 2.2, was put in to avoid adding enum values during
176  * the freeze.
177  */
178  void (* page_horizontally) (GtkTextView *text_view,
179  gint count,
180  gboolean extend_selection);
181 
182  /* move the "anchor" (what Emacs calls the mark) to the cursor position */
183  void (* set_anchor) (GtkTextView *text_view);
184 
185  /* Edits */
186  void (* insert_at_cursor) (GtkTextView *text_view,
187  const gchar *str);
188  void (* delete_from_cursor) (GtkTextView *text_view,
189  GtkDeleteType type,
190  gint count);
191  void (* backspace) (GtkTextView *text_view);
192 
193  /* cut copy paste */
194  void (* cut_clipboard) (GtkTextView *text_view);
195  void (* copy_clipboard) (GtkTextView *text_view);
196  void (* paste_clipboard) (GtkTextView *text_view);
197  /* overwrite */
198  void (* toggle_overwrite) (GtkTextView *text_view);
199 
200  /* as of GTK+ 2.12 the "move-focus" signal has been moved to GtkWidget,
201  * so this is merley a virtual function now. Overriding it in subclasses
202  * continues to work though.
203  */
204  void (* move_focus) (GtkTextView *text_view,
205  GtkDirectionType direction);
206 
207  /* Padding for future expansion */
208  void (*_gtk_reserved1) (void);
209  void (*_gtk_reserved2) (void);
210  void (*_gtk_reserved3) (void);
211  void (*_gtk_reserved4) (void);
212  void (*_gtk_reserved5) (void);
213  void (*_gtk_reserved6) (void);
214  void (*_gtk_reserved7) (void);
215 };
216 
217 GType gtk_text_view_get_type (void) G_GNUC_CONST;
221  GtkTextBuffer *buffer);
224  GtkTextIter *iter,
225  gdouble within_margin,
226  gboolean use_align,
227  gdouble xalign,
228  gdouble yalign);
230  GtkTextMark *mark,
231  gdouble within_margin,
232  gboolean use_align,
233  gdouble xalign,
234  gdouble yalign);
236  GtkTextMark *mark);
238  GtkTextMark *mark);
240 
242  GdkRectangle *visible_rect);
244  gboolean setting);
246 
248  const GtkTextIter *iter,
249  GdkRectangle *location);
251  GtkTextIter *iter,
252  gint x,
253  gint y);
255  GtkTextIter *iter,
256  gint *trailing,
257  gint x,
258  gint y);
260  const GtkTextIter *iter,
261  gint *y,
262  gint *height);
263 
265  GtkTextIter *target_iter,
266  gint y,
267  gint *line_top);
268 
270  GtkTextWindowType win,
271  gint buffer_x,
272  gint buffer_y,
273  gint *window_x,
274  gint *window_y);
276  GtkTextWindowType win,
277  gint window_x,
278  gint window_y,
279  gint *buffer_x,
280  gint *buffer_y);
281 
284 
286  GtkTextWindowType win);
288  GdkWindow *window);
289 
291  GtkTextWindowType type,
292  gint size);
294  GtkTextWindowType type);
295 
297  GtkTextIter *iter);
299  GtkTextIter *iter);
301  GtkTextIter *iter);
303  GtkTextIter *iter);
305  const GtkTextIter *iter);
307  GtkTextIter *iter,
308  gint count);
309 
311  GdkEventKey *event);
313 
314 /* Adding child widgets */
316  GtkWidget *child,
317  GtkTextChildAnchor *anchor);
318 
320  GtkWidget *child,
321  GtkTextWindowType which_window,
322  /* window coordinates */
323  gint xpos,
324  gint ypos);
325 
327  GtkWidget *child,
328  /* window coordinates */
329  gint xpos,
330  gint ypos);
331 
332 /* Default style settings (fallbacks if no tag affects the property) */
333 
335  GtkWrapMode wrap_mode);
338  gboolean setting);
341  gboolean overwrite);
344  gboolean accepts_tab);
347  gint pixels_above_lines);
350  gint pixels_below_lines);
353  gint pixels_inside_wrap);
356  GtkJustification justification);
359  gint left_margin);
362  gint right_margin);
365  gint indent);
368  PangoTabArray *tabs);
369 PangoTabArray* gtk_text_view_get_tabs (GtkTextView *text_view);
370 
371 /* note that the return value of this changes with the theme */
373 
374 G_END_DECLS
375 
376 #endif /* __GTK_TEXT_VIEW_H__ */
GtkDirectionType
Definition: gtkenums.h:123
GtkDeleteType
Definition: gtkenums.h:108
GtkWrapMode
Definition: gtkenums.h:468
GtkJustification
Definition: gtkenums.h:182
GtkMovementStep
Definition: gtkenums.h:238
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
gboolean gtk_text_view_backward_display_line_start(GtkTextView *text_view, GtkTextIter *iter)
void gtk_text_view_set_justification(GtkTextView *text_view, GtkJustification justification)
void gtk_text_view_reset_im_context(GtkTextView *text_view)
struct _GtkTextWindow GtkTextWindow
Definition: gtktextview.h:65
gboolean gtk_text_view_im_context_filter_keypress(GtkTextView *text_view, GdkEventKey *event)
void gtk_text_view_set_border_window_size(GtkTextView *text_view, GtkTextWindowType type, gint size)
void gtk_text_view_set_pixels_inside_wrap(GtkTextView *text_view, gint pixels_inside_wrap)
struct _GtkTextPendingScroll GtkTextPendingScroll
Definition: gtktextview.h:66
gboolean gtk_text_view_get_accepts_tab(GtkTextView *text_view)
void gtk_text_view_set_wrap_mode(GtkTextView *text_view, GtkWrapMode wrap_mode)
GtkTextWindowType gtk_text_view_get_window_type(GtkTextView *text_view, GdkWindow *window)
gint gtk_text_view_get_border_window_size(GtkTextView *text_view, GtkTextWindowType type)
gboolean gtk_text_view_get_editable(GtkTextView *text_view)
GtkWrapMode gtk_text_view_get_wrap_mode(GtkTextView *text_view)
gboolean gtk_text_view_forward_display_line_end(GtkTextView *text_view, GtkTextIter *iter)
GType gtk_text_view_get_type(void) G_GNUC_CONST
gboolean gtk_text_view_place_cursor_onscreen(GtkTextView *text_view)
void gtk_text_view_get_iter_location(GtkTextView *text_view, const GtkTextIter *iter, GdkRectangle *location)
GtkAdjustment * gtk_text_view_get_vadjustment(GtkTextView *text_view)
GtkJustification gtk_text_view_get_justification(GtkTextView *text_view)
gboolean gtk_text_view_get_overwrite(GtkTextView *text_view)
void gtk_text_view_add_child_at_anchor(GtkTextView *text_view, GtkWidget *child, GtkTextChildAnchor *anchor)
void gtk_text_view_set_tabs(GtkTextView *text_view, PangoTabArray *tabs)
gint gtk_text_view_get_pixels_below_lines(GtkTextView *text_view)
void gtk_text_view_set_overwrite(GtkTextView *text_view, gboolean overwrite)
void gtk_text_view_set_cursor_visible(GtkTextView *text_view, gboolean setting)
GtkAdjustment * gtk_text_view_get_hadjustment(GtkTextView *text_view)
GtkWidget * gtk_text_view_new(void)
GdkWindow * gtk_text_view_get_window(GtkTextView *text_view, GtkTextWindowType win)
gboolean gtk_text_view_backward_display_line(GtkTextView *text_view, GtkTextIter *iter)
void gtk_text_view_get_visible_rect(GtkTextView *text_view, GdkRectangle *visible_rect)
void gtk_text_view_set_buffer(GtkTextView *text_view, GtkTextBuffer *buffer)
gboolean gtk_text_view_move_visually(GtkTextView *text_view, GtkTextIter *iter, gint count)
void gtk_text_view_set_left_margin(GtkTextView *text_view, gint left_margin)
void gtk_text_view_move_child(GtkTextView *text_view, GtkWidget *child, gint xpos, gint ypos)
gint gtk_text_view_get_indent(GtkTextView *text_view)
gboolean gtk_text_view_move_mark_onscreen(GtkTextView *text_view, GtkTextMark *mark)
void gtk_text_view_get_line_yrange(GtkTextView *text_view, const GtkTextIter *iter, gint *y, gint *height)
gboolean gtk_text_view_starts_display_line(GtkTextView *text_view, const GtkTextIter *iter)
GtkTextBuffer * gtk_text_view_get_buffer(GtkTextView *text_view)
gint gtk_text_view_get_pixels_above_lines(GtkTextView *text_view)
gint gtk_text_view_get_left_margin(GtkTextView *text_view)
void gtk_text_view_window_to_buffer_coords(GtkTextView *text_view, GtkTextWindowType win, gint window_x, gint window_y, gint *buffer_x, gint *buffer_y)
void gtk_text_view_add_child_in_window(GtkTextView *text_view, GtkWidget *child, GtkTextWindowType which_window, gint xpos, gint ypos)
GtkWidget * gtk_text_view_new_with_buffer(GtkTextBuffer *buffer)
void gtk_text_view_set_accepts_tab(GtkTextView *text_view, gboolean accepts_tab)
gint gtk_text_view_get_pixels_inside_wrap(GtkTextView *text_view)
void gtk_text_view_set_pixels_above_lines(GtkTextView *text_view, gint pixels_above_lines)
void gtk_text_view_set_indent(GtkTextView *text_view, gint indent)
GtkTextAttributes * gtk_text_view_get_default_attributes(GtkTextView *text_view)
void gtk_text_view_set_editable(GtkTextView *text_view, gboolean setting)
void gtk_text_view_buffer_to_window_coords(GtkTextView *text_view, GtkTextWindowType win, gint buffer_x, gint buffer_y, gint *window_x, gint *window_y)
GtkTextWindowType
Definition: gtktextview.h:49
@ GTK_TEXT_WINDOW_BOTTOM
Definition: gtktextview.h:56
@ GTK_TEXT_WINDOW_RIGHT
Definition: gtktextview.h:54
@ GTK_TEXT_WINDOW_TOP
Definition: gtktextview.h:55
@ GTK_TEXT_WINDOW_TEXT
Definition: gtktextview.h:52
@ GTK_TEXT_WINDOW_WIDGET
Definition: gtktextview.h:51
@ GTK_TEXT_WINDOW_LEFT
Definition: gtktextview.h:53
@ GTK_TEXT_WINDOW_PRIVATE
Definition: gtktextview.h:50
gboolean gtk_text_view_get_cursor_visible(GtkTextView *text_view)
PangoTabArray * gtk_text_view_get_tabs(GtkTextView *text_view)
void gtk_text_view_scroll_mark_onscreen(GtkTextView *text_view, GtkTextMark *mark)
void gtk_text_view_get_iter_at_position(GtkTextView *text_view, GtkTextIter *iter, gint *trailing, gint x, gint y)
void gtk_text_view_get_iter_at_location(GtkTextView *text_view, GtkTextIter *iter, gint x, gint y)
void gtk_text_view_set_pixels_below_lines(GtkTextView *text_view, gint pixels_below_lines)
gboolean gtk_text_view_forward_display_line(GtkTextView *text_view, GtkTextIter *iter)
void gtk_text_view_set_right_margin(GtkTextView *text_view, gint right_margin)
void gtk_text_view_scroll_to_mark(GtkTextView *text_view, GtkTextMark *mark, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign)
gint gtk_text_view_get_right_margin(GtkTextView *text_view)
gboolean gtk_text_view_scroll_to_iter(GtkTextView *text_view, GtkTextIter *iter, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign)
void gtk_text_view_get_line_at_y(GtkTextView *text_view, GtkTextIter *target_iter, gint y, gint *line_top)
GtkTextBuffer * buffer
void(* copy_clipboard)(GtkTextView *text_view)
Definition: gtktextview.h:195
void(* _gtk_reserved1)(void)
Definition: gtktextview.h:208
void(* paste_clipboard)(GtkTextView *text_view)
Definition: gtktextview.h:196
void(* _gtk_reserved7)(void)
Definition: gtktextview.h:214
void(* set_scroll_adjustments)(GtkTextView *text_view, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment)
Definition: gtktextview.h:159
void(* move_cursor)(GtkTextView *text_view, GtkMovementStep step, gint count, gboolean extend_selection)
Definition: gtktextview.h:169
void(* _gtk_reserved6)(void)
Definition: gtktextview.h:213
void(* delete_from_cursor)(GtkTextView *text_view, GtkDeleteType type, gint count)
Definition: gtktextview.h:188
void(* toggle_overwrite)(GtkTextView *text_view)
Definition: gtktextview.h:198
void(* backspace)(GtkTextView *text_view)
Definition: gtktextview.h:191
void(* set_anchor)(GtkTextView *text_view)
Definition: gtktextview.h:183
void(* move_focus)(GtkTextView *text_view, GtkDirectionType direction)
Definition: gtktextview.h:204
void(* _gtk_reserved5)(void)
Definition: gtktextview.h:212
void(* cut_clipboard)(GtkTextView *text_view)
Definition: gtktextview.h:194
void(* insert_at_cursor)(GtkTextView *text_view, const gchar *str)
Definition: gtktextview.h:186
GtkContainerClass parent_class
Definition: gtktextview.h:157
void(* populate_popup)(GtkTextView *text_view, GtkMenu *menu)
Definition: gtktextview.h:163
void(* _gtk_reserved3)(void)
Definition: gtktextview.h:210
void(* _gtk_reserved2)(void)
Definition: gtktextview.h:209
void(* page_horizontally)(GtkTextView *text_view, gint count, gboolean extend_selection)
Definition: gtktextview.h:178
void(* _gtk_reserved4)(void)
Definition: gtktextview.h:211
struct _GtkTextLayout * GSEAL(layout)
gint GSEAL(pixels_above_lines)
gint GSEAL(width)
gint GSEAL(left_margin)
GtkTextWindow * GSEAL(right_window)
GtkTextWindow * GSEAL(bottom_window)
gint GSEAL(drag_start_x)
GtkTextWindow * GSEAL(left_window)
gint GSEAL(height)
GSList * GSEAL(children)
gint GSEAL(pending_place_cursor_button)
GtkAdjustment * GSEAL(vadjustment)
GtkWidget * GSEAL(popup_menu)
gint GSEAL(pixels_below_lines)
GtkTextBuffer * GSEAL(buffer)
guint GSEAL(scroll_timeout)
GtkTextWindow * GSEAL(top_window)
gint GSEAL(drag_start_y)
GtkWrapMode GSEAL(wrap_mode)
gint GSEAL(indent)
gint GSEAL(first_para_pixels)
gint GSEAL(virtual_cursor_x)
gint GSEAL(pixels_inside_wrap)
gint GSEAL(yoffset)
guint GSEAL(selection_drag_handler)
GtkContainer parent_instance
Definition: gtktextview.h:70
PangoTabArray * GSEAL(tabs)
guint GSEAL(first_validate_idle)
GtkTextPendingScroll * GSEAL(pending_scroll)
GtkTextMark * GSEAL(first_para_mark)
gint GSEAL(xoffset)
GtkJustification GSEAL(justify)
gint GSEAL(right_margin)
guint GSEAL(incremental_validate_idle)
GtkAdjustment * GSEAL(hadjustment)
gint GSEAL(virtual_cursor_y)
guint GSEAL(editable) guint GSEAL(overwrite_mode) guint GSEAL(cursor_visible) guint GSEAL(need_im_reset) guint GSEAL(accepts_tab) guint GSEAL(width_changed) guint GSEAL(onscreen_validated) guint GSEAL(mouse_cursor_obscured) GtkTextWindow * GSEAL(text_window)
GtkTextMark * GSEAL(dnd_mark)
GtkIMContext * GSEAL(im_context)
guint GSEAL(blink_timeout)
gint height
Definition: xcursors.h:1
gint width
Definition: xcursors.h:1