Implement gtk_event_box_get/set_input_only()

2003-09-08  Alexander Larsson  <alexl@redhat.com>

	* gtk/gtkeventbox.[hc]:
	Implement gtk_event_box_get/set_input_only()

	* tests/testgtk.c:
	Tests for the new input only event boxes
This commit is contained in:
Alexander Larsson 2003-09-08 20:04:49 +00:00 committed by Alexander Larsson
parent 51f98b6a70
commit 0217c9dbfb
8 changed files with 615 additions and 38 deletions

View File

@ -1,3 +1,11 @@
2003-09-08 Alexander Larsson <alexl@redhat.com>
* gtk/gtkeventbox.[hc]:
Implement gtk_event_box_get/set_input_only()
* tests/testgtk.c:
Tests for the new input only event boxes
Mon Sep 8 21:44:20 2003 Kristian Rietveld <kris@gtk.org>
Fixes from David Hampton <hampton@employees.org> via gtk-devel-list.

View File

@ -1,3 +1,11 @@
2003-09-08 Alexander Larsson <alexl@redhat.com>
* gtk/gtkeventbox.[hc]:
Implement gtk_event_box_get/set_input_only()
* tests/testgtk.c:
Tests for the new input only event boxes
Mon Sep 8 21:44:20 2003 Kristian Rietveld <kris@gtk.org>
Fixes from David Hampton <hampton@employees.org> via gtk-devel-list.

View File

@ -1,3 +1,11 @@
2003-09-08 Alexander Larsson <alexl@redhat.com>
* gtk/gtkeventbox.[hc]:
Implement gtk_event_box_get/set_input_only()
* tests/testgtk.c:
Tests for the new input only event boxes
Mon Sep 8 21:44:20 2003 Kristian Rietveld <kris@gtk.org>
Fixes from David Hampton <hampton@employees.org> via gtk-devel-list.

View File

@ -1,3 +1,11 @@
2003-09-08 Alexander Larsson <alexl@redhat.com>
* gtk/gtkeventbox.[hc]:
Implement gtk_event_box_get/set_input_only()
* tests/testgtk.c:
Tests for the new input only event boxes
Mon Sep 8 21:44:20 2003 Kristian Rietveld <kris@gtk.org>
Fixes from David Hampton <hampton@employees.org> via gtk-devel-list.

View File

@ -1,3 +1,11 @@
2003-09-08 Alexander Larsson <alexl@redhat.com>
* gtk/gtkeventbox.[hc]:
Implement gtk_event_box_get/set_input_only()
* tests/testgtk.c:
Tests for the new input only event boxes
Mon Sep 8 21:44:20 2003 Kristian Rietveld <kris@gtk.org>
Fixes from David Hampton <hampton@employees.org> via gtk-devel-list.

View File

