Blame gtk/gtktext.h

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