gtktextview.c 282 KB
Newer Older
Matthias Clasen's avatar
Matthias Clasen committed
1
/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
Cody Russell's avatar
Cody Russell committed
2
/* GTK - The GIMP Toolkit
3
 * gtktextview.c Copyright (C) 2000 Red Hat, Inc.
4
 *
5 6 7 8
 * 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.
9
 *
10 11
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 14 15 16 17 18 19 20 21 22 23 24
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
25
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
26 27
 */

28
#include "config.h"
29 30
#include <string.h>

31
#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
32 33
#include "gtkbindings.h"
#include "gtkdnd.h"
34
#include "gtkimagemenuitem.h"
Owen Taylor's avatar
Owen Taylor committed
35
#include "gtkintl.h"
36
#include "gtkmain.h"
37
#include "gtkmarshalers.h"
Owen Taylor's avatar
Owen Taylor committed
38 39
#include "gtkmenu.h"
#include "gtkmenuitem.h"
40
#include "gtkseparatormenuitem.h"
41
#include "gtksettings.h"
42
#include "gtkstock.h"
43
#include "gtktextbufferrichtext.h"
44 45 46 47
#include "gtktextdisplay.h"
#include "gtktextview.h"
#include "gtkimmulticontext.h"
#include "gdk/gdkkeysyms.h"
48
#include "gtkprivate.h"
49
#include "gtktextutil.h"
50
#include "gtkwindow.h"
51
#include "gtkalias.h"
52

53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
/* How scrolling, validation, exposes, etc. work.
 *
 * The expose_event handler has the invariant that the onscreen lines
 * have been validated.
 *
 * There are two ways that onscreen lines can become invalid. The first
 * is to change which lines are onscreen. This happens when the value
 * of a scroll adjustment changes. So the code path begins in
 * gtk_text_view_value_changed() and goes like this:
 *   - gdk_window_scroll() to reflect the new adjustment value
 *   - validate the lines that were moved onscreen
 *   - gdk_window_process_updates() to handle the exposes immediately
 *
 * The second way is that you get the "invalidated" signal from the layout,
 * indicating that lines have become invalid. This code path begins in
 * invalidated_handler() and goes like this:
 *   - install high-priority idle which does the rest of the steps
 *   - if a scroll is pending from scroll_to_mark(), do the scroll,
 *     jumping to the gtk_text_view_value_changed() code path
 *   - otherwise, validate the onscreen lines
 *   - DO NOT process updates
 *
 * In both cases, validating the onscreen lines can trigger a scroll
 * due to maintaining the first_para on the top of the screen.
 * If validation triggers a scroll, we jump to the top of the code path
 * for value_changed, and bail out of the current code path.
 *
 * Also, in size_allocate, if we invalidate some lines from changing
 * the layout width, we need to go ahead and run the high-priority idle,
 * because GTK sends exposes right after doing the size allocates without
 * returning to the main loop. This is also why the high-priority idle
 * is at a higher priority than resizing.
 *
 */

88
#if 0
89 90
#define DEBUG_VALIDATION_AND_SCROLLING
#endif
91 92 93 94 95 96 97

#ifdef DEBUG_VALIDATION_AND_SCROLLING
#define DV(x) (x)
#else
#define DV(x)
#endif

98 99 100
#define SCREEN_WIDTH(widget) text_window_get_width (GTK_TEXT_VIEW (widget)->text_window)
#define SCREEN_HEIGHT(widget) text_window_get_height (GTK_TEXT_VIEW (widget)->text_window)

101 102
#define SPACE_FOR_CURSOR 1

103 104 105 106 107 108 109
typedef struct _GtkTextViewPrivate GtkTextViewPrivate;

#define GTK_TEXT_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TEXT_VIEW, GtkTextViewPrivate))

struct _GtkTextViewPrivate 
{
  guint blink_time;  /* time in msec the cursor has blinked since last user event */
110
  guint im_spot_idle;
111
  gchar *im_module;
112
  guint scroll_after_paste : 1;
113 114 115
};


116 117 118 119 120 121 122 123 124
struct _GtkTextPendingScroll
{
  GtkTextMark   *mark;
  gdouble        within_margin;
  gboolean       use_align;
  gdouble        xalign;
  gdouble        yalign;
};
  
125 126
enum
{
Owen Taylor's avatar
Owen Taylor committed
127 128
  SET_SCROLL_ADJUSTMENTS,
  POPULATE_POPUP,
129
  MOVE_CURSOR,
130
  PAGE_HORIZONTALLY,
131
  SET_ANCHOR,
132
  INSERT_AT_CURSOR,
133
  DELETE_FROM_CURSOR,
134
  BACKSPACE,
135 136 137
  CUT_CLIPBOARD,
  COPY_CLIPBOARD,
  PASTE_CLIPBOARD,
138
  TOGGLE_OVERWRITE,
139
  MOVE_VIEWPORT,
140
  SELECT_ALL,
141
  TOGGLE_CURSOR_VISIBLE,
142
  PREEDIT_CHANGED,
143 144 145
  LAST_SIGNAL
};

146 147
enum
{
148 149 150 151 152 153 154 155 156 157 158 159
  PROP_0,
  PROP_PIXELS_ABOVE_LINES,
  PROP_PIXELS_BELOW_LINES,
  PROP_PIXELS_INSIDE_WRAP,
  PROP_EDITABLE,
  PROP_WRAP_MODE,
  PROP_JUSTIFICATION,
  PROP_LEFT_MARGIN,
  PROP_RIGHT_MARGIN,
  PROP_INDENT,
  PROP_TABS,
  PROP_CURSOR_VISIBLE,
160
  PROP_BUFFER,
161
  PROP_OVERWRITE,
162 163
  PROP_ACCEPTS_TAB,
  PROP_IM_MODULE
164 165 166 167
};

