Commit 22c3367a authored by James Westman's avatar James Westman Committed by Marcus Lundblad
Browse files

view: Add insert_layer_(behind/above)

This makes it easier to add layers in the correct order.
parent 7f01ab6a
......@@ -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
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment