mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
Clamp @max parameter passed in to [0, MAX_SIZE], improve docs. Fix default
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_new_with_max_length, gtk_entry_set_max_length): Clamp @max parameter passed in to [0, MAX_SIZE], improve docs. Fix default and range for ::max-length property, range for ::ncursor_position, ::selection_bound properties. (#55916, Vitaly Tishkov) * gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
This commit is contained in:
parent
b54e5f4ca1
commit
8d3278f076
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -1,3 +1,13 @@
|
||||
Sat Mar 2 15:48:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_new_with_max_length,
|
||||
gtk_entry_set_max_length): Clamp @max parameter passed in to
|
||||
[0, MAX_SIZE], improve docs. Fix default and range
|
||||
for ::max-length property, range for ::ncursor_position,
|
||||
::selection_bound properties. (#55916, Vitaly Tishkov)
|
||||
|
||||
* gtk/gtkmain.c (rewrite_event_for_grabs): Fix typo
|
||||
|
||||
Fri Mar 1 18:39:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/x11/{gdkevents-x11.c,gdkmain-x11.c,gdkprivate-x11.h,
|
||||
|
@ -435,7 +435,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
_("Cursor Position"),
|
||||
_("The current position of the insertion cursor in chars."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
MAX_SIZE,
|
||||
0,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
@ -445,7 +445,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
_("Selection Bound"),
|
||||
_("The position of the opposite end of the selection from the cursor in chars."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
MAX_SIZE,
|
||||
0,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
@ -461,10 +461,10 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
PROP_MAX_LENGTH,
|
||||
g_param_spec_int ("max_length",
|
||||
_("Maximum length"),
|
||||
_("Maximum number of characters for this entry"),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
_("Maximum number of characters for this entry. Zero if no maximum."),
|
||||
0,
|
||||
MAX_SIZE,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VISIBILITY,
|
||||
@ -3257,11 +3257,30 @@ gtk_entry_new (void)
|
||||
return GTK_WIDGET (gtk_type_new (GTK_TYPE_ENTRY));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_new_with_max_length:
|
||||
* @max: the maximum length of the entry, or 0 for no maximum.
|
||||
* (other than the maximum length of entries.) The value passed in will
|
||||
* be clamped to the range 0-65536.
|
||||
*
|
||||
* Creates a new #GtkEntry widget with the given maximum length.
|
||||
*
|
||||
* Note: the existance of this function is inconsistent
|
||||
* with the rest of the GTK+ API. The normal setup would
|
||||
* be to just require the user to make an extra call
|
||||
* to gtk_entry_set_max_length() instead. It is not
|
||||
* expected that this function will be removed, but
|
||||
* it would be better practice not to use it.
|
||||
*
|
||||
* Return value: a new #GtkEntry.
|
||||
**/
|
||||
GtkWidget*
|
||||
gtk_entry_new_with_max_length (gint max)
|
||||
{
|
||||
GtkEntry *entry;
|
||||
|
||||
max = CLAMP (max, 0, MAX_SIZE);
|
||||
|
||||
entry = gtk_type_new (GTK_TYPE_ENTRY);
|
||||
entry->text_max_length = max;
|
||||
|
||||
@ -3417,12 +3436,25 @@ gtk_entry_select_region (GtkEntry *entry,
|
||||
gtk_editable_select_region (GTK_EDITABLE (entry), start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_max_length:
|
||||
* @entry: a #GtkEntry.
|
||||
* @max: the maximum length of the entry, or 0 for no maximum.
|
||||
* (other than the maximum length of entries.) The value passed in will
|
||||
* be clamped to the range 0-65536.
|
||||
*
|
||||
* Sets the maximum allowed length of the contents of the widget. If
|
||||
* the current contents are longer than the given length, then they
|
||||
* will be truncated to fit.
|
||||
**/
|
||||
void
|
||||
gtk_entry_set_max_length (GtkEntry *entry,
|
||||
gint max)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
|
||||
max = CLAMP (max, 0, MAX_SIZE);
|
||||
|
||||
if (max > 0 && entry->text_length > max)
|
||||
gtk_editable_delete_text (GTK_EDITABLE (entry), max, -1);
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ static GdkEvent *
|
||||
rewrite_event_for_grabs (GdkEvent *event)
|
||||
{
|
||||
GdkWindow *grab_window;
|
||||
GtkWidget *event_widget, *grab_widget;;
|
||||
GtkWidget *event_widget, *grab_widget;
|
||||
gboolean owner_events;
|
||||
|
||||
switch (event->type)
|
||||
|
Loading…
Reference in New Issue
Block a user