static void gtk_text_view_destroy              (GtkObject        *object);
static void gtk_text_view_finalize             (GObject          *object);
168 169 170 171 172 173 174 175
static void gtk_text_view_set_property         (GObject         *object,
						guint            prop_id,
						const GValue    *value,
						GParamSpec      *pspec);
static void gtk_text_view_get_property         (GObject         *object,
						guint            prop_id,
						GValue          *value,
						GParamSpec      *pspec);
176
static void gtk_text_view_size_request         (GtkWidget        *widget,
177
                                                GtkRequisition   *requisition);
178
static void gtk_text_view_size_allocate        (GtkWidget        *widget,
179
                                                GtkAllocation    *allocation);
180 181 182
static void gtk_text_view_realize              (GtkWidget        *widget);
static void gtk_text_view_unrealize            (GtkWidget        *widget);
static void gtk_text_view_style_set            (GtkWidget        *widget,
183
                                                GtkStyle         *previous_style);
184
static void gtk_text_view_direction_changed    (GtkWidget        *widget,
185
                                                GtkTextDirection  previous_direction);
186 187
static void gtk_text_view_grab_notify          (GtkWidget        *widget,
					        gboolean         was_grabbed);
188 189 190
static void gtk_text_view_state_changed        (GtkWidget        *widget,
					        GtkStateType      previous_state);

191
static gint gtk_text_view_event                (GtkWidget        *widget,
192
                                                GdkEvent         *event);
193
static gint gtk_text_view_key_press_event      (GtkWidget        *widget,
194
                                                GdkEventKey      *event);
195
static gint gtk_text_view_key_release_event    (GtkWidget        *widget,
196
                                                GdkEventKey      *event);
197
static gint gtk_text_view_button_press_event   (GtkWidget        *widget,
198
                                                GdkEventButton   *event);
199
static gint gtk_text_view_button_release_event (GtkWidget        *widget,
200
                                                GdkEventButton   *event);
201
static gint gtk_text_view_focus_in_event       (GtkWidget        *widget,
202
                                                GdkEventFocus    *event);
203
static gint gtk_text_view_focus_out_event      (GtkWidget        *widget,
204
                                                GdkEventFocus    *event);
205
static gint gtk_text_view_motion_event         (GtkWidget        *widget,
206
                                                GdkEventMotion   *event);
207
static gint gtk_text_view_expose_event         (GtkWidget        *widget,
208
                                                GdkEventExpose   *expose);
209
static void gtk_text_view_draw_focus           (GtkWidget        *widget);
210 211
static gboolean gtk_text_view_focus            (GtkWidget        *widget,
                                                GtkDirectionType  direction);
212 213
static void gtk_text_view_move_focus           (GtkWidget        *widget,
                                                GtkDirectionType  direction_type);
214 215
static void gtk_text_view_select_all           (GtkWidget        *widget,
                                                gboolean          select);
216

217 218 219

/* Source side drag signals */
static void gtk_text_view_drag_begin       (GtkWidget        *widget,
220
                                            GdkDragContext   *context);
221
static void gtk_text_view_drag_end         (GtkWidget        *widget,
222
                                            GdkDragContext   *context);
223
static void gtk_text_view_drag_data_get    (GtkWidget        *widget,
224 225 226 227
                                            GdkDragContext   *context,
                                            GtkSelectionData *selection_data,
                                            guint             info,
                                            guint             time);
228
static void gtk_text_view_drag_data_delete (GtkWidget        *widget,
229
                                            GdkDragContext   *context);
230 231 232

/* Target side drag signals */
static void     gtk_text_view_drag_leave         (GtkWidget        *widget,
233 234
                                                  GdkDragContext   *context,
                                                  guint             time);
235
static gboolean gtk_text_view_drag_motion        (GtkWidget        *widget,
236 237 238 239
                                                  GdkDragContext   *context,
                                                  gint              x,
                                                  gint              y,
                                                  guint             time);
240
static gboolean gtk_text_view_drag_drop          (GtkWidget        *widget,
241 242 243 244
                                                  GdkDragContext   *context,
                                                  gint              x,
                                                  gint              y,
                                                  guint             time);
245
static void     gtk_text_view_drag_data_received (GtkWidget        *widget,
246 247 248 249 250 251
                                                  GdkDragContext   *context,
                                                  gint              x,
                                                  gint              y,
                                                  GtkSelectionData *selection_data,
                                                  guint             info,
                                                  guint             time);
252 253

static void gtk_text_view_set_scroll_adjustments (GtkTextView   *text_view,
254 255
                                                  GtkAdjustment *hadj,
                                                  GtkAdjustment *vadj);
256
static gboolean gtk_text_view_popup_menu         (GtkWidget     *widget);
257

258 259 260 261 262 263 264
static void gtk_text_view_move_cursor       (GtkTextView           *text_view,
                                             GtkMovementStep        step,
                                             gint                   count,
                                             gboolean               extend_selection);
static void gtk_text_view_page_horizontally (GtkTextView          *text_view,
                                             gint                  count,
                                             gboolean              extend_selection);
265
static gboolean gtk_text_view_move_viewport (GtkTextView           *text_view,
266 267
                                             GtkScrollStep          step,
                                             gint                   count);
268
static void gtk_text_view_set_anchor       (GtkTextView           *text_view);
269
static gboolean gtk_text_view_scroll_pages (GtkTextView           *text_view,
270 271
                                            gint                   count,
                                            gboolean               extend_selection);
272
static gboolean gtk_text_view_scroll_hpages(GtkTextView           *text_view,
273 274
                                            gint                   count,
                                            gboolean               extend_selection);
