]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkwidget.c
Doc update.
[~andy/gtk] / gtk / gtkwidget.c
index 8d3622ffe9e3e5e7231d64402801bfa169d667f5..58696d247dde89a717354b6306e9dd73ff252353 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <config.h>
 #include <stdarg.h>
 #include <string.h>
 #include <locale.h>
+#include "gtkalias.h"
 #include "gtkcontainer.h"
 #include "gtkaccelmap.h"
 #include "gtkclipboard.h"
@@ -1383,20 +1385,20 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                                                             P_("Focus linewidth"),
                                                             P_("Width, in pixels, of the focus indicator line"),
                                                             0, G_MAXINT, 1,
-                                                            G_PARAM_READWRITE));
+                                                            G_PARAM_READABLE));
 
   gtk_widget_class_install_style_property (klass,
                                           g_param_spec_string ("focus-line-pattern",
                                                                P_("Focus line dash pattern"),
                                                                P_("Dash pattern used to draw the focus indicator"),
                                                                "\1\1",
-                                                               G_PARAM_READWRITE));
+                                                               G_PARAM_READABLE));
   gtk_widget_class_install_style_property (klass,
                                           g_param_spec_int ("focus-padding",
                                                             P_("Focus padding"),
                                                             P_("Width, in pixels, between focus indicator and the widget 'box'"),
                                                             0, G_MAXINT, 1,
-                                                            G_PARAM_READWRITE));
+                                                            G_PARAM_READABLE));
   gtk_widget_class_install_style_property (klass,
                                           g_param_spec_boxed ("cursor-color",
                                                               P_("Cursor color"),
@@ -2942,12 +2944,14 @@ gtk_widget_real_can_activate_accel (GtkWidget *widget,
  * Determines whether an accelerator that activates the signal
  * identified by @signal_id can currently be activated.
  * This is done by emitting the GtkWidget::can-activate-accel
- * signal on @widget; if the signal isn't overriden by a
+ * signal on @widget; if the signal isn't overridden by a
  * handler or in a derived widget, then the default check is
  * that the widget must be sensitive, and the widget and all
- * its parents mapped.
+ * its ancestors mapped.
  *
  * Return value: %TRUE if the accelerator can be activated.
+ *
+ * Since: 2.4
  **/
 gboolean
 gtk_widget_can_activate_accel (GtkWidget *widget,
@@ -3301,14 +3305,14 @@ static gboolean
 gtk_widget_real_key_press_event (GtkWidget         *widget,
                                 GdkEventKey       *event)
 {
-  return _gtk_bindings_activate_event (GTK_OBJECT (widget), event);
+  return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
 }
 
 static gboolean
 gtk_widget_real_key_release_event (GtkWidget         *widget,
                                   GdkEventKey       *event)
 {
-  return _gtk_bindings_activate_event (GTK_OBJECT (widget), event);
+  return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
 }
 
 static gboolean
@@ -3800,6 +3804,22 @@ gtk_widget_region_intersect (GtkWidget *widget,
   return dest;
 }
 
+/**
+ * _gtk_widget_grab_notify:
+ * @widget: a #GtkWidget
+ * @was_grabbed: whether a grab is now in effect
+ * 
+ * Emits the signal "grab_notify" on @widget.
+ * 
+ * Since: 2.6
+ **/
+void
+_gtk_widget_grab_notify (GtkWidget *widget,
+                        gboolean   was_grabbed)
+{
+  g_signal_emit (widget, widget_signals[GRAB_NOTIFY], 0, was_grabbed);
+}
+
 /**
  * gtk_widget_grab_focus:
  * @widget: a #GtkWidget
@@ -4234,10 +4254,18 @@ gtk_widget_set_parent (GtkWidget *widget,
   GtkStateData data;
   
   g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (widget->parent == NULL);
-  g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget));
   g_return_if_fail (GTK_IS_WIDGET (parent));
   g_return_if_fail (widget != parent);
+  if (widget->parent != NULL)
+    {
+      g_warning ("Can't set a parent on widget which has a parent\n");
+      return;
+    }
+  if (GTK_WIDGET_TOPLEVEL (widget))
+    {
+      g_warning ("Can't set a parent on a toplevel widget\n");
+      return;
+    }
 
   /* keep this function in sync with gtk_menu_attach_to_widget()
    */
@@ -5012,7 +5040,9 @@ gtk_widget_create_pango_layout (GtkWidget   *widget,
  * gtk_widget_render_icon:
  * @widget: a #GtkWidget
  * @stock_id: a stock ID
- * @size: a stock size
+ * @size: a stock size. A size of (GtkIconSize)-1 means render at 
+ *     the size of the source and don't scale (if there are multiple 
+ *     source sizes, GTK+ picks one of the available sizes).
  * @detail: render detail to pass to theme engine
  * 
  * A convenience function that uses the theme engine and RC file
@@ -5040,7 +5070,7 @@ gtk_widget_render_icon (GtkWidget      *widget,
   
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
   g_return_val_if_fail (stock_id != NULL, NULL);
-  g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID, NULL);
+  g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID || size == -1, NULL);
   
   gtk_widget_ensure_style (widget);
   
@@ -6346,6 +6376,8 @@ gtk_widget_dispose (GObject *object)
 
   if (widget->parent)
     gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+  else if (GTK_WIDGET_VISIBLE (widget))
+    gtk_widget_hide (widget);
 
   GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
   if (GTK_WIDGET_REALIZED (widget))