Synopsis#include <gtk/gtk.h> GtkWidget; GtkWidgetClass; enum GtkWidgetFlags; #define GTK_WIDGET_TYPE (wid) #define GTK_WIDGET_STATE (wid) #define GTK_WIDGET_SAVED_STATE (wid) #define GTK_WIDGET_FLAGS (wid) #define GTK_WIDGET_TOPLEVEL (wid) #define GTK_WIDGET_NO_WINDOW (wid) #define GTK_WIDGET_REALIZED (wid) #define GTK_WIDGET_MAPPED (wid) #define GTK_WIDGET_VISIBLE (wid) #define GTK_WIDGET_DRAWABLE (wid) #define GTK_WIDGET_SENSITIVE (wid) #define GTK_WIDGET_PARENT_SENSITIVE (wid) #define GTK_WIDGET_IS_SENSITIVE (wid) #define GTK_WIDGET_CAN_FOCUS (wid) #define GTK_WIDGET_HAS_FOCUS (wid) #define GTK_WIDGET_CAN_DEFAULT (wid) #define GTK_WIDGET_RECEIVES_DEFAULT (wid) #define GTK_WIDGET_HAS_DEFAULT (wid) #define GTK_WIDGET_HAS_GRAB (wid) #define GTK_WIDGET_RC_STYLE (wid) #define GTK_WIDGET_COMPOSITE_CHILD (wid) #define GTK_WIDGET_APP_PAINTABLE (wid) #define GTK_WIDGET_DOUBLE_BUFFERED (wid) #define GTK_WIDGET_SET_FLAGS (wid,flag) #define GTK_WIDGET_UNSET_FLAGS (wid,flag) void (*GtkCallback) (GtkWidget *widget, gpointer data); GtkRequisition; struct GtkAllocation; GtkSelectionData; GtkWidgetAuxInfo; GtkWidgetShapeInfo; enum GtkWidgetHelpType; GtkWidget* gtk_widget_new (GType type, const gchar *first_property_name, ...); GtkWidget* gtk_widget_ref (GtkWidget *widget); void gtk_widget_unref (GtkWidget *widget); void gtk_widget_destroy (GtkWidget *widget); void gtk_widget_destroyed (GtkWidget *widget, GtkWidget **widget_pointer); void gtk_widget_set (GtkWidget *widget, const gchar *first_property_name, ...); void gtk_widget_unparent (GtkWidget *widget); void gtk_widget_show (GtkWidget *widget); void gtk_widget_show_now (GtkWidget *widget); void gtk_widget_hide (GtkWidget *widget); void gtk_widget_show_all (GtkWidget *widget); void gtk_widget_hide_all (GtkWidget *widget); void gtk_widget_map (GtkWidget *widget); void gtk_widget_unmap (GtkWidget *widget); void gtk_widget_realize (GtkWidget *widget); void gtk_widget_unrealize (GtkWidget *widget); void gtk_widget_queue_draw (GtkWidget *widget); void gtk_widget_queue_resize (GtkWidget *widget); void gtk_widget_queue_resize_no_redraw (GtkWidget *widget); void gtk_widget_draw (GtkWidget *widget, const GdkRectangle *area); void gtk_widget_size_request (GtkWidget *widget, GtkRequisition *requisition); void gtk_widget_get_child_requisition (GtkWidget *widget, GtkRequisition *requisition); void gtk_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); void gtk_widget_add_accelerator (GtkWidget *widget, const gchar *accel_signal, GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, GtkAccelFlags accel_flags); gboolean gtk_widget_remove_accelerator (GtkWidget *widget, GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods); void gtk_widget_set_accel_path (GtkWidget *widget, const gchar *accel_path, GtkAccelGroup *accel_group); GList* gtk_widget_list_accel_closures (GtkWidget *widget); gboolean gtk_widget_can_activate_accel (GtkWidget *widget, guint signal_id); gboolean gtk_widget_event (GtkWidget *widget, GdkEvent *event); gboolean gtk_widget_activate (GtkWidget *widget); void gtk_widget_reparent (GtkWidget *widget, GtkWidget *new_parent); gboolean gtk_widget_intersect (GtkWidget *widget, const GdkRectangle *area, GdkRectangle *intersection); gboolean gtk_widget_is_focus (GtkWidget *widget); void gtk_widget_grab_focus (GtkWidget *widget); void gtk_widget_grab_default (GtkWidget *widget); void gtk_widget_set_name (GtkWidget *widget, const gchar *name); const gchar* gtk_widget_get_name (GtkWidget *widget); void gtk_widget_set_state (GtkWidget *widget, GtkStateType state); void gtk_widget_set_sensitive (GtkWidget *widget, gboolean sensitive); void gtk_widget_set_parent (GtkWidget *widget, GtkWidget *parent); void gtk_widget_set_parent_window (GtkWidget *widget, GdkWindow *parent_window); GdkWindow* gtk_widget_get_parent_window (GtkWidget *widget); void gtk_widget_set_uposition (GtkWidget *widget, gint x, gint y); void gtk_widget_set_usize (GtkWidget *widget, gint width, gint height); void gtk_widget_set_events (GtkWidget *widget, gint events); void gtk_widget_add_events (GtkWidget *widget, gint events); void gtk_widget_set_extension_events (GtkWidget *widget, GdkExtensionMode mode); GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget); GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget); GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, GType widget_type); GdkColormap* gtk_widget_get_colormap (GtkWidget *widget); void gtk_widget_set_colormap (GtkWidget *widget, GdkColormap *colormap); GdkVisual* gtk_widget_get_visual (GtkWidget *widget); gint gtk_widget_get_events (GtkWidget *widget); void gtk_widget_get_pointer (GtkWidget *widget, gint *x, gint *y); gboolean gtk_widget_is_ancestor (GtkWidget *widget, GtkWidget *ancestor); gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget, GtkWidget *dest_widget, gint src_x, gint src_y, gint *dest_x, gint *dest_y); gboolean gtk_widget_hide_on_delete (GtkWidget *widget); void gtk_widget_set_style (GtkWidget *widget, GtkStyle *style); #define gtk_widget_set_rc_style (widget) void gtk_widget_ensure_style (GtkWidget *widget); GtkStyle* gtk_widget_get_style (GtkWidget *widget); #define gtk_widget_restore_default_style (widget) void gtk_widget_reset_rc_styles (GtkWidget *widget); void gtk_widget_push_colormap (GdkColormap *cmap); void gtk_widget_pop_colormap (void); void gtk_widget_set_default_colormap (GdkColormap *colormap); GtkStyle* gtk_widget_get_default_style (void); GdkColormap* gtk_widget_get_default_colormap (void); GdkVisual* gtk_widget_get_default_visual (void); void gtk_widget_set_direction (GtkWidget *widget, GtkTextDirection dir); enum GtkTextDirection; GtkTextDirection gtk_widget_get_direction (GtkWidget *widget); void gtk_widget_set_default_direction (GtkTextDirection dir); GtkTextDirection gtk_widget_get_default_direction (void); void gtk_widget_shape_combine_mask (GtkWidget *widget, GdkBitmap *shape_mask, gint offset_x, gint offset_y); void gtk_widget_input_shape_combine_mask (GtkWidget *widget, GdkBitmap *shape_mask, gint offset_x, gint offset_y); void gtk_widget_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed); void gtk_widget_class_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed); gchar* gtk_widget_get_composite_name (GtkWidget *widget); void gtk_widget_modify_style (GtkWidget *widget, GtkRcStyle *style); GtkRcStyle* gtk_widget_get_modifier_style (GtkWidget *widget); void gtk_widget_modify_fg (GtkWidget *widget, GtkStateType state, const GdkColor *color); void gtk_widget_modify_bg (GtkWidget *widget, GtkStateType state, const GdkColor *color); void gtk_widget_modify_text (GtkWidget *widget, GtkStateType state, const GdkColor *color); void gtk_widget_modify_base (GtkWidget *widget, GtkStateType state, const GdkColor *color); void gtk_widget_modify_font (GtkWidget *widget, PangoFontDescription *font_desc); void gtk_widget_modify_cursor (GtkWidget *widget, const GdkColor *primary, const GdkColor *secondary); PangoContext* gtk_widget_create_pango_context (GtkWidget *widget); PangoContext* gtk_widget_get_pango_context (GtkWidget *widget); PangoLayout* gtk_widget_create_pango_layout (GtkWidget *widget, const gchar *text); GdkPixbuf* gtk_widget_render_icon (GtkWidget *widget, const gchar *stock_id, GtkIconSize size, const gchar *detail); void gtk_widget_pop_composite_child (void); void gtk_widget_push_composite_child (void); void gtk_widget_queue_clear (GtkWidget *widget); void gtk_widget_queue_clear_area (GtkWidget *widget, gint x, gint y, gint width, gint height); void gtk_widget_queue_draw_area (GtkWidget *widget, gint x, gint y, gint width, gint height); void gtk_widget_reset_shapes (GtkWidget *widget); void gtk_widget_set_app_paintable (GtkWidget *widget, gboolean app_paintable); void gtk_widget_set_double_buffered (GtkWidget *widget, gboolean double_buffered); void gtk_widget_set_redraw_on_allocate (GtkWidget *widget, gboolean redraw_on_allocate); void gtk_widget_set_composite_name (GtkWidget *widget, const gchar *name); gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); gboolean gtk_widget_mnemonic_activate (GtkWidget *widget, gboolean group_cycling); void gtk_widget_class_install_style_property (GtkWidgetClass *klass, GParamSpec *pspec); void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass, GParamSpec *pspec, GtkRcPropertyParser parser); GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass, const gchar *property_name); GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass, guint *n_properties); GdkRegion* gtk_widget_region_intersect (GtkWidget *widget, const GdkRegion *region); gint gtk_widget_send_expose (GtkWidget *widget, GdkEvent *event); void gtk_widget_style_get (GtkWidget *widget, const gchar *first_property_name, ...); void gtk_widget_style_get_property (GtkWidget *widget, const gchar *property_name, GValue *value); void gtk_widget_style_get_valist (GtkWidget *widget, const gchar *first_property_name, va_list var_args); AtkObject* gtk_widget_get_accessible (GtkWidget *widget); gboolean gtk_widget_child_focus (GtkWidget *widget, GtkDirectionType direction); void gtk_widget_child_notify (GtkWidget *widget, const gchar *child_property); void gtk_widget_freeze_child_notify (GtkWidget *widget); gboolean gtk_widget_get_child_visible (GtkWidget *widget); GtkWidget* gtk_widget_get_parent (GtkWidget *widget); GtkSettings* gtk_widget_get_settings (GtkWidget *widget); GtkClipboard* gtk_widget_get_clipboard (GtkWidget *widget, GdkAtom selection); GdkDisplay* gtk_widget_get_display (GtkWidget *widget); GdkWindow* gtk_widget_get_root_window (GtkWidget *widget); GdkScreen* gtk_widget_get_screen (GtkWidget *widget); gboolean gtk_widget_has_screen (GtkWidget *widget); void gtk_widget_get_size_request (GtkWidget *widget, gint *width, gint *height); #define gtk_widget_pop_visual () #define gtk_widget_push_visual (visual) void gtk_widget_set_child_visible (GtkWidget *widget, gboolean is_visible); #define gtk_widget_set_default_visual (visual) void gtk_widget_set_size_request (GtkWidget *widget, gint width, gint height); #define gtk_widget_set_visual (widget,visual) void gtk_widget_thaw_child_notify (GtkWidget *widget); void gtk_widget_set_no_show_all (GtkWidget *widget, gboolean no_show_all); gboolean gtk_widget_get_no_show_all (GtkWidget *widget); GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget); void gtk_widget_add_mnemonic_label (GtkWidget *widget, GtkWidget *label); void gtk_widget_remove_mnemonic_label (GtkWidget *widget, GtkWidget *label); GtkAction* gtk_widget_get_action (GtkWidget *widget); gboolean gtk_widget_is_composited (GtkWidget *widget); void gtk_widget_error_bell (GtkWidget *widget); gboolean gtk_widget_keynav_failed (GtkWidget *widget, GtkDirectionType direction); gchar* gtk_widget_get_tooltip_markup (GtkWidget *widget); void gtk_widget_set_tooltip_markup (GtkWidget *widget, const gchar *markup); gchar* gtk_widget_get_tooltip_text (GtkWidget *widget); void gtk_widget_set_tooltip_text (GtkWidget *widget, const gchar *text); GtkWindow* gtk_widget_get_tooltip_window (GtkWidget *widget); void gtk_widget_set_tooltip_window (GtkWidget *widget, GtkWindow *custom_window); gboolean gtk_widget_get_has_tooltip (GtkWidget *widget); void gtk_widget_set_has_tooltip (GtkWidget *widget, gboolean has_tooltip); void gtk_widget_trigger_tooltip_query (GtkWidget *widget); GdkPixmap* gtk_widget_get_snapshot (GtkWidget *widget, GdkRectangle *clip_rect); GdkWindow* gtk_widget_get_window (GtkWidget *widget); GtkRequisition* gtk_requisition_copy (const GtkRequisition *requisition); void gtk_requisition_free (GtkRequisition *requisition); Object HierarchyGObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkMisc +----GtkCalendar +----GtkCellView +----GtkDrawingArea +----GtkEntry +----GtkRuler +----GtkRange +----GtkSeparator +----GtkInvisible +----GtkOldEditable +----GtkPreview +----GtkProgress Properties"app-paintable" gboolean : Read / Write "can-default" gboolean : Read / Write "can-focus" gboolean : Read / Write "composite-child" gboolean : Read "events" GdkEventMask : Read / Write "extension-events" GdkExtensionMode : Read / Write "has-default" gboolean : Read / Write "has-focus" gboolean : Read / Write "has-tooltip" gboolean : Read / Write "height-request" gint : Read / Write "is-focus" gboolean : Read / Write "name" gchar* : Read / Write "no-show-all" gboolean : Read / Write "parent" GtkContainer* : Read / Write "receives-default" gboolean : Read / Write "sensitive" gboolean : Read / Write "style" GtkStyle* : Read / Write "tooltip-markup" gchar* : Read / Write "tooltip-text" gchar* : Read / Write "visible" gboolean : Read / Write "width-request" gint : Read / Write "window" GdkWindow* : Read Style Properties"cursor-aspect-ratio" gfloat : Read "cursor-color" GdkColor* : Read "draw-border" GtkBorder* : Read "focus-line-pattern" gchar* : Read "focus-line-width" gint : Read "focus-padding" gint : Read "interior-focus" gboolean : Read "link-color" GdkColor* : Read "scroll-arrow-hlength" gint : Read "scroll-arrow-vlength" gint : Read "secondary-cursor-color" GdkColor* : Read "separator-height" gint : Read "separator-width" gint : Read "visited-link-color" GdkColor* : Read "wide-separators" gboolean : Read Signals"accel-closures-changed" "button-press-event" : Run Last "button-release-event" : Run Last "can-activate-accel" : Run Last "child-notify" : Run First / No Recursion / Has Details / No Hooks "client-event" : Run Last "composited-changed" : Run Last / Action "configure-event" : Run Last "damage-event" : Run Last "delete-event" : Run Last "destroy-event" : Run Last "direction-changed" : Run First "drag-begin" : Run Last "drag-data-delete" : Run Last "drag-data-get" : Run Last "drag-data-received" : Run Last "drag-drop" : Run Last "drag-end" : Run Last "drag-failed" : Run Last "drag-leave" : Run Last "drag-motion" : Run Last "enter-notify-event" : Run Last "event" : Run Last "event-after" "expose-event" : Run Last "focus" : Run Last "focus-in-event" : Run Last "focus-out-event" : Run Last "grab-broken-event" : Run Last "grab-focus" : Run Last / Action "grab-notify" : Run First "hide" : Run First "hierarchy-changed" : Run Last "key-press-event" : Run Last "key-release-event" : Run Last "keynav-failed" : Run Last "leave-notify-event" : Run Last "map" : Run First "map-event" : Run Last "mnemonic-activate" : Run Last "motion-notify-event" : Run Last "move-focus" : Run Last / Action "no-expose-event" : Run Last "parent-set" : Run First "popup-menu" : Run Last / Action "property-notify-event" : Run Last "proximity-in-event" : Run Last "proximity-out-event" : Run Last "query-tooltip" : Run Last "realize" : Run First "screen-changed" : Run Last "scroll-event" : Run Last "selection-clear-event" : Run Last "selection-get" : Run Last "selection-notify-event" : Run Last "selection-received" : Run Last "selection-request-event" : Run Last "show" : Run First "show-help" : Run Last / Action "size-allocate" : Run First "size-request" : Run First "state-changed" : Run First "style-set" : Run First "unmap" : Run First "unmap-event" : Run Last "unrealize" : Run Last "visibility-notify-event" : Run Last "window-state-event" : Run Last DescriptionGtkWidget introduces style properties - these are basically object properties that are stored not on the object, but in the style object associated to the widget. Style properties are set in resource files. This mechanism is used for configuring such things as the location of the scrollbar arrows through the theme, giving theme authors more control over the look of applications without the need to write a theme engine in C.
Use GtkWidget as GtkBuildableThe GtkWidget implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named key, modifiers and signal and allows to specify accelerators. Example 49. A UI definition fragment specifying an accelerator <object class="GtkButton"> <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/> </object> In addition to accelerators, GtkWidget also support a custom <accessible> element, which supports actions and relations. Properties on the accessible implementation of an object can be set by accessing the internal child "accessible" of a GtkWidget. Example 50. A UI definition fragment specifying an accessible <object class="GtkButton" id="label1"/> <property name="label">I am a Label for a Button</property> </object> <object class="GtkButton" id="button1"> <accessibility> <action action_name="click" description="Click the button."/> <relation target="label1" type="labelled-by"/> </accessibility> <child internal-child="accessible"> <object class="AtkObject" id="a11y-button1"> <property name="AtkObject::name">Clickable Button</property> </object> </child> </object> DetailsGtkWidgettypedef struct { /* The style for the widget. The style contains the * colors the widget should be drawn in for each state * along with graphics contexts used to draw with and * the font to use for text. */ GtkStyle *GSEAL (style); /* The widget's desired size. */ GtkRequisition GSEAL (requisition); /* The widget's allocated size. */ GtkAllocation GSEAL (allocation); /* The widget's window or its parent window if it does * not have a window. (Which will be indicated by the * GTK_NO_WINDOW flag being set). */ GdkWindow *GSEAL (window); /* The widget's parent. */ GtkWidget *GSEAL (parent); } GtkWidget;
GtkWidgetClasstypedef struct { /* The object class structure needs to be the first * element in the widget class structure in order for * the class mechanism to work correctly. This allows a * GtkWidgetClass pointer to be cast to a GtkObjectClass * pointer. */ GtkObjectClass parent_class; guint activate_signal; guint set_scroll_adjustments_signal; } GtkWidgetClass;
enum GtkWidgetFlagstypedef enum { GTK_TOPLEVEL = 1 << 4, GTK_NO_WINDOW = 1 << 5, GTK_REALIZED = 1 << 6, GTK_MAPPED = 1 << 7, GTK_VISIBLE = 1 << 8, GTK_SENSITIVE = 1 << 9, GTK_PARENT_SENSITIVE = 1 << 10, GTK_CAN_FOCUS = 1 << 11, GTK_HAS_FOCUS = 1 << 12, /* widget is allowed to receive the default via gtk_widget_grab_default * and will reserve space to draw the default if possible */ GTK_CAN_DEFAULT = 1 << 13, /* the widget currently is receiving the default action and should be drawn * appropriately if possible */ GTK_HAS_DEFAULT = 1 << 14, GTK_HAS_GRAB = 1 << 15, GTK_RC_STYLE = 1 << 16, GTK_COMPOSITE_CHILD = 1 << 17, GTK_NO_REPARENT = 1 << 18, GTK_APP_PAINTABLE = 1 << 19, /* the widget when focused will receive the default action and have * HAS_DEFAULT set even if there is a different widget set as default */ GTK_RECEIVES_DEFAULT = 1 << 20, GTK_DOUBLE_BUFFERED = 1 << 21, GTK_NO_SHOW_ALL = 1 << 22 } GtkWidgetFlags; Tells about certain properties of the widget.
GTK_WIDGET_TYPE()#define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid)) Gets the type of a widget.
GTK_WIDGET_STATE()#define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state) Returns the current state of the widget, as a GtkStateType.
GTK_WIDGET_SAVED_STATE()#define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state) Returns the saved state of the widget, as a GtkStateType.
The saved state will be restored when a widget gets sensitive
again, after it has been made insensitive with
GTK_WIDGET_FLAGS()#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
Returns the widget flags from
GTK_WIDGET_TOPLEVEL()#define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
Evaluates to
GTK_WIDGET_NO_WINDOW()#define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
Evaluates to
GTK_WIDGET_REALIZED()#define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
Evaluates to
GTK_WIDGET_MAPPED()#define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
Evaluates to
GTK_WIDGET_VISIBLE()#define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
Evaluates to
GTK_WIDGET_DRAWABLE()#define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
Evaluates to
GTK_WIDGET_SENSITIVE()#define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
Evaluates to
GTK_WIDGET_PARENT_SENSITIVE()#define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
Evaluates to
GTK_WIDGET_IS_SENSITIVE()#define GTK_WIDGET_IS_SENSITIVE(wid)
Evaluates to
GTK_WIDGET_CAN_FOCUS()#define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
Evaluates to
GTK_WIDGET_HAS_FOCUS()#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
Evaluates to
GTK_WIDGET_CAN_DEFAULT()#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
Evaluates to
GTK_WIDGET_RECEIVES_DEFAULT()#define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
Evaluates to
GTK_WIDGET_HAS_DEFAULT()#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
Evaluates to
GTK_WIDGET_HAS_GRAB()#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
Evaluates to
GTK_WIDGET_RC_STYLE()#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
Evaluates to
GTK_WIDGET_COMPOSITE_CHILD()#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
Evaluates to
GTK_WIDGET_APP_PAINTABLE()#define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
Evaluates to
GTK_WIDGET_DOUBLE_BUFFERED()#define GTK_WIDGET_DOUBLE_BUFFERED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_DOUBLE_BUFFERED) != 0)
Evaluates to
GTK_WIDGET_SET_FLAGS()#define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END Turns on certain widget flags.
GTK_WIDGET_UNSET_FLAGS()#define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END Turns off certain widget flags.
GtkCallback ()void (*GtkCallback) (GtkWidget *widget, gpointer data);
The type of the callback functions used for e.g. iterating over
the children of a container, see
GtkRequisitiontypedef struct { gint width; gint height; } GtkRequisition; A GtkRequisition represents the desired size of a widget. See the section called “Size Requisition” for more information.
struct GtkAllocationstruct GtkAllocation { gint x; gint y; gint width; gint height; }; A GtkAllocation of a widget represents region which has been allocated to the widget by its parent. It is a subregion of its parents allocation. See the section called “Size Allocation” for more information.
GtkSelectionDatatypedef struct { GdkAtom GSEAL (selection); GdkAtom GSEAL (target); GdkAtom GSEAL (type); gint GSEAL (format); guchar *GSEAL (data); gint GSEAL (length); GdkDisplay *GSEAL (display); } GtkSelectionData;
GtkWidgetAuxInfotypedef struct { gint x; gint y; gint width; gint height; guint x_set : 1; guint y_set : 1; } GtkWidgetAuxInfo;
GtkWidgetShapeInfotypedef struct { gint16 offset_x; gint16 offset_y; GdkBitmap *shape_mask; } GtkWidgetShapeInfo;
enum GtkWidgetHelpTypetypedef enum { GTK_WIDGET_HELP_TOOLTIP, GTK_WIDGET_HELP_WHATS_THIS } GtkWidgetHelpType;
gtk_widget_new ()GtkWidget* gtk_widget_new (GType type, const gchar *first_property_name, ...);
This is a convenience function for creating a widget and setting
its properties in one go. For example you might write:
gtk_widget_ref ()GtkWidget* gtk_widget_ref (GtkWidget *widget); Warning
Adds a reference to a widget. This function is exactly the same
as calling
gtk_widget_unref ()void gtk_widget_unref (GtkWidget *widget); Warning
Inverse of
gtk_widget_destroy ()void gtk_widget_destroy (GtkWidget *widget);
Destroys a widget. Equivalent to In most cases, only toplevel widgets (windows) require explicit destruction, because when you destroy a toplevel its children will be destroyed as well.
gtk_widget_destroyed ()void gtk_widget_destroyed (GtkWidget *widget, GtkWidget **widget_pointer);
This function sets *
gtk_widget_set ()void gtk_widget_set (GtkWidget *widget, const gchar *first_property_name, ...); Warning
Precursor of
gtk_widget_unparent ()void gtk_widget_unparent (GtkWidget *widget); This function is only for use in widget implementations. Should be called by implementations of the remove method on GtkContainer, to dissociate a child from the container.
gtk_widget_show ()void gtk_widget_show (GtkWidget *widget);
Flags a widget to be displayed. Any widget that isn't shown will
not appear on the screen. If you want to show all the widgets in a
container, it's easier to call Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen. When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.
gtk_widget_show_now ()void gtk_widget_show_now (GtkWidget *widget); Shows a widget. If the widget is an unmapped toplevel widget (i.e. a GtkWindow that has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.
gtk_widget_hide ()void gtk_widget_hide (GtkWidget *widget);
Reverses the effects of
gtk_widget_show_all ()void gtk_widget_show_all (GtkWidget *widget); Recursively shows a widget, and any child widgets (if the widget is a container).
gtk_widget_hide_all ()void gtk_widget_hide_all (GtkWidget *widget); Recursively hides a widget and any child widgets.
gtk_widget_map ()void gtk_widget_map (GtkWidget *widget); This function is only for use in widget implementations. Causes a widget to be mapped if it isn't already.
gtk_widget_unmap ()void gtk_widget_unmap (GtkWidget *widget); This function is only for use in widget implementations. Causes a widget to be unmapped if it's currently mapped.
gtk_widget_realize ()void gtk_widget_realize (GtkWidget *widget);
Creates the GDK (windowing system) resources associated with a
widget. For example,
Realizing a widget requires all
the widget's parent widgets to be realized; calling
This function is primarily used in widget implementations, and
isn't very useful otherwise. Many times when you think you might
need it, a better approach is to connect to a signal that will be
called after the widget is realized automatically, such as
GtkWidget::expose-event. Or simply
gtk_widget_unrealize ()void gtk_widget_unrealize (GtkWidget *widget);
This function is only useful in widget implementations.
Causes a widget to be unrealized (frees all GDK resources
associated with the widget, such as
gtk_widget_queue_draw ()void gtk_widget_queue_draw (GtkWidget *widget);
Equivalent to calling
gtk_widget_queue_resize ()void gtk_widget_queue_resize (GtkWidget *widget); This function is only for use in widget implementations. Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a GtkLabel, GtkLabel queues a resize to ensure there's enough space for the new text.
gtk_widget_queue_resize_no_redraw ()void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
This function works like
Since 2.4 gtk_widget_draw ()void gtk_widget_draw (GtkWidget *widget, const GdkRectangle *area); Warning
In GTK+ 1.2, this function would immediately render the
region
gtk_widget_size_request ()void gtk_widget_size_request (GtkWidget *widget, GtkRequisition *requisition);
This function is typically used when implementing a GtkContainer
subclass. Obtains the preferred size of a widget. The container
uses this information to arrange its child widgets and decide what
size allocations to give them with You can also call this function from an application, with some caveats. Most notably, getting a size request requires the widget to be associated with a screen, because font information may be needed. Multihead-aware applications should keep this in mind. Also remember that the size request is not necessarily the size a widget will actually be allocated.
See also
gtk_widget_get_child_requisition ()void gtk_widget_get_child_requisition (GtkWidget *widget, GtkRequisition *requisition);
This function is only for use in widget implementations. Obtains
This function differs from
Because this function does not call the "size_request" method, it
can only be used when you know that
gtk_widget_size_allocate ()void gtk_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); This function is only used by GtkContainer subclasses, to assign a size and position to their child widgets.
gtk_widget_add_accelerator ()void gtk_widget_add_accelerator (GtkWidget *widget, const gchar *accel_signal, GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, GtkAccelFlags accel_flags);
Installs an accelerator for this
gtk_widget_remove_accelerator ()gboolean gtk_widget_remove_accelerator (GtkWidget *widget, GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods);
Removes an accelerator from
gtk_widget_set_accel_path ()void gtk_widget_set_accel_path (GtkWidget *widget, const gchar *accel_path, GtkAccelGroup *accel_group);
Given an accelerator group, This function is a low level function that would most likely be used by a menu creation system like GtkUIManager. If you use GtkUIManager, setting up accelerator paths will be done automatically.
Even when you you aren't using GtkUIManager, if you only want to
set up accelerators on menu items
Note that
gtk_widget_list_accel_closures ()GList* gtk_widget_list_accel_closures (GtkWidget *widget);
Lists the closures used by
gtk_widget_can_activate_accel ()gboolean gtk_widget_can_activate_accel (GtkWidget *widget, guint signal_id);
Determines whether an accelerator that activates the signal
identified by
Since 2.4 gtk_widget_event ()gboolean gtk_widget_event (GtkWidget *widget, GdkEvent *event);
Rarely-used function. This function is used to emit
the event signals on a widget (those signals should never
be emitted without using this function to do so).
If you want to synthesize an event though, don't use this function;
instead, use
gtk_widget_activate ()gboolean gtk_widget_activate (GtkWidget *widget);
For widgets that can be "activated" (buttons, menu items, etc.)
this function activates them. Activation is what happens when you
press Enter on a widget during key navigation. If
gtk_widget_reparent ()void gtk_widget_reparent (GtkWidget *widget, GtkWidget *new_parent); Moves a widget from one GtkContainer to another, handling reference count issues to avoid destroying the widget.
gtk_widget_intersect ()gboolean gtk_widget_intersect (GtkWidget *widget, const GdkRectangle *area, GdkRectangle *intersection);
Computes the intersection of a
gtk_widget_is_focus ()gboolean gtk_widget_is_focus (GtkWidget *widget);
Determines if the widget is the focus widget within its
toplevel. (This does not mean that the
gtk_widget_grab_focus ()void gtk_widget_grab_focus (GtkWidget *widget);
Causes
gtk_widget_grab_default ()void gtk_widget_grab_default (GtkWidget *widget);
Causes
gtk_widget_set_name ()void gtk_widget_set_name (GtkWidget *widget, const gchar *name); Widgets can be named, which allows you to refer to them from a gtkrc file. You can apply a style to widgets with a particular name in the gtkrc file. See the documentation for gtkrc files (on the same page as the docs for GtkRcStyle).
Note that widget names are separated by periods in paths (see
gtk_widget_get_name ()const gchar* gtk_widget_get_name (GtkWidget *widget);
Retrieves the name of a widget. See
gtk_widget_set_state ()void gtk_widget_set_state (GtkWidget *widget, GtkStateType state);
This function is for use in widget implementations. Sets the state
of a widget (insensitive, prelighted, etc.) Usually you should set
the state using wrapper functions such as
gtk_widget_set_sensitive ()void gtk_widget_set_sensitive (GtkWidget *widget, gboolean 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", "disabled", or "ghosted" in some other toolkits.
gtk_widget_set_parent ()void gtk_widget_set_parent (GtkWidget *widget, GtkWidget *parent);
This function is useful only when implementing subclasses of
GtkContainer.
Sets the container as the parent of
gtk_widget_set_parent_window ()void gtk_widget_set_parent_window (GtkWidget *widget, GdkWindow *parent_window);
Sets a non default parent window for
gtk_widget_get_parent_window ()GdkWindow* gtk_widget_get_parent_window (GtkWidget *widget);
Gets
gtk_widget_set_uposition ()void gtk_widget_set_uposition (GtkWidget *widget, gint x, gint y); Warning
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 exists for legacy reasons. This function doesn't work if a widget is inside a container; it's only really useful on GtkWindow.
Don't use this function to center dialogs over the main application
window; most window managers will do the centering on your behalf
if you call
Note that although
gtk_widget_set_usize ()void gtk_widget_set_usize (GtkWidget *widget, gint width, gint height); Warning
Sets the minimum size of a widget; that is, the widget's size
request will be Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct.
gtk_widget_set_events ()void gtk_widget_set_events (GtkWidget *widget, gint events);
Sets the event mask (see GdkEventMask) for a widget. The event
mask determines which events a widget will receive. Keep in mind
that different widgets have different default event masks, and by
changing the event mask you may disrupt a widget's functionality,
so be careful. This function must be called while a widget is
unrealized. Consider
gtk_widget_add_events ()void gtk_widget_add_events (GtkWidget *widget, gint events);
Adds the events in the bitfield
gtk_widget_set_extension_events ()void gtk_widget_set_extension_events (GtkWidget *widget, GdkExtensionMode mode);
Sets the extension events mask to
gtk_widget_get_extension_events ()GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
Retrieves the extension events the widget will receive; see
gtk_widget_get_toplevel ()GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
This function returns the topmost widget in the container hierarchy
Note the difference in behavior vs.
To reliably find the toplevel GtkWindow, use
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); if (GTK_WIDGET_TOPLEVEL (toplevel)) { /* Perform action on toplevel. */ }
gtk_widget_get_ancestor ()GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, GType widget_type);
Gets the first ancestor of
Note that unlike
gtk_widget_get_colormap ()GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
Gets the colormap that will be used to render
gtk_widget_set_colormap ()void gtk_widget_set_colormap (GtkWidget *widget, GdkColormap *colormap);
Sets the colormap for the widget to the given value. Widget must not
have been previously realized. This probably should only be used
from an
gtk_widget_get_visual ()GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
Gets the visual that will be used to render
gtk_widget_get_events ()gint gtk_widget_get_events (GtkWidget *widget); Returns the event mask for the widget (a bitfield containing flags from the GdkEventMask enumeration). These are the events that the widget will receive.
gtk_widget_get_pointer ()void gtk_widget_get_pointer (GtkWidget *widget, gint *x, gint *y);
Obtains the location of the mouse pointer in widget coordinates.
Widget coordinates are a bit odd; for historical reasons, they are
defined as
gtk_widget_is_ancestor ()gboolean gtk_widget_is_ancestor (GtkWidget *widget, GtkWidget *ancestor);
Determines whether
gtk_widget_translate_coordinates ()gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget, GtkWidget *dest_widget, gint src_x, gint src_y, gint *dest_x, gint *dest_y);
Translate coordinates relative to
gtk_widget_hide_on_delete ()gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
Utility function; intended to be connected to the "delete-event"
signal on a GtkWindow. The function calls
gtk_widget_set_style ()void gtk_widget_set_style (GtkWidget *widget, GtkStyle *style);
Sets the GtkStyle for a widget (
gtk_widget_set_rc_style()#define gtk_widget_set_rc_style(widget) (gtk_widget_set_style (widget, NULL)) Warning
Equivalent to
gtk_widget_ensure_style ()void gtk_widget_ensure_style (GtkWidget *widget);
Ensures that
gtk_widget_get_style ()GtkStyle* gtk_widget_get_style (GtkWidget *widget);
Simply an accessor function that returns
gtk_widget_restore_default_style()#define gtk_widget_restore_default_style(widget) (gtk_widget_set_style (widget, NULL)) Warning
Equivalent to
gtk_widget_reset_rc_styles ()void gtk_widget_reset_rc_styles (GtkWidget *widget);
Reset the styles of This function is not useful for applications.
gtk_widget_push_colormap ()void gtk_widget_push_colormap (GdkColormap *cmap);
Pushes
gtk_widget_pop_colormap ()void gtk_widget_pop_colormap (void);
Removes a colormap pushed with
gtk_widget_set_default_colormap ()void gtk_widget_set_default_colormap (GdkColormap *colormap);
Sets the default colormap to use when creating widgets.
gtk_widget_get_default_style ()GtkStyle* gtk_widget_get_default_style (void); Returns the default style used by all widgets initially.
gtk_widget_get_default_colormap ()GdkColormap* gtk_widget_get_default_colormap (void); Obtains the default colormap used to create widgets.
gtk_widget_get_default_visual ()GdkVisual* gtk_widget_get_default_visual (void);
Obtains the visual of the default colormap. Not really useful;
used to be useful before
gtk_widget_set_direction ()void gtk_widget_set_direction (GtkWidget *widget, GtkTextDirection dir); Sets the reading direction on a particular widget. This direction controls the primary direction for widgets containing text, and also the direction in which the children of a container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left 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 justification).
If the direction is set to
enum GtkTextDirectiontypedef enum { GTK_TEXT_DIR_NONE, GTK_TEXT_DIR_LTR, GTK_TEXT_DIR_RTL } GtkTextDirection;
gtk_widget_get_direction ()GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
Gets the reading direction for a particular widget. See
gtk_widget_set_default_direction ()void gtk_widget_set_default_direction (GtkTextDirection dir);
Sets the default reading direction for widgets where the
direction has not been explicitly set by
gtk_widget_get_default_direction ()GtkTextDirection gtk_widget_get_default_direction (void);
Obtains the current default reading direction. See
gtk_widget_shape_combine_mask ()void gtk_widget_shape_combine_mask (GtkWidget *widget, GdkBitmap *shape_mask, gint offset_x, gint offset_y);
Sets a shape for this widget's GDK window. This allows for
transparent windows etc., see
gtk_widget_input_shape_combine_mask ()void gtk_widget_input_shape_combine_mask (GtkWidget *widget, GdkBitmap *shape_mask, gint offset_x, gint offset_y);
Sets an input shape for this widget's GDK window. This allows for
windows which react to mouse click in a nonrectangular region, see
Since 2.10 gtk_widget_path ()void gtk_widget_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed);
Obtains the full path to
gtk_widget_class_path ()void gtk_widget_class_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed);
Same as
gtk_widget_get_composite_name ()gchar* gtk_widget_get_composite_name (GtkWidget *widget); Obtains the composite name of a widget.
gtk_widget_modify_style ()void gtk_widget_modify_style (GtkWidget *widget, GtkRcStyle *style);
Modifies style values on the widget. Modifications made using this
technique take precedence over style values set via an RC file,
however, they will be overriden if a style is explicitely set on
the widget using
Note that modifications made with this function are not cumulative
with previous calls to
gtk_widget_get_modifier_style ()GtkRcStyle* gtk_widget_get_modifier_style (GtkWidget *widget);
Returns the current modifier style for the widget. (As set by
Caution: passing the style back to
gtk_widget_modify_fg ()void gtk_widget_modify_fg (GtkWidget *widget, GtkStateType state, const GdkColor *color);
Sets the foreground color for a widget in a particular state.
All other style values are left untouched. See also
gtk_widget_modify_bg ()void gtk_widget_modify_bg (GtkWidget *widget, GtkStateType state, const GdkColor *color);
Sets the background color for a widget in a particular state.
All other style values are left untouched. See also
Note that "no window" widgets (which have the
gtk_widget_modify_text ()void gtk_widget_modify_text (GtkWidget *widget, GtkStateType state, const GdkColor *color);
Sets the text color for a widget in a particular state. All other
style values are left untouched. The text color is the foreground
color used along with the base color (see
gtk_widget_modify_base ()void gtk_widget_modify_base (GtkWidget *widget, GtkStateType state, const GdkColor *color);
Sets the base color for a widget in a particular state.
All other style values are left untouched. The base color
is the background color used along with the text color
(see
Note that "no window" widgets (which have the
gtk_widget_modify_font ()void gtk_widget_modify_font (GtkWidget *widget, PangoFontDescription *font_desc);
Sets the font to use for a widget. All other style values are left
untouched. See also
gtk_widget_modify_cursor ()void gtk_widget_modify_cursor (GtkWidget *widget, const GdkColor *primary, const GdkColor *secondary);
Sets the cursor color to use in a widget, overriding the
"cursor-color" and "secondary-cursor-color"
style properties. All other style values are left untouched.
See also
Since 2.12 gtk_widget_create_pango_context ()PangoContext* gtk_widget_create_pango_context (GtkWidget *widget);
Creates a new PangoContext with the appropriate font map,
font description, and base direction for drawing text for
this widget. See also
gtk_widget_get_pango_context ()PangoContext* gtk_widget_get_pango_context (GtkWidget *widget);
Gets a PangoContext with the appropriate font map, font description,
and base direction for this widget. Unlike the context returned
by
If you create and keep a PangoLayout using this context, you must
deal with changes to the context by calling
gtk_widget_create_pango_layout ()PangoLayout* gtk_widget_create_pango_layout (GtkWidget *widget, const gchar *text); Creates a new PangoLayout with the appropriate font map, font description, and base direction for drawing text for this widget.
If you keep a PangoLayout created in this way around, in order to
notify the layout of changes to the base direction or font of this
widget, you must call
gtk_widget_render_icon ()GdkPixbuf* gtk_widget_render_icon (GtkWidget *widget, const gchar *stock_id, GtkIconSize size, const gchar *detail);
A convenience function that uses the theme engine and RC file
settings for
The pixels in the returned GdkPixbuf are shared with the rest of
the application and should not be modified. The pixbuf should be freed
after use with
gtk_widget_pop_composite_child ()void gtk_widget_pop_composite_child (void);
Cancels the effect of a previous call to
gtk_widget_push_composite_child ()void gtk_widget_push_composite_child (void);
Makes all newly-created widgets as composite children until
the corresponding
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 Here is a simple example: 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)); g_object_ref (scrolled_window->hscrollbar);
gtk_widget_queue_clear ()void gtk_widget_queue_clear (GtkWidget *widget); Warning
This function does the same as
gtk_widget_queue_clear_area ()void gtk_widget_queue_clear_area (GtkWidget *widget, gint x, gint y, gint width, gint height); Warning
This function is no longer different from
gtk_widget_queue_draw_area ()void gtk_widget_queue_draw_area (GtkWidget *widget, gint x, gint y, gint width, gint height);
Invalidates the rectangular area of
Normally you would only use this function in widget
implementations. You might also use it, or
Frequently you can just call The advantage of adding to the invalidated region compared to simply drawing immediately is efficiency; using an invalid region ensures that you only have to redraw one time.
gtk_widget_reset_shapes ()void gtk_widget_reset_shapes (GtkWidget *widget); Recursively resets the shape on this widget and its descendants.
gtk_widget_set_app_paintable ()void gtk_widget_set_app_paintable (GtkWidget *widget, gboolean app_paintable); Sets whether the application intends to draw on the widget in an "expose-event" handler. This is a hint to the widget and does not affect the behavior of the GTK+ core; many widgets ignore this flag entirely. For widgets that do pay attention to the flag, such as GtkEventBox and GtkWindow, the effect is to suppress default themed drawing of the widget's background. (Children of the widget will still be drawn.) The application is then entirely responsible for drawing the widget background. Note that the background is still drawn when the widget is mapped. If this is not suitable (e.g. because you want to make a transparent window using an RGBA visual), you can work around this by doing: gtk_widget_realize (window); gdk_window_set_back_pixmap (window->window, NULL, FALSE); gtk_widget_show (window);
gtk_widget_set_double_buffered ()void gtk_widget_set_double_buffered (GtkWidget *widget, gboolean double_buffered);
Widgets are double buffered by default; you can use this function
to turn off the buffering. "Double buffered" simply means that
In very simple terms, double buffered widgets don't flicker, so you would only use this function to turn off double buffering if you had special needs and really knew what you were doing.
Note: if you turn off double-buffering, you have to handle
expose events, since even the clearing to the background color or
pixmap will not happen automatically (as it is done in
gtk_widget_set_redraw_on_allocate ()void gtk_widget_set_redraw_on_allocate (GtkWidget *widget, gboolean redraw_on_allocate);
Sets whether the entire widget is queued for drawing when its size
allocation changes. By default, this setting is
Note that for
gtk_widget_set_composite_name ()void gtk_widget_set_composite_name (GtkWidget *widget, const gchar *name);
Sets a widgets composite name. The widget must be
a composite child of its parent; see
gtk_widget_set_scroll_adjustments ()gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment);
For widgets that support scrolling, sets the scroll adjustments and
returns
gtk_widget_mnemonic_activate ()gboolean gtk_widget_mnemonic_activate (GtkWidget *widget, gboolean group_cycling);
gtk_widget_class_install_style_property ()void gtk_widget_class_install_style_property (GtkWidgetClass *klass, GParamSpec *pspec);
Installs a style property on a widget class. The parser for the
style property is determined by the value type of
gtk_widget_class_install_style_property_parser ()void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass, GParamSpec *pspec, GtkRcPropertyParser parser); Installs a style property on a widget class.
gtk_widget_class_find_style_property ()GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass, const gchar *property_name); Finds a style property of a widget class by name.
Since 2.2 gtk_widget_class_list_style_properties ()GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass, guint *n_properties); Returns all style properties of a widget class.
Since 2.2 gtk_widget_region_intersect ()GdkRegion* gtk_widget_region_intersect (GtkWidget *widget, const GdkRegion *region);
Computes the intersection of a
gtk_widget_send_expose ()gint gtk_widget_send_expose (GtkWidget *widget, GdkEvent *event);
Very rarely-used function. This function is used to emit
an expose event signals on a widget. This function is not
normally used directly. The only time it is used is when
propagating an expose event to a child
If you want to force an area of a window to be redrawn,
use
gtk_widget_style_get ()void gtk_widget_style_get (GtkWidget *widget, const gchar *first_property_name, ...);
Gets the values of a multiple style properties of
gtk_widget_style_get_property ()void gtk_widget_style_get_property (GtkWidget *widget, const gchar *property_name, GValue *value);
Gets the value of a style property of
gtk_widget_style_get_valist ()void gtk_widget_style_get_valist (GtkWidget *widget, const gchar *first_property_name, va_list var_args);
Non-vararg variant of
gtk_widget_get_accessible ()AtkObject* gtk_widget_get_accessible (GtkWidget *widget); Returns the accessible object that describes the widget to an assistive technology.
If no accessibility library is loaded (i.e. no ATK implementation library is
loaded via The documentation of the ATK library contains more information about accessible objects and their uses.
gtk_widget_child_focus ()gboolean gtk_widget_child_focus (GtkWidget *widget, GtkDirectionType direction);
This function is used by custom widget implementations; if you're
writing an app, you'd use
The default ::focus handler for a widget should return
This function replaces
gtk_widget_child_notify ()void gtk_widget_child_notify (GtkWidget *widget, const gchar *child_property);
Emits a "child-notify" signal for the
child property
This is the analogue of
gtk_widget_freeze_child_notify ()void gtk_widget_freeze_child_notify (GtkWidget *widget);
Stops emission of "child-notify" signals on
This is the analogue of
gtk_widget_get_child_visible ()gboolean gtk_widget_get_child_visible (GtkWidget *widget);
Gets the value set with This function is only useful for container implementations and never should be called by an application.
gtk_widget_get_parent ()GtkWidget* gtk_widget_get_parent (GtkWidget *widget);
Returns the parent container of
gtk_widget_get_settings ()GtkSettings* gtk_widget_get_settings (GtkWidget *widget); Gets the settings object holding the settings (global property settings, RC file information, etc) used for this widget. Note that this function can only be called when the GtkWidget is attached to a toplevel, since the settings object is specific to a particular GdkScreen.
gtk_widget_get_clipboard ()GtkClipboard* gtk_widget_get_clipboard (GtkWidget *widget, GdkAtom selection);
Returns the clipboard object for the given selection to
be used with
Since 2.2 gtk_widget_get_display ()GdkDisplay* gtk_widget_get_display (GtkWidget *widget); Get the GdkDisplay for the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a GtkWindow at the top. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.
Since 2.2 gtk_widget_get_root_window ()GdkWindow* gtk_widget_get_root_window (GtkWidget *widget); Get the root window where this widget is located. This function can only be called after the widget has been added to a widget heirarchy with GtkWindow at the top. The root window is useful for such purposes as creating a popup GdkWindow associated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.
Since 2.2 gtk_widget_get_screen ()GdkScreen* gtk_widget_get_screen (GtkWidget *widget); Get the GdkScreen from the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a GtkWindow at the top. In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.
Since 2.2 gtk_widget_has_screen ()gboolean gtk_widget_has_screen (GtkWidget *widget); Checks whether there is a GdkScreen is associated with this widget. All toplevel widgets have an associated screen, and all widgets added into a heirarchy with a toplevel window at the top.
Since 2.2 gtk_widget_get_size_request ()void gtk_widget_get_size_request (GtkWidget *widget, gint *width, gint *height);
Gets the size request that was explicitly set for the widget using
gtk_widget_pop_visual()#define gtk_widget_pop_visual() ((void) 0) Warning
This function is deprecated; it does nothing. gtk_widget_push_visual()#define gtk_widget_push_visual(visual) ((void) 0) Warning
This function is deprecated; it does nothing.
gtk_widget_set_child_visible ()void gtk_widget_set_child_visible (GtkWidget *widget, gboolean is_visible);
Sets whether
The child visibility can be set for widget before it is added to
a container with Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself. This function is only useful for container implementations and never should be called by an application.
gtk_widget_set_default_visual()#define gtk_widget_set_default_visual(visual) ((void) 0) Warning
This function is deprecated; it does nothing.
gtk_widget_set_size_request ()void gtk_widget_set_size_request (GtkWidget *widget, gint width, gint height);
Sets the minimum size of a widget; that is, the widget's size
request will be
In most cases, Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct. The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it requested. If the size request in a given direction is -1 (unset), then the "natural" size request of the widget will be used instead. Widgets can't actually be allocated a size less than 1 by 1, but you can pass 0,0 to this function to mean "as small as possible."
gtk_widget_set_visual()#define gtk_widget_set_visual(widget,visual) ((void) 0) Warning
This function is deprecated; it does nothing.
gtk_widget_thaw_child_notify ()void gtk_widget_thaw_child_notify (GtkWidget *widget);
Reverts the effect of a previous call to
gtk_widget_set_no_show_all ()void gtk_widget_set_no_show_all (GtkWidget *widget, gboolean no_show_all);
Sets the "no-show-all" property, which determines whether
calls to This is mostly for use in constructing widget hierarchies with externally controlled visibility, see GtkUIManager.
Since 2.4 gtk_widget_get_no_show_all ()gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
Returns the current value of the GtkWidget:no-show-all property,
which determines whether calls to
Since 2.4 gtk_widget_list_mnemonic_labels ()GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
Returns a newly allocated list of the widgets, normally labels, for
which this widget is a the target of a mnemonic (see for example,
The widgets in the list are not individually referenced. If you
want to iterate through the list and perform actions involving
callbacks that might destroy the widgets, you
must call
Since 2.4 gtk_widget_add_mnemonic_label ()void gtk_widget_add_mnemonic_label (GtkWidget *widget, GtkWidget *label);
Adds a widget to the list of mnemonic labels for
this widget. (See
Since 2.4 gtk_widget_remove_mnemonic_label ()void gtk_widget_remove_mnemonic_label (GtkWidget *widget, GtkWidget *label);
Removes a widget from the list of mnemonic labels for
this widget. (See
Since 2.4 gtk_widget_get_action ()GtkAction* gtk_widget_get_action (GtkWidget *widget);
Returns the GtkAction that
Since 2.10 gtk_widget_is_composited ()gboolean gtk_widget_is_composited (GtkWidget *widget);
Whether
Please note that the semantics of this call will change
in the future if used on a widget that has a composited
window in its heirarchy (as set by
Since 2.10 gtk_widget_error_bell ()void gtk_widget_error_bell (GtkWidget *widget);
Notifies the user about an input-related error on this widget.
If the "gtk-error-bell" setting is
Note that the effect of
Since 2.12 gtk_widget_keynav_failed ()gboolean gtk_widget_keynav_failed (GtkWidget *widget, GtkDirectionType direction);
This function should be called whenever keyboard navigation within
a single widget hits a boundary. The function emits the
"keynav-failed" signal on the widget and its return
value should be interpreted in a way similar to the return value of
When
When
The default ::keynav-failed handler returns
Whenever the default handler returns A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of GtkEntry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.
Since 2.12 gtk_widget_get_tooltip_markup ()gchar* gtk_widget_get_tooltip_markup (GtkWidget *widget);
Gets the contents of the tooltip for
Since 2.12 gtk_widget_set_tooltip_markup ()void gtk_widget_set_tooltip_markup (GtkWidget *widget, const gchar *markup);
Sets
This function will take care of setting GtkWidget:has-tooltip to
See also the GtkWidget:tooltip-markup property and
Since 2.12 gtk_widget_get_tooltip_text ()gchar* gtk_widget_get_tooltip_text (GtkWidget *widget);
Gets the contents of the tooltip for
Since 2.12 gtk_widget_set_tooltip_text ()void gtk_widget_set_tooltip_text (GtkWidget *widget, const gchar *text);
Sets
See also the GtkWidget:tooltip-text property and
Since 2.12 gtk_widget_get_tooltip_window ()GtkWindow* gtk_widget_get_tooltip_window (GtkWidget *widget);
Returns the GtkWindow of the current tooltip. This can be the
GtkWindow created by default, or the custom tooltip window set
using
Since 2.12 gtk_widget_set_tooltip_window ()void gtk_widget_set_tooltip_window (GtkWidget *widget, GtkWindow *custom_window);
Replaces the default, usually yellow, window used for displaying
tooltips with
Since 2.12 gtk_widget_get_has_tooltip ()gboolean gtk_widget_get_has_tooltip (GtkWidget *widget); Returns the current value of the has-tooltip property. See GtkWidget:has-tooltip for more information.
Since 2.12 gtk_widget_set_has_tooltip ()void gtk_widget_set_has_tooltip (GtkWidget *widget, gboolean has_tooltip);
Sets the has-tooltip property on
Since 2.12 gtk_widget_trigger_tooltip_query ()void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
Triggers a tooltip query on the display where the toplevel of
Since 2.12 gtk_widget_get_snapshot ()GdkPixmap* gtk_widget_get_snapshot (GtkWidget *widget, GdkRectangle *clip_rect); Create a GdkPixmap of the contents of the widget and its children.
Works even if the widget is obscured. The depth and visual of the
resulting pixmap is dependent on the widget being snapshot and likely
differs from those of a target widget displaying the pixmap.
The function
The snapshot area used by this function is the
If
The returned pixmap can be
Since 2.14 gtk_widget_get_window ()GdkWindow* gtk_widget_get_window (GtkWidget *widget);
Returns the widget's window if it is realized,
Since 2.14 gtk_requisition_copy ()GtkRequisition* gtk_requisition_copy (const GtkRequisition *requisition); Copies a GtkRequisition.
gtk_requisition_free ()void gtk_requisition_free (GtkRequisition *requisition); Frees a GtkRequisition.
Property DetailsThe
|
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"button-press-event"
signalgboolean user_function (GtkWidget *widget, GdkEventButton *event, gpointer user_data) : Run Last
The ::button-press-event signal will be emitted when a button (typically from a mouse) is pressed.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_BUTTON_PRESS_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal. |
|
the GdkEventButton which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"button-release-event"
signalgboolean user_function (GtkWidget *widget, GdkEventButton *event, gpointer user_data) : Run Last
The ::button-release-event signal will be emitted when a button (typically from a mouse) is released.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_BUTTON_RELEASE_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal. |
|
the GdkEventButton which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"can-activate-accel"
signalgboolean user_function (GtkWidget *widget, guint signal_id, gpointer user_data) : Run Last
Determines whether an accelerator that activates the signal
identified by signal_id
can currently be activated.
This signal is present to allow applications and derived
widgets to override the default GtkWidget handling
for determining whether an accelerator can be activated.
|
the object which received the signal |
|
the ID of a signal installed on widget
|
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the signal can be activated.
|
"child-notify"
signalvoid user_function (GtkWidget *widget, GParamSpec *pspec, gpointer user_data) : Run First / No Recursion / Has Details / No Hooks
The ::child-notify signal is emitted for each child property that has changed on an object. The signal's detail holds the property name.
|
the object which received the signal |
|
the GParamSpec of the changed child property |
|
user data set when the signal handler was connected. |
"client-event"
signalgboolean user_function (GtkWidget *widget, GdkEventClient *event, gpointer user_data) : Run Last
The ::client-event will be emitted when the widget
's window
receives a message (via a ClientMessage event) from another
application.
|
the object which received the signal |
|
the GdkEventClient which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for
the event. FALSE to propagate the event further.
|
"composited-changed"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run Last / Action
The ::composited-changed signal is emitted when the composited
status of widget
s screen changes.
See gdk_screen_is_composited()
.
|
the object on which the signal is emitted |
|
user data set when the signal handler was connected. |
"configure-event"
signalgboolean user_function (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data) : Run Last
The ::configure-event signal will be emitted when the size, position or
stacking of the widget
's window has changed.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.
|
the object which received the signal |
|
the GdkEventConfigure which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"damage-event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
Emitted when a redirected window belonging to widget
gets drawn into.
The region/area members of the event shows what area of the redirected
drawable was drawn into.
|
the object which received the signal |
|
the GdkEventExpose event |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
Since 2.14
"delete-event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
The ::delete-event signal is emitted if a user requests that
a toplevel window is closed. The default handler for this signal
destroys the window. Connecting gtk_widget_hide_on_delete()
to
this signal will cause the window to be hidden instead, so that
it can later be shown again without reconstructing it.
|
the object which received the signal |
|
the event which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"destroy-event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
The ::destroy-event signal is emitted when a GdkWindow is destroyed. You rarely get this signal, because most widgets disconnect themselves from their window before they destroy it, so no widget owns the window at destroy time.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.
|
the object which received the signal. |
|
the event which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"direction-changed"
signalvoid user_function (GtkWidget *widget, GtkTextDirection previous_direction, gpointer user_data) : Run First
The ::direction-changed signal is emitted when the text direction of a widget changes.
|
the object on which the signal is emitted |
|
the previous text direction of widget
|
|
user data set when the signal handler was connected. |
"drag-begin"
signalvoid user_function (GtkWidget *widget, GdkDragContext *drag_context, gpointer user_data) : Run Last
The ::drag-begin signal is emitted on the drag source when a drag is
started. A typical reason to connect to this signal is to set up a
custom drag icon with gtk_drag_source_set_icon()
.
|
the object which received the signal |
|
the drag context |
|
user data set when the signal handler was connected. |
"drag-data-delete"
signalvoid user_function (GtkWidget *widget, GdkDragContext *drag_context, gpointer user_data) : Run Last
The ::drag-data-delete signal is emitted on the drag source when a drag
with the action GDK_ACTION_MOVE
is successfully completed. The signal
handler is responsible for deleting the data that has been dropped. What
"delete" means depends on the context of the drag operation.
|
the object which received the signal |
|
the drag context |
|
user data set when the signal handler was connected. |
"drag-data-get"
signalvoid user_function (GtkWidget *widget, GdkDragContext *drag_context, GtkSelectionData *data, guint info, guint time, gpointer user_data) : Run Last
The ::drag-data-get signal is emitted on the drag source when the drop
site requests the data which is dragged. It is the responsibility of
the signal handler to fill data
with the data in the format which
is indicated by info
. See gtk_selection_data_set()
and
gtk_selection_data_set_text()
.
|
the object which received the signal |
|
the drag context |
|
the GtkSelectionData to be filled with the dragged data |
|
the info that has been registered with the target in the GtkTargetList |
|
the timestamp at which the data was requested |
|
user data set when the signal handler was connected. |
"drag-data-received"
signalvoid user_function (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data) : Run Last
The ::drag-data-received signal is emitted on the drop site when the
dragged data has been received. If the data was received in order to
determine whether the drop will be accepted, the handler is expected
to call gdk_drag_status()
and not finish the drag.
If the data was received in response to a "drag-drop" signal
(and this is the last target to be received), the handler for this
signal is expected to process the received data and then call
gtk_drag_finish()
, setting the success
parameter depending on whether
the data was processed successfully.
The handler may inspect and modify drag_context->action
before calling
gtk_drag_finish()
, e.g. to implement GDK_ACTION_ASK
as shown in the
following example:
void drag_data_received (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time) { if ((data->length >= 0) && (data->format == 8)) { if (drag_context->action == GDK_ACTION_ASK) { GtkWidget *dialog; gint response; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, "Move the data ?\n"); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_YES) drag_context->action = GDK_ACTION_MOVE; else drag_context->action = GDK_ACTION_COPY; } gtk_drag_finish (drag_context, TRUE, FALSE, time); return; } gtk_drag_finish (drag_context, FALSE, FALSE, time); }
|
the object which received the signal |
|
the drag context |
|
where the drop happened |
|
where the drop happened |
|
the received data |
|
the info that has been registered with the target in the GtkTargetList |
|
the timestamp at which the data was received |
|
user data set when the signal handler was connected. |
"drag-drop"
signalgboolean user_function (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, guint time, gpointer user_data) : Run Last
The ::drag-drop signal is emitted on the drop site when the user drops
the data onto the widget. The signal handler must determine whether
the cursor position is in a drop zone or not. If it is not in a drop
zone, it returns FALSE
and no further processing is necessary.
Otherwise, the handler returns TRUE
. In this case, the handler must
ensure that gtk_drag_finish()
is called to let the source know that
the drop is done. The call to gtk_drag_finish()
can be done either
directly or in a "drag-data-received" handler which gets
triggered by calling gtk_drag_get_data()
to receive the data for one
or more of the supported targets.
|
the object which received the signal |
|
the drag context |
|
the x coordinate of the current cursor position |
|
the y coordinate of the current cursor position |
|
the timestamp of the motion event |
|
whether the cursor position is in a drop zone |
|
user data set when the signal handler was connected. |
"drag-end"
signalvoid user_function (GtkWidget *widget, GdkDragContext *drag_context, gpointer user_data) : Run Last
The ::drag-end signal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in "drag-begin".
|
the object which received the signal |
|
the drag context |
|
user data set when the signal handler was connected. |
"drag-failed"
signalgboolean user_function (GtkWidget *widget, GdkDragContext *drag_context, GtkDragResult result, gpointer user_data) : Run Last
The ::drag-failed signal is emitted on the drag source when a drag has
failed. The signal handler may hook custom code to handle a failed DND
operation based on the type of error, it returns TRUE
is the failure has
been already handled (not showing the default "drag operation failed"
animation), otherwise it returns FALSE
.
|
the object which received the signal |
|
the drag context |
|
the result of the drag operation |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the failed drag operation has been already handled.
|
Since 2.12
"drag-leave"
signalvoid user_function (GtkWidget *widget, GdkDragContext *drag_context, guint time, gpointer user_data) : Run Last
The ::drag-leave signal is emitted on the drop site when the cursor
leaves the widget. A typical reason to connect to this signal is to
undo things done in "drag-motion", e.g. undo highlighting
with gtk_drag_unhighlight()
|
the object which received the signal. |
|
the drag context |
|
the timestamp of the motion event |
|
user data set when the signal handler was connected. |
"drag-motion"
signalgboolean user_function (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, guint time, gpointer user_data) : Run Last
The drag-motion signal is emitted on the drop site when the user
moves the cursor over the widget during a drag. The signal handler
must determine whether the cursor position is in a drop zone or not.
If it is not in a drop zone, it returns FALSE
and no further processing
is necessary. Otherwise, the handler returns TRUE
. In this case, the
handler is responsible for providing the necessary information for
displaying feedback to the user, by calling gdk_drag_status()
.
If the decision whether the drop will be accepted or rejected can't be
made based solely on the cursor position and the type of the data, the
handler may inspect the dragged data by calling gtk_drag_get_data()
and
defer the gdk_drag_status()
call to the "drag-data-received"
handler. Note that you cannot not pass GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_MOTION or GTK_DEST_DEFAULT_ALL to gtk_drag_dest_set()
when using the drag-motion signal that way.
Also note that there is no drag-enter signal. The drag receiver has to
keep track of whether he has received any drag-motion signals since the
last "drag-leave" and if not, treat the drag-motion signal as
an "enter" signal. Upon an "enter", the handler will typically highlight
the drop site with gtk_drag_highlight()
.
static void drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time) { GdkAtom target; PrivateData *private_data = GET_PRIVATE_DATA (widget); if (!private_data->drag_highlight) { private_data->drag_highlight = 1; gtk_drag_highlight (widget); } target = gtk_drag_dest_find_target (widget, context, NULL); if (target == GDK_NONE) gdk_drag_status (context, 0, time); else { private_data->pending_status = context->suggested_action; gtk_drag_get_data (widget, context, target, time); } return TRUE; } static void drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time) { PrivateData *private_data = GET_PRIVATE_DATA (widget); if (private_data->suggested_action) { private_data->suggested_action = 0; /* We are getting this data due to a request in drag_motion, * rather than due to a request in drag_drop, so we are just * supposed to call gdk_drag_status (), not actually paste in * the data. */ str = gtk_selection_data_get_text (selection_data); if (!data_is_acceptable (str)) gdk_drag_status (context, 0, time); else gdk_drag_status (context, private_data->suggested_action, time); } else { /* accept the drop */ } }
|
the object which received the signal |
|
the drag context |
|
the x coordinate of the current cursor position |
|
the y coordinate of the current cursor position |
|
the timestamp of the motion event |
|
whether the cursor position is in a drop zone |
|
user data set when the signal handler was connected. |
"enter-notify-event"
signalgboolean user_function (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data) : Run Last
The ::enter-notify-event will be emitted when the pointer enters
the widget
's window.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_ENTER_NOTIFY_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal |
|
the GdkEventCrossing which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic ::event signal, another, more specific, signal that matches the type of event delivered (e.g. "key-press-event") and finally a generic "event-after" signal.
|
the object which received the signal. |
|
the GdkEvent which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event
and to cancel the emission of the second specific ::event signal.
FALSE to propagate the event further and to allow the emission of
the second signal. The ::event-after signal is emitted regardless of
the return value.
|
"event-after"
signalvoid user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data)
After the emission of the "event" signal and (optionally) the second more specific signal, ::event-after will be emitted regardless of the previous two signals handlers return values.
|
the object which received the signal. |
|
the GdkEvent which triggered this signal |
|
user data set when the signal handler was connected. |
"expose-event"
signalgboolean user_function (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) : Run Last
The ::expose-event signal is emitted when an area of a previously obscured GdkWindow is made visible and needs to be redrawn. GTK_NO_WINDOW widgets will get a synthesized event from their parent widget.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_EXPOSURE_MASK mask.
|
the object which received the signal. |
|
the GdkEventExpose which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"focus"
signalgboolean user_function (GtkWidget *widget, GtkDirectionType arg1, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
|
"focus-in-event"
signalgboolean user_function (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) : Run Last
The ::focus-in-event signal will be emitted when the keyboard focus
enters the widget
's window.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_FOCUS_CHANGE_MASK mask.
|
the object which received the signal |
|
the GdkEventFocus which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"focus-out-event"
signalgboolean user_function (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) : Run Last
The ::focus-out-event signal will be emitted when the keyboard focus
leaves the widget
's window.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_FOCUS_CHANGE_MASK mask.
|
the object which received the signal |
|
the GdkEventFocus which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"grab-broken-event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
Emitted when a pointer or keyboard grab on a window belonging
to widget
gets broken.
On X11, this happens when the grab window becomes unviewable (i.e. it or one of its ancestors is unmapped), or if the same application grabs the pointer or keyboard again.
|
the object which received the signal |
|
the GdkEventGrabBroken event |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for
the event. FALSE to propagate the event further.
|
Since 2.8
"grab-focus"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"grab-notify"
signalvoid user_function (GtkWidget *widget, gboolean was_grabbed, gpointer user_data) : Run First
The ::grab-notify signal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.
A widget is shadowed by a gtk_grab_add()
when the topmost
grab widget in the grab stack of its window group is not
its ancestor.
|
the object which received the signal |
|
FALSE if the widget becomes shadowed, TRUE
if it becomes unshadowed
|
|
user data set when the signal handler was connected. |
"hide"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"hierarchy-changed"
signalvoid user_function (GtkWidget *widget, GtkWidget *previous_toplevel, gpointer user_data) : Run Last
The ::hierarchy-changed signal is emitted when the anchored state of a widget changes. A widget is anchored when its toplevel ancestor is a GtkWindow. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.
|
the object on which the signal is emitted |
|
the previous toplevel ancestor, or NULL
if the widget was previously unanchored
|
|
user data set when the signal handler was connected. |
"key-press-event"
signalgboolean user_function (GtkWidget *widget, GdkEventKey *event, gpointer user_data) : Run Last
The ::key-press-event signal is emitted when a key is pressed.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_KEY_PRESS_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal |
|
the GdkEventKey which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"key-release-event"
signalgboolean user_function (GtkWidget *widget, GdkEventKey *event, gpointer user_data) : Run Last
The ::key-release-event signal is emitted when a key is pressed.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_KEY_RELEASE_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal |
|
the GdkEventKey which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"keynav-failed"
signalgboolean user_function (GtkWidget *widget, GtkDirectionType direction, gpointer user_data) : Run Last
Gets emitted if keyboard navigation fails.
See gtk_widget_keynav_failed()
for details.
|
the object which received the signal |
|
the direction of movement |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if stopping keyboard navigation is fine, FALSE
if the emitting widget should try to handle the keyboard
navigation attempt in its parent container(s).
|
Since 2.12
"leave-notify-event"
signalgboolean user_function (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data) : Run Last
The ::leave-notify-event will be emitted when the pointer leaves
the widget
's window.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_LEAVE_NOTIFY_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal |
|
the GdkEventCrossing which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"map"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"map-event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
The ::map-event signal will be emitted when the widget
's window is
mapped. A window is mapped when it becomes visible on the screen.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.
|
the object which received the signal |
|
the GdkEventAny which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"mnemonic-activate"
signalgboolean user_function (GtkWidget *widget, gboolean arg1, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
"motion-notify-event"
signalgboolean user_function (GtkWidget *widget, GdkEventMotion *event, gpointer user_data) : Run Last
The ::motion-notify-event signal is emitted when the pointer moves over the widget's GdkWindow.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_POINTER_MOTION_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal. |
|
the GdkEventMotion which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"move-focus"
signalvoid user_function (GtkWidget *widget, GtkDirectionType arg1, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"no-expose-event"
signalgboolean user_function (GtkWidget *widget, GdkEventNoExpose *event, gpointer user_data) : Run Last
The ::no-expose-event will be emitted when the widget
's window is
drawn as a copy of another GdkDrawable (with gdk_draw_drawable()
or
gdk_window_copy_area()
) which was completely unobscured. If the source
window was partially obscured GdkEventExpose events will be generated
for those areas.
|
the object which received the signal |
|
the GdkEventNoExpose which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"parent-set"
signalvoid user_function (GtkWidget *widget, GtkObject *old_parent, gpointer user_data) : Run First
The ::parent-set signal is emitted when a new parent has been set on a widget.
|
the object on which the signal is emitted |
|
the previous parent, or NULL if the widget
just got its initial parent.
|
|
user data set when the signal handler was connected. |
"popup-menu"
signalgboolean user_function (GtkWidget *widget, gpointer user_data) : Run Last / Action
This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the GtkEntry widget creates a menu with clipboard commands. See the section called “Implement GtkWidget::popup_menu” for an example of how to use this signal.
|
the object which received the signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if a menu was activated
|
"property-notify-event"
signalgboolean user_function (GtkWidget *widget, GdkEventProperty *event, gpointer user_data) : Run Last
The ::property-notify-event signal will be emitted when a property on
the widget
's window has been changed or deleted.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_PROPERTY_CHANGE_MASK mask.
|
the object which received the signal |
|
the GdkEventProperty which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"proximity-in-event"
signalgboolean user_function (GtkWidget *widget, GdkEventProximity *event, gpointer user_data) : Run Last
To receive this signal the GdkWindow associated to the widget needs to enable the GDK_PROXIMITY_IN_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal |
|
the GdkEventProximity which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"proximity-out-event"
signalgboolean user_function (GtkWidget *widget, GdkEventProximity *event, gpointer user_data) : Run Last
To receive this signal the GdkWindow associated to the widget needs to enable the GDK_PROXIMITY_OUT_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal |
|
the GdkEventProximity which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"query-tooltip"
signalgboolean user_function (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data) : Run Last
Emitted when the "gtk-tooltip-timeout" has expired with
the cursor hovering "above" widget
; or emitted when widget
got
focus in keyboard mode.
Using the given coordinates, the signal handler should determine
whether a tooltip should be shown for widget
. If this is the case
TRUE
should be returned, FALSE
otherwise. Note that if
keyboard_mode
is TRUE
, the values of x
and y
are undefined and
should not be used.
The signal handler is free to manipulate tooltip
with the therefore
destined function calls.
|
the object which received the signal |
|
the x coordinate of the cursor position where the request has
been emitted, relative to widget->window
|
|
the y coordinate of the cursor position where the request has
been emitted, relative to widget->window
|
|
TRUE if the tooltip was trigged using the keyboard
|
|
a GtkTooltip |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if tooltip should be shown right now, FALSE otherwise.
|
Since 2.12
"realize"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"screen-changed"
signalvoid user_function (GtkWidget *widget, GdkScreen *previous_screen, gpointer user_data) : Run Last
The ::screen-changed signal gets emitted when the screen of a widget has changed.
|
the object on which the signal is emitted |
|
the previous screen, or NULL if the
widget was not associated with a screen before
|
|
user data set when the signal handler was connected. |
"scroll-event"
signalgboolean user_function (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) : Run Last
The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_BUTTON_PRESS_MASK mask.
This signal will be sent to the grab widget if there is one.
|
the object which received the signal. |
|
the GdkEventScroll which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"selection-clear-event"
signalgboolean user_function (GtkWidget *widget, GdkEventSelection *event, gpointer user_data) : Run Last
The ::selection-clear-event signal will be emitted when the
the widget
's window has lost ownership of a selection.
|
the object which received the signal |
|
the GdkEventSelection which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"selection-get"
signalvoid user_function (GtkWidget *widget, GtkSelectionData *data, guint info, guint time, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
|
|
|
|
user data set when the signal handler was connected. |
"selection-notify-event"
signalgboolean user_function (GtkWidget *widget, GdkEventSelection *event, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
|
"selection-received"
signalvoid user_function (GtkWidget *widget, GtkSelectionData *data, guint time, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |
"selection-request-event"
signalgboolean user_function (GtkWidget *widget, GdkEventSelection *event, gpointer user_data) : Run Last
The ::selection-request-event signal will be emitted when
another client requests ownership of the selection owned by
the widget
's window.
|
the object which received the signal |
|
the GdkEventSelection which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"show"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"show-help"
signalgboolean user_function (GtkWidget *widget, GtkWidgetHelpType arg1, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
"size-allocate"
signalvoid user_function (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"size-request"
signalvoid user_function (GtkWidget *widget, GtkRequisition *requisition, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"state-changed"
signalvoid user_function (GtkWidget *widget, GtkStateType state, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"style-set"
signalvoid user_function (GtkWidget *widget, GtkStyle *previous_style, gpointer user_data) : Run First
The ::style-set signal is emitted when a new style has been set
on a widget. Note that style-modifying functions like
gtk_widget_modify_base()
also cause this signal to be emitted.
|
the object on which the signal is emitted |
|
the previous style, or NULL if the widget
just got its initial style
|
|
user data set when the signal handler was connected. |
"unmap"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"unmap-event"
signalgboolean user_function (GtkWidget *widget, GdkEvent *event, gpointer user_data) : Run Last
The ::unmap-event signal will be emitted when the widget
's window is
unmapped. A window is unmapped when it becomes invisible on the screen.
To receive this signal, the GdkWindow associated to the widget needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.
|
the object which received the signal |
|
the GdkEventAny which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"unrealize"
signalvoid user_function (GtkWidget *widget, gpointer user_data) : Run Last
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"visibility-notify-event"
signalgboolean user_function (GtkWidget *widget, GdkEventVisibility *event, gpointer user_data) : Run Last
The ::visibility-notify-event will be emitted when the widget
's window
is obscured or unobscured.
To receive this signal the GdkWindow associated to the widget needs to enable the GDK_VISIBILITY_NOTIFY_MASK mask.
|
the object which received the signal |
|
the GdkEventVisibility which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the event.
FALSE to propagate the event further.
|
"window-state-event"
signalgboolean user_function (GtkWidget *widget, GdkEventWindowState *event, gpointer user_data) : Run Last
The ::window-state-event will be emitted when the state of the
toplevel window associated to the widget
changes.
To receive this signal the GdkWindow associated to the widget needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.
|
the object which received the signal |
|
the GdkEventWindowState which triggered this signal |
|
user data set when the signal handler was connected. |
Returns : |
TRUE to stop other handlers from being invoked for the
event. FALSE to propagate the event further.
|