[gtk+/scrollable-indicator] Add a gtk_scrollable_get_border
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/scrollable-indicator] Add a gtk_scrollable_get_border
- Date: Wed, 10 Dec 2014 11:53:39 +0000 (UTC)
commit 0ca42c9881dcb33bcad3c6b77d09ff3af1f3f3bf
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 10 06:45:21 2014 -0500
Add a gtk_scrollable_get_border
Add a vfunc to return a non-scrollable border around scrollables.
This would be nicer as a property, but we can't add properties
to an interface without breaking 3rd party implementations, so
make this an optional vfunc, and handle it not being set.
docs/reference/gtk/gtk3-sections.txt | 2 +-
gtk/gtkscrollable.c | 28 ++++++++++++++++++++++++++++
gtk/gtkscrollable.h | 8 ++++++++
3 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 6c34734..702a741 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -3096,7 +3096,7 @@ gtk_scrollable_get_hscroll_policy
gtk_scrollable_set_hscroll_policy
gtk_scrollable_get_vscroll_policy
gtk_scrollable_set_vscroll_policy
-
+gtk_scrollable_get_border
<SUBSECTION Standard>
GtkScrollableInterface
diff --git a/gtk/gtkscrollable.c b/gtk/gtkscrollable.c
index 2002878..1ac26b6 100644
--- a/gtk/gtkscrollable.c
+++ b/gtk/gtkscrollable.c
@@ -312,3 +312,31 @@ gtk_scrollable_set_vscroll_policy (GtkScrollable *scrollable,
g_object_set (scrollable, "vscroll-policy", policy, NULL);
}
+
+/**
+ * gtk_scrollable_get_border:
+ * @scrollable: a #GtkScrollable
+ * @border: return location for the results
+ *
+ * Returns the size of a non-scrolling border around the
+ * outside of the scrollable. An example for this would
+ * be treeview headers. GTK+ can use this information to
+ * display overlayed graphics, like the overshoot indication,
+ * at the right position.
+ *
+ * Returns: %TRUE if @border has been set
+ *
+ * Since: 3.16
+ */
+gboolean
+gtk_scrollable_get_border (GtkScrollable *scrollable,
+ GtkBorder *border)
+{
+ g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), FALSE);
+ g_return_val_if_fail (border != NULL, FALSE);
+
+ if (GTK_SCROLLABLE_GET_IFACE (scrollable)->get_border)
+ return GTK_SCROLLABLE_GET_IFACE (scrollable)->get_border (scrollable, border);
+
+ return FALSE;
+}
diff --git a/gtk/gtkscrollable.h b/gtk/gtkscrollable.h
index 112301f..a4e0af1 100644
--- a/gtk/gtkscrollable.h
+++ b/gtk/gtkscrollable.h
@@ -25,6 +25,7 @@
#include <gdk/gdk.h>
#include <gtk/gtkenums.h>
#include <gtk/gtktypes.h>
+#include <gtk/gtkborder.h>
G_BEGIN_DECLS
@@ -39,6 +40,9 @@ typedef struct _GtkScrollableInterface GtkScrollableInterface;
struct _GtkScrollableInterface
{
GTypeInterface base_iface;
+
+ gboolean (* get_border) (GtkScrollable *scrollable,
+ GtkBorder *border);
};
/* Public API */
@@ -65,6 +69,10 @@ GDK_AVAILABLE_IN_ALL
void gtk_scrollable_set_vscroll_policy (GtkScrollable *scrollable,
GtkScrollablePolicy policy);
+GDK_AVAILABLE_IN_3_16
+gboolean gtk_scrollable_get_border (GtkScrollable *scrollable,
+ GtkBorder *border);
+
G_END_DECLS
#endif /* __GTK_SCROLLABLE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]