Merge branch 'overlay-layout' into 'master'

overlay: Use a layout manager

See merge request GNOME/gtk!677
This commit is contained in:
Matthias Clasen 2019-03-28 21:07:38 +00:00
commit 121bbcec4b
17 changed files with 698 additions and 508 deletions

View File

@ -22,6 +22,7 @@
#include "gtkoverlay.h"
#include "gtkoverlaylayoutprivate.h"
#include "gtkbuildable.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
@ -61,104 +62,25 @@
* whose alignments cause them to be positioned at an edge get the style classes
* .left, .right, .top, and/or .bottom according to their position.
*/
typedef struct _GtkOverlayChild GtkOverlayChild;
struct _GtkOverlayChild
{
guint measure : 1;
guint clip_overlay : 1;
};
enum {
GET_CHILD_POSITION,
LAST_SIGNAL
};
enum
{
CHILD_PROP_0,
CHILD_PROP_PASS_THROUGH,
CHILD_PROP_MEASURE,
CHILD_PROP_CLIP_OVERLAY
};
static guint signals[LAST_SIGNAL] = { 0 };
static GQuark child_data_quark = 0;
static void gtk_overlay_buildable_init (GtkBuildableIface *iface);
typedef struct {
GtkLayoutManager *layout;
} GtkOverlayPrivate;
G_DEFINE_TYPE_WITH_CODE (GtkOverlay, gtk_overlay, GTK_TYPE_BIN,
G_ADD_PRIVATE (GtkOverlay)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_overlay_buildable_init))
static void
gtk_overlay_set_overlay_child (GtkWidget *widget,
GtkOverlayChild *child_data)
{
g_object_set_qdata_full (G_OBJECT (widget), child_data_quark, child_data, g_free);
}
static GtkOverlayChild *
gtk_overlay_get_overlay_child (GtkWidget *widget)
{
return (GtkOverlayChild *) g_object_get_qdata (G_OBJECT (widget), child_data_quark);
}
static void
gtk_overlay_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkWidget *child;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
GtkOverlayChild *child_data = gtk_overlay_get_overlay_child (child);
if (child_data == NULL || child_data->measure)
{
int child_min, child_nat, child_min_baseline, child_nat_baseline;
gtk_widget_measure (child,
orientation,
for_size,
&child_min, &child_nat,
&child_min_baseline, &child_nat_baseline);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
if (child_min_baseline > -1)
*minimum_baseline = MAX (*minimum_baseline, child_min_baseline);
if (child_nat_baseline > -1)
*natural_baseline = MAX (*natural_baseline, child_nat_baseline);
}
}
}
static void
gtk_overlay_compute_child_allocation (GtkOverlay *overlay,
GtkWidget *widget,
GtkOverlayChild *child,
GtkAllocation *widget_allocation)
{
GtkAllocation allocation;
gboolean result;
g_signal_emit (overlay, signals[GET_CHILD_POSITION],
0, widget, &allocation, &result);
widget_allocation->x = allocation.x;
widget_allocation->y = allocation.y;
widget_allocation->width = allocation.width;
widget_allocation->height = allocation.height;
}
static GtkAlign
effective_align (GtkAlign align,
GtkTextDirection direction)
@ -177,110 +99,6 @@ effective_align (GtkAlign align,
}
}
static void
gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
GtkWidget *child,
GtkAllocation *child_allocation)
{
int width, height;
GtkAlign valign, halign;
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
GtkStyleContext *context;
context = gtk_widget_get_style_context (child);
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE;
width = gtk_widget_get_width (GTK_WIDGET (overlay));
height = gtk_widget_get_height (GTK_WIDGET (overlay));
halign = effective_align (gtk_widget_get_halign (child),
gtk_widget_get_direction (child));
if (halign == GTK_ALIGN_START)
is_left = (child_allocation->x == 0);
else if (halign == GTK_ALIGN_END)
is_right = (child_allocation->x + child_allocation->width == width);
valign = gtk_widget_get_valign (child);
if (valign == GTK_ALIGN_START)
is_top = (child_allocation->y == 0);
else if (valign == GTK_ALIGN_END)
is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
if (has_right && !is_right)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
if (has_top && !is_top)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
if (has_bottom && !is_bottom)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
}
static void
gtk_overlay_child_allocate (GtkOverlay *overlay,
GtkWidget *widget,
GtkOverlayChild *child)
{
GtkAllocation child_allocation;
if (!gtk_widget_get_visible (widget))
return;
gtk_overlay_compute_child_allocation (overlay, widget, child, &child_allocation);
gtk_overlay_child_update_style_classes (overlay, widget, &child_allocation);
gtk_widget_size_allocate (widget, &child_allocation, -1);
}
static void
gtk_overlay_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkOverlay *overlay = GTK_OVERLAY (widget);
GtkWidget *child;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
if (main_widget && gtk_widget_get_visible (main_widget))
gtk_widget_size_allocate (main_widget,
&(GtkAllocation) {
0, 0,
width, height
}, -1);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
if (child != main_widget)
{
GtkOverlayChild *child_data = gtk_overlay_get_overlay_child (child);
gtk_overlay_child_allocate (overlay, child, child_data);
}
}
}
static gboolean
gtk_overlay_get_child_position (GtkOverlay *overlay,
GtkWidget *widget,
@ -355,7 +173,8 @@ gtk_overlay_add (GtkContainer *container,
/* We only get into this path if we have no child
* (since GtkOverlay is a GtkBin) and the only child
* we can add through gtk_container_add is the main child,
* which we want to keep the lowest in the hierarchy. */
* which we want to keep the lowest in the hierarchy.
*/
gtk_widget_insert_after (widget, GTK_WIDGET (container), NULL);
_gtk_bin_set_child (GTK_BIN (container), widget);
}
@ -394,106 +213,6 @@ gtk_overlay_forall (GtkContainer *overlay,
}
}
static void
gtk_overlay_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GtkOverlay *overlay = GTK_OVERLAY (container);
GtkOverlayChild *child_info;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
if (child == main_widget)
child_info = NULL;
else
{
child_info = gtk_overlay_get_overlay_child (child);
if (child_info == NULL)
{
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
return;
}
}
switch (property_id)
{
case CHILD_PROP_MEASURE:
if (child_info)
{
if (g_value_get_boolean (value) != child_info->measure)
{
child_info->measure = g_value_get_boolean (value);
gtk_container_child_notify (container, child, "measure");
gtk_widget_queue_resize (GTK_WIDGET (overlay));
}
}
break;
case CHILD_PROP_CLIP_OVERLAY:
if (child_info)
{
if (g_value_get_boolean (value) != child_info->clip_overlay)
{
child_info->clip_overlay = g_value_get_boolean (value);
gtk_container_child_notify (container, child, "clip-overlay");
gtk_widget_queue_resize (GTK_WIDGET (overlay));
}
}
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static void
gtk_overlay_get_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GtkOverlay *overlay = GTK_OVERLAY (container);
GtkOverlayChild *child_info;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
if (child == main_widget)
child_info = NULL;
else
{
child_info = gtk_overlay_get_overlay_child (child);
if (child_info == NULL)
{
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
return;
}
}
switch (property_id)
{
case CHILD_PROP_MEASURE:
if (child_info)
g_value_set_boolean (value, child_info->measure);
else
g_value_set_boolean (value, TRUE);
break;
case CHILD_PROP_CLIP_OVERLAY:
if (child_info)
g_value_set_boolean (value, child_info->clip_overlay);
else
g_value_set_boolean (value, FALSE);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static void
gtk_overlay_snapshot_child (GtkWidget *overlay,
GtkWidget *child,
@ -540,43 +259,14 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
widget_class->measure = gtk_overlay_measure;
widget_class->size_allocate = gtk_overlay_size_allocate;
widget_class->snapshot = gtk_overlay_snapshot;
container_class->add = gtk_overlay_add;
container_class->remove = gtk_overlay_remove;
container_class->forall = gtk_overlay_forall;
container_class->set_child_property = gtk_overlay_set_child_property;
container_class->get_child_property = gtk_overlay_get_child_property;
klass->get_child_position = gtk_overlay_get_child_position;
/**
* GtkOverlay:measure:
*
* Include this child in determining the child request.
*
* The main child will always be measured.
*/
gtk_container_class_install_child_property (container_class, CHILD_PROP_MEASURE,
g_param_spec_boolean ("measure", P_("Measure"), P_("Include in size measurement"),
FALSE,
GTK_PARAM_READWRITE));
/**
* GtkOverlay:clip-overlay:
*
* Clip the overlay child widget so as to fit the parent
*/
gtk_container_class_install_child_property (container_class, CHILD_PROP_CLIP_OVERLAY,
g_param_spec_boolean ("clip-overlay",
P_("Clip Overlay"),
P_("Clip the overlay child widget so as to fit the parent"),
FALSE,
GTK_PARAM_READWRITE));
/**
* GtkOverlay::get-child-position:
* @overlay: the #GtkOverlay
@ -611,15 +301,18 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
GTK_TYPE_WIDGET,
GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
child_data_quark = g_quark_from_static_string ("gtk-overlay-child-data");
gtk_widget_class_set_css_name (widget_class, I_("overlay"));
}
static void
gtk_overlay_init (GtkOverlay *overlay)
{
GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
gtk_widget_set_has_surface (GTK_WIDGET (overlay), FALSE);
priv->layout = gtk_overlay_layout_new ();
gtk_widget_set_layout_manager (GTK_WIDGET (overlay), priv->layout);
}
static GtkBuildableIface *parent_buildable_iface;
@ -687,15 +380,10 @@ void
gtk_overlay_add_overlay (GtkOverlay *overlay,
GtkWidget *widget)
{
GtkOverlayChild *child;
g_return_if_fail (GTK_IS_OVERLAY (overlay));
g_return_if_fail (GTK_IS_WIDGET (widget));
child = g_new0 (GtkOverlayChild, 1);
gtk_widget_insert_before (widget, GTK_WIDGET (overlay), NULL);
gtk_overlay_set_overlay_child (widget, child);
}
/**
@ -715,12 +403,14 @@ gtk_overlay_set_measure_overlay (GtkOverlay *overlay,
GtkWidget *widget,
gboolean measure)
{
GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
GtkOverlayLayoutChild *child;
g_return_if_fail (GTK_IS_OVERLAY (overlay));
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_container_child_set (GTK_CONTAINER (overlay), widget,
"measure", measure,
NULL);
child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
gtk_overlay_layout_child_set_measure (child, measure);
}
/**
@ -737,16 +427,14 @@ gboolean
gtk_overlay_get_measure_overlay (GtkOverlay *overlay,
GtkWidget *widget)
{
gboolean measure;
GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
GtkOverlayLayoutChild *child;
g_return_val_if_fail (GTK_IS_OVERLAY (overlay), FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
gtk_container_child_get (GTK_CONTAINER (overlay), widget,
"measure", &measure,
NULL);
return measure;
child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
return gtk_overlay_layout_child_get_measure (child);
}
/**
@ -763,12 +451,14 @@ gtk_overlay_set_clip_overlay (GtkOverlay *overlay,
GtkWidget *widget,
gboolean clip_overlay)
{
GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
GtkOverlayLayoutChild *child;
g_return_if_fail (GTK_IS_OVERLAY (overlay));
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_container_child_set (GTK_CONTAINER (overlay), widget,
"clip-overlay", clip_overlay,
NULL);
child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
gtk_overlay_layout_child_set_clip_overlay (child, clip_overlay);
}
/**
@ -785,14 +475,13 @@ gboolean
gtk_overlay_get_clip_overlay (GtkOverlay *overlay,
GtkWidget *widget)
{
gboolean clip_overlay;
GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
GtkOverlayLayoutChild *child;
g_return_val_if_fail (GTK_IS_OVERLAY (overlay), FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
gtk_container_child_get (GTK_CONTAINER (overlay), widget,
"clip-overlay", &clip_overlay,
NULL);
child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
return clip_overlay;
return gtk_overlay_layout_child_get_clip_overlay (child);
}

View File

@ -38,7 +38,6 @@ G_BEGIN_DECLS
typedef struct _GtkOverlay GtkOverlay;
typedef struct _GtkOverlayClass GtkOverlayClass;
typedef struct _GtkOverlayPrivate GtkOverlayPrivate;
struct _GtkOverlay
{

448
gtk/gtkoverlaylayout.c Normal file
View File

@ -0,0 +1,448 @@
/* gtkoverlaylayout.c: Overlay layout manager
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Copyright 2019 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkoverlaylayoutprivate.h"
#include "gtkintl.h"
#include "gtklayoutchild.h"
#include "gtkoverlay.h"
#include "gtkprivate.h"
#include "gtkstylecontext.h"
#include "gtkwidgetprivate.h"
#include <graphene-gobject.h>
struct _GtkOverlayLayout
{
GtkLayoutManager parent_instance;
};
struct _GtkOverlayLayoutChild
{
GtkLayoutChild parent_instance;
guint measure : 1;
guint clip_overlay : 1;
};
enum
{
PROP_MEASURE = 1,
PROP_CLIP_OVERLAY,
N_CHILD_PROPERTIES
};
static GParamSpec *child_props[N_CHILD_PROPERTIES];
G_DEFINE_TYPE (GtkOverlayLayoutChild, gtk_overlay_layout_child, GTK_TYPE_LAYOUT_CHILD)
static void
gtk_overlay_layout_child_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkOverlayLayoutChild *self = GTK_OVERLAY_LAYOUT_CHILD (gobject);
switch (prop_id)
{
case PROP_MEASURE:
gtk_overlay_layout_child_set_measure (self, g_value_get_boolean (value));
break;
case PROP_CLIP_OVERLAY:
gtk_overlay_layout_child_set_clip_overlay (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gtk_overlay_layout_child_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkOverlayLayoutChild *self = GTK_OVERLAY_LAYOUT_CHILD (gobject);
switch (prop_id)
{
case PROP_MEASURE:
g_value_set_boolean (value, self->measure);
break;
case PROP_CLIP_OVERLAY:
g_value_set_boolean (value, self->clip_overlay);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gtk_overlay_layout_child_finalize (GObject *gobject)
{
//GtkOverlayLayoutChild *self = GTK_OVERLAY_LAYOUT_CHILD (gobject);
G_OBJECT_CLASS (gtk_overlay_layout_child_parent_class)->finalize (gobject);
}
static void
gtk_overlay_layout_child_class_init (GtkOverlayLayoutChildClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gtk_overlay_layout_child_set_property;
gobject_class->get_property = gtk_overlay_layout_child_get_property;
gobject_class->finalize = gtk_overlay_layout_child_finalize;
child_props[PROP_MEASURE] =
g_param_spec_boolean ("measure",
P_("Measure"),
P_("Include in size measurement"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
child_props[PROP_CLIP_OVERLAY] =
g_param_spec_boolean ("clip-overlay",
P_("Clip Overlay"),
P_("Clip the overlay child widget so as to fit the parent"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (gobject_class, N_CHILD_PROPERTIES, child_props);
}
static void
gtk_overlay_layout_child_init (GtkOverlayLayoutChild *self)
{
}
/**
* gtk_overlay_layout_child_set_measure:
* @child: a #GtkOverlayLayoutChild
* @measure: whether to measure this child
*
* Sets whether to measure this child.
*/
void
gtk_overlay_layout_child_set_measure (GtkOverlayLayoutChild *child,
gboolean measure)
{
GtkLayoutManager *layout;
g_return_if_fail (GTK_IS_OVERLAY_LAYOUT_CHILD (child));
if (child->measure == measure)
return;
child->measure = measure;
layout = gtk_layout_child_get_layout_manager (GTK_LAYOUT_CHILD (child));
gtk_layout_manager_layout_changed (layout);
g_object_notify_by_pspec (G_OBJECT (child), child_props[PROP_MEASURE]);
}
/**
* gtk_overlay_layout_child_get_measure:
* @child: a #GtkOverlayLayoutChild
*
* Retrieves whether the child is measured.
*
* Returns: (transfer none) (nullable): whether the child is measured
*/
gboolean
gtk_overlay_layout_child_get_measure (GtkOverlayLayoutChild *child)
{
g_return_val_if_fail (GTK_IS_OVERLAY_LAYOUT_CHILD (child), FALSE);
return child->measure;
}
/**
* gtk_overlay_layout_child_set_clip_overlay:
* @child: a #GtkOverlayLayoutChild
* @clip_overlay: whether to clip this child
*
* Sets whether to clip this child.
*/
void
gtk_overlay_layout_child_set_clip_overlay (GtkOverlayLayoutChild *child,
gboolean clip_overlay)
{
GtkLayoutManager *layout;
g_return_if_fail (GTK_IS_OVERLAY_LAYOUT_CHILD (child));
if (child->clip_overlay == clip_overlay)
return;
child->clip_overlay = clip_overlay;
layout = gtk_layout_child_get_layout_manager (GTK_LAYOUT_CHILD (child));
gtk_layout_manager_layout_changed (layout);
g_object_notify_by_pspec (G_OBJECT (child), child_props[PROP_CLIP_OVERLAY]);
}
/**
* gtk_overlay_layout_child_get_clip_overlay:
* @child: a #GtkOverlayLayoutChild
*
* Retrieves whether the child is clipped.
*
* Returns: (transfer none) (nullable): whether the child is clipped
*/
gboolean
gtk_overlay_layout_child_get_clip_overlay (GtkOverlayLayoutChild *child)
{
g_return_val_if_fail (GTK_IS_OVERLAY_LAYOUT_CHILD (child), FALSE);
return child->clip_overlay;
}
G_DEFINE_TYPE (GtkOverlayLayout, gtk_overlay_layout, GTK_TYPE_LAYOUT_MANAGER)
static void
gtk_overlay_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkOverlayLayoutChild *child_info;
GtkWidget *child;
int min, nat;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (widget));
min = 0;
nat = 0;
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
child_info = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (layout_manager, child));
if (child == main_widget || child_info->measure)
{
int child_min, child_nat, child_min_baseline, child_nat_baseline;
gtk_widget_measure (child,
orientation,
for_size,
&child_min, &child_nat,
&child_min_baseline, &child_nat_baseline);
min = MAX (min, child_min);
nat = MAX (nat, child_nat);
}
}
if (minimum != NULL)
*minimum = min;
if (natural != NULL)
*natural = nat;
}
static void
gtk_overlay_compute_child_allocation (GtkOverlay *overlay,
GtkWidget *widget,
GtkOverlayLayoutChild *child,
GtkAllocation *widget_allocation)
{
GtkAllocation allocation;
gboolean result;
g_signal_emit_by_name (overlay, "get-child-position",
widget, &allocation, &result);
widget_allocation->x = allocation.x;
widget_allocation->y = allocation.y;
widget_allocation->width = allocation.width;
widget_allocation->height = allocation.height;
}
static GtkAlign
effective_align (GtkAlign align,
GtkTextDirection direction)
{
switch (align)
{
case GTK_ALIGN_START:
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START;
case GTK_ALIGN_END:
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END;
case GTK_ALIGN_FILL:
case GTK_ALIGN_CENTER:
case GTK_ALIGN_BASELINE:
default:
return align;
}
}
static void
gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
GtkWidget *child,
GtkAllocation *child_allocation)
{
int width, height;
GtkAlign valign, halign;
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
GtkStyleContext *context;
context = gtk_widget_get_style_context (child);
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE;
width = gtk_widget_get_width (GTK_WIDGET (overlay));
height = gtk_widget_get_height (GTK_WIDGET (overlay));
halign = effective_align (gtk_widget_get_halign (child),
gtk_widget_get_direction (child));
if (halign == GTK_ALIGN_START)
is_left = (child_allocation->x == 0);
else if (halign == GTK_ALIGN_END)
is_right = (child_allocation->x + child_allocation->width == width);
valign = gtk_widget_get_valign (child);
if (valign == GTK_ALIGN_START)
is_top = (child_allocation->y == 0);
else if (valign == GTK_ALIGN_END)
is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
if (has_right && !is_right)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
if (has_top && !is_top)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
if (has_bottom && !is_bottom)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
}
static void
gtk_overlay_child_allocate (GtkOverlay *overlay,
GtkWidget *widget,
GtkOverlayLayoutChild *child)
{
GtkAllocation child_allocation;
if (!gtk_widget_get_visible (widget))
return;
gtk_overlay_compute_child_allocation (overlay, widget, child, &child_allocation);
gtk_overlay_child_update_style_classes (overlay, widget, &child_allocation);
gtk_widget_size_allocate (widget, &child_allocation, -1);
}
static void
gtk_overlay_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkWidget *child;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (widget));
if (main_widget && gtk_widget_get_visible (main_widget))
gtk_widget_size_allocate (main_widget,
&(GtkAllocation) { 0, 0, width, height },
-1);
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
if (child != main_widget)
{
GtkOverlayLayoutChild *child_data;
child_data = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (layout_manager, child));
gtk_overlay_child_allocate (GTK_OVERLAY (widget), child, child_data);
}
}
}
static GtkLayoutChild *
gtk_overlay_layout_create_layout_child (GtkLayoutManager *manager,
GtkWidget *widget,
GtkWidget *for_child)
{
return g_object_new (GTK_TYPE_OVERLAY_LAYOUT_CHILD,
"layout-manager", manager,
"child-widget", for_child,
NULL);
}
static void
gtk_overlay_layout_class_init (GtkOverlayLayoutClass *klass)
{
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
layout_class->measure = gtk_overlay_layout_measure;
layout_class->allocate = gtk_overlay_layout_allocate;
layout_class->create_layout_child = gtk_overlay_layout_create_layout_child;
}
static void
gtk_overlay_layout_init (GtkOverlayLayout *self)
{
}
GtkLayoutManager *
gtk_overlay_layout_new (void)
{
return g_object_new (GTK_TYPE_OVERLAY_LAYOUT, NULL);
}

View File

@ -0,0 +1,57 @@
/* gtkoverlaylayout.h: Overlay layout manager
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Copyright 2019 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <gtk/gtklayoutmanager.h>
G_BEGIN_DECLS
#define GTK_TYPE_OVERLAY_LAYOUT (gtk_overlay_layout_get_type ())
#define GTK_TYPE_OVERLAY_LAYOUT_CHILD (gtk_overlay_layout_child_get_type ())
/* GtkOverlayLayout */
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkOverlayLayout, gtk_overlay_layout, GTK, OVERLAY_LAYOUT, GtkLayoutManager)
GDK_AVAILABLE_IN_ALL
GtkLayoutManager * gtk_overlay_layout_new (void);
/* GtkOverlayLayoutChild */
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkOverlayLayoutChild, gtk_overlay_layout_child, GTK, OVERLAY_LAYOUT_CHILD, GtkLayoutChild)
GDK_AVAILABLE_IN_ALL
void gtk_overlay_layout_child_set_measure (GtkOverlayLayoutChild *child,
gboolean measure);
GDK_AVAILABLE_IN_ALL
gboolean gtk_overlay_layout_child_get_measure (GtkOverlayLayoutChild *child);
GDK_AVAILABLE_IN_ALL
void gtk_overlay_layout_child_set_clip_overlay (GtkOverlayLayoutChild *child,
gboolean clip_overlay);
GDK_AVAILABLE_IN_ALL
gboolean gtk_overlay_layout_child_get_clip_overlay (GtkOverlayLayoutChild *child);
G_END_DECLS

View File

@ -289,6 +289,7 @@ gtk_public_sources = files([
'gtknotebook.c',
'gtkorientable.c',
'gtkoverlay.c',
'gtkoverlaylayout.c',
'gtkpadcontroller.c',
'gtkpagesetup.c',
'gtkpaned.c',

View File

@ -137,6 +137,12 @@ canonical_boolean_value (MyParserData *data,
return b ? "1" : "0";
}
typedef enum {
PROP_KIND_OBJECT,
PROP_KIND_PACKING,
PROP_KIND_CELL_PACKING,
} PropKind;
/* A number of properties unfortunately can't be omitted even
* if they are nominally set to their default value. In many
* cases, this is due to subclasses not overriding the default
@ -144,23 +150,23 @@ canonical_boolean_value (MyParserData *data,
*/
static gboolean
needs_explicit_setting (GParamSpec *pspec,
gboolean packing)
PropKind kind)
{
struct _Prop {
const char *class;
const char *property;
gboolean packing;
PropKind kind;
} props[] = {
{ "GtkAboutDialog", "program-name", 0 },
{ "GtkCalendar", "year", 0 },
{ "GtkCalendar", "month", 0 },
{ "GtkCalendar", "day", 0 },
{ "GtkPlacesSidebar", "show-desktop", 0 },
{ "GtkRadioButton", "draw-indicator", 0 },
{ "GtkGrid", "left-attach", 1 },
{ "GtkGrid", "top-attach", 1 },
{ "GtkWidget", "hexpand", 0 },
{ "GtkWidget", "vexpand", 0 },
{ "GtkAboutDialog", "program-name", PROP_KIND_OBJECT },
{ "GtkCalendar", "year", PROP_KIND_OBJECT },
{ "GtkCalendar", "month", PROP_KIND_OBJECT },
{ "GtkCalendar", "day", PROP_KIND_OBJECT },
{ "GtkPlacesSidebar", "show-desktop", PROP_KIND_OBJECT },
{ "GtkRadioButton", "draw-indicator", PROP_KIND_OBJECT },
{ "GtkGrid", "left-attach", PROP_KIND_PACKING },
{ "GtkGrid", "top-attach", PROP_KIND_PACKING },
{ "GtkWidget", "hexpand", PROP_KIND_OBJECT },
{ "GtkWidget", "vexpand", PROP_KIND_OBJECT },
};
gboolean found;
gint k;
@ -173,7 +179,7 @@ needs_explicit_setting (GParamSpec *pspec,
{
if (strcmp (class_name, props[k].class) == 0 &&
strcmp (pspec->name, props[k].property) == 0 &&
packing == props[k].packing)
kind == props[k].kind)
{
found = TRUE;
break;
@ -186,20 +192,22 @@ needs_explicit_setting (GParamSpec *pspec,
static gboolean
keep_for_rewrite (const char *class_name,
const char *prop_name,
gboolean packing)
PropKind kind)
{
struct _Prop {
const char *class;
const char *property;
gboolean packing;
PropKind kind;
} props[] = {
{ "GtkActionBar", "pack-type", 1 },
{ "GtkHeaderBar", "pack-type", 1 },
{ "GtkPopoverMenu", "submenu", 1 },
{ "GtkToolbar", "expand", 1 },
{ "GtkToolbar", "homogeneous", 1 },
{ "GtkPaned", "resize", 1 },
{ "GtkPaned", "shrink", 1 },
{ "GtkActionBar", "pack-type", PROP_KIND_PACKING },
{ "GtkHeaderBar", "pack-type", PROP_KIND_PACKING },
{ "GtkPopoverMenu", "submenu", PROP_KIND_PACKING },
{ "GtkToolbar", "expand", PROP_KIND_PACKING },
{ "GtkToolbar", "homogeneous", PROP_KIND_PACKING },
{ "GtkPaned", "resize", PROP_KIND_PACKING },
{ "GtkPaned", "shrink", PROP_KIND_PACKING },
{ "GtkOverlay", "measure", PROP_KIND_PACKING },
{ "GtkOverlay", "clip-overlay", PROP_KIND_PACKING },
};
gboolean found;
gint k;
@ -209,7 +217,7 @@ keep_for_rewrite (const char *class_name,
{
if (strcmp (class_name, props[k].class) == 0 &&
strcmp (prop_name, props[k].property) == 0 &&
packing == props[k].packing)
kind == props[k].kind)
{
found = TRUE;
break;
@ -253,6 +261,7 @@ is_container_element (Element *element)
*/
const char *names[] = {
"packing",
"layout",
"cell-packing",
"attributes",
"action-widgets",
@ -295,8 +304,7 @@ static GParamSpec *
get_property_pspec (MyParserData *data,
const gchar *class_name,
const gchar *property_name,
gboolean packing,
gboolean cell_packing)
PropKind kind)
{
GType type;
GObjectClass *class;
@ -314,9 +322,15 @@ get_property_pspec (MyParserData *data,
class = g_type_class_ref (type);
canonical_name = g_strdup (property_name);
canonicalize_key (canonical_name);
if (packing)
switch (kind)
{
case PROP_KIND_OBJECT:
pspec = g_object_class_find_property (class, canonical_name);
break;
case PROP_KIND_PACKING:
pspec = gtk_container_class_find_child_property (class, canonical_name);
else if (cell_packing)
break;
case PROP_KIND_CELL_PACKING:
{
GObjectClass *cell_class;
@ -325,8 +339,10 @@ get_property_pspec (MyParserData *data,
pspec = gtk_cell_area_class_find_cell_property (GTK_CELL_AREA_CLASS (cell_class), canonical_name);
g_type_class_unref (cell_class);
}
else
pspec = g_object_class_find_property (class, canonical_name);
break;
default:
g_assert_not_reached ();
}
g_free (canonical_name);
g_type_class_unref (class);
@ -419,13 +435,15 @@ property_is_boolean (Element *element,
MyParserData *data)
{
GParamSpec *pspec;
gboolean packing = FALSE;
const char *class_name;
const char *property_name;
int i;
PropKind kind;
if (g_str_equal (element->parent->element_name, "packing"))
packing = TRUE;
kind = PROP_KIND_PACKING;
else
kind = PROP_KIND_OBJECT;
class_name = get_class_name (element);
property_name = "";
@ -436,7 +454,7 @@ property_is_boolean (Element *element,
property_name = (const gchar *)element->attribute_values[i];
}
pspec = get_property_pspec (data, class_name, property_name, packing, FALSE);
pspec = get_property_pspec (data, class_name, property_name, kind);
if (pspec)
return G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN;
@ -453,14 +471,15 @@ property_can_be_omitted (Element *element,
const char *class_name;
const char *property_name;
const char *value_string;
gboolean packing = FALSE;
gboolean cell_packing = FALSE;
GParamSpec *pspec;
PropKind kind;
if (g_str_equal (element->parent->element_name, "packing"))
packing = TRUE;
kind = PROP_KIND_PACKING;
if (g_str_equal (element->parent->element_name, "cell-packing"))
cell_packing = TRUE;
kind = PROP_KIND_CELL_PACKING;
else
kind = PROP_KIND_OBJECT;
class_name = get_class_name (element);
property_name = "";
@ -479,7 +498,7 @@ property_can_be_omitted (Element *element,
property_name = (const gchar *)element->attribute_values[i];
}
if (keep_for_rewrite (class_name, property_name, packing))
if (keep_for_rewrite (class_name, property_name, kind))
return FALSE; /* keep, will be rewritten */
if (translatable)
@ -488,20 +507,22 @@ property_can_be_omitted (Element *element,
if (bound)
return FALSE;
pspec = get_property_pspec (data, class_name, property_name, packing, cell_packing);
pspec = get_property_pspec (data, class_name, property_name, kind);
if (pspec == NULL)
{
if (packing)
g_printerr (_("%s: Packing property %s::%s not found\n"), data->input_filename, class_name, property_name);
else if (cell_packing)
g_printerr (_("%s: Cell property %s::%s not found\n"), data->input_filename, class_name, property_name);
else
g_printerr (_("%s: Property %s::%s not found\n"), data->input_filename, class_name, property_name);
const char *kind_str[] = {
"",
"Packing ",
"Cell "
};
g_printerr (_("%s: %sproperty %s::%s not found\n"),
kind_str[kind], data->input_filename, class_name, property_name);
return FALSE;
}
if (needs_explicit_setting (pspec, packing))
if (needs_explicit_setting (pspec, kind))
return FALSE;
return value_is_default (data, pspec, value_string);
@ -513,30 +534,32 @@ property_has_been_removed (Element *element,
{
const gchar *class_name;
const gchar *property_name;
gboolean packing = FALSE;
struct _Prop {
const char *class;
const char *property;
gboolean packing;
PropKind kind;
} props[] = {
{ "GtkActionBar", "position", 1 },
{ "GtkButtonBox", "secondary", 1 },
{ "GtkButtonBox", "non-homogeneous", 1 },
{ "GtkBox", "position", 1 },
{ "GtkBox", "pack-type", 1 },
{ "GtkHeaderBar", "position", 1 },
{ "GtkPopoverMenu", "position", 1 },
{ "GtkMenu", "left-attach", 1 },
{ "GtkMenu", "right-attach", 1 },
{ "GtkMenu", "top-attach", 1 },
{ "GtkMenu", "bottom-attach", 1 }
{ "GtkActionBar", "position", PROP_KIND_PACKING },
{ "GtkButtonBox", "secondary", PROP_KIND_PACKING },
{ "GtkButtonBox", "non-homogeneous", PROP_KIND_PACKING },
{ "GtkBox", "position", PROP_KIND_PACKING },
{ "GtkBox", "pack-type", PROP_KIND_PACKING },
{ "GtkHeaderBar", "position", PROP_KIND_PACKING },
{ "GtkPopoverMenu", "position",PROP_KIND_PACKING },
{ "GtkMenu", "left-attach", PROP_KIND_PACKING },
{ "GtkMenu", "right-attach", PROP_KIND_PACKING },
{ "GtkMenu", "top-attach", PROP_KIND_PACKING },
{ "GtkMenu", "bottom-attach", PROP_KIND_PACKING }
};
gchar *canonical_name;
gboolean found;
gint i, k;
PropKind kind;
if (g_str_equal (element->parent->element_name, "packing"))
packing = TRUE;
kind = PROP_KIND_PACKING;
else
kind = PROP_KIND_OBJECT;
class_name = get_class_name (element);
property_name = "";
@ -555,7 +578,7 @@ property_has_been_removed (Element *element,
{
if (strcmp (class_name, props[k].class) == 0 &&
strcmp (canonical_name, props[k].property) == 0 &&
packing == props[k].packing)
kind == props[k].kind)
{
found = TRUE;
break;
@ -1068,6 +1091,46 @@ rewrite_paned (Element *element,
rewrite_paned_child (element, data, child2, "child2");
}
static void
rewrite_layout_props (Element *element,
MyParserData *data)
{
GList *l, *ll;
for (l = element->children; l; l = l->next)
{
Element *child = l->data;
if (g_str_equal (child->element_name, "child"))
{
Element *object = NULL;
Element *packing = NULL;
for (ll = child->children; ll; ll = ll->next)
{
Element *elt2 = ll->data;
if (g_str_equal (elt2->element_name, "object"))
object = elt2;
if (g_str_equal (elt2->element_name, "packing"))
packing = elt2;
}
if (object && packing)
{
child->children = g_list_remove (child->children, packing);
g_free (packing->element_name);
packing->element_name = g_strdup ("layout");
packing->parent = object;
object->children = g_list_append (object->children, packing);
}
}
}
}
static gboolean
simplify_element (Element *element,
MyParserData *data)
@ -1139,6 +1202,10 @@ simplify_element (Element *element,
g_str_equal (get_class_name (element), "GtkPaned"))
rewrite_paned (element, data);
if (g_str_equal (element->element_name, "object") &&
g_str_equal (get_class_name (element), "GtkOverlay"))
rewrite_layout_props (element, data);
if (g_str_equal (element->element_name, "property") &&
property_has_been_removed (element, data))
return TRUE;

View File

@ -235,8 +235,8 @@
<object class="GtkEntry" id="preview2">
<property name="can-focus">1</property>
<property name="placeholder-text" translatable="yes">Preview text</property>
<property name="text" bind-source="preview" bind-property="text" bind-flags="bidirectional"></property>
<property name="attributes" bind-source="preview" bind-property="attributes" bind-flags="bidirectional"></property>
<property name="text" bind-source="preview" bind-property="text" bind-flags="bidirectional"/>
<property name="attributes" bind-source="preview" bind-property="attributes" bind-flags="bidirectional"/>
</object>
</child>
<child>

View File

@ -35,10 +35,10 @@
<child>
<object class="GtkScale" id="seek_scale">
<property name="adjustment">time_adjustment</property>
<property name="can_focus">True</property>
<property name="draw_value">False</property>
<property name="restrict-to-fill-level">False</property>
<property name="hexpand">True</property>
<property name="can_focus">1</property>
<property name="draw_value">0</property>
<property name="restrict-to-fill-level">0</property>
<property name="hexpand">1</property>
</object>
</child>
<child>

View File

@ -119,7 +119,6 @@
<property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="active">1</property>
<property name="draw-indicator">1</property>
<child>
<object class="GtkBox" id="box1">
<property name="spacing">6</property>
@ -146,7 +145,6 @@
<property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="active">1</property>
<property name="draw-indicator">1</property>
<property name="group">portrait_radio</property>
<child>
<object class="GtkBox" id="box2">
@ -174,7 +172,6 @@
<property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="active">1</property>
<property name="draw-indicator">1</property>
<property name="group">portrait_radio</property>
<child>
<object class="GtkBox" id="box3">
@ -201,7 +198,6 @@
<object class="GtkRadioButton" id="reverse_landscape_radio">
<property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="draw-indicator">1</property>
<property name="group">portrait_radio</property>
<child>
<object class="GtkBox" id="box4">

View File

@ -271,7 +271,6 @@
<property name="valign">center</property>
<signal name="clicked" handler="on_connect_button_clicked" object="GtkPlacesView" swapped="yes"/>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkBox">
@ -309,7 +308,6 @@
<class name="linked"/>
</style>
</object>
<packing/>
</child>
</object>
</child>

View File

@ -2,7 +2,7 @@
<requires lib="gtk+" version="3.16"/>
<template class="GtkPlacesViewRow" parent="GtkListBoxRow">
<property name="width-request">100</property>
<property name="can-focus">True</property>
<property name="can-focus">1</property>
<child>
<object class="GtkBox" id="box">
<property name="margin-start">12</property>

View File

@ -59,7 +59,7 @@
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin-start">4px</property>
<property name="visible">False</property>
<property name="visible">0</property>
</object>
</child>
</object>

View File

@ -15,10 +15,10 @@
<property name="valign">center</property>
<property name="icon-name">media-playback-start-symbolic</property>
<property name="icon-size">large</property>
</object>
<packing>
<layout>
<property name="measure">1</property>
</packing>
</layout>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="controls_revealer">
@ -31,10 +31,10 @@
</style>
</object>
</child>
</object>
<packing>
<layout>
<property name="measure">1</property>
</packing>
</layout>
</object>
</child>
</object>
</child>

View File

@ -1,23 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">600</property>
<child>
<object class="GtkOverlay" id="overlay1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="filler">
<property name="visible">True</property>
</object>
<object class="GtkDrawingArea" id="filler"/>
</child>
<child type="overlay">
<object class="GtkToolbar" id="bottom_toolbar">
<property name="visible">True</property>
<property name="show_arrow">False</property>
<property name="show_arrow">0</property>
<property name="halign">center</property>
<property name="valign">end</property>
<property name="margin_bottom">24</property>
@ -26,18 +18,12 @@
</style>
<child>
<object class="GtkToolItem" id="left_item">
<property name="visible">True</property>
<child>
<object class="GtkBox" id="left_box">
<property name="orientation">horizontal</property>
<property name="spacing">0</property>
<property name="visible">True</property>
<child>
<object class="GtkToggleButton" id="camera">
<property name="visible">True</property>
<child>
<object class="GtkImage" id="camera_icon">
<property name="visible">True</property>
<property name="icon_name">camera-web-symbolic</property>
</object>
</child>
@ -45,11 +31,9 @@
</child>
<child>
<object class="GtkToggleButton" id="volume">
<property name="visible">True</property>
<property name="active">True</property>
<property name="active">1</property>
<child>
<object class="GtkImage" id="volume_icon">
<property name="visible">True</property>
<property name="icon_name">audio-volume-medium-symbolic</property>
</object>
</child>
@ -57,11 +41,9 @@
</child>
<child>
<object class="GtkToggleButton" id="microphone">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="sensitive">0</property>
<child>
<object class="GtkImage" id="microphone_icon">
<property name="visible">True</property>
<property name="icon_name">audio-input-microphone-symbolic</property>
</object>
</child>
@ -69,12 +51,10 @@
</child>
<child>
<object class="GtkToggleButton" id="bt">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="active">True</property>
<property name="sensitive">0</property>
<property name="active">1</property>
<child>
<object class="GtkImage" id="bt_icon">
<property name="visible">True</property>
<property name="icon_name">bluetooth-active-symbolic</property>
</object>
</child>
@ -86,19 +66,14 @@
</child>
<child>
<object class="GtkSeparatorToolItem" id="toolbutton2">
<property name="draw">False</property>
<property name="visible">True</property>
<property name="expand-item">True</property>
<property name="draw">0</property>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
<object class="GtkToolItem" id="toolitem4">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="status_label">
<property name="visible">True</property>
<property name="label">OSD Toolbar</property>
<property name="margin_start">10</property>
<property name="margin_end">10</property>
@ -108,18 +83,12 @@
</child>
<child>
<object class="GtkToolItem" id="right_item">
<property name="visible">True</property>
<child>
<object class="GtkBox" id="right_box">
<property name="orientation">horizontal</property>
<property name="spacing">0</property>
<property name="visible">True</property>
<child>
<object class="GtkToggleButton" id="opt">
<property name="visible">True</property>
<child>
<object class="GtkImage" id="opt_icon">
<property name="visible">True</property>
<property name="icon_name">media-optical-symbolic</property>
</object>
</child>
@ -127,11 +96,9 @@
</child>
<child>
<object class="GtkToggleButton" id="hdd">
<property name="visible">True</property>
<property name="active">True</property>
<property name="active">1</property>
<child>
<object class="GtkImage" id="hdd_icon">
<property name="visible">True</property>
<property name="icon_name">drive-harddisk-symbolic</property>
</object>
</child>
@ -139,11 +106,9 @@
</child>
<child>
<object class="GtkToggleButton" id="joy">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="sensitive">0</property>
<child>
<object class="GtkImage" id="joy_icon">
<property name="visible">True</property>
<property name="icon_name">input-gaming-symbolic</property>
</object>
</child>
@ -157,8 +122,7 @@
</child>
<child type="overlay">
<object class="GtkToolbar" id="top_toolbar">
<property name="visible">True</property>
<property name="show_arrow">False</property>
<property name="show_arrow">0</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="margin_top">24</property>
@ -167,34 +131,28 @@
</style>
<child>
<object class="GtkToggleToolButton" id="tb1">
<property name="visible">True</property>
<property name="icon_name">edit-undo-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton" id="tb2">
<property name="visible">True</property>
<property name="icon_name">edit-redo-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton" id="tb3">
<property name="visible">True</property>
<property name="icon_name">start-here-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton" id="tb4">
<property name="visible">True</property>
<property name="icon_name">applications-science-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolItem" id="tb5">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="tb5_label">
<property name="visible">True</property>
<property name="label">Another kind of OSD toolbar</property>
<property name="margin_start">10</property>
<property name="margin_end">10</property>

View File

@ -1,24 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkOverlay" id="overlay1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child type="overlay">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">I'm the invisible label.
<property name="label" translatable="yes">I&apos;m the invisible label.
Incredible how you can
see right through me.</property>
</object>

View File

@ -1,19 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="GtkOverlay" id="overlay1">
<property name="width_request">100</property>
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
@ -22,8 +15,6 @@
</child>
<child type="overlay">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">VISIBLE</property>
</object>
</child>

View File

@ -1,22 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="GtkOverlay" id="overlay1">
<property name="width_request">100</property>
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child type="overlay">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">VISIBLE</property>
</object>
</child>