[gtk+/popovers: 22/45] window: Add gtk_window_get_popover_position()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/popovers: 22/45] window: Add gtk_window_get_popover_position()
- Date: Fri, 17 Jan 2014 18:01:29 +0000 (UTC)
commit 7a5199b11a4991606840f9fb9e9a9cfd136ab06a
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Dec 23 19:04:48 2013 +0100
window: Add gtk_window_get_popover_position()
A getter to complement the setter
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtkwindow.c | 41 ++++++++++++++++++++++++++++++++++
gtk/gtkwindow.h | 5 ++++
3 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 80b22a5..c9e36b8 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5676,6 +5676,7 @@ gtk_window_set_titlebar
gtk_window_add_popover
gtk_window_remove_popover
gtk_window_set_popover_position
+gtk_window_get_popover_position
<SUBSECTION Standard>
GTK_WINDOW
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index fe1a1a8..f048820 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -12031,3 +12031,44 @@ gtk_window_set_popover_position (GtkWindow *window,
gtk_widget_queue_resize (popover);
}
+
+/**
+ * gtk_window_get_popover_position:
+ * @window: a #GtkWindow
+ * @popover: a #GtkWidget acting as popover
+ * @pos: return value for the position of @popover relative to @rect
+ * @rect: return value for the disclosure rectangle
+ *
+ * Returns the positioning details of @popover, relative to @window.
+ *
+ * Since: 3.12
+ **/
+void
+gtk_window_get_popover_position (GtkWindow *window,
+ GtkWidget *popover,
+ GtkPositionType *pos,
+ cairo_rectangle_int_t *rect)
+{
+ GtkWindowPopover *data;
+ GtkWindowPrivate *priv;
+
+ g_return_if_fail (GTK_IS_WINDOW (window));
+ g_return_if_fail (GTK_IS_WIDGET (popover));
+
+ priv = window->priv;
+ data = g_hash_table_lookup (priv->popovers, popover);
+
+ if (!data)
+ {
+ g_warning ("Widget %s(%p) is not a popover of window %s",
+ gtk_widget_get_name (popover), popover,
+ gtk_widget_get_name (GTK_WIDGET (window)));
+ return;
+ }
+
+ if (pos)
+ *pos = data->pos;
+
+ if (rect)
+ *rect = data->rect;
+}
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 1abbc85..4c2a97e 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -481,6 +481,11 @@ void gtk_window_set_popover_position (GtkWindow *window,
GtkWidget *popover,
GtkPositionType pos,
const cairo_rectangle_int_t *rect);
+GDK_AVAILABLE_IN_3_12
+void gtk_window_get_popover_position (GtkWindow *window,
+ GtkWidget *popover,
+ GtkPositionType *pos,
+ cairo_rectangle_int_t *rect);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]