GtkTextDirection previous_direction);
static void gtk_widget_real_grab_focus (GtkWidget *focus_widget);
-static void gtk_widget_real_show_help (GtkWidget *widget,
+static gboolean gtk_widget_real_show_help (GtkWidget *widget,
GtkWidgetHelpType help_type);
static void gtk_widget_dispatch_child_properties_changed (GtkWidget *object,
static void gtk_widget_set_style_internal (GtkWidget *widget,
GtkStyle *style,
gboolean initial_emission);
-static void gtk_widget_set_style_recurse (GtkWidget *widget,
- gpointer client_data);
static gint gtk_widget_event_internal (GtkWidget *widget,
GdkEvent *event);
static gboolean gtk_widget_real_mnemonic_activate (GtkWidget *widget,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
widget_signals[POPUP_MENU] =
- gtk_signal_new ("popup_menu",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkWidgetClass, popup_menu),
- _gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("popup_menu",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ GTK_SIGNAL_OFFSET (GtkWidgetClass, popup_menu),
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__VOID,
+ G_TYPE_BOOLEAN, 0);
widget_signals[SHOW_HELP] =
- gtk_signal_new ("show_help",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkWidgetClass, show_help),
- _gtk_marshal_NONE__ENUM,
- GTK_TYPE_NONE, 1, GTK_TYPE_WIDGET_HELP_TYPE);
+ g_signal_new ("show_help",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ GTK_SIGNAL_OFFSET (GtkWidgetClass, show_help),
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__ENUM,
+ G_TYPE_BOOLEAN, 1, GTK_TYPE_WIDGET_HELP_TYPE);
widget_signals[ACCEL_CLOSURES_CHANGED] =
gtk_signal_new ("accel_closures_changed",
0,
_("Width, in pixels, between focus indicator and the widget 'box'."),
0, G_MAXINT, 1,
G_PARAM_READWRITE));
-
+ gtk_widget_class_install_style_property (klass,
+ g_param_spec_boxed ("cursor-color",
+ _("Cursor color"),
+ _("Color with which to draw insertion cursor"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+ gtk_widget_class_install_style_property (klass,
+ g_param_spec_float ("cursor-aspect-ratio",
+ _("Cursor line aspect ratio"),
+ _("Aspect ratio with which to draw insertion cursor"),
+ 0.0, 1.0, 0.033,
+ G_PARAM_READABLE));
}
static void
const GValue *value,
GParamSpec *pspec)
{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (object);
+ GtkWidget *widget = GTK_WIDGET (object);
switch (prop_id)
{
GValue *value,
GParamSpec *pspec)
{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (object);
+ GtkWidget *widget = GTK_WIDGET (object);
switch (prop_id)
{
break;
case PROP_PARENT:
if (widget->parent)
- g_value_set_object (value, G_OBJECT (widget->parent));
+ g_value_set_object (value, widget->parent);
else
g_value_set_object (value, NULL);
break;
g_value_set_boolean (value, (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE));
break;
case PROP_STYLE:
- g_value_set_object (value, G_OBJECT (gtk_widget_get_style (widget)));
+ g_value_set_object (value, gtk_widget_get_style (widget));
break;
case PROP_EVENTS:
eventp = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_event_mask);
GTK_DOUBLE_BUFFERED);
GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_ON_ALLOC);
+ GTK_PRIVATE_SET_FLAG (widget, GTK_REQUEST_NEEDED);
+ GTK_PRIVATE_SET_FLAG (widget, GTK_ALLOC_NEEDED);
widget->style = gtk_widget_get_default_style ();
g_object_ref (widget->style);
g_object_unref (widget);
}
+/**
+ * gtk_widget_thaw_child_notify:
+ * @widget: a #GtkWidget
+ *
+ * Reverts the effect of a previous call to gtk_widget_freeze_child_notify().
+ */
void
gtk_widget_thaw_child_notify (GtkWidget *widget)
{
static void
gtk_widget_real_show (GtkWidget *widget)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
if (!GTK_WIDGET_VISIBLE (widget))
{
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
{
gtk_widget_ref (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
- if (!GTK_WIDGET_TOPLEVEL (widget) && GTK_WIDGET_REALIZED (widget))
+ if (!GTK_WIDGET_TOPLEVEL (widget))
gtk_widget_queue_resize (widget);
g_object_notify (G_OBJECT (widget), "visible");
gtk_widget_unref (widget);
static void
gtk_widget_real_hide (GtkWidget *widget)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
if (GTK_WIDGET_VISIBLE (widget))
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
*
* Utility function; intended to be connected to the "delete_event"
* signal on a #GtkWindow. The function calls gtk_widget_hide() on its
- * argument, then returns %TRUE. If connected to "delete_event",
- * the result is that clicking the window manager close button for
- * will hide but not destroy the window. By default, GTK+ destroys
- * windows when "delete_event" is received.
+ * argument, then returns %TRUE. If connected to "delete_event", the
+ * result is that clicking the close button for a window (on the
+ * window frame, top right corner usually) will hide but not destroy
+ * the window. By default, GTK+ destroys windows when "delete_event"
+ * is received.
*
* Return value: %TRUE
**/
* @widget: a #GtkWidget
*
* Creates the GDK (windowing system) resources associated with a
- * widget. For example, widget->window will be created when a widget
+ * widget. For example, @widget->window will be created when a widget
* is realized. Normally realization happens implicitly; if you show
* a widget and all its parent containers, then the widget will be
* realized and mapped automatically.
*
* This function is only useful in widget implementations.
* Causes a widget to be unrealized (frees all GDK resources
- * associated with the widget, such as widget->window).
+ * associated with the widget, such as @widget->window).
*
**/
void
gtk_widget_real_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget) &&
/**
* gtk_widget_add_accelerator
* @widget: widget to install an accelerator on
- * @accel_signal: widget signal to emit on accelerator actiavtion
+ * @accel_signal: widget signal to emit on accelerator activation
* @accel_group: accel group for this widget, added to its toplevel
* @accel_key: GDK keyval of the accelerator
* @accel_mods: modifier key combination of the accelerator
* @accel_flags: flag accelerators, e.g. %GTK_ACCEL_VISIBLE
*
- * Installs an accelerator for this @widget in @accel_group, that causes
+ * Installs an accelerator for this @widget in @accel_group that causes
* @accel_signal to be emitted if the accelerator is activated.
* The @accel_group needs to be added to the widget's toplevel via
* gtk_window_add_accel_group(), and the signal must be of type %G_RUN_ACTION.
- * Accelerators added through this function are not user changable during
+ * Accelerators added through this function are not user changeable during
* runtime. If you want to support accelerators that can be changed by the
- * user, use gtk_accel_map_add_entry() and gtk_menu_item_set_accel_path()
- * instead.
+ * user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or
+ * gtk_menu_item_set_accel_path() instead.
*/
void
-gtk_widget_add_accelerator (GtkWidget *widget,
- const gchar *accel_signal,
- GtkAccelGroup *accel_group,
- guint accel_key,
- guint accel_mods,
- GtkAccelFlags accel_flags)
+gtk_widget_add_accelerator (GtkWidget *widget,
+ const gchar *accel_signal,
+ GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods,
+ GtkAccelFlags accel_flags)
{
GClosure *closure;
GSignalQuery query;
* gtk_widget_add_accelerator().
*/
gboolean
-gtk_widget_remove_accelerator (GtkWidget *widget,
- GtkAccelGroup *accel_group,
- guint accel_key,
- guint accel_mods)
+gtk_widget_remove_accelerator (GtkWidget *widget,
+ GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods)
{
GtkAccelGroupEntry *ag_entry;
GList *slist, *clist;
* Lists the closures used by @widget for accelerator group connections
* with gtk_accel_group_connect_by_path() or gtk_accel_group_connect().
* The closures can be used to monitor accelerator changes on @widget,
- * by connecting to the ::accel_changed signal of the #GtkAccelGroup
- * of a closure which can be found out with gtk_accel_group_from_accel_closure().
+ * by connecting to the ::accel_changed signal of the #GtkAccelGroup of a
+ * closure which can be found out with gtk_accel_group_from_accel_closure().
*/
GList*
gtk_widget_list_accel_closures (GtkWidget *widget)
g_free (apath);
}
-/* accel_group: the accel group used to activate this widget
- * accel_path: the accel path, associating the accelerator
- * to activate this widget
- * set accel path through which this widget can be actiavated.
- */
+
+/**
+ * gtk_widget_set_accel_path:
+ * @widget: a #GtkWidget
+ * @accel_path: path used to look up the the accelerator
+ * @accel_group: a #GtkAccelGroup.
+ *
+ * Given an accelerator group, @accel_group, and an accelerator path,
+ * @accel_path, sets up an accelerator in @accel_group so whenever the
+ * key binding that is defined for @accel_path is pressed, @widget
+ * will be activated. This removes any accelerators (for any
+ * accelerator group) installed by previous calls to
+ * gtk_widget_set_accel_path(). Associating accelerators with
+ * paths allows them to be modified by the user and the modifications
+ * to be saved for future use. (See gtk_accel_map_save().)
+ *
+ * This function is a low level function that would most likely
+ * be used by a menu creation system like #GtkItemFactory. If you
+ * use #GtkItemFactory, setting up accelerator paths will be done
+ * automatically.
+ *
+ * Even when you you aren't using #GtkItemFactory, if you only want to
+ * set up accelerators on menu items gtk_menu_item_set_accel_path()
+ * provides a somewhat more convenient interface.
+ **/
void
-_gtk_widget_set_accel_path (GtkWidget *widget,
- const gchar *accel_path,
- GtkAccelGroup *accel_group)
+gtk_widget_set_accel_path (GtkWidget *widget,
+ const gchar *accel_path,
+ GtkAccelGroup *accel_group)
{
AccelPath *apath;
gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
- gboolean handled = FALSE;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), handled);
- g_return_val_if_fail (event != NULL, handled);
-
- if (!handled)
- handled = gtk_bindings_activate (GTK_OBJECT (widget),
- event->keyval,
- event->state);
-
- return handled;
+ return _gtk_bindings_activate_event (GTK_OBJECT (widget), event);
}
static gboolean
gtk_widget_real_key_release_event (GtkWidget *widget,
GdkEventKey *event)
{
- gboolean handled = FALSE;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), handled);
- g_return_val_if_fail (event != NULL, handled);
-
- if (!handled)
- handled = gtk_bindings_activate (GTK_OBJECT (widget),
- event->keyval,
- event->state | GDK_RELEASE_MASK);
-
- return handled;
+ return _gtk_bindings_activate_event (GTK_OBJECT (widget), event);
}
static gboolean
gtk_widget_real_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
{
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
return FALSE;
gtk_widget_real_focus_out_event (GtkWidget *widget,
GdkEventFocus *event)
{
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
return FALSE;
}
+#define WIDGET_REALIZED_FOR_EVENT(widget, event) \
+ (event->type == GDK_FOCUS_CHANGE || GTK_WIDGET_REALIZED(widget))
+
/**
* gtk_widget_event:
* @widget: a #GtkWidget
GdkEvent *event)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
- g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), TRUE);
+ g_return_val_if_fail (WIDGET_REALIZED_FOR_EVENT (widget, event), TRUE);
if (event->type == GDK_EXPOSE)
{
* If you want to force an area of a window to be redrawn,
* use gdk_window_invalidate_rect() or gdk_window_invalidate_region().
* To cause the redraw to be done immediately, follow that call
- * with a call to gdk_window_procss_updates().
+ * with a call to gdk_window_process_updates().
*
* Return value: return from the event signal emission (%TRUE if the event was handled)
**/
gtk_widget_ref (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT], event, &return_val);
- return_val |= !GTK_WIDGET_REALIZED (widget);
+ return_val |= !WIDGET_REALIZED_FOR_EVENT (widget, event);
if (!return_val)
{
gint signal_num;
if (signal_num != -1)
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[signal_num], event, &return_val);
}
- if (GTK_WIDGET_REALIZED (widget))
+ if (WIDGET_REALIZED_FOR_EVENT (widget, event))
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT_AFTER], event);
else
return_val = TRUE;
gtk_widget_reparent_container_child (GtkWidget *widget,
gpointer client_data)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (client_data != NULL);
if (GTK_WIDGET_NO_WINDOW (widget))
gtk_widget_reparent_container_child (widget,
gtk_widget_get_parent_window (widget));
}
+
+ g_object_notify (G_OBJECT (widget), "parent");
}
}
* gtk_widget_region_intersect:
* @widget: a #GtkWidget
* @region: a #GdkRegion, in the same coordinate system as
- * widget->allocation. That is, relative to @widget->window
+ * @widget->allocation. That is, relative to @widget->window
* for %NO_WINDOW widgets; relative to the parent window
* of @widget->window for widgets with their own window.
* @returns: A newly allocated region holding the intersection of @widget
{
g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ return;
+
g_object_ref (G_OBJECT (widget));
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[GRAB_FOCUS]);
g_object_notify (G_OBJECT (widget), "has_focus");
static void
gtk_widget_real_grab_focus (GtkWidget *focus_widget)
{
- g_return_if_fail (GTK_IS_WIDGET (focus_widget));
-
if (GTK_WIDGET_CAN_FOCUS (focus_widget))
{
GtkWidget *toplevel;
}
}
-static void
+static gboolean
gtk_widget_real_show_help (GtkWidget *widget,
GtkWidgetHelpType help_type)
{
if (help_type == GTK_WIDGET_HELP_TOOLTIP)
- _gtk_tooltips_show_tip (widget);
+ {
+ _gtk_tooltips_toggle_keyboard_mode (widget);
+ return TRUE;
+ }
+ else
+ return FALSE;
}
static gboolean
window = gtk_widget_get_toplevel (widget);
if (window && GTK_WIDGET_TOPLEVEL (window))
- gtk_window_set_default (GTK_WINDOW (window), widget);
+ {
+ gtk_window_set_default (GTK_WINDOW (window), widget);
+ g_object_notify (G_OBJECT (widget), "has_default");
+ }
else
g_warning (G_STRLOC ": widget not within a GtkWindow");
}
/**
* gtk_widget_set_sensitive:
- * @widget: a @widget
+ * @widget: a #GtkWidget
* @sensitive: %TRUE to make the widget sensitive
*
* Sets the sensitivity of a widget. A widget is sensitive if the user
* can interact with it. Insensitive widgets are "grayed out" and the
* user can't interact with them. Insensitive widgets are known as
- * "inactive" in some other toolkits.
+ * "inactive", "disabled", or "ghosted" in some other toolkits.
*
**/
void
gtk_widget_propagate_state (widget, &data);
- gtk_widget_set_style_recurse (widget, NULL);
+ gtk_widget_reset_rc_styles (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);
if (GTK_WIDGET_ANCHORED (widget->parent))
{
GtkRcStyle *old_style;
+ g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_IS_RC_STYLE (style));
old_style = gtk_object_get_data_by_id (GTK_OBJECT (widget),
{
GtkRcStyle *rc_style;
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
rc_style = gtk_object_get_data_by_id (GTK_OBJECT (widget),
quark_rc_style);
GtkStyle *style,
gboolean initial_emission)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (style != NULL);
-
g_object_ref (G_OBJECT (widget));
g_object_freeze_notify (G_OBJECT (widget));
g_object_unref (previous_style);
if (widget->parent && !initial_emission)
- {
- GtkRequisition old_requisition;
-
- old_requisition = widget->requisition;
- gtk_widget_size_request (widget, NULL);
-
- if ((old_requisition.width != widget->requisition.width) ||
- (old_requisition.height != widget->requisition.height))
- gtk_widget_queue_resize (widget);
- else if (GTK_WIDGET_DRAWABLE (widget))
- gtk_widget_queue_clear (widget);
- }
+ gtk_widget_queue_resize (widget);
}
else if (initial_emission)
gtk_signal_emit (GTK_OBJECT (widget),
g_object_unref (G_OBJECT (widget));
}
-static void
-gtk_widget_set_style_recurse (GtkWidget *widget,
- gpointer client_data)
-{
- if (GTK_WIDGET_RC_STYLE (widget))
- gtk_widget_reset_rc_style (widget);
-
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
- gtk_widget_set_style_recurse,
- NULL);
-}
-
static void
gtk_widget_propagate_hierarchy_changed_recurse (GtkWidget *widget,
gpointer client_data)
g_object_unref (previous_toplevel);
}
+static void
+reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
+{
+ if (GTK_WIDGET_RC_STYLE (widget))
+ gtk_widget_reset_rc_style (widget);
+
+ if (GTK_IS_CONTAINER (widget))
+ gtk_container_forall (GTK_CONTAINER (widget),
+ reset_rc_styles_recurse,
+ NULL);
+}
+
void
gtk_widget_reset_rc_styles (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- gtk_widget_set_style_recurse (widget, NULL);
+ reset_rc_styles_recurse (widget, NULL);
}
+/**
+ * gtk_widget_get_default_style:
+ *
+ * Returns the default style used by all widgets initially.
+ *
+ * Returns: the default style. This #GtkStyle object is owned by GTK+ and
+ * should not be modified or freed.
+ */
GtkStyle*
gtk_widget_get_default_style (void)
{
*
* Creates a new #PangoContext with the appropriate colormap,
* font description, and base direction for drawing text for
- * this widget. See also gtk_widget_get_pango_context()
+ * this widget. See also gtk_widget_get_pango_context().
*
* Return value: the new #PangoContext
**/
*
*
* Sets the position of a widget. The funny "u" in the name comes from
- * the "user position" hint specified by the X window system, and
+ * the "user position" hint specified by the X Window System, and
* exists for legacy reasons. This function doesn't work if a widget
* is inside a container; it's only really useful on #GtkWindow.
*
gdk_window_get_user_data (window, &user_data);
if (user_data == widget)
gdk_window_set_events (window, gdk_window_get_events (window) | events);
+ tmp_list = tmp_list->next;
}
+
+ g_list_free (children);
}
else
{
* window was inside a #GtkWindow-derived widget which was in turn
* inside the toplevel #GtkWindow. While the second case may
* seem unlikely, it actually happens when a #GtkPlug is embedded
- * inside a #GtkSocket within the same application
+ * inside a #GtkSocket within the same application.
*
* To reliably find the toplevel #GtkWindow, use
* gtk_widget_get_toplevel() and check if the %TOPLEVEL flags
* is set on the result.
- *
- * <programlisting>
- * GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
- * if (GTK_WIDGET_TOPLEVEL (toplevel))
- * {
- * [ Perform action on toplevel. ]
- * }
- * </programlisting>
+ * <informalexample><programlisting>
+ * <!>GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
+ * <!>if (GTK_WIDGET_TOPLEVEL (toplevel))
+ * <!> {
+ * <!> [ Perform action on toplevel. ]
+ * <!> }
+ * </programlisting></informalexample>
*
- * Return value: the topmost ancestor of @widget, or @widget itself if there's no ancestor
+ * Return value: the topmost ancestor of @widget, or @widget itself if there's no ancestor.
**/
GtkWidget*
gtk_widget_get_toplevel (GtkWidget *widget)
* gtk_widget_get_settings:
* @widget: a #GtkWidget
*
- * Get the settings object holding the settings (global property
+ * Gets the settings object holding the settings (global property
* settings, RC file information, etc) used for this widget.
*
* Return value: the relevant #GtkSettings object
* Makes all newly-created widgets as composite children until
* the corresponding gtk_widget_pop_composite_child() call.
*
+ * A composite child is a child that's an implementation detail of the
+ * container it's inside and should not be visible to people using the
+ * container. Composite children aren't treated differently by GTK (but
+ * see gtk_container_foreach() vs. gtk_container_forall()), but e.g. GUI
+ * builders might want to treat them in a different way.
+ *
* Here is a simple example:
- * <programlisting>
- * gtk_widget_push_composite_child ();
- * scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
- * gtk_widget_set_composite_name (scrolled_window->hscrollbar, "hscrollbar");
- * gtk_widget_pop_composite_child ();
- * gtk_widget_set_parent (scrolled_window->hscrollbar,
- * GTK_WIDGET (scrolled_window));
- * gtk_widget_ref (scrolled_window->hscrollbar);
- * </programlisting>
+ * <informalexample><programlisting>
+ * <!> gtk_widget_push_composite_child (<!>);
+ * <!> scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
+ * <!> gtk_widget_set_composite_name (scrolled_window->hscrollbar, "hscrollbar");
+ * <!> gtk_widget_pop_composite_child (<!>);
+ * <!> gtk_widget_set_parent (scrolled_window->hscrollbar,
+ * <!> GTK_WIDGET (scrolled_window));
+ * <!> gtk_widget_ref (scrolled_window->hscrollbar);
+ * </programlisting></informalexample>
**/
void
gtk_widget_push_composite_child (void)
void
gtk_widget_push_colormap (GdkColormap *cmap)
{
- g_return_if_fail (cmap != NULL);
+ g_return_if_fail (GDK_IS_COLORMAP (cmap));
colormap_stack = g_slist_prepend (colormap_stack, cmap);
}
void
gtk_widget_set_default_colormap (GdkColormap *colormap)
{
+ g_return_if_fail (GDK_IS_COLORMAP (colormap));
+
if (default_colormap != colormap)
{
if (default_colormap)
* reading directions can be done. Generally, applications will
* let the default reading direction present, except for containers
* where the containers are arranged in an order that is explicitely
- * visual rather than logical (such as buttons for text justificiation).
+ * visual rather than logical (such as buttons for text justification).
*
* If the direction is set to %GTK_TEXT_DIR_NONE, then the value
* set by gtk_widget_set_default_direction() will be used.
* gtk_widget_get_default_direction:
*
* Obtains the current default reading direction. See
- * gtk_widget_set_direction().
+ * gtk_widget_set_default_direction().
*
* Return value: the current default direction.
**/
static void
gtk_widget_real_destroy (GtkObject *object)
{
- GtkWidget *widget;
-
- /* gtk_object_destroy() will already hold a refcount on object
- */
- widget = GTK_WIDGET (object);
+ /* gtk_object_destroy() will already hold a refcount on object */
+ GtkWidget *widget = GTK_WIDGET (object);
/* wipe accelerator closures (keep order) */
g_object_set_qdata (G_OBJECT (widget), quark_accel_path, NULL);
g_object_set_qdata (G_OBJECT (widget), quark_accel_closures, NULL);
gtk_grab_remove (widget);
- gtk_selection_remove_all (widget);
g_object_unref (widget->style);
widget->style = gtk_widget_get_default_style ();
GtkAccessible *accessible;
gtk_grab_remove (widget);
- gtk_selection_remove_all (widget);
g_object_unref (widget->style);
widget->style = NULL;
static void
gtk_widget_real_map (GtkWidget *widget)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_WIDGET_REALIZED (widget) == TRUE);
if (!GTK_WIDGET_MAPPED (widget))
static void
gtk_widget_real_unmap (GtkWidget *widget)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
if (GTK_WIDGET_MAPPED (widget))
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
static void
gtk_widget_real_realize (GtkWidget *widget)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_WIDGET_NO_WINDOW (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
static void
gtk_widget_real_unrealize (GtkWidget *widget)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
if (GTK_WIDGET_MAPPED (widget))
gtk_widget_real_unmap (widget);
widget->window = NULL;
}
+ gtk_selection_remove_all (widget);
+
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
}
gtk_widget_real_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
requisition->width = widget->requisition.width;
requisition->height = widget->requisition.height;
}
static void
gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info)
{
- g_return_if_fail (aux_info != NULL);
-
g_mem_chunk_free (aux_info_mem_chunk, aux_info);
}
* @offset_x: X position of shape mask with respect to @window.
* @offset_y: Y position of shape mask with respect to @window.
*
- * Sets a shape for this widget's gdk window. This allows for
+ * Sets a shape for this widget's GDK window. This allows for
* transparent windows etc., see gdk_window_shape_combine_mask()
* for more information.
**/
gtk_widget_class_install_style_property_parser (class, pspec, parser);
}
+/**
+ * gtk_widget_style_get_property:
+ * @widget: a #GtkWidget
+ * @property_name: the name of a style property
+ * @value: location to return the property value
+ *
+ * Gets the value of a style property of @widget.
+ */
void
gtk_widget_style_get_property (GtkWidget *widget,
const gchar *property_name,
g_object_unref (widget);
}
+/**
+ * gtk_widget_style_get_valist:
+ * @widget: a #GtkWidget
+ * @first_property_name: the name of the first property to get
+ * @var_args: a <type>va_list</type> of pairs of property names and
+ * locations to return the property values, starting with the location
+ * for @first_property_name.
+ *
+ * Non-vararg variant of gtk_widget_style_get(). Used primarily by language
+ * bindings.
+ */
void
gtk_widget_style_get_valist (GtkWidget *widget,
const gchar *first_property_name,
g_object_unref (widget);
}
+/**
+ * gtk_widget_style_get:
+ * @widget: a #GtkWidget
+ * @first_property_name: the name of the first property to get
+ * @Varargs: pairs of property names and locations to
+ * return the property values, starting with the location for
+ * @first_property_name, terminated by %NULL.
+ *
+ * Gets the values of a multiple style properties of @widget.
+ */
void
gtk_widget_style_get (GtkWidget *widget,
const gchar *first_property_name,
/**
* gtk_widget_path:
* @widget: a #GtkWidget
- * @path_length_p: location to store length of the path, or %NULL
- * @path_p: location to store allocated path string, or %NULL
- * @path_reversed_p: location to store allocated reverse path string, or %NULL
+ * @path_length: location to store length of the path, or %NULL
+ * @path: location to store allocated path string, or %NULL
+ * @path_reversed: location to store allocated reverse path string, or %NULL
*
* Obtains the full path to @widget. The path is simply the name of a
* widget and all its parents in the container hierarchy, separated by
**/
void
gtk_widget_path (GtkWidget *widget,
- guint *path_length_p,
- gchar **path_p,
- gchar **path_reversed_p)
+ guint *path_length,
+ gchar **path,
+ gchar **path_reversed)
{
static gchar *rev_path = NULL;
- static guint path_len = 0;
+ static guint tmp_path_len = 0;
guint len;
g_return_if_fail (GTK_IS_WIDGET (widget));
string = gtk_widget_get_name (widget);
l = strlen (string);
- while (path_len <= len + l + 1)
+ while (tmp_path_len <= len + l + 1)
{
- path_len += INIT_PATH_SIZE;
- rev_path = g_realloc (rev_path, path_len);
+ tmp_path_len += INIT_PATH_SIZE;
+ rev_path = g_realloc (rev_path, tmp_path_len);
}
s = string + l - 1;
d = rev_path + len;
}
while (widget);
- if (path_length_p)
- *path_length_p = len - 1;
- if (path_reversed_p)
- *path_reversed_p = g_strdup (rev_path);
- if (path_p)
+ if (path_length)
+ *path_length = len - 1;
+ if (path_reversed)
+ *path_reversed = g_strdup (rev_path);
+ if (path)
{
- *path_p = g_strdup (rev_path);
- g_strreverse (*path_p);
+ *path = g_strdup (rev_path);
+ g_strreverse (*path);
}
}
/**
* gtk_widget_class_path:
* @widget: a #GtkWidget
- * @path_length_p: location to store the length of the class path, or %NULL
- * @path_p: location to store the class path as an allocated string, or %NULL
- * @path_reversed_p: location to store the reverse class path as an allocated string, or %NULL
+ * @path_length: location to store the length of the class path, or %NULL
+ * @path: location to store the class path as an allocated string, or %NULL
+ * @path_reversed: location to store the reverse class path as an allocated string, or %NULL
*
* Same as gtk_widget_path(), but always uses the name of a widget's type,
* never uses a custom name set with gtk_widget_set_name().
**/
void
gtk_widget_class_path (GtkWidget *widget,
- guint *path_length_p,
- gchar **path_p,
- gchar **path_reversed_p)
+ guint *path_length,
+ gchar **path,
+ gchar **path_reversed)
{
static gchar *rev_path = NULL;
- static guint path_len = 0;
+ static guint tmp_path_len = 0;
guint len;
g_return_if_fail (GTK_IS_WIDGET (widget));
string = gtk_type_name (GTK_WIDGET_TYPE (widget));
l = strlen (string);
- while (path_len <= len + l + 1)
+ while (tmp_path_len <= len + l + 1)
{
- path_len += INIT_PATH_SIZE;
- rev_path = g_realloc (rev_path, path_len);
+ tmp_path_len += INIT_PATH_SIZE;
+ rev_path = g_realloc (rev_path, tmp_path_len);
}
s = string + l - 1;
d = rev_path + len;
}
while (widget);
- if (path_length_p)
- *path_length_p = len - 1;
- if (path_reversed_p)
- *path_reversed_p = g_strdup (rev_path);
- if (path_p)
+ if (path_length)
+ *path_length = len - 1;
+ if (path_reversed)
+ *path_reversed = g_strdup (rev_path);
+ if (path)
{
- *path_p = g_strdup (rev_path);
- g_strreverse (*path_p);
+ *path = g_strdup (rev_path);
+ g_strreverse (*path);
}
}
g_free (requisition);
}
+GType
+gtk_requisition_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("GtkTypeRequisition",
+ (GBoxedCopyFunc) gtk_requisition_copy,
+ (GBoxedFreeFunc) gtk_requisition_free);
+
+ return our_type;
+}
+
AtkObject*
gtk_widget_get_accessible (GtkWidget *widget)
{
g_object_ref (G_OBJECT (accessible));
return accessible;
}
-