forked from AuroraMiddleware/gtk
widget: Implement map/unmap with child widgets
Once again, do what GtkContainer did before.
This commit is contained in:
parent
b15b9e028f
commit
8ef73660e4
@ -326,8 +326,6 @@ static gint gtk_container_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static void gtk_container_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot);
|
||||
static void gtk_container_map (GtkWidget *widget);
|
||||
static void gtk_container_unmap (GtkWidget *widget);
|
||||
static GtkSizeRequestMode gtk_container_get_request_mode (GtkWidget *widget);
|
||||
|
||||
static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *container,
|
||||
@ -464,8 +462,6 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
widget_class->compute_expand = gtk_container_compute_expand;
|
||||
widget_class->snapshot = gtk_container_snapshot;
|
||||
widget_class->draw = gtk_container_draw;
|
||||
widget_class->map = gtk_container_map;
|
||||
widget_class->unmap = gtk_container_unmap;
|
||||
widget_class->focus = gtk_container_focus;
|
||||
widget_class->get_request_mode = gtk_container_get_request_mode;
|
||||
|
||||
@ -3087,36 +3083,6 @@ gtk_container_snapshot (GtkWidget *widget,
|
||||
snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_map_child (GtkWidget *child,
|
||||
gpointer client_data)
|
||||
{
|
||||
if (_gtk_widget_get_visible (child) &&
|
||||
_gtk_widget_get_child_visible (child) &&
|
||||
!_gtk_widget_get_mapped (child))
|
||||
gtk_widget_map (child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_map (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
||||
|
||||
gtk_container_forall (GTK_CONTAINER (widget),
|
||||
gtk_container_map_child,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_unmap (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
||||
|
||||
gtk_container_forall (GTK_CONTAINER (widget),
|
||||
(GtkCallback)gtk_widget_unmap,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_container_should_propagate_draw (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
|
@ -10636,10 +10636,21 @@ gtk_widget_real_map (GtkWidget *widget)
|
||||
|
||||
if (!_gtk_widget_get_mapped (widget))
|
||||
{
|
||||
GtkWidget *p;
|
||||
priv->mapped = TRUE;
|
||||
|
||||
if (_gtk_widget_get_has_window (widget))
|
||||
gdk_window_show (priv->window);
|
||||
gdk_window_show (priv->window);
|
||||
|
||||
for (p = gtk_widget_get_first_child (widget);
|
||||
p != NULL;
|
||||
p = gtk_widget_get_next_sibling (p))
|
||||
{
|
||||
if (_gtk_widget_get_visible (p) &&
|
||||
_gtk_widget_get_child_visible (p) &&
|
||||
!_gtk_widget_get_mapped (p))
|
||||
gtk_widget_map (p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10658,10 +10669,18 @@ gtk_widget_real_unmap (GtkWidget *widget)
|
||||
|
||||
if (_gtk_widget_get_mapped (widget))
|
||||
{
|
||||
GtkWidget *child;
|
||||
priv->mapped = FALSE;
|
||||
|
||||
if (_gtk_widget_get_has_window (widget))
|
||||
gdk_window_hide (priv->window);
|
||||
gdk_window_hide (priv->window);
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
gtk_widget_unmap (child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user