summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish Singh <yosh@src.gnome.org>1998-01-03 08:35:21 +0000
committerManish Singh <yosh@src.gnome.org>1998-01-03 08:35:21 +0000
commit25995faa6cf0291ac801cb3ebdc47cd8a3fe4881 (patch)
treeb10964b6bbcaa19eb6733516fada15f758558435
parent621e1dd4c23c9d6ab2d46e595a00c6cd6af34749 (diff)
downloadgdk-pixbuf-25995faa6cf0291ac801cb3ebdc47cd8a3fe4881.tar.gz
Added Gordon Matzigkeit's patch for fixed length gtk entry fields
-Yosh
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-06
-rw-r--r--ChangeLog.pre-2-106
-rw-r--r--ChangeLog.pre-2-26
-rw-r--r--ChangeLog.pre-2-46
-rw-r--r--ChangeLog.pre-2-66
-rw-r--r--ChangeLog.pre-2-86
-rw-r--r--gtk/gtkentry.c19
-rw-r--r--gtk/gtkentry.h2
9 files changed, 63 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,9 @@
+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
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,9 @@
+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
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,9 @@
+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
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,9 @@
+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
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,9 @@
+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
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index d5de96b7c..6aca5144d 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,9 @@
+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
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 42ffc7194..1e9684b39 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -320,6 +320,7 @@ gtk_entry_init (GtkEntry *entry)
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;
@@ -374,6 +375,15 @@ gtk_entry_new ()
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)
@@ -1651,6 +1661,15 @@ gtk_real_entry_insert_text (GtkEntry *entry,
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;
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
index c4395fba3..a1f6c77d4 100644
--- a/gtk/gtkentry.h
+++ b/gtk/gtkentry.h
@@ -45,6 +45,7 @@ struct _GtkEntry
guint16 text_size;
guint16 text_length;
+ guint16 text_max_length;
gint16 current_pos;
gint16 selection_start_pos;
gint16 selection_end_pos;
@@ -76,6 +77,7 @@ struct _GtkEntryClass
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,