]> Pileus Git - ~andy/gtk/blob - gtk/gtkoldeditable.h
896f1d8ec20bc83bd83325c70a6ee678cc0a56d1
[~andy/gtk] / gtk / gtkoldeditable.h
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 Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser 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
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef GTK_DISABLE_DEPRECATED
28
29 #ifndef __GTK_OLD_EDITABLE_H__
30 #define __GTK_OLD_EDITABLE_H__
31
32
33 #include <gdk/gdk.h>
34 #include <gtk/gtkeditable.h>
35 #include <gtk/gtkwidget.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41
42 #define GTK_TYPE_OLD_EDITABLE            (gtk_old_editable_get_type ())
43 #define GTK_OLD_EDITABLE(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_OLD_EDITABLE, GtkOldEditable))
44 #define GTK_OLD_EDITABLE_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_OLD_EDITABLE, GtkOldEditableClass))
45 #define GTK_IS_OLD_EDITABLE(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_OLD_EDITABLE))
46 #define GTK_IS_OLD_EDITABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OLD_EDITABLE))
47 #define GTK_OLD_EDITABLE_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_OLD_EDITABLE, GtkOldEditableClass))
48
49
50 typedef struct _GtkOldEditable       GtkOldEditable;
51 typedef struct _GtkOldEditableClass  GtkOldEditableClass;
52
53 typedef void (*GtkTextFunction) (GtkOldEditable  *editable, guint32 time);
54
55 struct _GtkOldEditable
56 {
57   GtkWidget widget;
58
59   /*< public >*/
60   guint      current_pos;
61
62   guint      selection_start_pos;
63   guint      selection_end_pos;
64   guint      has_selection : 1;
65
66   /*< private >*/
67   guint      editable : 1;
68   guint      visible : 1;
69   
70   gchar *clipboard_text;
71 };
72
73 struct _GtkOldEditableClass
74 {
75   GtkWidgetClass parent_class;
76   
77   /* Signals for notification/filtering of changes */
78   void (* changed)      (GtkOldEditable    *editable);
79   void (* insert_text)  (GtkOldEditable    *editable,
80                          const gchar       *text,
81                          gint               length,
82                          gint              *position);
83   void (* delete_text)  (GtkOldEditable    *editable,
84                          gint               start_pos,
85                          gint               end_pos);
86
87   /* Bindings actions */
88   void (* activate)        (GtkOldEditable *editable);
89   void (* set_editable)    (GtkOldEditable *editable,
90                             gboolean        is_editable);
91   void (* move_cursor)     (GtkOldEditable *editable,
92                             gint            x,
93                             gint            y);
94   void (* move_word)       (GtkOldEditable *editable,
95                             gint            n);
96   void (* move_page)       (GtkOldEditable *editable,
97                             gint            x,
98                             gint            y);
99   void (* move_to_row)     (GtkOldEditable *editable,
100                             gint            row);
101   void (* move_to_column)  (GtkOldEditable *editable,
102                             gint            row);
103   void (* kill_char)       (GtkOldEditable *editable,
104                             gint            direction);
105   void (* kill_word)       (GtkOldEditable *editable,
106                             gint            direction);
107   void (* kill_line)       (GtkOldEditable *editable,
108                             gint            direction);
109   void (* cut_clipboard)   (GtkOldEditable *editable);
110   void (* copy_clipboard)  (GtkOldEditable *editable);
111   void (* paste_clipboard) (GtkOldEditable *editable);
112
113   /* Virtual functions. get_chars is in paricular not a signal because
114    * it returns malloced memory. The others are not signals because
115    * they would not be particularly useful as such. (All changes to
116    * selection and position do not go through these functions)
117    */
118   void (* update_text)  (GtkOldEditable  *editable,
119                          gint             start_pos,
120                          gint             end_pos);
121   gchar* (* get_chars)  (GtkOldEditable  *editable,
122                          gint             start_pos,
123                          gint             end_pos);
124   void (* set_selection)(GtkOldEditable  *editable,
125                          gint             start_pos,
126                          gint             end_pos);
127   void (* set_position) (GtkOldEditable  *editable,
128                          gint             position);
129 };
130
131 GtkType    gtk_old_editable_get_type        (void) G_GNUC_CONST;
132 void       gtk_old_editable_claim_selection (GtkOldEditable *old_editable,
133                                              gboolean        claim,
134                                              guint32         time);
135 void       gtk_old_editable_changed         (GtkOldEditable *old_editable);
136
137 #ifdef __cplusplus
138 }
139 #endif /* __cplusplus */
140
141
142 #endif /* __GTK_OLD_EDITABLE_H__ */
143
144 #endif /* GTK_DISABLE_DEPRECATED */