1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 #ifndef __GTK_EDIT_H__
20 #define __GTK_EDIT_H__
21 
22 
23 #include <gdk/gdk.h>
24 #include <gtk/gtkadjustment.h>
25 #include <gtk/gtkeditable.h>
26 #include <gtkedit/mousemark.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
32 
33 #define GTK_EDIT(obj)          GTK_CHECK_CAST (obj, gtk_edit_get_type (), GtkEdit)
34 #define GTK_EDIT_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_edit_get_type (), GtkEditClass)
35 #define GTK_IS_EDIT(obj)       GTK_CHECK_TYPE (obj, gtk_edit_get_type ())
36 
37 
38 typedef struct _GtkEdit           GtkEdit;
39 typedef struct _GtkEditClass      GtkEditClass;
40 
41 
42 struct _GtkEdit
43 {
44   GtkEditable editable;
45 
46   GdkWindow *text_area;
47   GtkWidget *menubar, *status;
48 
49   GtkAdjustment *hadj;
50   gint last_hadj_value;
51 
52   GtkAdjustment *vadj;
53   gint last_vadj_value;
54 
55   GdkGC *gc;
56   GdkColor color[256];
57   int color_last_pixel;
58   void (*destroy_me) (void *);
59   void *destroy_me_user_data;
60   struct editor_widget *editor;
61   struct mouse_funcs *funcs;
62   gulong options;
63   gint timer;
64 };
65 
66 struct _GtkEditClass
67 {
68   GtkEditableClass parent_class;
69 };
70 
71 
72 guint      gtk_edit_get_type        (void);
73 GtkWidget* gtk_edit_new             (GtkAdjustment *hadj,
74 				     GtkAdjustment *vadj);
75 void       gtk_edit_set_editable    (GtkEdit       *text,
76 				     gint           editable);
77 void       gtk_edit_set_word_wrap   (GtkEdit       *text,
78 				     gint           word_wrap);
79 void       gtk_edit_set_adjustments (GtkEdit       *text,
80 				     GtkAdjustment *hadj,
81 				     GtkAdjustment *vadj);
82 void       gtk_edit_set_point       (GtkEdit       *text,
83 				     guint          index);
84 guint      gtk_edit_get_point       (GtkEdit       *text);
85 guint      gtk_edit_get_length      (GtkEdit       *text);
86 void       gtk_edit_freeze          (GtkEdit       *text);
87 void       gtk_edit_thaw            (GtkEdit       *text);
88 void       gtk_edit_insert          (GtkEdit       *text,
89 				     GdkFont       *font,
90 				     GdkColor      *fore,
91 				     GdkColor      *back,
92 				     const char    *chars,
93 				     gint           length);
94 gint       gtk_edit_backward_delete (GtkEdit       *text,
95 				     guint          nchars);
96 gint       gtk_edit_forward_delete  (GtkEdit       *text,
97 				     guint          nchars);
98 
99 
100 char *gtk_edit_dialog_get_load_file (guchar * directory, guchar * file, guchar * heading);
101 char *gtk_edit_dialog_get_save_file (guchar * directory, guchar * file, guchar * heading);
102 void gtk_edit_dialog_error (guchar * heading, char *fmt,...);
103 void gtk_edit_dialog_message (guchar * heading, char *fmt,...);
104 int gtk_edit_dialog_query (guchar * heading, guchar * first,...);
105 
106 
107 
108 #ifdef __cplusplus
109 }
110 #endif /* __cplusplus */
111 
112 
113 #endif /* __GTK_EDIT_H__ */
114