275
static void gtk_text_view_insert_at_cursor (GtkTextView           *text_view,
276
                                            const gchar           *str);
277 278 279
static void gtk_text_view_delete_from_cursor (GtkTextView           *text_view,
                                              GtkDeleteType          type,
                                              gint                   count);
280
static void gtk_text_view_backspace        (GtkTextView           *text_view);
281 282 283 284
static void gtk_text_view_cut_clipboard    (GtkTextView           *text_view);
static void gtk_text_view_copy_clipboard   (GtkTextView           *text_view);
static void gtk_text_view_paste_clipboard  (GtkTextView           *text_view);
static void gtk_text_view_toggle_overwrite (GtkTextView           *text_view);
285
static void gtk_text_view_toggle_cursor_visible (GtkTextView      *text_view);
286
static void gtk_text_view_compat_move_focus(GtkTextView           *text_view,
287
                                            GtkDirectionType       direction_type);
288
static void gtk_text_view_unselect         (GtkTextView           *text_view);
289 290 291

static void     gtk_text_view_validate_onscreen     (GtkTextView        *text_view);
static void     gtk_text_view_get_first_para_iter   (GtkTextView        *text_view,
292
                                                     GtkTextIter        *iter);
293
static void     gtk_text_view_update_layout_width       (GtkTextView        *text_view);
294 295 296
static void     gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
                                                         GtkTextAttributes *values,
                                                         GtkStyle           *style);
297 298 299 300 301 302
static void     gtk_text_view_ensure_layout          (GtkTextView        *text_view);
static void     gtk_text_view_destroy_layout         (GtkTextView        *text_view);
static void     gtk_text_view_check_keymap_direction (GtkTextView        *text_view);
static void     gtk_text_view_start_selection_drag   (GtkTextView        *text_view,
                                                      const GtkTextIter  *iter,
                                                      GdkEventButton     *event);
303
static gboolean gtk_text_view_end_selection_drag     (GtkTextView        *text_view);
304 305 306 307 308 309
static void     gtk_text_view_start_selection_dnd    (GtkTextView        *text_view,
                                                      const GtkTextIter  *iter,
                                                      GdkEventMotion     *event);
static void     gtk_text_view_check_cursor_blink     (GtkTextView        *text_view);
static void     gtk_text_view_pend_cursor_blink      (GtkTextView        *text_view);
static void     gtk_text_view_stop_cursor_blink      (GtkTextView        *text_view);
310
static void     gtk_text_view_reset_blink_time       (GtkTextView        *text_view);
311

312 313 314 315 316
static void     gtk_text_view_value_changed                (GtkAdjustment *adj,
							    GtkTextView   *view);
static void     gtk_text_view_commit_handler               (GtkIMContext  *context,
							    const gchar   *str,
							    GtkTextView   *text_view);
317 318
static void     gtk_text_view_commit_text                  (GtkTextView   *text_view,
                                                            const gchar   *text);
319 320 321 322 323 324 325 326
static void     gtk_text_view_preedit_changed_handler      (GtkIMContext  *context,
							    GtkTextView   *text_view);
static gboolean gtk_text_view_retrieve_surrounding_handler (GtkIMContext  *context,
							    GtkTextView   *text_view);
static gboolean gtk_text_view_delete_surrounding_handler   (GtkIMContext  *context,
							    gint           offset,
							    gint           n_chars,
							    GtkTextView   *text_view);
327 328

static void gtk_text_view_mark_set_handler       (GtkTextBuffer     *buffer,
329
                                                  const GtkTextIter *location,
Havoc Pennington's avatar
Havoc Pennington committed
330
                                                  GtkTextMark       *mark,
331
                                                  gpointer           data);
332 333 334
static void gtk_text_view_target_list_notify     (GtkTextBuffer     *buffer,
                                                  const GParamSpec  *pspec,
                                                  gpointer           data);
335 336 337
static void gtk_text_view_paste_done_handler     (GtkTextBuffer     *buffer,
                                                  GtkClipboard      *clipboard,
                                                  gpointer           data);
338 339
static void gtk_text_view_get_cursor_location    (GtkTextView       *text_view,
						  GdkRectangle      *pos);
340
static void gtk_text_view_get_virtual_cursor_pos (GtkTextView       *text_view,
341
                                                  GtkTextIter       *cursor,
342 343
                                                  gint              *x,
                                                  gint              *y);
344
static void gtk_text_view_set_virtual_cursor_pos (GtkTextView       *text_view,
345 346
                                                  gint               x,
                                                  gint               y);
347

348 349 350
static GtkAdjustment* get_hadjustment            (GtkTextView       *text_view);
static GtkAdjustment* get_vadjustment            (GtkTextView       *text_view);

Owen Taylor's avatar
Owen Taylor committed
351
static void gtk_text_view_do_popup               (GtkTextView       *text_view,
Owen Taylor's avatar
Owen Taylor committed
352
						  GdkEventButton    *event);
353

354
static void cancel_pending_scroll                (GtkTextView   *text_view);
355 356 357 358 359 360 361
static void gtk_text_view_queue_scroll           (GtkTextView   *text_view,
                                                  GtkTextMark   *mark,
                                                  gdouble        within_margin,
                                                  gboolean       use_align,
                                                  gdouble        xalign,
                                                  gdouble        yalign);

362 363 364 365
static gboolean gtk_text_view_flush_scroll         (GtkTextView *text_view);
static void     gtk_text_view_update_adjustments   (GtkTextView *text_view);
static void     gtk_text_view_invalidate           (GtkTextView *text_view);
static void     gtk_text_view_flush_first_validate (GtkTextView *text_view);
366

367 368
static void gtk_text_view_update_im_spot_location (GtkTextView *text_view);

369 370 371 372 373 374 375
/* Container methods */
static void gtk_text_view_add    (GtkContainer *container,
                                  GtkWidget    *child);
