+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
+Sat Jan 3 00:41:28 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gtk/gtkentry.c:
+ * gtk/gtkentry.h: applied Gordon Matzigkeit's patch to add
+ fixed-length entry fields (gtk_entry_new_with_max_length)
+
Fri Jay 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
* reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack
entry->text = NULL;
entry->text_size = 0;
entry->text_length = 0;
+ entry->text_max_length = 0;
entry->current_pos = 0;
entry->selection_start_pos = 0;
entry->selection_end_pos = 0;
return GTK_WIDGET (gtk_type_new (gtk_entry_get_type ()));
}
+GtkWidget*
+gtk_entry_new_with_max_length (guint16 max)
+{
+ GtkEntry *entry;
+ entry = gtk_type_new (gtk_entry_get_type ());
+ entry->text_max_length = max;
+ return GTK_WIDGET (entry);
+}
+
void
gtk_entry_set_text (GtkEntry *entry,
const gchar *text)
g_return_if_fail (entry != NULL);
g_return_if_fail (GTK_IS_ENTRY (entry));
+ /* Make sure we do not exceed the maximum size of the entry. */
+ if (entry->text_max_length != 0 &&
+ new_text_length + entry->text_length > entry->text_max_length)
+ new_text_length = entry->text_max_length - entry->text_length;
+
+ /* Don't insert anything, if there was nothing to insert. */
+ if (new_text_length == 0)
+ return;
+
start_pos = *position;
end_pos = start_pos + new_text_length;
last_pos = new_text_length + entry->text_length;
guint16 text_size;
guint16 text_length;
+ guint16 text_max_length;
gint16 current_pos;
gint16 selection_start_pos;
gint16 selection_end_pos;
guint gtk_entry_get_type (void);
GtkWidget* gtk_entry_new (void);
+GtkWidget* gtk_entry_new_with_max_length (guint16 max);
void gtk_entry_set_text (GtkEntry *entry,
const gchar *text);
void gtk_entry_append_text (GtkEntry *entry,