checked in gtk_entry_set_max_length (it truncates the texts if it's
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org> * gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length (it truncates the texts if it's longer, now)
This commit is contained in:
parent
e648c2d68f
commit
85d4cd0f43
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
Wed Mar 18 17:38:25 CET 1998 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkentry.[ch]: checked in gtk_entry_set_max_length
|
||||
(it truncates the texts if it's longer, now)
|
||||
|
||||
Wed Mar 18 02:06:52 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkcontainer.c (gtk_container_border_width): use the resize queue.
|
||||
|
@ -1422,18 +1422,18 @@ gtk_entry_insert_text (GtkEditable *editable,
|
||||
|
||||
entry = GTK_ENTRY (editable);
|
||||
|
||||
if (new_text_length < 0)
|
||||
new_text_length = strlen (new_text);
|
||||
|
||||
/* 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)
|
||||
if (new_text_length <= 0)
|
||||
return;
|
||||
|
||||
if (new_text_length < 0)
|
||||
new_text_length = strlen (new_text);
|
||||
|
||||
start_pos = *position;
|
||||
end_pos = start_pos + new_text_length;
|
||||
last_pos = new_text_length + entry->text_length;
|
||||
@ -1879,3 +1879,15 @@ gtk_entry_select_region (GtkEntry *entry,
|
||||
{
|
||||
gtk_editable_select_region (GTK_EDITABLE(entry), start, end);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_entry_set_max_length (GtkEntry *entry,
|
||||
guint16 max)
|
||||
{
|
||||
g_return_if_fail(entry != NULL);
|
||||
g_return_if_fail(GTK_IS_ENTRY(entry));
|
||||
|
||||
if (max && entry->text_length > max)
|
||||
gtk_editable_delete_text(GTK_EDITABLE(entry), max, -1);
|
||||
entry->text_max_length = max;
|
||||
}
|
||||
|
@ -78,7 +78,9 @@ void gtk_entry_set_visibility (GtkEntry *entry,
|
||||
gboolean visible);
|
||||
void gtk_entry_set_editable (GtkEntry *entry,
|
||||
gboolean editable);
|
||||
|
||||
/* text is truncated if needed */
|
||||
void gtk_entry_set_max_length (GtkEntry *entry,
|
||||
guint16 max);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
Loading…
Reference in New Issue
Block a user