static void gtk_text_view_remove (GtkContainer *container,
                                  GtkWidget    *child);
static void gtk_text_view_forall (GtkContainer *container,
                                  gboolean      include_internals,
376
                                  GtkCallback   callback,
377 378 379 380 381 382 383 384 385 386 387 388
                                  gpointer      callback_data);

/* FIXME probably need the focus methods. */

typedef struct _GtkTextViewChild GtkTextViewChild;

struct _GtkTextViewChild
{
  GtkWidget *widget;

  GtkTextChildAnchor *anchor;

389 390 391
  gint from_top_of_line;
  gint from_left_of_buffer;
  
392 393 394 395 396 397
  /* These are ignored if anchor != NULL */
  GtkTextWindowType type;
  gint x;
  gint y;
};

398 399 400 401 402 403 404 405 406 407
static GtkTextViewChild* text_view_child_new_anchored      (GtkWidget          *child,
							    GtkTextChildAnchor *anchor,
							    GtkTextLayout      *layout);
static GtkTextViewChild* text_view_child_new_window        (GtkWidget          *child,
							    GtkTextWindowType   type,
							    gint                x,
							    gint                y);
static void              text_view_child_free              (GtkTextViewChild   *child);
static void              text_view_child_set_parent_window (GtkTextView        *text_view,
							    GtkTextViewChild   *child);
408

409 410 411 412 413 414 415 416 417 418
struct _GtkTextWindow
{
  GtkTextWindowType type;
  GtkWidget *widget;
  GdkWindow *window;
  GdkWindow *bin_window;
  GtkRequisition requisition;
  GdkRectangle allocation;
};

419 420 421 422 423 424
static GtkTextWindow *text_window_new             (GtkTextWindowType  type,
                                                   GtkWidget         *widget,
                                                   gint               width_request,
                                                   gint               height_request);
static void           text_window_free            (GtkTextWindow     *win);
static void           text_window_realize         (GtkTextWindow     *win,
425
                                                   GtkWidget         *widget);
426 427 428 429 430 431 432 433
static void           text_window_unrealize       (GtkTextWindow     *win);
static void           text_window_size_allocate   (GtkTextWindow     *win,
                                                   GdkRectangle      *rect);
static void           text_window_scroll          (GtkTextWindow     *win,
                                                   gint               dx,
                                                   gint               dy);
static void           text_window_invalidate_rect (GtkTextWindow     *win,
                                                   GdkRectangle      *rect);
434
static void           text_window_invalidate_cursors (GtkTextWindow  *win);
435 436 437

static gint           text_window_get_width       (GtkTextWindow     *win);
static gint           text_window_get_height      (GtkTextWindow     *win);
438 439


440 441
static guint signals[LAST_SIGNAL] = { 0 };

Matthias Clasen's avatar
Matthias Clasen committed
442
G_DEFINE_TYPE (GtkTextView, gtk_text_view, GTK_TYPE_CONTAINER)
443 444

static void
445
add_move_binding (GtkBindingSet  *binding_set,
446 447 448 449
                  guint           keyval,
                  guint           modmask,
                  GtkMovementStep step,
                  gint            count)
450
{
451
  g_assert ((modmask & GDK_SHIFT_MASK) == 0);
452

453
  gtk_binding_entry_add_signal (binding_set, keyval, modmask,
454
                                "move-cursor", 3,
Manish Singh's avatar
Manish Singh committed
455 456 457
                                G_TYPE_ENUM, step,
                                G_TYPE_INT, count,
                                G_TYPE_BOOLEAN, FALSE);
458 459 460

  /* Selection-extending version */
  gtk_binding_entry_add_signal (binding_set, keyval, modmask | GDK_SHIFT_MASK,
461
                                "move-cursor", 3,
Manish Singh's avatar
Manish Singh committed
462 463 464
                                G_TYPE_ENUM, step,
                                G_TYPE_INT, count,
                                G_TYPE_BOOLEAN, TRUE);
465 466 467 468 469 470 471 472
}

