Blame gtk/gtktext.h

Packit Service fb6fa5
/* GTK - The GIMP Toolkit
Packit Service fb6fa5
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is free software; you can redistribute it and/or
Packit Service fb6fa5
 * modify it under the terms of the GNU Lesser General Public
Packit Service fb6fa5
 * License as published by the Free Software Foundation; either
Packit Service fb6fa5
 * version 2 of the License, or (at your option) any later version.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is distributed in the hope that it will be useful,
Packit Service fb6fa5
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fb6fa5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service fb6fa5
 * Lesser General Public License for more details.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * You should have received a copy of the GNU Lesser General Public
Packit Service fb6fa5
 * License along with this library; if not, write to the
Packit Service fb6fa5
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit Service fb6fa5
 * Boston, MA 02111-1307, USA.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
/*
Packit Service fb6fa5
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
Packit Service fb6fa5
 * file for a list of people on the GTK+ Team.  See the ChangeLog
Packit Service fb6fa5
 * files for a list of changes.  These files are distributed with
Packit Service fb6fa5
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
#ifdef GTK_ENABLE_BROKEN
Packit Service fb6fa5
Packit Service fb6fa5
#ifndef __GTK_TEXT_H__
Packit Service fb6fa5
#define __GTK_TEXT_H__
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
#include <gtk/gtkoldeditable.h>
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
G_BEGIN_DECLS
Packit Service fb6fa5
Packit Service fb6fa5
#define GTK_TYPE_TEXT                  (gtk_text_get_type ())
Packit Service fb6fa5
#define GTK_TEXT(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT, GtkText))
Packit Service fb6fa5
#define GTK_TEXT_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT, GtkTextClass))
Packit Service fb6fa5
#define GTK_IS_TEXT(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT))
Packit Service fb6fa5
#define GTK_IS_TEXT_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT))
Packit Service fb6fa5
#define GTK_TEXT_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT, GtkTextClass))
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
typedef struct _GtkTextFont       GtkTextFont;
Packit Service fb6fa5
typedef struct _GtkPropertyMark   GtkPropertyMark;
Packit Service fb6fa5
typedef struct _GtkText           GtkText;
Packit Service fb6fa5
typedef struct _GtkTextClass      GtkTextClass;
Packit Service fb6fa5
Packit Service fb6fa5
struct _GtkPropertyMark
Packit Service fb6fa5
{
Packit Service fb6fa5
  /* Position in list. */
Packit Service fb6fa5
  GList* property;
Packit Service fb6fa5
Packit Service fb6fa5
  /* Offset into that property. */
Packit Service fb6fa5
  guint offset;
Packit Service fb6fa5
Packit Service fb6fa5
  /* Current index. */
