* 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"
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"),
* 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,
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
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
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()
*/
* 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
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);
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))