GtkEntry: Added gtk_entry_grab_focus_without_selection()

Providing a way to focus an entry without selecting its contents.

https://bugzilla.gnome.org/show_bug.cgi?id=735838
This commit is contained in:
Ankita Patil 2014-11-06 17:46:02 +05:30 committed by Matthias Clasen
parent 45bed11272
commit a4e827e4bf
3 changed files with 26 additions and 0 deletions

View File

@ -1196,6 +1196,7 @@ gtk_entry_get_input_purpose
GtkInputHints
gtk_entry_set_input_hints
gtk_entry_get_input_hints
gtk_entry_grab_focus_without_selecting
<SUBSECTION Standard>
GTK_ENTRY

View File

@ -5016,6 +5016,28 @@ gtk_entry_grab_focus (GtkWidget *widget)
}
}
/**
* gtk_entry_grab_focus_without_selecting:
* @entry: a #GtkEntry
*
* Causes @entry to have keyboard focus.
*
* It behaves like gtk_widget_grab_focus(),
* except that it doesn't select the contents of the entry.
* You only want to call this on some special entries
* which the user usually doesn't want to replace all text in,
* such as search-as-you-type entries.
*
* Since: 3.16
*/
void
gtk_entry_grab_focus_without_selecting (GtkEntry *entry)
{
g_return_if_fail (GTK_IS_ENTRY (entry));
_gtk_entry_grab_focus (entry, FALSE);
}
static void
gtk_entry_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir)

View File

@ -374,6 +374,9 @@ void gtk_entry_set_tabs (GtkEntry
GDK_AVAILABLE_IN_3_10
PangoTabArray *gtk_entry_get_tabs (GtkEntry *entry);
GDK_AVAILABLE_IN_3_16
void gtk_entry_grab_focus_without_selecting (GtkEntry *entry);
G_END_DECLS
#endif /* __GTK_ENTRY_H__ */