]> Pileus Git - ~andy/gtk/blob - gtk/gtkeditable.h
removed all occourances of #pragma } and #pragma { which were in place to
[~andy/gtk] / gtk / gtkeditable.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 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_EDITABLE_H__
20 #define __GTK_EDITABLE_H__
21
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtkwidget.h>
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31
32 #define GTK_TYPE_EDITABLE            (gtk_editable_get_type ())
33 #define GTK_EDITABLE(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_EDITABLE, GtkEditable))
34 #define GTK_EDITABLE_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_EDITABLE, GtkEditableClass))
35 #define GTK_IS_EDITABLE(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_EDITABLE))
36 #define GTK_IS_EDITABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EDITABLE))
37
38
39 typedef struct _GtkEditable       GtkEditable;
40 typedef struct _GtkEditableClass  GtkEditableClass;
41
42 typedef void (*GtkTextFunction) (GtkEditable  *editable, guint32 time);
43
44 struct _GtkEditable
45 {
46   GtkWidget widget;
47
48   guint   current_pos;
49
50   guint   selection_start_pos;
51   guint   selection_end_pos;
52   guint   has_selection : 1;
53   guint   editable : 1;
54   GdkIC   ic;
55
56   gchar *clipboard_text;
57 };
58
59 struct _GtkEditableClass
60 {
61   GtkWidgetClass parent_class;
62   
63   /* Signals for notification/filtering of changes */
64   void (* changed)      (GtkEditable    *editable);
65   void (* insert_text)  (GtkEditable    *editable,
66                          const gchar    *text,
67                          gint            length,
68                          gint           *position);
69   void (* delete_text)  (GtkEditable    *editable,
70                          gint            start_pos,
71                          gint            end_pos);
72
73   /* Bindings actions */
74   void (* activate)        (GtkEditable *editable);
75   void (* set_editable)    (GtkEditable *editable,
76                             gboolean     is_editable);
77   void (* move_cursor)     (GtkEditable *editable,
78                             gint         x,
79                             gint         y);
80   void (* move_word)       (GtkEditable *editable,
81                             gint         n);
82   void (* move_page)       (GtkEditable *editable,
83                             gint         x,
84                             gint         y);
85   void (* move_to_row)     (GtkEditable *editable,
86                             gint         row);
87   void (* move_to_column)  (GtkEditable *editable,
88                             gint         row);
89   void (* kill_char)       (GtkEditable *editable,
90                             gint         direction);
91   void (* kill_word)       (GtkEditable *editable,
92                             gint         direction);
93   void (* kill_line)       (GtkEditable *editable,
94                             gint         direction);
95   void (* cut_clipboard)   (GtkEditable *editable);
96   void (* copy_clipboard)  (GtkEditable *editable);
97   void (* paste_clipboard) (GtkEditable *editable);
98
99   /* Virtual functions. get_chars is in paricular not a signal because
100    * it returns malloced memory. The others are not signals because
101    * they would not be particularly useful as such. (All changes to
102    * selection and position do not go through these functions)
103    */
104   void (* update_text)  (GtkEditable    *editable,
105                          gint            start_pos,
106                          gint            end_pos);
107   gchar* (* get_chars)  (GtkEditable    *editable,
108                          gint            start_pos,
109                          gint            end_pos);
110   void (* set_selection)(GtkEditable    *editable,
111                          gint            start_pos,
112                          gint            end_pos);
113   void (* set_position) (GtkEditable    *editable,
114                          gint            position);
115 };
116
117 GtkType    gtk_editable_get_type       (void);
118 void       gtk_editable_select_region  (GtkEditable      *editable,
119                                         gint              start,
120                                         gint              end);
121 void       gtk_editable_insert_text   (GtkEditable       *editable,
122                                         const gchar      *new_text,
123                                         gint              new_text_length,
124                                         gint             *position);
125 void       gtk_editable_delete_text    (GtkEditable      *editable,
126                                         gint              start_pos,
127                                         gint              end_pos);
128 gchar*     gtk_editable_get_chars      (GtkEditable      *editable,
129                                         gint              start_pos,
130                                         gint              end_pos);
131 void       gtk_editable_cut_clipboard  (GtkEditable      *editable);
132 void       gtk_editable_copy_clipboard (GtkEditable      *editable);
133 void       gtk_editable_paste_clipboard (GtkEditable     *editable);
134 void       gtk_editable_claim_selection (GtkEditable     *editable, 
135                                          gboolean         claim, 
136                                          guint32          time);
137 void       gtk_editable_delete_selection (GtkEditable    *editable);
138
139 void       gtk_editable_changed         (GtkEditable    *editable);
140 void       gtk_editable_set_position    (GtkEditable    *editable,
141                                          gint            position);
142 gint       gtk_editable_get_position    (GtkEditable    *editable);
143 void       gtk_editable_set_editable    (GtkEditable    *editable,
144                                          gboolean        is_editable);
145
146
147 #ifdef __cplusplus
148 }
149 #endif /* __cplusplus */
150
151
152 #endif /* __GTK_EDITABLE_H__ */