@ -25,20 +25,45 @@
*/
#include "gtkeventbox.h"
#include "gtkintl.h"
typedef struct
{
gboolean above_child;
GdkWindow *event_window;
} GtkEventBoxPrivate;
enum {
PROP_0,
PROP_VISIBLE_WINDOW,
PROP_ABOVE_CHILD
};
static void gtk_event_box_class_init (GtkEventBoxClass *klass);
static void gtk_event_box_init (GtkEventBox *event_box);
static void gtk_event_box_realize (GtkWidget *widget);
static void gtk_event_box_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_event_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_event_box_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_event_box_expose (GtkWidget *widget,
GdkEventExpose *event);
#define GTK_EVENT_BOX_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_EVENT_BOX, GtkEventBoxPrivate)
static void gtk_event_box_class_init (GtkEventBoxClass *klass);
static void gtk_event_box_init (GtkEventBox *event_box);
static void gtk_event_box_realize (GtkWidget *widget);
static void gtk_event_box_unrealize (GtkWidget *widget);
static void gtk_event_box_map (GtkWidget *widget);
static void gtk_event_box_unmap (GtkWidget *widget);
static void gtk_event_box_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_event_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_event_box_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_event_box_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_event_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_event_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GtkBinClass *parent_class = NULL;
@ -72,22 +97,49 @@ gtk_event_box_get_type (void)
static void
gtk_event_box_class_init (GtkEventBoxClass *class)
{
GtkWidgetClass *widget_class;
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
parent_class = g_type_class_peek_parent (class);
widget_class = (GtkWidgetClass*) class;
gobject_class->set_property = gtk_event_box_set_property;
gobject_class->get_property = gtk_event_box_get_property;
widget_class->realize = gtk_event_box_realize;
widget_class->unrealize = gtk_event_box_unrealize;
widget_class->map = gtk_event_box_map;
widget_class->unmap = gtk_event_box_unmap;
widget_class->size_request = gtk_event_box_size_request;
widget_class->size_allocate = gtk_event_box_size_allocate;
widget_class->expose_event = gtk_event_box_expose;
g_object_class_install_property (gobject_class,
PROP_VISIBLE_WINDOW,
g_param_spec_boolean ("visible-window",
_("Visible Window"),
_(" Whether the event box is visible, as opposed to invisible and only used to trap events."),
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_ABOVE_CHILD,
g_param_spec_boolean ("above-child",
_("Above child"),
_("Whether the event-trapping window of the eventbox is above the window of the child widget as opposed to below it."),
FALSE,
G_PARAM_READWRITE));
g_type_class_add_private (class, sizeof (GtkEventBoxPrivate));
}
static void
gtk_event_box_init (GtkEventBox *event_box)
{
GtkEventBoxPrivate *priv;
GTK_WIDGET_UNSET_FLAGS (event_box, GTK_NO_WINDOW);
priv = GTK_EVENT_BOX_GET_PRIVATE (event_box);
priv->above_child = FALSE;
}
GtkWidget*
@ -96,12 +148,267 @@ gtk_event_box_new (void)
return g_object_new (GTK_TYPE_EVENT_BOX, NULL);
}
static void
gtk_event_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkEventBox *event_box;
event_box = GTK_EVENT_BOX (object);
switch (prop_id)
{
case PROP_VISIBLE_WINDOW:
gtk_event_box_set_visible_window (event_box, g_value_get_boolean (value));
break;
case PROP_ABOVE_CHILD:
gtk_event_box_set_above_child (event_box, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_event_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkEventBox *event_box;
event_box = GTK_EVENT_BOX (object);
switch (prop_id)
{
case PROP_VISIBLE_WINDOW:
g_value_set_boolean (value, gtk_event_box_get_visible_window (event_box));
break;
case PROP_ABOVE_CHILD:
g_value_set_boolean (value, gtk_event_box_get_above_child (event_box));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/**
* gtk_event_box_get_visible_window:
* @event_box: a #GtkEventBox
*
* Returns whether the event box has a visible window.
* See gtk_event_box_set_visible_window() for details.
*
* Return value: %TRUE if the event box window is visible
*
* Since: 2.4
**/
gboolean
gtk_event_box_get_visible_window (GtkEventBox *event_box)
{
g_return_val_if_fail (GTK_IS_EVENT_BOX (event_box), FALSE);
return !GTK_WIDGET_NO_WINDOW (event_box);
}
/**
* gtk_event_box_set_visible_window:
* @event_box: a #GtkEventBox
* @visible_window: boolean value
*
* Set whether the event box uses a visible or invisible child
* window. The default is to use visible windows.
*
* In an invisible window event box, the window that that the
* event box creates is a %GDK_INPUT_ONLY window, which
* means that it is invisible and only serves to receive
* events.
*
* A visible window event box creates a visible (%GDK_INPUT_OUTPUT)
* window that acts as the parent window for all the widgets
* contained in the event box.
*
* You should generally make your event box invisible if
* you just want to trap events. Creating a visible window
* may cause artifacts that are visible to the user, especially
* if the user is using a theme with gradients or pixmaps.
*
* The main reason to create a non input-only event box is if
* you want to set the background to a different color or
* draw on it.
*
* <note>
* There is one unexpected issue for an invisible event box that has its
* window below the child. (See gtk_event_box_set_above_child().)
* Since the input-only window is not an ancestor window of any windows
* that descendent widgets of the event box create, events on these
* windows aren't propagated up by the windowing system, but only by GTK+.
* The practical effect of this is if an event isn't in the event
* mask for the descendant window (see gtk_widget_add_events()),
* it won't be received by the event box.
*
* This problem doesn't occur for visible event boxes, because in
* that case, the event box window is actually the ancestor of the
* descendant windows, not just at the same place on the screen.
* </note>
*
* Since: 2.4
**/
void
gtk_event_box_set_visible_window (GtkEventBox *event_box,
gboolean visible_window)
{
GtkWidget *widget;
GtkEventBoxPrivate *priv;
g_return_if_fail (GTK_IS_EVENT_BOX (event_box));
widget = GTK_WIDGET (event_box);
priv = GTK_EVENT_BOX_GET_PRIVATE (event_box);
visible_window = visible_window != FALSE;
if (visible_window != !GTK_WIDGET_NO_WINDOW (widget))
{
if (GTK_WIDGET_REALIZED (widget))
{
gboolean visible = GTK_WIDGET_VISIBLE (widget);
if (visible)
gtk_widget_hide (widget);
gtk_widget_unrealize (widget);
if (visible_window)
GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
else
GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
gtk_widget_realize (widget);
if (visible)
gtk_widget_show (widget);
}
else
{
if (visible_window)
GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
else
GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
}
if (GTK_WIDGET_VISIBLE (widget))
gtk_widget_queue_resize (widget);
g_object_notify (G_OBJECT (event_box), "visible-window");
}
}
/**
* gtk_event_box_get_above_child:
* @event_box: a #GtkEventBox
*
* Returns whether the event box window is above or below the
* windows of its child. See gtk_event_box_set_above_child() for
* details.
*
* Return value: %TRUE if the event box window is above the window
* of its child.
*
* Since: 2.4
**/
gboolean
gtk_event_box_get_above_child (GtkEventBox *event_box)
{
GtkEventBoxPrivate *priv;
g_return_val_if_fail (GTK_IS_EVENT_BOX (event_box), FALSE);
priv = GTK_EVENT_BOX_GET_PRIVATE (event_box);
return priv->above_child;
}
/**
* gtk_event_box_set_above_child:
* @event_box: a #GtkEventBox
* @above_child: %TRUE if the event box window is above the windows of its child
*
* Set whether the event box window is positioned above the windows of its child,
* as opposed to below it. If the window is above, all events inside the
* event box will go to the event box. If the window is below, events
* in windows of child widgets will first got to that widget, and then
* to its parents.
*
* The default is to keep the window below the child.
*
* Since: 2.4
**/
void
gtk_event_box_set_above_child (GtkEventBox *event_box,
gboolean above_child)
{
GtkWidget *widget;
GtkEventBoxPrivate *priv;
g_return_if_fail (GTK_IS_EVENT_BOX (event_box));
widget = GTK_WIDGET (event_box);
priv = GTK_EVENT_BOX_GET_PRIVATE (event_box);
above_child = above_child != FALSE;
if (priv->above_child != above_child)
{
if (GTK_WIDGET_REALIZED (widget))
{
if (GTK_WIDGET_NO_WINDOW (widget))
{
if (above_child)
gdk_window_raise (priv->event_window);
else
gdk_window_lower (priv->event_window);
}
else
{
gboolean visible = GTK_WIDGET_VISIBLE (widget);
if (visible)
gtk_widget_hide (widget);
gtk_widget_unrealize (widget);
priv->above_child = above_child;
gtk_widget_realize (widget);
if (visible)
gtk_widget_show (widget);
}
}
else
priv->above_child = above_child;
if (GTK_WIDGET_VISIBLE (widget))
gtk_widget_queue_resize (widget);
g_object_notify (G_OBJECT (event_box), "above-child");
}
}
static void
gtk_event_box_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
gint border_width;
GtkEventBoxPrivate *priv;
gboolean visible_window;
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
@ -112,9 +419,6 @@ gtk_event_box_realize (GtkWidget *widget)
attributes.width = widget->allocation.width - 2*border_width;
attributes.height = widget->allocation.height - 2*border_width;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_BUTTON_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
@ -123,15 +427,95 @@ gtk_event_box_realize (GtkWidget *widget)
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
priv = GTK_EVENT_BOX_GET_PRIVATE (widget);
visible_window = !GTK_WIDGET_NO_WINDOW (widget);
if (visible_window)
{
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
}
else
{
widget->window = gtk_widget_get_parent_window (widget);
g_object_ref (widget->window);
}
if (!visible_window || priv->above_child)
{
attributes.wclass = GDK_INPUT_ONLY;
attributes_mask = GDK_WA_X | GDK_WA_Y;
priv->event_window = gdk_window_new (widget->window,
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
}
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
if (visible_window)
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
static void
gtk_event_box_unrealize (GtkWidget *widget)
{
GtkEventBox *event_box;
GtkEventBoxPrivate *priv;
event_box = GTK_EVENT_BOX (widget);
priv = GTK_EVENT_BOX_GET_PRIVATE (widget);
if (priv->event_window != NULL)
{
gdk_window_set_user_data (priv->event_window, NULL);
gdk_window_destroy (priv->event_window);
priv->event_window = NULL;
}
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
static void
gtk_event_box_map (GtkWidget *widget)
{
GtkEventBoxPrivate *priv;
priv = GTK_EVENT_BOX_GET_PRIVATE (widget);
if (priv->event_window != NULL && !priv->above_child)
gdk_window_show (priv->event_window);
(* GTK_WIDGET_CLASS (parent_class)->map) (widget);
if (priv->event_window != NULL && priv->above_child)
gdk_window_show (priv->event_window);
}
static void
gtk_event_box_unmap (GtkWidget *widget)
{
GtkEventBoxPrivate *priv;
priv = GTK_EVENT_BOX_GET_PRIVATE (widget);
if (priv->event_window != NULL)
gdk_window_hide (priv->event_window);
(* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
}
static void
gtk_event_box_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@ -154,32 +538,49 @@ gtk_event_box_size_request (GtkWidget *widget,
static void
gtk_event_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
GtkAllocation *allocation)
{
GtkBin *bin;
GtkAllocation child_allocation;
GtkEventBoxPrivate *priv;
widget->allocation = *allocation;
bin = GTK_BIN (widget);
child_allocation.x = 0;
child_allocation.y = 0;
if (GTK_WIDGET_NO_WINDOW (widget))
{
child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width;
child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width;
}
else
{
child_allocation.x = 0;
child_allocation.y = 0;
}
child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0);
child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0);
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
allocation->x + GTK_CONTAINER (widget)->border_width,
allocation->y + GTK_CONTAINER (widget)->border_width,
child_allocation.width,
child_allocation.height);
priv = GTK_EVENT_BOX_GET_PRIVATE (widget);
if (priv->event_window != NULL)
gdk_window_move_resize (priv->event_window,
child_allocation.x,
child_allocation.y,
child_allocation.width,
child_allocation.height);
if (!GTK_WIDGET_NO_WINDOW (widget))
gdk_window_move_resize (widget->window,
allocation->x + GTK_CONTAINER (widget)->border_width,
allocation->y + GTK_CONTAINER (widget)->border_width,
child_allocation.width,
child_allocation.height);
}
if (bin->child)
{
gtk_widget_size_allocate (bin->child, &child_allocation);
}
gtk_widget_size_allocate (bin->child, &child_allocation);
}
static void
@ -199,7 +600,8 @@ gtk_event_box_expose (GtkWidget *widget,
{
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_event_box_paint (widget, &event->area);
if (!GTK_WIDGET_NO_WINDOW (widget))
gtk_event_box_paint (widget, &event->area);
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}

View File

@ -44,7 +44,6 @@ extern "C" {
#define GTK_IS_EVENT_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EVENT_BOX))
#define GTK_EVENT_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_EVENT_BOX, GtkEventBoxClass))
typedef struct _GtkEventBox GtkEventBox;
typedef struct _GtkEventBoxClass GtkEventBoxClass;
@ -58,8 +57,14 @@ struct _GtkEventBoxClass
GtkBinClass parent_class;
};
GType gtk_event_box_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_event_box_new (void);
GType gtk_event_box_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_event_box_new (void);
gboolean gtk_event_box_get_visible_window (GtkEventBox *event_box);
void gtk_event_box_set_visible_window (GtkEventBox *event_box,
gboolean visible_window);
gboolean gtk_event_box_get_above_child (GtkEventBox *event_box);
void gtk_event_box_set_above_child (GtkEventBox *event_box,
gboolean above_child);
#ifdef __cplusplus
}

View File

@ -4434,6 +4434,135 @@ create_entry (GtkWidget *widget)
gtk_widget_destroy (window);
}
/* GtkEventBox */
static void
event_box_label_pressed (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
g_print ("clicked on event box\n");
}
static void
event_box_button_clicked (GtkWidget *widget,
GtkWidget *button,
gpointer user_data)
{
g_print ("pushed button\n");
}
static void
event_box_toggle_visible_window (GtkWidget *checkbutton,
GtkEventBox *event_box)
{
gtk_event_box_set_visible_window (event_box,
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
static void
event_box_toggle_above_child (GtkWidget *checkbutton,
GtkEventBox *event_box)
{
gtk_event_box_set_above_child (event_box,
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
static void
create_event_box (GtkWidget *widget)
{
static GtkWidget *window = NULL;
GtkWidget *box1;
GtkWidget *box2;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *button;
GtkWidget *separator;
GtkWidget *event_box;
GtkWidget *label;
GtkWidget *visible_window_check;
GtkWidget *above_child_check;
GdkColor color;
if (!window)
{
color.red = 0;
color.blue = 65535;
color.green = 0;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&window);
gtk_window_set_title (GTK_WINDOW (window), "event box");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &color);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box1), hbox, TRUE, FALSE, 0);
event_box = gtk_event_box_new ();
gtk_box_pack_start (GTK_BOX (hbox), event_box, TRUE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (event_box), vbox);
g_signal_connect (event_box, "button_press_event",
G_CALLBACK (event_box_label_pressed),
NULL);
label = gtk_label_new ("Click on this label");
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
button = gtk_button_new_with_label ("button in eventbox");
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, FALSE, 0);
g_signal_connect (button, "clicked",
G_CALLBACK (event_box_button_clicked),
NULL);
visible_window_check = gtk_check_button_new_with_label("Visible Window");
gtk_box_pack_start (GTK_BOX (box1), visible_window_check, FALSE, TRUE, 0);
g_signal_connect (visible_window_check, "toggled",
G_CALLBACK (event_box_toggle_visible_window), event_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (visible_window_check), FALSE);
above_child_check = gtk_check_button_new_with_label("Above Child");
gtk_box_pack_start (GTK_BOX (box1), above_child_check, FALSE, TRUE, 0);
g_signal_connect (above_child_check, "toggled",
G_CALLBACK (event_box_toggle_above_child), event_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (above_child_check), FALSE);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
}
/*
* GtkSizeGroup
*/
@ -12310,6 +12439,7 @@ struct {
{ "dialog", create_dialog },
{ "display & screen", create_display_screen },
{ "entry", create_entry },
{ "event box", create_event_box },
{ "event watcher", create_event_watcher },
{ "file selection", create_file_selection },
{ "flipping", create_flipping },