[libshumate] view: Add insert_layer_(behind/above)
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] view: Add insert_layer_(behind/above)
- Date: Wed, 10 Mar 2021 16:49:58 +0000 (UTC)
commit 22c3367a8c2059351f2040593ea8df86021ed107
Author: James Westman <james jwestman net>
Date: Sun Mar 7 16:52:36 2021 -0600
view: Add insert_layer_(behind/above)
This makes it easier to add layers in the correct order.
docs/reference/libshumate-sections.txt | 2 ++
shumate/shumate-view.c | 46 ++++++++++++++++++++++++++++++++++
shumate/shumate-view.h | 6 +++++
3 files changed, 54 insertions(+)
---
diff --git a/docs/reference/libshumate-sections.txt b/docs/reference/libshumate-sections.txt
index ae76033..f14d855 100644
--- a/docs/reference/libshumate-sections.txt
+++ b/docs/reference/libshumate-sections.txt
@@ -96,6 +96,8 @@ shumate_view_set_background_pattern
shumate_view_set_horizontal_wrap
shumate_view_add_layer
shumate_view_remove_layer
+shumate_view_insert_layer_behind
+shumate_view_insert_layer_above
shumate_view_get_zoom_level
shumate_view_get_min_zoom_level
shumate_view_get_max_zoom_level
diff --git a/shumate/shumate-view.c b/shumate/shumate-view.c
index 9ff75fc..a2342a9 100644
--- a/shumate/shumate-view.c
+++ b/shumate/shumate-view.c
@@ -1079,6 +1079,52 @@ shumate_view_add_layer (ShumateView *view,
}
+/**
+ * shumate_view_insert_layer_behind:
+ * @view: a #ShumateView
+ * @layer: a #ShumateLayer
+ * @next_sibling: (nullable): a #ShumateLayer that is a child of @view, or %NULL
+ *
+ * Adds @layer to @view behind @next_sibling or, if @next_sibling is %NULL, at
+ * the top of the layer list.
+ */
+void
+shumate_view_insert_layer_behind (ShumateView *view,
+ ShumateLayer *layer,
+ ShumateLayer *next_sibling)
+{
+ g_return_if_fail (SHUMATE_IS_VIEW (view));
+ g_return_if_fail (SHUMATE_IS_LAYER (layer));
+ g_return_if_fail (next_sibling == NULL || SHUMATE_IS_LAYER (next_sibling));
+ g_return_if_fail (next_sibling == NULL || gtk_widget_get_parent (GTK_WIDGET (next_sibling)) == GTK_WIDGET
(view));
+
+ gtk_widget_insert_before (GTK_WIDGET (layer), GTK_WIDGET (view), GTK_WIDGET (next_sibling));
+}
+
+
+/**
+ * shumate_view_insert_layer_above:
+ * @view: a #ShumateView
+ * @layer: a #ShumateLayer
+ * @next_sibling: (nullable): a #ShumateLayer that is a child of @view, or %NULL
+ *
+ * Adds @layer to @view above @next_sibling or, if @next_sibling is %NULL, at
+ * the bottom of the layer list.
+ */
+void
+shumate_view_insert_layer_above (ShumateView *view,
+ ShumateLayer *layer,
+ ShumateLayer *next_sibling)
+{
+ g_return_if_fail (SHUMATE_IS_VIEW (view));
+ g_return_if_fail (SHUMATE_IS_LAYER (layer));
+ g_return_if_fail (next_sibling == NULL || SHUMATE_IS_LAYER (next_sibling));
+ g_return_if_fail (next_sibling == NULL || gtk_widget_get_parent (GTK_WIDGET (next_sibling)) == GTK_WIDGET
(view));
+
+ gtk_widget_insert_after (GTK_WIDGET (layer), GTK_WIDGET (view), GTK_WIDGET (next_sibling));
+}
+
+
/**
* shumate_view_remove_layer:
* @view: a #ShumateView
diff --git a/shumate/shumate-view.h b/shumate/shumate-view.h
index 8e8ea36..39cc3c6 100644
--- a/shumate/shumate-view.h
+++ b/shumate/shumate-view.h
@@ -85,6 +85,12 @@ void shumate_view_add_layer (ShumateView *view,
ShumateLayer *layer);
void shumate_view_remove_layer (ShumateView *view,
ShumateLayer *layer);
+void shumate_view_insert_layer_behind (ShumateView *view,
+ ShumateLayer *layer,
+ ShumateLayer *next_sibling);
+void shumate_view_insert_layer_above (ShumateView *view,
+ ShumateLayer *layer,
+ ShumateLayer *next_sibling);
gboolean shumate_view_get_zoom_on_double_click (ShumateView *view);
gboolean shumate_view_get_animate_zoom (ShumateView *view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]