]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkinvisible.c
GtkWidget::draw() - Document how to get the dirty region
[~andy/gtk] / gtk / gtkinvisible.c
index dc349e990b9f8688caf50c293482d265482b0666..27ca2502cbc66b18a5342a035c9d71d80591675d 100644 (file)
@@ -12,9 +12,7 @@
  * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
 #include "config.h"
 #include <gdk/gdk.h>
 #include "gtkinvisible.h"
+#include "gtkwidgetprivate.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
+
+/**
+ * SECTION:gtkinvisible
+ * @Short_description: A widget which is not displayed
+ * @Title: GtkInvisible
+ *
+ * The #GtkInvisible widget is used internally in GTK+, and is probably not
+ * very useful for application developers.
+ *
+ * It is used for reliable pointer grabs and selection handling in the code
+ * for drag-and-drop.
+ */
+
+
 struct _GtkInvisiblePrivate
 {
   GdkScreen    *screen;
@@ -42,10 +55,9 @@ enum {
   LAST_ARG
 };
 
-static void gtk_invisible_destroy       (GtkObject         *object);
+static void gtk_invisible_destroy       (GtkWidget         *widget);
 static void gtk_invisible_realize       (GtkWidget         *widget);
-static void gtk_invisible_style_set     (GtkWidget         *widget,
-                                        GtkStyle          *previous_style);
+static void gtk_invisible_style_updated (GtkWidget         *widget);
 static void gtk_invisible_show          (GtkWidget         *widget);
 static void gtk_invisible_size_allocate (GtkWidget         *widget,
                                         GtkAllocation     *allocation);
@@ -68,19 +80,17 @@ static void
 gtk_invisible_class_init (GtkInvisibleClass *class)
 {
   GObjectClass  *gobject_class;
-  GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;
 
   widget_class = (GtkWidgetClass*) class;
-  object_class = (GtkObjectClass*) class;
   gobject_class = (GObjectClass*) class;
 
   widget_class->realize = gtk_invisible_realize;
-  widget_class->style_set = gtk_invisible_style_set;
+  widget_class->style_updated = gtk_invisible_style_updated;
   widget_class->show = gtk_invisible_show;
   widget_class->size_allocate = gtk_invisible_size_allocate;
+  widget_class->destroy = gtk_invisible_destroy;
 
-  object_class->destroy = gtk_invisible_destroy;
   gobject_class->set_property = gtk_invisible_set_property;
   gobject_class->get_property = gtk_invisible_get_property;
   gobject_class->constructor = gtk_invisible_constructor;
@@ -100,7 +110,6 @@ static void
 gtk_invisible_init (GtkInvisible *invisible)
 {
   GtkInvisiblePrivate *priv;
-  GdkColormap *colormap;
 
   invisible->priv = G_TYPE_INSTANCE_GET_PRIVATE (invisible,
                                                  GTK_TYPE_INVISIBLE,
@@ -114,16 +123,12 @@ gtk_invisible_init (GtkInvisible *invisible)
 
   priv->has_user_ref_count = TRUE;
   priv->screen = gdk_screen_get_default ();
-
-  colormap = _gtk_widget_peek_colormap ();
-  if (colormap)
-    gtk_widget_set_colormap (GTK_WIDGET (invisible), colormap);
 }
 
 static void
-gtk_invisible_destroy (GtkObject *object)
+gtk_invisible_destroy (GtkWidget *widget)
 {
-  GtkInvisible *invisible = GTK_INVISIBLE (object);
+  GtkInvisible *invisible = GTK_INVISIBLE (widget);
   GtkInvisiblePrivate *priv = invisible->priv;
 
   if (priv->has_user_ref_count)
@@ -132,7 +137,7 @@ gtk_invisible_destroy (GtkObject *object)
       g_object_unref (invisible);
     }
 
-  GTK_OBJECT_CLASS (gtk_invisible_parent_class)->destroy (object);  
+  GTK_WIDGET_CLASS (gtk_invisible_parent_class)->destroy (widget);
 }
 
 /**
@@ -216,7 +221,7 @@ gtk_invisible_set_screen (GtkInvisible *invisible,
  *
  * Returns the #GdkScreen object associated with @invisible
  *
- * Return value: the associated #GdkScreen.
+ * Return value: (transfer none): the associated #GdkScreen.
  *
  * Since: 2.2
  **/
@@ -255,14 +260,11 @@ gtk_invisible_realize (GtkWidget *widget)
 
   window = gdk_window_new (parent, &attributes, attributes_mask);
   gtk_widget_set_window (widget, window);
-  gdk_window_set_user_data (window, widget);
-
-  gtk_widget_style_attach (widget);
+  gtk_widget_register_window (widget, window);
 }
 
 static void
-gtk_invisible_style_set (GtkWidget *widget,
-                        GtkStyle  *previous_style)
+gtk_invisible_style_updated (GtkWidget *widget)
 {
   /* Don't chain up to parent implementation */
 }
@@ -270,7 +272,7 @@ gtk_invisible_style_set (GtkWidget *widget,
 static void
 gtk_invisible_show (GtkWidget *widget)
 {
-  GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+  _gtk_widget_set_visible_flag (widget, TRUE);
   gtk_widget_map (widget);
 }