| 1 | /* gtkentrybuffer.h | 
| 2 |  * Copyright (C) 2009  Stefan Walter <stef@memberwebs.com> | 
| 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, see <http://www.gnu.org/licenses/>. | 
| 16 |  */ | 
| 17 |  | 
| 18 | #ifndef __GTK_ENTRY_BUFFER_H__ | 
| 19 | #define __GTK_ENTRY_BUFFER_H__ | 
| 20 |  | 
| 21 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) | 
| 22 | #error "Only <gtk/gtk.h> can be included directly." | 
| 23 | #endif | 
| 24 |  | 
| 25 | #include <glib-object.h> | 
| 26 | #include <gdk/gdk.h> | 
| 27 |  | 
| 28 | G_BEGIN_DECLS | 
| 29 |  | 
| 30 | /* Maximum size of text buffer, in bytes */ | 
| 31 | #define GTK_ENTRY_BUFFER_MAX_SIZE        G_MAXUSHORT | 
| 32 |  | 
| 33 | #define GTK_TYPE_ENTRY_BUFFER            (gtk_entry_buffer_get_type ()) | 
| 34 | #define GTK_ENTRY_BUFFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_BUFFER, GtkEntryBuffer)) | 
| 35 | #define GTK_ENTRY_BUFFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_BUFFER, GtkEntryBufferClass)) | 
| 36 | #define GTK_IS_ENTRY_BUFFER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_BUFFER)) | 
| 37 | #define GTK_IS_ENTRY_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_BUFFER)) | 
| 38 | #define GTK_ENTRY_BUFFER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_BUFFER, GtkEntryBufferClass)) | 
| 39 |  | 
| 40 | typedef struct _GtkEntryBuffer            GtkEntryBuffer; | 
| 41 | typedef struct _GtkEntryBufferClass       GtkEntryBufferClass; | 
| 42 | typedef struct _GtkEntryBufferPrivate     GtkEntryBufferPrivate; | 
| 43 |  | 
| 44 | struct _GtkEntryBuffer | 
| 45 | { | 
| 46 |   GObject parent_instance; | 
| 47 |  | 
| 48 |   /*< private >*/ | 
| 49 |   GtkEntryBufferPrivate *priv; | 
| 50 | }; | 
| 51 |  | 
| 52 | struct _GtkEntryBufferClass | 
| 53 | { | 
| 54 |   GObjectClass parent_class; | 
| 55 |  | 
| 56 |   /* Signals */ | 
| 57 |  | 
| 58 |   void         (*inserted_text)          (GtkEntryBuffer *buffer, | 
| 59 |                                           guint           position, | 
| 60 |                                           const gchar    *chars, | 
| 61 |                                           guint           n_chars); | 
| 62 |  | 
| 63 |   void         (*deleted_text)           (GtkEntryBuffer *buffer, | 
| 64 |                                           guint           position, | 
| 65 |                                           guint           n_chars); | 
| 66 |  | 
| 67 |   /* Virtual Methods */ | 
| 68 |  | 
| 69 |   const gchar* (*get_text)               (GtkEntryBuffer *buffer, | 
| 70 |                                           gsize          *n_bytes); | 
| 71 |  | 
| 72 |   guint        (*get_length)             (GtkEntryBuffer *buffer); | 
| 73 |  | 
| 74 |   guint        (*insert_text)            (GtkEntryBuffer *buffer, | 
| 75 |                                           guint           position, | 
| 76 |                                           const gchar    *chars, | 
| 77 |                                           guint           n_chars); | 
| 78 |  | 
| 79 |   guint        (*delete_text)            (GtkEntryBuffer *buffer, | 
| 80 |                                           guint           position, | 
| 81 |                                           guint           n_chars); | 
| 82 |  | 
| 83 |   /* Padding for future expansion */ | 
| 84 |   void (*_gtk_reserved1) (void); | 
| 85 |   void (*_gtk_reserved2) (void); | 
| 86 |   void (*_gtk_reserved3) (void); | 
| 87 |   void (*_gtk_reserved4) (void); | 
| 88 |   void (*_gtk_reserved5) (void); | 
| 89 |   void (*_gtk_reserved6) (void); | 
| 90 |   void (*_gtk_reserved7) (void); | 
| 91 |   void (*_gtk_reserved8) (void); | 
| 92 | }; | 
| 93 |  | 
| 94 | GDK_AVAILABLE_IN_ALL | 
| 95 | GType                     gtk_entry_buffer_get_type               (void) G_GNUC_CONST; | 
| 96 |  | 
| 97 | GDK_AVAILABLE_IN_ALL | 
| 98 | GtkEntryBuffer*           gtk_entry_buffer_new                    (const gchar     *initial_chars, | 
| 99 |                                                                    gint             n_initial_chars); | 
| 100 |  | 
| 101 | GDK_AVAILABLE_IN_ALL | 
| 102 | gsize                     gtk_entry_buffer_get_bytes              (GtkEntryBuffer  *buffer); | 
| 103 |  | 
| 104 | GDK_AVAILABLE_IN_ALL | 
| 105 | guint                     gtk_entry_buffer_get_length             (GtkEntryBuffer  *buffer); | 
| 106 |  | 
| 107 | GDK_AVAILABLE_IN_ALL | 
| 108 | const gchar*              gtk_entry_buffer_get_text               (GtkEntryBuffer  *buffer); | 
| 109 |  | 
| 110 | GDK_AVAILABLE_IN_ALL | 
| 111 | void                      gtk_entry_buffer_set_text               (GtkEntryBuffer  *buffer, | 
| 112 |                                                                    const gchar     *chars, | 
| 113 |                                                                    gint             n_chars); | 
| 114 |  | 
| 115 | GDK_AVAILABLE_IN_ALL | 
| 116 | void                      gtk_entry_buffer_set_max_length         (GtkEntryBuffer  *buffer, | 
| 117 |                                                                    gint             max_length); | 
| 118 |  | 
| 119 | GDK_AVAILABLE_IN_ALL | 
| 120 | gint                      gtk_entry_buffer_get_max_length         (GtkEntryBuffer  *buffer); | 
| 121 |  | 
| 122 | GDK_AVAILABLE_IN_ALL | 
| 123 | guint                     gtk_entry_buffer_insert_text            (GtkEntryBuffer  *buffer, | 
| 124 |                                                                    guint            position, | 
| 125 |                                                                    const gchar     *chars, | 
| 126 |                                                                    gint             n_chars); | 
| 127 |  | 
| 128 | GDK_AVAILABLE_IN_ALL | 
| 129 | guint                     gtk_entry_buffer_delete_text            (GtkEntryBuffer  *buffer, | 
| 130 |                                                                    guint            position, | 
| 131 |                                                                    gint             n_chars); | 
| 132 |  | 
| 133 | GDK_AVAILABLE_IN_ALL | 
| 134 | void                      gtk_entry_buffer_emit_inserted_text     (GtkEntryBuffer  *buffer, | 
| 135 |                                                                    guint            position, | 
| 136 |                                                                    const gchar     *chars, | 
| 137 |                                                                    guint            n_chars); | 
| 138 |  | 
| 139 | GDK_AVAILABLE_IN_ALL | 
| 140 | void                      gtk_entry_buffer_emit_deleted_text      (GtkEntryBuffer  *buffer, | 
| 141 |                                                                    guint            position, | 
| 142 |                                                                    guint            n_chars); | 
| 143 |  | 
| 144 | G_END_DECLS | 
| 145 |  | 
| 146 | #endif /* __GTK_ENTRY_BUFFER_H__ */ | 
| 147 |  |