]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktext.h
Get rid of incorrect calls to g_value_init(). (#100669, Johan Dahlin,
[~andy/gtk] / gtk / gtktext.h
index 8284682dd450b61e419e85821db70c875b330770..24c0634756990647b2c2e1968a3474b1857219c1 100644 (file)
@@ -2,27 +2,37 @@
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * 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.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * 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
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifdef GTK_ENABLE_BROKEN
+
 #ifndef __GTK_TEXT_H__
 #define __GTK_TEXT_H__
 
 
 #include <gdk/gdk.h>
 #include <gtk/gtkadjustment.h>
-#include <gtk/gtkeditable.h>
+#include <gtk/gtkoldeditable.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -34,6 +44,8 @@ extern "C" {
 #define GTK_TEXT_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT, GtkTextClass))
 #define GTK_IS_TEXT(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_TEXT))
 #define GTK_IS_TEXT_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT))
+#define GTK_TEXT_GET_CLASS(obj)        (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TEXT, GtkTextClass))
+
 
 typedef struct _GtkTextFont       GtkTextFont;
 typedef struct _GtkPropertyMark   GtkPropertyMark;
@@ -54,7 +66,7 @@ struct _GtkPropertyMark
 
 struct _GtkText
 {
-  GtkEditable editable;
+  GtkOldEditable old_editable;
 
   GdkWindow *text_area;
 
@@ -70,7 +82,7 @@ struct _GtkText
 
   /* The text, a single segment of text a'la emacs, with a gap
    * where insertion occurs. */
-  guchar* text;
+  union { GdkWChar *wc; guchar  *ch; } text;
   /* The allocated length of the text segment. */
   guint text_len;
   /* The gap position, index into address where a char
@@ -94,17 +106,20 @@ struct _GtkText
   /* First visible horizontal pixel. */
   guint first_onscreen_hor_pixel;
   /* First visible vertical pixel. */
- guint first_onscreen_ver_pixel;
 guint first_onscreen_ver_pixel;
 
                             /* FLAGS */
 
   /* True iff this buffer is wrapping lines, otherwise it is using a
    * horizontal scrollbar. */
   guint line_wrap : 1;
-  /* Frozen, don't do updates. @@@ fixme */
-  guint freeze : 1;
   guint word_wrap : 1;
+ /* If a fontset is supplied for the widget, use_wchar become true,
+   * and we use GdkWchar as the encoding of text. */
+  guint use_wchar : 1;
 
+  /* Frozen, don't do updates. @@@ fixme */
+  guint freeze_count;
                        /* TEXT PROPERTIES */
 
   /* A doubly-linked-list containing TextProperty objects. */
@@ -119,7 +134,7 @@ struct _GtkText
 
                          /* SCRATCH AREA */
 
-  guchar* scratch_buffer;
+  union { GdkWChar *wc; guchar *ch; } scratch_buffer;
   guint   scratch_buffer_len;
 
                           /* SCROLLING */
@@ -131,7 +146,7 @@ struct _GtkText
   gint            cursor_pos_x;       /* Position of cursor. */
   gint            cursor_pos_y;       /* Baseline of line cursor is drawn on. */
   GtkPropertyMark cursor_mark;        /* Where it is in the buffer. */
-  gchar           cursor_char;        /* Character to redraw. */
+  GdkWChar        cursor_char;        /* Character to redraw. */
   gchar           cursor_char_offset; /* Distance from baseline of the font. */
   gint            cursor_virtual_x;   /* Where it would be if it could be. */
   gint            cursor_drawn_level; /* How many people have undrawn. */
@@ -151,27 +166,28 @@ struct _GtkText
   gint timer;
   
   guint button;                        /* currently pressed mouse button */
+  GdkGC *bg_gc;                        /* gc for drawing background pixmap */
 };
 
 struct _GtkTextClass
 {
-  GtkEditableClass parent_class;
+  GtkOldEditableClass parent_class;
 
-  void  (*scroll_adjustments)   (GtkText       *text,
-                                GtkAdjustment  *hadjustment,
-                                GtkAdjustment  *vadjustment);
+  void  (*set_scroll_adjustments)   (GtkText       *text,
+                                    GtkAdjustment  *hadjustment,
+                                    GtkAdjustment  *vadjustment);
 };
 
 
-GtkType    gtk_text_get_type        (void);
+GtkType    gtk_text_get_type        (void) G_GNUC_CONST;
 GtkWidget* gtk_text_new             (GtkAdjustment *hadj,
                                     GtkAdjustment *vadj);
 void       gtk_text_set_editable    (GtkText       *text,
                                     gboolean       editable);
 void       gtk_text_set_word_wrap   (GtkText       *text,
-                                    gint           word_wrap);
+                                    gboolean       word_wrap);
 void       gtk_text_set_line_wrap   (GtkText       *text,
-                                    gint           line_wrap);
+                                    gboolean       line_wrap);
 void       gtk_text_set_adjustments (GtkText       *text,
                                     GtkAdjustment *hadj,
                                     GtkAdjustment *vadj);
@@ -187,14 +203,16 @@ void       gtk_text_insert          (GtkText       *text,
                                     GdkColor      *back,
                                     const char    *chars,
                                     gint           length);
-gint       gtk_text_backward_delete (GtkText       *text,
+gboolean   gtk_text_backward_delete (GtkText       *text,
                                     guint          nchars);
-gint       gtk_text_forward_delete  (GtkText       *text,
+gboolean   gtk_text_forward_delete  (GtkText       *text,
                                     guint          nchars);
 
-#define GTK_TEXT_INDEX(t, index)  \
-      ((index) < (t)->gap_position ? (t)->text[index] : \
-                                     (t)->text[(index) + (t)->gap_size])
+#define GTK_TEXT_INDEX(t, index)       (((t)->use_wchar) \
+       ? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
+                                       (t)->text.wc[(index)+(t)->gap_size]) \
+       : ((index) < (t)->gap_position ? (t)->text.ch[index] : \
+                                       (t)->text.ch[(index)+(t)->gap_size]))
 
 #ifdef __cplusplus
 }
@@ -202,3 +220,5 @@ gint       gtk_text_forward_delete  (GtkText       *text,
 
 
 #endif /* __GTK_TEXT_H__ */
+
+#endif /* GTK_ENABLE_BROKEN */