]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkbin.c
Adapt cast macros to standard.
[~andy/gtk] / gtk / gtkbin.c
index 6362eb53de0a872fcfaec7b3e16fbc6f6427829f..bfb3dfadf3019f5d91e5efc6257b5dea0cd88b47 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
 #include "gtkbin.h"
 
 
@@ -48,7 +56,7 @@ gtk_bin_get_type (void)
 
   if (!bin_type)
     {
-      GtkTypeInfo bin_info =
+      static const GtkTypeInfo bin_info =
       {
        "GtkBin",
        sizeof (GtkBin),
@@ -119,15 +127,13 @@ gtk_bin_map (GtkWidget *widget)
   GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
   bin = GTK_BIN (widget);
 
-  if (!GTK_WIDGET_NO_WINDOW (widget))
-    gdk_window_show (widget->window);
-  else
-    gtk_widget_queue_draw (widget);
-
   if (bin->child &&
       GTK_WIDGET_VISIBLE (bin->child) &&
       !GTK_WIDGET_MAPPED (bin->child))
     gtk_widget_map (bin->child);
+
+  if (!GTK_WIDGET_NO_WINDOW (widget))
+    gdk_window_show (widget->window);
 }
 
 static void
@@ -142,17 +148,11 @@ gtk_bin_unmap (GtkWidget *widget)
   bin = GTK_BIN (widget);
 
   if (GTK_WIDGET_NO_WINDOW (widget))
-    gdk_window_clear_area (widget->window,
-                          widget->allocation.x,
-                          widget->allocation.y,
-                          widget->allocation.width,
-                          widget->allocation.height);
+     gtk_widget_queue_clear (widget);
   else
     gdk_window_hide (widget->window);
 
-  if (bin->child &&
-      GTK_WIDGET_VISIBLE (bin->child) &&
-      GTK_WIDGET_MAPPED (bin->child))
+  if (bin->child && GTK_WIDGET_MAPPED (bin->child))
     gtk_widget_unmap (bin->child);
 }
 
@@ -166,13 +166,13 @@ gtk_bin_draw (GtkWidget    *widget,
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_BIN (widget));
 
-  if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
-    {
-      bin = GTK_BIN (widget);
+  bin = GTK_BIN (widget);
 
-      if (bin->child &&
+  if (GTK_WIDGET_DRAWABLE (bin))
+    {
+      if (bin->child && GTK_WIDGET_DRAWABLE (bin->child) &&
          gtk_widget_intersect (bin->child, area, &child_area))
-        gtk_widget_draw (bin->child, &child_area);
+       gtk_widget_draw (bin->child, &child_area);
     }
 }
 
@@ -192,7 +192,7 @@ gtk_bin_expose (GtkWidget      *widget,
       bin = GTK_BIN (widget);
 
       child_event = *event;
-      if (bin->child &&
+      if (bin->child && GTK_WIDGET_DRAWABLE (bin->child) &&
          GTK_WIDGET_NO_WINDOW (bin->child) &&
          gtk_widget_intersect (bin->child, &event->area, &child_event.area))
        gtk_widget_event (bin->child, (GdkEvent*) &child_event);
@@ -219,19 +219,16 @@ gtk_bin_add (GtkContainer *container,
   gtk_widget_set_parent (child, GTK_WIDGET (bin));
   bin->child = child;
 
-  if (GTK_WIDGET_VISIBLE (child->parent))
+  if (GTK_WIDGET_REALIZED (child->parent))
+    gtk_widget_realize (child);
+
+  if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child))
     {
-      if (GTK_WIDGET_REALIZED (child->parent) &&
-         !GTK_WIDGET_REALIZED (child))
-       gtk_widget_realize (child);
-      
-      if (GTK_WIDGET_MAPPED (child->parent) &&
-         !GTK_WIDGET_MAPPED (child))
+      if (GTK_WIDGET_MAPPED (child->parent))
        gtk_widget_map (child);
+
+      gtk_widget_queue_resize (child);
     }
-  
-  if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (container))
-    gtk_widget_queue_resize (child);
 }
 
 static void