[gtk+] GtkEntry: Added gtk_entry_grab_focus_without_selection()
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkEntry: Added gtk_entry_grab_focus_without_selection()
- Date: Sat, 6 Dec 2014 04:35:16 +0000 (UTC)
commit a4e827e4bfba11dd34bababc78c013566b605aa0
Author: Ankita Patil <patil ankita r gmail com>
Date: Thu Nov 6 17:46:02 2014 +0530
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
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtkentry.c | 22 ++++++++++++++++++++++
gtk/gtkentry.h | 3 +++
3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 994a150..6c34734 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -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
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 4be143c..73d0a82 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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)
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
index ce3c021..57d65a5 100644
--- a/gtk/gtkentry.h
+++ b/gtk/gtkentry.h
@@ -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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]