summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2018-06-03 11:32:09 +0200
committerTimm Bäder <mail@baedert.org>2018-06-03 11:32:09 +0200
commit0f858319219062f10f00763b9642b39fc560ab63 (patch)
tree8a1fdd37ed81c77061984cc05c16eecdabdc7879
parentbca184ff5cb197ca184663e249c7729262a1fce7 (diff)
downloadgtk+-0f858319219062f10f00763b9642b39fc560ab63.tar.gz
widget: Add docs for {get,set}_focus_child
With get_ being still private.
-rw-r--r--docs/reference/gtk/gtk4-sections.txt1
-rw-r--r--gtk/gtkwidget.c24
2 files changed, 23 insertions, 2 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 34c9d6b030..aef56e724e 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4334,6 +4334,7 @@ gtk_widget_get_can_focus
gtk_widget_set_can_focus
gtk_widget_get_focus_on_click
gtk_widget_set_focus_on_click
+gtk_widget_set_focus_child
gtk_widget_get_has_surface
gtk_widget_set_has_surface
gtk_widget_get_sensitive
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3e5864df06..ac2e6bd656 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13330,6 +13330,19 @@ gtk_widget_snapshot_child (GtkWidget *widget,
gtk_snapshot_offset (snapshot, -x, -y);
}
+/**
+ * gtk_widget_set_focus_child:
+ * @widget: a #GtkWidget
+ * @child: (nullable): a direct child widget of @widget or %NULL
+ * to unset the focus child of @widget
+ *
+ * Set @child as the current focus child of @widget. The previous
+ * focus child will be unset.
+ *
+ * This function is only suitable for widget implementations.
+ * If you want a certain widget to get the input focus, call
+ * gtk_widget_grab_focus() on it.
+*/
void
gtk_widget_set_focus_child (GtkWidget *widget,
GtkWidget *child)
@@ -13364,10 +13377,17 @@ gtk_widget_set_focus_child (GtkWidget *widget,
if (GTK_IS_CONTAINER (widget))
gtk_container_set_focus_child (GTK_CONTAINER (widget), child);
-
- /* TODO: ??? */
}
+/**
+ * gtk_widget_get_focus_child:
+ * @widget: a #GtkWidget
+ *
+ * Returns the current focus child of @widget.
+ *
+ * Returns: (nullable): The current focus child of @widget,
+ * or %NULL in case the focus child is unset.
+ */
GtkWidget *
gtk_widget_get_focus_child (GtkWidget *widget)
{