static void
gtk_text_view_class_init (GtkTextViewClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
473
  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
474
  GtkBindingSet *binding_set;
475

476 477
  /* Default handlers and virtual methods
   */
478 479
  gobject_class->set_property = gtk_text_view_set_property;
  gobject_class->get_property = gtk_text_view_get_property;
480 481 482 483 484 485 486 487

  object_class->destroy = gtk_text_view_destroy;
  gobject_class->finalize = gtk_text_view_finalize;

  widget_class->realize = gtk_text_view_realize;
  widget_class->unrealize = gtk_text_view_unrealize;
  widget_class->style_set = gtk_text_view_style_set;
  widget_class->direction_changed = gtk_text_view_direction_changed;
488
  widget_class->grab_notify = gtk_text_view_grab_notify;
489
  widget_class->state_changed = gtk_text_view_state_changed;
490 491 492 493 494 495 496 497 498 499 500
  widget_class->size_request = gtk_text_view_size_request;
  widget_class->size_allocate = gtk_text_view_size_allocate;
  widget_class->event = gtk_text_view_event;
  widget_class->key_press_event = gtk_text_view_key_press_event;
  widget_class->key_release_event = gtk_text_view_key_release_event;
  widget_class->button_press_event = gtk_text_view_button_press_event;
  widget_class->button_release_event = gtk_text_view_button_release_event;
  widget_class->focus_in_event = gtk_text_view_focus_in_event;
  widget_class->focus_out_event = gtk_text_view_focus_out_event;
  widget_class->motion_notify_event = gtk_text_view_motion_event;
  widget_class->expose_event = gtk_text_view_expose_event;
501
  widget_class->focus = gtk_text_view_focus;
502

503
  /* need to override the base class function via override_class_handler,
504 505
   * because the signal slot is not available in GtkWidgetCLass
   */
506
  g_signal_override_class_handler ("move-focus",
507
                                   GTK_TYPE_TEXT_VIEW,
508
                                   G_CALLBACK (gtk_text_view_move_focus));
509

510 511 512 513 514 515 516 517 518 519
  widget_class->drag_begin = gtk_text_view_drag_begin;
  widget_class->drag_end = gtk_text_view_drag_end;
  widget_class->drag_data_get = gtk_text_view_drag_data_get;
  widget_class->drag_data_delete = gtk_text_view_drag_data_delete;

  widget_class->drag_leave = gtk_text_view_drag_leave;
  widget_class->drag_motion = gtk_text_view_drag_motion;
  widget_class->drag_drop = gtk_text_view_drag_drop;
  widget_class->drag_data_received = gtk_text_view_drag_data_received;

Owen Taylor's avatar
Owen Taylor committed
520 521
  widget_class->popup_menu = gtk_text_view_popup_menu;
  
522 523 524 525 526
  container_class->add = gtk_text_view_add;
  container_class->remove = gtk_text_view_remove;
  container_class->forall = gtk_text_view_forall;

  klass->move_cursor = gtk_text_view_move_cursor;
527
  klass->page_horizontally = gtk_text_view_page_horizontally;
528 529 530
  klass->set_anchor = gtk_text_view_set_anchor;
  klass->insert_at_cursor = gtk_text_view_insert_at_cursor;
  klass->delete_from_cursor = gtk_text_view_delete_from_cursor;
531
  klass->backspace = gtk_text_view_backspace;
532 533 534 535
  klass->cut_clipboard = gtk_text_view_cut_clipboard;
  klass->copy_clipboard = gtk_text_view_copy_clipboard;
  klass->paste_clipboard = gtk_text_view_paste_clipboard;
  klass->toggle_overwrite = gtk_text_view_toggle_overwrite;
536
  klass->move_focus = gtk_text_view_compat_move_focus;
537 538
  klass->set_scroll_adjustments = gtk_text_view_set_scroll_adjustments;

539
  /*
540
   * Properties
541
   */
542 543 544
 
  g_object_class_install_property (gobject_class,
                                   PROP_PIXELS_ABOVE_LINES,
Matthias Clasen's avatar
x  
Matthias Clasen committed
545
                                   g_param_spec_int ("pixels-above-lines",
546 547
						     P_("Pixels Above Lines"),
						     P_("Pixels of blank space above paragraphs"),
548 549 550
						     0,
						     G_MAXINT,
						     0,
551
						     GTK_PARAM_READWRITE));
552 553 554
 
  g_object_class_install_property (gobject_class,
                                   PROP_PIXELS_BELOW_LINES,
Matthias Clasen's avatar
x  
Matthias Clasen committed
555
                                   g_param_spec_int ("pixels-below-lines",
556 557
						     P_("Pixels Below Lines"),
						     P_("Pixels of blank space below paragraphs"),
558 559 560
						     0,
						     G_MAXINT,
						     0,
561
						     GTK_PARAM_READWRITE));
562 563 564
 
  g_object_class_install_property (gobject_class,
                                   PROP_PIXELS_INSIDE_WRAP,
Matthias Clasen's avatar
x  
Matthias Clasen committed
565
                                   g_param_spec_int ("pixels-inside-wrap",
566 567
						     P_("Pixels Inside Wrap"),
						     P_("Pixels of blank space between wrapped lines in a paragraph"),
568 569 570
						     0,
						     G_MAXINT,
						     0,
571
						     GTK_PARAM_READWRITE));
572 573 574 575

  g_object_class_install_property (gobject_class,
                                   PROP_EDITABLE,
                                   g_param_spec_boolean ("editable",
576 577
							 P_("Editable"),
							 P_("Whether the text can be modified by the user"),
578
							 TRUE,
579
							 GTK_PARAM_READWRITE));
580 581 582

  g_object_class_install_property (gobject_class,
                                   PROP_WRAP_MODE,
Matthias Clasen's avatar
x  
Matthias Clasen committed
583
                                   g_param_spec_enum ("wrap-mode",
584 585
						      P_("Wrap Mode"),
						      P_("Whether to wrap lines never, at word boundaries, or at character boundaries"),
586 587
						      GTK_TYPE_WRAP_MODE,
						      GTK_WRAP_NONE,
588
						      GTK_PARAM_READWRITE));
589 590 591 592
 
  g_object_class_install_property (gobject_class,
                                   PROP_JUSTIFICATION,
                                   g_param_spec_enum ("justification",
593 594
						      P_("Justification"),
						      P_("Left, right, or center justification"),
595 596
						      GTK_TYPE_JUSTIFICATION,
						      GTK_JUSTIFY_LEFT,
597
						      GTK_PARAM_READWRITE));
598 599 600
 
  g_object_class_install_property (gobject_class,
                                   PROP_LEFT_MARGIN,
Matthias Clasen's avatar
x  
Matthias Clasen committed
601
                                   g_param_spec_int ("left-margin",
602 603
						     P_("Left Margin"),
						     P_("Width of the left margin in pixels"),
604 605 606
						     0,
						     G_MAXINT,
						     0,
607
						     GTK_PARAM_READWRITE));
608 609 610

  g_object_class_install_property (gobject_class,
                                   PROP_RIGHT_MARGIN,
Matthias Clasen's avatar
x  
Matthias Clasen committed
611
                                   g_param_spec_int ("right-margin",
612 613
						     P_("Right Margin"),
						     P_("Width of the right margin in pixels"),
614 615 616
						     0,
						     G_MAXINT,
						     0,
617
						     GTK_PARAM_READWRITE));
618 619 620 621

  g_object_class_install_property (gobject_class,
                                   PROP_INDENT,
                                   g_param_spec_int ("indent",
622 623
						     P_("Indent"),
						     P_("Amount to indent the paragraph, in pixels"),
624
						     G_MININT,
625 626
						     G_MAXINT,
						     0,
627
						     GTK_PARAM_READWRITE));
628 629 630 631

  g_object_class_install_property (gobject_class,
                                   PROP_TABS,
                                   g_param_spec_boxed ("tabs",
632 633
                                                       P_("Tabs"),
                                                       P_("Custom tabs for this text"),
634
                                                       PANGO_TYPE_TAB_ARRAY,
635
						       GTK_PARAM_READWRITE));
636 637 638

  g_object_class_install_property (gobject_class,
                                   PROP_CURSOR_VISIBLE,
Matthias Clasen's avatar
x  
Matthias Clasen committed
639
                                   g_param_spec_boolean ("cursor-visible",
640 641
							 P_("Cursor Visible"),
							 P_("If the insertion cursor is shown"),
642
							 TRUE,
643
							 GTK_PARAM_READWRITE));
644

645 646 647
  g_object_class_install_property (gobject_class,
                                   PROP_BUFFER,
                                   g_param_spec_object ("buffer",
648 649
							P_("Buffer"),
							P_("The buffer which is displayed"),
650
							GTK_TYPE_TEXT_BUFFER,
651
							GTK_PARAM_READWRITE));
652

653 654 655
  g_object_class_install_property (gobject_class,
                                   PROP_OVERWRITE,
                                   g_param_spec_boolean ("overwrite",
656 657
							 P_("Overwrite mode"),
							 P_("Whether entered text overwrites existing contents"),
658
							 FALSE,
659
							 GTK_PARAM_READWRITE));
660

661
  g_object_class_install_property (gobject_class,
662
                                   PROP_ACCEPTS_TAB,
Matthias Clasen's avatar
x  
Matthias Clasen committed
663
                                   g_param_spec_boolean ("accepts-tab",
664 665
							 P_("Accepts tab"),
							 P_("Whether Tab will result in a tab character being entered"),
666
							 TRUE,
667
							 GTK_PARAM_READWRITE));
668

669 670 671
   /**
    * GtkTextView:im-module:
    *
672 673
    * Which IM (input method) module should be used for this entry. 
    * See #GtkIMContext.
674 675
    *
    * Setting this to a non-%NULL value overrides the
676 677
    * system-wide IM module setting. See the GtkSettings 
    * #GtkSettings:gtk-im-module property.
678 679 680 681 682 683 684 685 686 687 688
    *
    * Since: 2.16
    */
   g_object_class_install_property (gobject_class,
                                    PROP_IM_MODULE,
                                    g_param_spec_string ("im-module",
                                                         P_("IM module"),
                                                         P_("Which IM module should be used"),
                                                         NULL,
                                                         GTK_PARAM_READWRITE));

689 690 691 692 693
  /*
   * Style properties
   */
  gtk_widget_class_install_style_property (widget_class,
					   g_param_spec_boxed ("error-underline-color",
694
							       P_("Error underline color"),
Owen Taylor's avatar
Owen Taylor committed
695
							       P_("Color with which to draw error-indication underlines"),
696
							       GDK_TYPE_COLOR,
697
							       GTK_PARAM_READABLE));
698
  
699 700 701 702
  /*
   * Signals
   */

703 704
  /**
   * GtkTextView::move-cursor: 
Matthias Clasen's avatar
Matthias Clasen committed
705
   * @text_view: the object which received the signal
706 707 708 709
   * @step: the granularity of the move, as a #GtkMovementStep
   * @count: the number of @step units to move
   * @extend_selection: %TRUE if the move should extend the selection
   *  
Matthias Clasen's avatar
Matthias Clasen committed
710 711 712 713 714
   * The ::move-cursor signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted when the user initiates a cursor movement. 
   * If the cursor is not visible in @text_view, this signal causes
   * the viewport to be moved instead.
715 716
   *
   * Applications should not connect to it, but may emit it with 
717
   * g_signal_emit_by_name() if they need to control the cursor
718
   * programmatically.
Matthias Clasen's avatar
Matthias Clasen committed
719 720 721 722 723 724 725 726 727 728 729 730
   *
   * The default bindings for this signal come in two variants,
   * the variant with the Shift modifier extends the selection,
   * the variant without the Shift modifer does not.
   * There are too many key combinations to list them all here.
   * <itemizedlist>
   * <listitem>Arrow keys move by individual characters/lines</listitem>
   * <listitem>Ctrl-arrow key combinations move by words/paragraphs</listitem>
   * <listitem>Home/End keys move to the ends of the buffer</listitem>
   * <listitem>PageUp/PageDown keys move vertically by pages</listitem>
   * <listitem>Ctrl-PageUp/PageDown keys move horizontally by pages</listitem>
   * </itemizedlist>
731 732
   */
  signals[MOVE_CURSOR] = 
733
    g_signal_new (I_("move-cursor"),
734 735
		  G_OBJECT_CLASS_TYPE (gobject_class), 
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, 
Manish Singh's avatar
Manish Singh committed
736
		  G_STRUCT_OFFSET (GtkTextViewClass, move_cursor),
737 738
		  NULL, NULL, 
		  _gtk_marshal_VOID__ENUM_INT_BOOLEAN, 
Manish Singh's avatar
Manish Singh committed
739
		  G_TYPE_NONE, 3,
740 741
		  GTK_TYPE_MOVEMENT_STEP, 
		  G_TYPE_INT, 
Manish Singh's avatar
Manish Singh committed
742
		  G_TYPE_BOOLEAN);
743

Matthias Clasen's avatar
Matthias Clasen committed
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
  /**
   * GtkTextView::page-horizontally:
   * @text_view: the object which received the signal
   * @count: the number of @step units to move
   * @extend_selection: %TRUE if the move should extend the selection
   *
   * The ::page-horizontally signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which can be bound to key combinations to allow the user
   * to initiate horizontal cursor movement by pages.  
   * 
   * This signal should not be used anymore, instead use the
   * #GtkTextview::move-cursor signal with the #GTK_MOVEMENT_HORIZONTAL_PAGES
   * granularity.
   */
759
  signals[PAGE_HORIZONTALLY] =
760
    g_signal_new (I_("page-horizontally"),
Manish Singh's avatar
Manish Singh committed
761 762 763 764 765 766 767 768
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, page_horizontally),
		  NULL, NULL,
		  _gtk_marshal_VOID__INT_BOOLEAN,
		  G_TYPE_NONE, 2,
		  G_TYPE_INT,
		  G_TYPE_BOOLEAN);