Packit Service fb6fa5
  guint index;
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
struct _GtkText
Packit Service fb6fa5
{
Packit Service fb6fa5
  GtkOldEditable old_editable;
Packit Service fb6fa5
Packit Service fb6fa5
  GdkWindow *text_area;
Packit Service fb6fa5
Packit Service fb6fa5
  GtkAdjustment *hadj;
Packit Service fb6fa5
  GtkAdjustment *vadj;
Packit Service fb6fa5
Packit Service fb6fa5
  GdkGC *gc;
Packit Service fb6fa5
Packit Service fb6fa5
  GdkPixmap* line_wrap_bitmap;
Packit Service fb6fa5
  GdkPixmap* line_arrow_bitmap;
Packit Service fb6fa5
Packit Service fb6fa5
		      /* GAPPED TEXT SEGMENT */
Packit Service fb6fa5
Packit Service fb6fa5
  /* The text, a single segment of text a'la emacs, with a gap
Packit Service fb6fa5
   * where insertion occurs. */
Packit Service fb6fa5
  union { GdkWChar *wc; guchar  *ch; } text;
Packit Service fb6fa5
  /* The allocated length of the text segment. */
Packit Service fb6fa5
  guint text_len;
Packit Service fb6fa5
  /* The gap position, index into address where a char
Packit Service fb6fa5
   * should be inserted. */
Packit Service fb6fa5
  guint gap_position;
Packit Service fb6fa5
  /* The gap size, s.t. *(text + gap_position + gap_size) is
Packit Service fb6fa5
   * the first valid character following the gap. */
Packit Service fb6fa5
  guint gap_size;
Packit Service fb6fa5
  /* The last character position, index into address where a
Packit Service fb6fa5
   * character should be appeneded.  Thus, text_end - gap_size
Packit Service fb6fa5
   * is the length of the actual data. */
Packit Service fb6fa5
  guint text_end;
Packit Service fb6fa5
			/* LINE START CACHE */
Packit Service fb6fa5
Packit Service fb6fa5
  /* A cache of line-start information.  Data is a LineParam*. */
Packit Service fb6fa5
  GList *line_start_cache;
Packit Service fb6fa5
  /* Index to the start of the first visible line. */
Packit Service fb6fa5
  guint first_line_start_index;
Packit Service fb6fa5
  /* The number of pixels cut off of the top line. */
Packit Service fb6fa5
  guint first_cut_pixels;
Packit Service fb6fa5
  /* First visible horizontal pixel. */
Packit Service fb6fa5
  guint first_onscreen_hor_pixel;
Packit Service fb6fa5
  /* First visible vertical pixel. */
Packit Service fb6fa5
  guint first_onscreen_ver_pixel;
Packit Service fb6fa5
Packit Service fb6fa5
			     /* FLAGS */
Packit Service fb6fa5
Packit Service fb6fa5
  /* True iff this buffer is wrapping lines, otherwise it is using a
Packit Service fb6fa5
   * horizontal scrollbar. */
Packit Service fb6fa5
  guint line_wrap : 1;
Packit Service fb6fa5
  guint word_wrap : 1;
Packit Service fb6fa5
 /* If a fontset is supplied for the widget, use_wchar become true,
Packit Service fb6fa5
   * and we use GdkWchar as the encoding of text. */
Packit Service fb6fa5
  guint use_wchar : 1;
Packit Service fb6fa5
Packit Service fb6fa5
  /* Frozen, don't do updates. @@@ fixme */
Packit Service fb6fa5
  guint freeze_count;
Packit Service fb6fa5
			/* TEXT PROPERTIES */
Packit Service fb6fa5
Packit Service fb6fa5
  /* A doubly-linked-list containing TextProperty objects. */
Packit Service fb6fa5
  GList *text_properties;
Packit Service fb6fa5
  /* The end of this list. */
Packit Service fb6fa5
  GList *text_properties_end;
Packit Service fb6fa5
  /* The first node before or on the point along with its offset to
Packit Service fb6fa5
   * the point and the buffer's current point.  This is the only
Packit Service fb6fa5
   * PropertyMark whose index is guaranteed to remain correct
Packit Service fb6fa5
   * following a buffer insertion or deletion. */
Packit Service fb6fa5
  GtkPropertyMark point;
Packit Service fb6fa5
Packit Service fb6fa5
			  /* SCRATCH AREA */
Packit Service fb6fa5
Packit Service fb6fa5
  union { GdkWChar *wc; guchar *ch; } scratch_buffer;
Packit Service fb6fa5
  guint   scratch_buffer_len;
Packit Service fb6fa5
Packit Service fb6fa5
			   /* SCROLLING */
Packit Service fb6fa5
Packit Service fb6fa5
  gint last_ver_value;
Packit Service fb6fa5
Packit Service fb6fa5
			     /* CURSOR */
Packit Service fb6fa5
Packit Service fb6fa5
  gint            cursor_pos_x;       /* Position of cursor. */
Packit Service fb6fa5
  gint            cursor_pos_y;       /* Baseline of line cursor is drawn on. */
Packit Service fb6fa5
  GtkPropertyMark cursor_mark;        /* Where it is in the buffer. */
Packit Service fb6fa5
  GdkWChar        cursor_char;        /* Character to redraw. */
Packit Service fb6fa5
  gchar           cursor_char_offset; /* Distance from baseline of the font. */
Packit Service fb6fa5
  gint            cursor_virtual_x;   /* Where it would be if it could be. */
Packit Service fb6fa5
  gint            cursor_drawn_level; /* How many people have undrawn. */
Packit Service fb6fa5
Packit Service fb6fa5
			  /* Current Line */
Packit Service fb6fa5
Packit Service fb6fa5
  GList *current_line;
Packit Service fb6fa5
Packit Service fb6fa5
			   /* Tab Stops */
Packit Service fb6fa5
Packit Service fb6fa5
  GList *tab_stops;
Packit Service fb6fa5
  gint default_tab_width;
Packit Service fb6fa5
Packit Service fb6fa5
  GtkTextFont *current_font;	/* Text font for current style */
Packit Service fb6fa5
Packit Service fb6fa5
  /* Timer used for auto-scrolling off ends */
Packit Service fb6fa5
  gint timer;
Packit Service fb6fa5
  
Packit Service fb6fa5
  guint button;			/* currently pressed mouse button */
Packit Service fb6fa5
  GdkGC *bg_gc;			/* gc for drawing background pixmap */
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
struct _GtkTextClass
Packit Service fb6fa5
{
Packit Service fb6fa5
  GtkOldEditableClass parent_class;
Packit Service fb6fa5
Packit Service fb6fa5
  void  (*set_scroll_adjustments)   (GtkText	    *text,
Packit Service fb6fa5
				     GtkAdjustment  *hadjustment,
Packit Service fb6fa5
				     GtkAdjustment  *vadjustment);
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
GType      gtk_text_get_type        (void) G_GNUC_CONST;
Packit Service fb6fa5
GtkWidget* gtk_text_new             (GtkAdjustment *hadj,
Packit Service fb6fa5
				     GtkAdjustment *vadj);
Packit Service fb6fa5
void       gtk_text_set_editable    (GtkText       *text,
Packit Service fb6fa5
				     gboolean       editable);
Packit Service fb6fa5
void       gtk_text_set_word_wrap   (GtkText       *text,
Packit Service fb6fa5
				     gboolean       word_wrap);
Packit Service fb6fa5
void       gtk_text_set_line_wrap   (GtkText       *text,
Packit Service fb6fa5
				     gboolean       line_wrap);
Packit Service fb6fa5
void       gtk_text_set_adjustments (GtkText       *text,
Packit Service fb6fa5
				     GtkAdjustment *hadj,
Packit Service fb6fa5
				     GtkAdjustment *vadj);
Packit Service fb6fa5
void       gtk_text_set_point       (GtkText       *text,
Packit Service fb6fa5
				     guint          index);
Packit Service fb6fa5
guint      gtk_text_get_point       (GtkText       *text);
Packit Service fb6fa5
guint      gtk_text_get_length      (GtkText       *text);
Packit Service fb6fa5
void       gtk_text_freeze          (GtkText       *text);
Packit Service fb6fa5
void       gtk_text_thaw            (GtkText       *text);
Packit Service fb6fa5
void       gtk_text_insert          (GtkText        *text,
Packit Service fb6fa5
				     GdkFont        *font,
Packit Service fb6fa5
				     const GdkColor *fore,
Packit Service fb6fa5
				     const GdkColor *back,
Packit Service fb6fa5
				     const char     *chars,
Packit Service fb6fa5
				     gint            length);
Packit Service fb6fa5
gboolean   gtk_text_backward_delete (GtkText       *text,
Packit Service fb6fa5
				     guint          nchars);
Packit Service fb6fa5
gboolean   gtk_text_forward_delete  (GtkText       *text,
Packit Service fb6fa5
				     guint          nchars);
Packit Service fb6fa5
Packit Service fb6fa5
#define GTK_TEXT_INDEX(t, index)	(((t)->use_wchar) \
Packit Service fb6fa5
	? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
Packit Service fb6fa5
					(t)->text.wc[(index)+(t)->gap_size]) \
Packit Service fb6fa5
	: ((index) < (t)->gap_position ? (t)->text.ch[index] : \
Packit Service fb6fa5
					(t)->text.ch[(index)+(t)->gap_size]))
Packit Service fb6fa5
Packit Service fb6fa5
G_END_DECLS
Packit Service fb6fa5
Packit Service fb6fa5
#endif /* __GTK_TEXT_H__ */
Packit Service fb6fa5
Packit Service fb6fa5
#endif /* GTK_ENABLE_BROKEN */