diff options
author | Owen Taylor <otaylor@src.gnome.org> | 1998-10-18 22:52:25 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-10-18 22:52:25 +0000 |
commit | 58d21d03f681960f4d4f4ddade0a5174bb89c499 (patch) | |
tree | f1aa300ec77bd776e1cfb0f75eaa685777f45004 | |
parent | f7bcb456072dac59b1ce5bd5329282ba95a3b495 (diff) | |
download | gtk+-58d21d03f681960f4d4f4ddade0a5174bb89c499.tar.gz |
Missed two files.
-rw-r--r-- | gtk/gtkinvisible.c | 121 | ||||
-rw-r--r-- | gtk/gtkinvisible.h | 61 |
2 files changed, 182 insertions, 0 deletions
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c new file mode 100644 index 0000000000..b9c3e181f9 --- /dev/null +++ b/gtk/gtkinvisible.c @@ -0,0 +1,121 @@ +/* GTK - The GIMP Toolkit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#include "gtksignal.h" +#include "gtkinvisible.h" + +static void gtk_invisible_class_init (GtkInvisibleClass *klass); +static void gtk_invisible_init (GtkInvisible *invisible); +static void gtk_invisible_realize (GtkWidget *widget); +static void gtk_invisible_show (GtkWidget *widget); +static void gtk_invisible_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); + +GtkType +gtk_invisible_get_type (void) +{ + static GtkType invisible_type = 0; + + if (!invisible_type) + { + GtkTypeInfo invisible_info = + { + "GtkInvisible", + sizeof (GtkInvisible), + sizeof (GtkInvisibleClass), + (GtkClassInitFunc) gtk_invisible_class_init, + (GtkObjectInitFunc) gtk_invisible_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + invisible_type = gtk_type_unique (gtk_widget_get_type (), &invisible_info); + } + + return invisible_type; +} + +static void +gtk_invisible_class_init (GtkInvisibleClass *class) +{ + GtkWidgetClass *widget_class; + + widget_class = (GtkWidgetClass*) class; + + widget_class->realize = gtk_invisible_realize; + widget_class->show = gtk_invisible_show; + widget_class->size_allocate = gtk_invisible_size_allocate; +} + +static void +gtk_invisible_init (GtkInvisible *invisible) +{ + GTK_WIDGET_UNSET_FLAGS (invisible, GTK_NO_WINDOW); + + gtk_widget_ref (GTK_WIDGET (invisible)); + gtk_object_sink (GTK_OBJECT (invisible)); +} + +GtkWidget* +gtk_invisible_new (void) +{ + return GTK_WIDGET ( gtk_type_new (gtk_invisible_get_type ())); +} + +static void +gtk_invisible_realize (GtkWidget *widget) +{ + GdkWindowAttr attributes; + gint attributes_mask; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_INVISIBLE (widget)); + + GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + + attributes.x = -100; + attributes.y = -100; + attributes.width = 10; + attributes.height = 10; + attributes.window_type = GDK_WINDOW_TEMP; + attributes.wclass = GDK_INPUT_ONLY; + attributes.override_redirect = TRUE; + attributes.event_mask = gtk_widget_get_events (widget); + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR; + + widget->window = gdk_window_new (NULL, &attributes, attributes_mask); + gdk_window_set_user_data (widget->window, widget); +} + +static void +gtk_invisible_show (GtkWidget *widget) +{ + g_return_if_fail (widget != NULL); + + GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE); + gtk_widget_map (widget); +} + +static void +gtk_invisible_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) +{ + widget->allocation = *allocation; +} diff --git a/gtk/gtkinvisible.h b/gtk/gtkinvisible.h new file mode 100644 index 0000000000..9abb9ba0f5 --- /dev/null +++ b/gtk/gtkinvisible.h @@ -0,0 +1,61 @@ +/* GTK - The GIMP Toolkit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GTK_INVISIBLE_H__ +#define __GTK_INVISIBLE_H__ + + +#include <gdk/gdk.h> +#include <gtk/gtkbin.h> + + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + + +#define GTK_TYPE_INVISIBLE (gtk_invisible_get_type ()) +#define GTK_INVISIBLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_INVISIBLE, GtkInvisible)) +#define GTK_INVISIBLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_INVISIBLE, GtkInvisibleClass)) +#define GTK_IS_INVISIBLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_INVISIBLE)) +#define GTK_IS_INVISIBLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_INVISIBLE)) + + +typedef struct _GtkInvisible GtkInvisible; +typedef struct _GtkInvisibleClass GtkInvisibleClass; + +struct _GtkInvisible +{ + GtkBin bin; +}; + +struct _GtkInvisibleClass +{ + GtkBinClass parent_class; +}; + +GtkType gtk_invisible_get_type (void); +GtkWidget* gtk_invisible_new (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_INVISIBLE_H__ */ |