769
  
Matthias Clasen's avatar
Matthias Clasen committed
770 771 772 773 774 775 776 777 778 779 780 781 782 783
  /**
   * GtkTextView::move-viewport:
   * @text_view: the object which received the signal
   * @step: the granularity of the move, as a #GtkMovementStep
   * @count: the number of @step units to move
   *
   * The ::move-viewport signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which can be bound to key combinations to allow the user
   * to move the viewport, i.e. change what part of the text view
   * is visible in a containing scrolled window.
   *
   * There are no default bindings for this signal.
   */
784
  signals[MOVE_VIEWPORT] =
785
    g_signal_new_class_handler (I_("move-viewport"),
786 787 788 789 790 791 792 793
                                G_OBJECT_CLASS_TYPE (gobject_class),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (gtk_text_view_move_viewport),
                                NULL, NULL,
                                _gtk_marshal_VOID__ENUM_INT,
                                G_TYPE_NONE, 2,
                                GTK_TYPE_SCROLL_STEP,
                                G_TYPE_INT);
794

Matthias Clasen's avatar
Matthias Clasen committed
795 796 797 798 799 800 801 802 803 804 805 806
  /**
   * GtkTextView::set-anchor:
   * @text_view: the object which received the signal
   *
   * The ::set-anchor signal is a
   * <link linkend="keybinding-signals">keybinding signal</link>
   * which gets emitted when the user initiates setting the "anchor" 
   * mark. The "anchor" mark gets placed at the same position as the
   * "insert" mark.
   *
   * This signal has no default bindings.
   */   
807
  signals[SET_ANCHOR] =
808
    g_signal_new (I_("set-anchor"),
Manish Singh's avatar
Manish Singh committed
809 810 811 812 813 814
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, set_anchor),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
815

Matthias Clasen's avatar
Matthias Clasen committed
816 817 818 819 820 821 822 823 824 825 826 827
  /**
   * GtkTextView::insert-at-cursor:
   * @text_view: the object which received the signal
   * @string: the string to insert
   *
   * The ::insert-at-cursor signal is a
   * <link linkend="keybinding-signals">keybinding signal</link>
   * which gets emitted when the user initiates the insertion of a 
   * fixed string at the cursor.
   *
   * This signal has no default bindings.
   */
828
  signals[INSERT_AT_CURSOR] =
829
    g_signal_new (I_("insert-at-cursor"),
Manish Singh's avatar
Manish Singh committed
830 831 832 833 834 835 836
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, insert_at_cursor),
		  NULL, NULL,
		  _gtk_marshal_VOID__STRING,
		  G_TYPE_NONE, 1,
		  G_TYPE_STRING);
837

Matthias Clasen's avatar
Matthias Clasen committed
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
  /**
   * GtkTextView::delete-from-cursor:
   * @text_view: the object which received the signal
   * @type: the granularity of the deletion, as a #GtkDeleteType
   * @count: the number of @type units to delete
   *
   * The ::delete-from-cursor signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted when the user initiates a text deletion.
   *
   * If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection
   * if there is one, otherwise it deletes the requested number
   * of characters.
   *
   * The default bindings for this signal are
   * Delete for deleting a character, Ctrl-Delete for 
   * deleting a word and Ctrl-Backspace for deleting a word 
   * backwords.
   */
857
  signals[DELETE_FROM_CURSOR] =
858
    g_signal_new (I_("delete-from-cursor"),
Manish Singh's avatar
Manish Singh committed
859 860 861 862 863 864 865 866
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, delete_from_cursor),
		  NULL, NULL,
		  _gtk_marshal_VOID__ENUM_INT,
		  G_TYPE_NONE, 2,
		  GTK_TYPE_DELETE_TYPE,
		  G_TYPE_INT);
867

Matthias Clasen's avatar
Matthias Clasen committed
868 869 870 871 872 873 874 875 876 877 878
  /**
   * GtkTextView::backspace:
   * @text_view: the object which received the signal
   *
   * The ::backspace signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted when the user asks for it.
   * 
   * The default bindings for this signal are
   * Backspace and Shift-Backspace.
   */
879
  signals[BACKSPACE] =
Matthias Clasen's avatar
Matthias Clasen committed
880
    g_signal_new (I_("backspace"),
881 882 883 884 885 886 887
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, backspace),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);

Matthias Clasen's avatar
Matthias Clasen committed
888 889 890 891 892 893 894 895 896 897 898
  /**
   * GtkTextView::cut-clipboard:
   * @text_view: the object which received the signal
   *
   * The ::cut-clipboard signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted to cut the selection to the clipboard.
   * 
   * The default bindings for this signal are
   * Ctrl-x and Shift-Delete.
   */
899
  signals[CUT_CLIPBOARD] =
