Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

extgtktext.h

Go to the documentation of this file.
00001 /* GTK - The GIMP Toolkit
00002  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 /*
00021  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
00022  * file for a list of people on the GTK+ Team.  See the ChangeLog
00023  * files for a list of changes.  These files are distributed with
00024  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
00025  */
00026 
00027 /* 
00028  * Modified by the AOL Instant Messenger (SM) Development Team in August 2001. 
00029  * Besides adding support for images and action-requiring 
00030  * (eg. hyperlinked) text, the following was also applied: 
00031  * Underline Patch (#2) for GtkText by Patrick Earl 
00032  * (located at http://www.informatik.fh-hamburg.de/pub/linux/gtk/patches/). 
00033  * In accordance with LGPL, the files that were modified 
00034  * for use in the Linux AIM software are provided free of charge 
00035  * with this distribution and on the AOL Linux AIM website. 
00036  * The modifications were localized to gtktext widget. 
00037  */
00038 
00039 
00040 #ifndef __EXT_GTK_TEXT_H__
00041 #define __EXT_GTK_TEXT_H__
00042 
00043 #include <gdk/gdk.h>
00044 #include <gtk/gtkadjustment.h>
00045 #include <gtk/gtkeditable.h>
00046 #ifdef HAVE_LIBXFT
00047 #include <X11/Xft/Xft.h>
00048 #endif
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif /* __cplusplus */
00053 
00054 #ifndef HAVE_LIBXFT
00055 #define VFont GdkFont
00056 #else
00057 #define VFont XftFont
00058 #endif
00059 
00060 #define EXT_GTK_TYPE_TEXT                  (ext_gtk_text_get_type ())
00061 #define GTK_SCTEXT(obj)                  (GTK_CHECK_CAST ((obj), EXT_GTK_TYPE_TEXT, ExtGtkText))
00062 #define EXT_GTK_TEXT(obj)                  (GTK_CHECK_CAST ((obj), EXT_GTK_TYPE_TEXT, ExtGtkText))
00063 #define EXT_GTK_TEXT_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), EXT_GTK_TYPE_TEXT, ExtGtkTextClass))
00064 #define EXT_GTK_IS_TEXT(obj)               (GTK_CHECK_TYPE ((obj), EXT_GTK_TYPE_TEXT))
00065 #define EXT_GTK_IS_TEXT_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), EXT_GTK_TYPE_TEXT))
00066 
00067 typedef struct _ExtGtkTextFont       ExtGtkTextFont;
00068 typedef struct _ExtGtkPropertyMark   ExtGtkPropertyMark; 
00069 typedef struct _ExtGtkText           ExtGtkText;   
00070 typedef struct _ExtGtkTextClass      ExtGtkTextClass; 
00071 
00072 typedef void   DataFunc           (GdkWindow * window, gpointer info);
00073 
00074 
00075 struct _ExtGtkPropertyMark
00076 {
00077   /* Position in list. */
00078   GList* property;
00079 
00080   /* Offset into that property. */
00081   guint offset;
00082 
00083   /* Current index. */
00084   guint index;
00085 };
00086 
00087 struct _ExtGtkText
00088 {
00089   GtkEditable editable;
00090 
00091   GdkWindow *text_area;
00092 
00093   GtkAdjustment *hadj;
00094   GtkAdjustment *vadj;
00095 
00096   GdkGC *gc;
00097 
00098 
00099               /* GAPPED TEXT SEGMENT */
00100 
00101   /* The text, a single segment of text a'la emacs, with a gap
00102    * where insertion occurs. */
00103   union { GdkWChar *wc; guchar  *ch; } text;
00104   /* The allocated length of the text segment. */
00105   guint text_len;
00106   /* The gap position, index into address where a char
00107    * should be inserted. */
00108   guint gap_position;
00109   /* The gap size, s.t. *(text + gap_position + gap_size) is
00110    * the first valid character following the gap. */
00111   guint gap_size;
00112   /* The last character position, index into address where a
00113    * character should be appeneded.  Thus, text_end - gap_size
00114    * is the length of the actual data. */
00115   guint text_end;
00116             /* LINE START CACHE */
00117 
00118   /* A cache of line-start information.  Data is a LineParam*. */
00119   GList *line_start_cache;
00120   /* Index to the start of the first visible line. */
00121   guint first_line_start_index;
00122   /* The number of pixels cut off of the top line. */
00123   guint first_cut_pixels;
00124   /* First visible horizontal pixel. */
00125   guint first_onscreen_hor_pixel;
00126   /* First visible vertical pixel. */
00127   guint first_onscreen_ver_pixel;
00128 
00129                  /* FLAGS */
00130 
00131   /* True iff this buffer is wrapping lines, otherwise it is using a
00132    * horizontal scrollbar. */
00133   guint line_wrap : 1;
00134   guint word_wrap : 1;
00135  /* If a fontset is supplied for the widget, use_wchar become true,
00136    * and we use GdkWchar as the encoding of text. */
00137   guint use_wchar : 1;
00138 
00139   /* Frozen, don't do updates. @@@ fixme */
00140   guint freeze_count;
00141             /* TEXT PROPERTIES */
00142 
00143   /* A doubly-linked-list containing TextProperty objects. */
00144   GList *text_properties;
00145   /* The end of this list. */
00146   GList *text_properties_end;
00147   /* The first node before or on the point along with its offset to
00148    * the point and the buffer's current point.  This is the only
00149    * PropertyMark whose index is guaranteed to remain correct
00150    * following a buffer insertion or deletion. */
00151   ExtGtkPropertyMark point;
00152 
00153               /* SCRATCH AREA */
00154 
00155   union { GdkWChar *wc; guchar *ch; } scratch_buffer;
00156   guint   scratch_buffer_len;
00157 
00158                /* SCROLLING */
00159 
00160   gint last_ver_value;
00161 
00162                  /* CURSOR */
00163 
00164   gint            cursor_pos_x;       /* Position of cursor. */
00165   gint            cursor_pos_y;       /* Baseline of line cursor is drawn on. */
00166   ExtGtkPropertyMark cursor_mark;        /* Where it is in the buffer. */
00167   GdkWChar        cursor_char;        /* Character to redraw. */
00168   gchar           cursor_char_offset; /* Distance from baseline of the font. */
00169   gint            cursor_virtual_x;   /* Where it would be if it could be. */
00170   gint            cursor_drawn_level; /* How many people have undrawn. */
00171 
00172               /* Current Line */
00173 
00174   GList *current_line;
00175 
00176                /* Tab Stops */
00177 
00178   GList *tab_stops;
00179   gint default_tab_width;
00180 
00181   ExtGtkTextFont *current_font; /* Text font for current style */
00182 
00183   /* Timer used for auto-scrolling off ends */
00184   gint timer;
00185   
00186   guint button;         /* currently pressed mouse button */
00187   GdkGC *bg_gc;         /* gc for drawing background pixmap */
00188 };
00189 
00190 struct _ExtGtkTextClass
00191 {
00192   GtkEditableClass parent_class;
00193 
00194   void  (*set_scroll_adjustments)   (ExtGtkText     *text,
00195                      GtkAdjustment  *hadjustment,
00196                      GtkAdjustment  *vadjustment);
00197 };
00198 
00199 GtkType    ext_gtk_text_get_type        (void);
00200 GtkWidget* ext_gtk_text_new             (GtkAdjustment *hadj,
00201                      GtkAdjustment *vadj);
00202 void       ext_gtk_text_set_editable    (ExtGtkText       *text,
00203                      gboolean       editable);
00204 void       ext_gtk_text_set_word_wrap   (ExtGtkText       *text,
00205                      gint           word_wrap);
00206 void       ext_gtk_text_set_line_wrap   (ExtGtkText       *text,
00207                      gint           line_wrap);
00208 void       ext_gtk_text_set_adjustments (ExtGtkText       *text,
00209                      GtkAdjustment *hadj,
00210                      GtkAdjustment *vadj);
00211 void       ext_gtk_text_set_point       (ExtGtkText       *text,
00212                      guint          index);
00213 guint      ext_gtk_text_get_point       (ExtGtkText       *text);
00214 guint      ext_gtk_text_get_length      (ExtGtkText       *text);
00215 void       ext_gtk_text_freeze          (ExtGtkText       *text);
00216 void       ext_gtk_text_thaw            (ExtGtkText       *text);
00217 void       ext_gtk_text_insert          (ExtGtkText       *text,
00218                      VFont     *font,
00219                      GdkColor      *fore,
00220                      GdkColor      *back,
00221                      const char    *chars,
00222                      gint           length);
00223 void       ext_gtk_text_insert_underlined(ExtGtkText       *text,
00224                      VFont *font,
00225                      GdkColor      *fore,
00226                      GdkColor      *back,
00227                      const char    *chars,
00228                      gint           length);
00229 void
00230 ext_gtk_text_insert_divider(ExtGtkText    *text,
00231                     VFont *font,
00232                 GdkColor   *fore,
00233                 GdkColor   *back,
00234                 const char *chars,
00235                 gint        nchars);
00236 
00237 void       ext_gtk_text_insert_pixmap(ExtGtkText       *text,
00238                      VFont *font,
00239                      GdkColor      *fore,
00240                      GdkColor      *back,
00241                                      GdkDrawable   *image,
00242                      GdkBitmap     *mask,
00243                      const char    *chars,
00244                      gint           length);
00245 void       ext_gtk_text_insert_data_underlined (ExtGtkText       *text,
00246                      VFont *font,
00247                      GdkColor      *fore,
00248                      GdkColor      *back,
00249                                      gpointer      user_data,
00250                                      guint         user_data_length,
00251                                      DataFunc      *user_data_func, 
00252                      const char    *chars,
00253                      gint           length);
00254 void       ext_gtk_text_insert_data (ExtGtkText       *text,
00255                      VFont *font,
00256                      GdkColor      *fore,
00257                      GdkColor      *back,
00258                                      gpointer      user_data,
00259                                      guint         user_data_length,
00260                                      DataFunc      *user_data_func, 
00261                      const char    *chars,
00262                      gint           length);
00263 gint       ext_gtk_text_backward_delete (ExtGtkText       *text,
00264                      guint          nchars);
00265 gint       ext_gtk_text_forward_delete  (ExtGtkText       *text,
00266                      guint          nchars);
00267 
00268 #define EXT_GTK_TEXT_INDEX(t, index)    (((t)->use_wchar) \
00269     ? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
00270                     (t)->text.wc[(index)+(t)->gap_size]) \
00271     : ((index) < (t)->gap_position ? (t)->text.ch[index] : \
00272                     (t)->text.ch[(index)+(t)->gap_size]))
00273 
00274 #ifdef __cplusplus
00275 }
00276 #endif /* __cplusplus */
00277 
00278 
00279 #endif /* __EXT_GTK_TEXT_H__ */

Contact: Andy Maloney     [Documentation generated by doxygen]