[gnome-builder] editor: add overlay to be used by plugins



commit 3ee2e2fa8a6009d66ee0db7c8a3c72c713f16072
Author: Christian Hergert <chergert redhat com>
Date:   Sat Sep 2 16:04:48 2017 -0700

    editor: add overlay to be used by plugins
    
    This allows plugins to layer things over all layout grid elements, which
    may be desirable to create a layering effect.

 libide/editor/ide-editor-perspective.c  |   18 ++++++++++++++++++
 libide/editor/ide-editor-perspective.h  |    1 +
 libide/editor/ide-editor-perspective.ui |    9 +++++++--
 libide/editor/ide-editor-private.h      |    1 +
 4 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/libide/editor/ide-editor-perspective.c b/libide/editor/ide-editor-perspective.c
index d220128..8d8ce8d 100644
--- a/libide/editor/ide-editor-perspective.c
+++ b/libide/editor/ide-editor-perspective.c
@@ -248,6 +248,7 @@ ide_editor_perspective_class_init (IdeEditorPerspectiveClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/ide-editor-perspective.ui");
   gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, grid);
+  gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, overlay);
   gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, properties);
 
   g_type_ensure (IDE_TYPE_EDITOR_PROPERTIES);
@@ -794,3 +795,20 @@ _ide_editor_perspective_show_properties (IdeEditorPerspective *self,
   ide_layout_transient_sidebar_set_panel (sidebar, GTK_WIDGET (self->properties));
   g_object_set (self, "right-visible", view != NULL, NULL);
 }
+
+/**
+ * ide_editor_perspective_get_overlay:
+ * @self: a #IdeEditorPerspective
+ *
+ * Gets the overlay widget which can be used to layer things above all
+ * items in the layout grid.
+ *
+ * Returns: (transfer none) (type Gtk.Overlay): A #GtkWidget
+ */
+GtkWidget *
+ide_editor_perspective_get_overlay (IdeEditorPerspective *self)
+{
+  g_return_val_if_fail (IDE_IS_EDITOR_PERSPECTIVE (self), NULL);
+
+  return GTK_WIDGET (self->overlay);
+}
diff --git a/libide/editor/ide-editor-perspective.h b/libide/editor/ide-editor-perspective.h
index 7881934..c562e09 100644
--- a/libide/editor/ide-editor-perspective.h
+++ b/libide/editor/ide-editor-perspective.h
@@ -42,5 +42,6 @@ IdeLayoutGrid             *ide_editor_perspective_get_grid
 IdeEditorSidebar          *ide_editor_perspective_get_sidebar                   (IdeEditorPerspective *self);
 IdeLayoutTransientSidebar *ide_editor_perspective_get_transient_sidebar         (IdeEditorPerspective *self);
 GtkWidget                 *ide_editor_perspective_get_utilities                 (IdeEditorPerspective *self);
+GtkWidget                 *ide_editor_perspective_get_overlay                   (IdeEditorPerspective *self);
 
 G_END_DECLS
diff --git a/libide/editor/ide-editor-perspective.ui b/libide/editor/ide-editor-perspective.ui
index 8cc9f56..8d98bdb 100644
--- a/libide/editor/ide-editor-perspective.ui
+++ b/libide/editor/ide-editor-perspective.ui
@@ -12,9 +12,14 @@
       </object>
     </child>
     <child>
-      <object class="IdeLayoutGrid" id="grid">
-        <property name="orientation">horizontal</property>
+      <object class="GtkOverlay" id="overlay">
         <property name="visible">true</property>
+        <child>
+          <object class="IdeLayoutGrid" id="grid">
+            <property name="orientation">horizontal</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/libide/editor/ide-editor-private.h b/libide/editor/ide-editor-private.h
index 80ca106..e05bfd2 100644
--- a/libide/editor/ide-editor-private.h
+++ b/libide/editor/ide-editor-private.h
@@ -42,6 +42,7 @@ struct _IdeEditorPerspective
 
   /* Template widgets */
   IdeLayoutGrid       *grid;
+  GtkOverlay          *overlay;
   IdeEditorProperties *properties;
 
   /* State before entering focus mode */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]