forked from AuroraMiddleware/gtk
popover: Use a bin layout for the contents gizmo
This commit is contained in:
parent
f8303c7a22
commit
e5f1ff6a4d
@ -113,6 +113,7 @@
|
|||||||
#include "gtkeventcontrollerkey.h"
|
#include "gtkeventcontrollerkey.h"
|
||||||
#include "gtkcssnodeprivate.h"
|
#include "gtkcssnodeprivate.h"
|
||||||
#include "gtkbindings.h"
|
#include "gtkbindings.h"
|
||||||
|
#include "gtkbinlayout.h"
|
||||||
#include "gtkenums.h"
|
#include "gtkenums.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkmnemonichash.h"
|
#include "gtkmnemonichash.h"
|
||||||
@ -504,39 +505,6 @@ surface_moved_to_rect (GdkSurface *surface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
measure_contents (GtkGizmo *gizmo,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
int for_size,
|
|
||||||
int *minimum,
|
|
||||||
int *natural,
|
|
||||||
int *minimum_baseline,
|
|
||||||
int *natural_baseline)
|
|
||||||
{
|
|
||||||
GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
|
|
||||||
|
|
||||||
if (child)
|
|
||||||
gtk_widget_measure (child, orientation, for_size,
|
|
||||||
minimum, natural,
|
|
||||||
minimum_baseline, natural_baseline);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
allocate_contents (GtkGizmo *gizmo,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
int baseline)
|
|
||||||
{
|
|
||||||
GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
|
|
||||||
|
|
||||||
if (child)
|
|
||||||
gtk_widget_size_allocate (child,
|
|
||||||
&(GtkAllocation) { 0, 0, width, height
|
|
||||||
}, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_popover_activate_default (GtkPopover *popover)
|
gtk_popover_activate_default (GtkPopover *popover)
|
||||||
{
|
{
|
||||||
@ -622,11 +590,8 @@ gtk_popover_init (GtkPopover *popover)
|
|||||||
G_CALLBACK (node_style_changed_cb), popover, 0);
|
G_CALLBACK (node_style_changed_cb), popover, 0);
|
||||||
g_object_unref (priv->arrow_node);
|
g_object_unref (priv->arrow_node);
|
||||||
|
|
||||||
priv->contents_widget = gtk_gizmo_new ("contents",
|
priv->contents_widget = gtk_gizmo_new ("contents", NULL, NULL, NULL, NULL);
|
||||||
measure_contents,
|
gtk_widget_set_layout_manager (priv->contents_widget, gtk_bin_layout_new ());
|
||||||
allocate_contents,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
gtk_widget_set_parent (priv->contents_widget, GTK_WIDGET (popover));
|
gtk_widget_set_parent (priv->contents_widget, GTK_WIDGET (popover));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (popover));
|
context = gtk_widget_get_style_context (GTK_WIDGET (popover));
|
||||||
|
Loading…
Reference in New Issue
Block a user