900
    g_signal_new (I_("cut-clipboard"),
Manish Singh's avatar
Manish Singh committed
901 902 903 904 905 906
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, cut_clipboard),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
907

Matthias Clasen's avatar
Matthias Clasen committed
908 909 910 911 912 913 914 915 916 917 918
  /**
   * GtkTextView::copy-clipboard:
   * @text_view: the object which received the signal
   *
   * The ::copy-clipboard signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted to copy the selection to the clipboard.
   * 
   * The default bindings for this signal are
   * Ctrl-c and Ctrl-Insert.
   */
919
  signals[COPY_CLIPBOARD] =
920
    g_signal_new (I_("copy-clipboard"),
Manish Singh's avatar
Manish Singh committed
921 922 923 924 925 926
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, copy_clipboard),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
927

Matthias Clasen's avatar
Matthias Clasen committed
928 929 930 931 932 933 934 935 936 937 938 939
  /**
   * GtkTextView::paste-clipboard:
   * @text_view: the object which received the signal
   *
   * The ::paste-clipboard signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted to paste the contents of the clipboard 
   * into the text view.
   * 
   * The default bindings for this signal are
   * Ctrl-v and Shift-Insert.
   */
940
  signals[PASTE_CLIPBOARD] =
941
    g_signal_new (I_("paste-clipboard"),
Manish Singh's avatar
Manish Singh committed
942 943 944 945 946 947
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, paste_clipboard),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
948

Matthias Clasen's avatar
Matthias Clasen committed
949 950 951 952 953 954
  /**
   * GtkTextView::toggle-overwrite:
   * @text_view: the object which received the signal
   *
   * The ::toggle-overwrite signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
Matthias Clasen's avatar
Matthias Clasen committed
955
   * which gets emitted to toggle the overwrite mode of the text view.
Matthias Clasen's avatar
Matthias Clasen committed
956 957 958
   * 
   * The default bindings for this signal is Insert.
   */ 
959
  signals[TOGGLE_OVERWRITE] =
960
    g_signal_new (I_("toggle-overwrite"),
Manish Singh's avatar
Manish Singh committed
961 962 963 964 965 966
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, toggle_overwrite),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
967

968 969 970 971 972 973 974 975 976
  /**
   * GtkTextView::set-scroll-adjustments
   * @horizontal: the horizontal #GtkAdjustment
   * @vertical: the vertical #GtkAdjustment
   *
   * Set the scroll adjustments for the text view. Usually scrolled containers
   * like #GtkScrolledWindow will emit this signal to connect two instances
   * of #GtkScrollbar to the scroll directions of the #GtkTextView.
   */
977
  signals[SET_SCROLL_ADJUSTMENTS] =
978
    g_signal_new (I_("set-scroll-adjustments"),
Manish Singh's avatar
Manish Singh committed
979 980 981 982 983 984 985 986
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTextViewClass, set_scroll_adjustments),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT_OBJECT,
		  G_TYPE_NONE, 2,
		  GTK_TYPE_ADJUSTMENT,
		  GTK_TYPE_ADJUSTMENT);
987
  widget_class->set_scroll_adjustments_signal = signals[SET_SCROLL_ADJUSTMENTS];
988

Matthias Clasen's avatar
Matthias Clasen committed
989 990 991 992 993 994 995 996 997 998 999
  /**
   * GtkTextView::populate-popup:
   * @entry: The text view on which the signal is emitted
   * @menu: the menu that is being populated
   *
   * The ::populate-popup signal gets emitted before showing the 
   * context menu of the text view.
   *
   * If you need to add items to the context menu, connect
   * to this signal and append your menuitems to the @menu.
   */
Owen Taylor's avatar
Owen Taylor committed
1000
  signals[POPULATE_POPUP] =
1001
    g_signal_new (I_("populate-popup"),
Manish Singh's avatar
Manish Singh committed
1002 1003 1004 1005 1006 1007 1008
		  G_OBJECT_CLASS_TYPE (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTextViewClass, populate_popup),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_MENU);
Owen Taylor's avatar
Owen Taylor committed
1009
  
Matthias Clasen's avatar
Matthias Clasen committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
  /**
   * GtkTextView::select-all:
   * @text_view: the object which received the signal
   * @select: %TRUE to select, %FALSE to unselect
   *
   * The ::select-all signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted to select or unselect the complete
   * contents of the text view.
   *
   * The default bindings for this signal are Ctrl-a and Ctrl-/ 
   * for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
   */
1023
  signals[SELECT_ALL] =
1024
    g_signal_new_class_handler (I_("select-all"),
1025 1026 1027 1028 1029 1030
                                G_OBJECT_CLASS_TYPE (object_class),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (gtk_text_view_select_all),
                                NULL, NULL,
                                _gtk_marshal_VOID__BOOLEAN,
                                G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
1031

Matthias Clasen's avatar
Matthias Clasen committed
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
  /**
   * GtkTextView::toggle-cursor-visible:
   * @text_view: the object which received the signal
   *
   * The ::toggle-cursor-visible signal is a 
   * <link linkend="keybinding-signals">keybinding signal</link> 
   * which gets emitted to toggle the visibility of the cursor.
   *
   * The default binding for this signal is F7.
   */ 
1042
  signals[TOGGLE_CURSOR_VISIBLE] =
1043
    g_signal_new_class_handler (I_("toggle-cursor-visible"),
1044 1045 1046 1047 1048 1049
                                G_OBJECT_CLASS_TYPE (object_class),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (gtk_text_view_toggle_cursor_visible),
                                NULL, NULL,
                                _gtk_marshal_VOID__VOID,
                                G_TYPE_NONE, 0);
1050

1051 1052 1053 1054 1055 1056 1057 1058