GTK+ 2 Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Known Derived Interfaces | Properties | Style Properties | Signals |
#include <gtk/gtk.h> GtkWidget; struct 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
); struct GtkRequisition; struct GtkAllocation; GtkSelectionData; struct GtkWidgetAuxInfo; struct 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
); gboolean gtk_widget_send_focus_change (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
); void gtk_widget_style_attach (GtkWidget *style
); 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
); void gtk_widget_get_allocation (GtkWidget *widget
,GtkAllocation *allocation
); void gtk_widget_set_allocation (GtkWidget *widget
,const GtkAllocation *allocation
); gboolean gtk_widget_get_app_paintable (GtkWidget *widget
); gboolean gtk_widget_get_can_default (GtkWidget *widget
); void gtk_widget_set_can_default (GtkWidget *widget
,gboolean can_default
); gboolean gtk_widget_get_can_focus (GtkWidget *widget
); void gtk_widget_set_can_focus (GtkWidget *widget
,gboolean can_focus
); gboolean gtk_widget_get_double_buffered (GtkWidget *widget
); gboolean gtk_widget_get_has_window (GtkWidget *widget
); void gtk_widget_set_has_window (GtkWidget *widget
,gboolean has_window
); gboolean gtk_widget_get_sensitive (GtkWidget *widget
); gboolean gtk_widget_is_sensitive (GtkWidget *widget
); GtkStateType gtk_widget_get_state (GtkWidget *widget
); gboolean gtk_widget_get_visible (GtkWidget *widget
); void gtk_widget_set_visible (GtkWidget *widget
,gboolean visible
); gboolean gtk_widget_has_default (GtkWidget *widget
); gboolean gtk_widget_has_focus (GtkWidget *widget
); gboolean gtk_widget_has_grab (GtkWidget *widget
); gboolean gtk_widget_has_rc_style (GtkWidget *widget
); gboolean gtk_widget_is_drawable (GtkWidget *widget
); gboolean gtk_widget_is_toplevel (GtkWidget *widget
); void gtk_widget_set_window (GtkWidget *widget
,GdkWindow *window
); void gtk_widget_set_receives_default (GtkWidget *widget
,gboolean receives_default
); gboolean gtk_widget_get_receives_default (GtkWidget *widget
); void gtk_widget_set_realized (GtkWidget *widget
,gboolean realized
); gboolean gtk_widget_get_realized (GtkWidget *widget
); void gtk_widget_set_mapped (GtkWidget *widget
,gboolean mapped
); gboolean gtk_widget_get_mapped (GtkWidget *widget
); void gtk_widget_get_requisition (GtkWidget *widget
,GtkRequisition *requisition
); GtkRequisition * gtk_requisition_copy (const GtkRequisition *requisition
); void gtk_requisition_free (GtkRequisition *requisition
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkMisc +----GtkCalendar +----GtkCellView +----GtkDrawingArea +----GtkEntry +----GtkRuler +----GtkRange +----GtkSeparator +----GtkHSV +----GtkInvisible +----GtkOldEditable +----GtkPreview +----GtkProgress
GBoxed +----GtkRequisition
GBoxed +----GtkSelectionData
"app-paintable" gboolean : Read / Write "can-default" gboolean : Read / Write "can-focus" gboolean : Read / Write "composite-child" gboolean : Read "double-buffered" gboolean : Read / Write "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
"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
"accel-closures-changed" "button-press-event" :Run Last
"button-release-event" :Run Last
"can-activate-accel" :Run Last
"child-notify" :No Hooks
"client-event" :Run Last
"composited-changed" :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" :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" :Action
"no-expose-event" :Run Last
"parent-set" :Run First
"popup-menu" :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" :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
GtkWidget is the base class all widgets in GTK+ derive from. It manages the widget lifecycle, states and style.
GtkWidget 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 gtk_widget_class_install_style_property()
to install style properties for
a widget class, gtk_widget_class_find_style_property()
or
gtk_widget_class_list_style_properties()
to get information about existing
style properties and gtk_widget_style_get_property()
, gtk_widget_style_get()
or
gtk_widget_style_get_valist()
to obtain the value of a style property.
The 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 57. A UI definition fragment specifying an accelerator
1 2 3 |
<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 58. A UI definition fragment specifying an accessible
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<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" translatable="yes">Click the button.</action> <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> |
typedef 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;
struct GtkWidgetClass { /* 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; };
activate_signal
The signal to emit when a widget of this class is activated,
gtk_widget_activate()
handles the emission. Implementation of this
signal is optional.
set_scroll_adjustment_signal
This signal is emitted when a widget of this class is added
to a scrolling aware parent, gtk_widget_set_scroll_adjustments()
handles the emission.
Implementation of this signal is optional.
typedef 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, GTK_CAN_DEFAULT = 1 << 13, GTK_HAS_DEFAULT = 1 << 14, GTK_HAS_GRAB = 1 << 15, GTK_RC_STYLE = 1 << 16, GTK_COMPOSITE_CHILD = 1 << 17, #ifndef GTK_DISABLE_DEPRECATED GTK_NO_REPARENT = 1 << 18, #endif GTK_APP_PAINTABLE = 1 << 19, GTK_RECEIVES_DEFAULT = 1 << 20, GTK_DOUBLE_BUFFERED = 1 << 21, GTK_NO_SHOW_ALL = 1 << 22 } GtkWidgetFlags;
Tells about certain properties of the widget.
widgets without a real parent, as there are GtkWindows and GtkMenus have this flag set throughout their lifetime. Toplevel widgets always contain their own GdkWindow. | |
Indicative for a widget that does not provide its own GdkWindow. Visible action (e.g. drawing) is performed on the parent's GdkWindow. | |
Set by gtk_widget_realize() , unset by gtk_widget_unrealize() .
A realized widget has an associated GdkWindow.
|
|
Set by gtk_widget_map() , unset by gtk_widget_unmap() .
Only realized widgets can be mapped. It means that gdk_window_show()
has been called on the widgets window(s).
|
|
Set by gtk_widget_show() , unset by gtk_widget_hide() . Implies that a
widget will be mapped as soon as its parent is mapped.
|
|
Set and unset by gtk_widget_set_sensitive() .
The sensitivity of a widget determines whether it will receive
certain events (e.g. button or key presses). One premise for
the widget's sensitivity is to have this flag set.
|
|
Set and unset by gtk_widget_set_sensitive() operations on the
parents of the widget.
This is the second premise for the widget's sensitivity. Once
it has GTK_SENSITIVE and GTK_PARENT_SENSITIVE set, its state is
effectively sensitive. This is expressed (and can be examined) by
the GTK_WIDGET_IS_SENSITIVE macro.
|
|
Determines whether a widget is able to handle focus grabs. | |
Set by gtk_widget_grab_focus() for widgets that also
have GTK_CAN_FOCUS set. The flag will be unset once another widget
grabs the focus.
|
|
The widget is allowed to receive the default action via
gtk_widget_grab_default() and will reserve space to draw the default if possible
|
|
The widget currently is receiving the default action and should be drawn appropriately if possible | |
Set by gtk_grab_add() , unset by gtk_grab_remove() . It means that the
widget is in the grab_widgets stack, and will be the preferred one for
receiving events other than ones of cosmetic value.
|
|
Indicates that the widget's style has been looked up through the rc mechanism. It does not imply that the widget actually had a style defined through the rc mechanism. | |
Indicates that the widget is a composite child of its parent; see
gtk_widget_push_composite_child() , gtk_widget_pop_composite_child() .
|
|
Unused since before GTK+ 1.2, will be removed in a future version. | |
Set and unset by gtk_widget_set_app_paintable() .
Must be set on widgets whose window the application directly draws on,
in order to keep GTK+ from overwriting the drawn stuff. See
the section called “App-paintable widgets” for a detailed
description of this flag.
|
|
The widget when focused will receive the default action and have
GTK_HAS_DEFAULT set even if there is a different widget set as default.
|
|
Set and unset by gtk_widget_set_double_buffered() .
Indicates that exposes done on the widget should be
double-buffered. See the section called “Double buffering” for a
detailed discussion of how double-buffering works in GTK+ and
why you may want to disable it for special cases.
|
|
#define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
GTK_WIDGET_TYPE
has been deprecated since version 2.20 and should not be used in newly-written code. Use G_OBJECT_TYPE()
instead.
Gets the type of a widget.
|
a GtkWidget. |
#define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
GTK_WIDGET_STATE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_state()
instead.
|
a GtkWidget. |
Returns : |
the current state of the widget, as a GtkStateType. |
#define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state)
GTK_WIDGET_SAVED_STATE
has been deprecated since version 2.20 and should not be used in newly-written code. Do not used it.
|
a GtkWidget. |
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_set_state()
or gtk_widget_set_sensitive() . |
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
GTK_WIDGET_FLAGS
has been deprecated since version 2.20 and should not be used in newly-written code. Use the proper function to test individual states:
gtk_widget_get_app_paintable()
, gtk_widget_get_can_default()
,
gtk_widget_get_can_focus()
, gtk_widget_get_double_buffered()
,
gtk_widget_has_default()
, gtk_widget_is_drawable()
,
gtk_widget_has_focus()
, gtk_widget_has_grab()
, gtk_widget_get_mapped()
,
gtk_widget_get_has_window()
, gtk_widget_has_rc_style()
,
gtk_widget_get_realized()
, gtk_widget_get_receives_default()
,
gtk_widget_get_sensitive()
, gtk_widget_is_sensitive()
,
gtk_widget_is_toplevel()
or gtk_widget_get_visible()
.
|
a GtkWidget. |
Returns : |
the widget flags from wid . |
#define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
GTK_WIDGET_TOPLEVEL
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_is_toplevel()
instead.
Evaluates to TRUE
if the widget is a toplevel widget.
|
a GtkWidget. |
#define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
GTK_WIDGET_NO_WINDOW
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_has_window()
instead.
Evaluates to TRUE
if the widget doesn't have an own GdkWindow.
|
a GtkWidget. |
#define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
GTK_WIDGET_REALIZED
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_realized()
instead.
Evaluates to TRUE
if the widget is realized.
|
a GtkWidget. |
#define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
GTK_WIDGET_MAPPED
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_mapped()
instead.
Evaluates to TRUE
if the widget is mapped.
|
a GtkWidget. |
#define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
GTK_WIDGET_VISIBLE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_visible()
instead.
Evaluates to TRUE
if the widget is visible.
|
a GtkWidget. |
#define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
GTK_WIDGET_DRAWABLE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_is_drawable()
instead.
Evaluates to TRUE
if the widget is mapped and visible.
|
a GtkWidget. |
#define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
GTK_WIDGET_SENSITIVE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_sensitive()
instead.
Evaluates to TRUE
if the GTK_SENSITIVE flag has be set on the widget.
|
a GtkWidget. |
#define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
GTK_WIDGET_PARENT_SENSITIVE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_sensitive()
on the parent widget instead.
Evaluates to TRUE
if the GTK_PARENT_SENSITIVE flag has be set on the widget.
|
a GtkWidget. |
#define GTK_WIDGET_IS_SENSITIVE(wid)
GTK_WIDGET_IS_SENSITIVE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_is_sensitive()
instead.
Evaluates to TRUE
if the widget is effectively sensitive.
|
a GtkWidget. |
#define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
GTK_WIDGET_CAN_FOCUS
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_can_focus()
instead.
Evaluates to TRUE
if the widget is able to handle focus grabs.
|
a GtkWidget. |
#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
GTK_WIDGET_HAS_FOCUS
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_has_focus()
instead.
Evaluates to TRUE
if the widget has grabbed the focus and no other
widget has done so more recently.
|
a GtkWidget. |
#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
GTK_WIDGET_CAN_DEFAULT
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_can_default()
instead.
Evaluates to TRUE
if the widget is allowed to receive the default action
via gtk_widget_grab_default()
.
|
a GtkWidget. |
#define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
GTK_WIDGET_RECEIVES_DEFAULT
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_receives_default()
instead.
Evaluates to TRUE
if the widget when focused will receive the default action
even if there is a different widget set as default.
|
a GtkWidget. |
#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
GTK_WIDGET_HAS_DEFAULT
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_has_default()
instead.
Evaluates to TRUE
if the widget currently is receiving the default action.
|
a GtkWidget. |
#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
GTK_WIDGET_HAS_GRAB
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_has_grab()
instead.
Evaluates to TRUE
if the widget is in the grab_widgets stack, and will be
the preferred one for receiving events other than ones of cosmetic value.
|
a GtkWidget. |
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
GTK_WIDGET_RC_STYLE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_has_rc_style()
instead.
Evaluates to TRUE
if the widget's style has been looked up through the rc
mechanism.
|
a GtkWidget. |
#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
GTK_WIDGET_COMPOSITE_CHILD
has been deprecated since version 2.20 and should not be used in newly-written code. Use the "composite-child" property instead.
Evaluates to TRUE
if the widget is a composite child of its parent.
|
a GtkWidget. |
#define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
GTK_WIDGET_APP_PAINTABLE
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_app_paintable()
instead.
Evaluates to TRUE
if the GTK_APP_PAINTABLE flag has been set on the widget.
|
a GtkWidget. |
#define GTK_WIDGET_DOUBLE_BUFFERED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_DOUBLE_BUFFERED) != 0)
GTK_WIDGET_DOUBLE_BUFFERED
has been deprecated since version 2.20 and should not be used in newly-written code. Use gtk_widget_get_double_buffered()
instead.
Evaluates to TRUE
if the GTK_DOUBLE_BUFFERED flag has been set on the widget.
|
a GtkWidget. |
#define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
GTK_WIDGET_SET_FLAGS
has been deprecated since version 2.22 and should not be used in newly-written code. Use the proper function instead: gtk_widget_set_app_paintable()
,
gtk_widget_set_can_default()
, gtk_widget_set_can_focus()
,
gtk_widget_set_double_buffered()
, gtk_widget_set_has_window()
,
gtk_widget_set_mapped()
, gtk_widget_set_no_show_all()
,
gtk_widget_set_realized()
, gtk_widget_set_receives_default()
,
gtk_widget_set_sensitive()
or gtk_widget_set_visible()
.
Turns on certain widget flags.
|
a GtkWidget. |
|
the flags to set. |
#define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
GTK_WIDGET_UNSET_FLAGS
has been deprecated since version 2.22 and should not be used in newly-written code. Use the proper function instead. See GTK_WIDGET_SET_FLAGS()
.
Turns off certain widget flags.
|
a GtkWidget. |
|
the flags to unset. |
void (*GtkCallback) (GtkWidget *widget
,gpointer data
);
The type of the callback functions used for e.g. iterating over
the children of a container, see gtk_container_foreach()
.
|
the widget to operate on |
|
user-supplied data |
struct GtkRequisition;
A GtkRequisition represents the desired size of a widget. See the section called “Size Requisition” for more information.
struct 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.
struct GtkWidgetAuxInfo { gint x; gint y; gint width; gint height; guint x_set : 1; guint y_set : 1; };
struct GtkWidgetShapeInfo { gint16 offset_x; gint16 offset_y; GdkBitmap *shape_mask; };
typedef enum { GTK_WIDGET_HELP_TOOLTIP, GTK_WIDGET_HELP_WHATS_THIS } GtkWidgetHelpType;
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_new (GTK_TYPE_LABEL, "label", "Hello World", "xalign",
0.0, NULL)
to create a left-aligned label. Equivalent to
g_object_new()
, but returns a widget so you don't have to
cast the object yourself.
|
type ID of the widget to create |
|
name of first property to set |
Returns : |
a new GtkWidget of type widget_type
|
GtkWidget * gtk_widget_ref (GtkWidget *widget
);
gtk_widget_ref
has been deprecated since version 2.12 and should not be used in newly-written code. Use g_object_ref()
instead.
Adds a reference to a widget. This function is exactly the same
as calling g_object_ref()
, and exists mostly for historical
reasons. It can still be convenient to avoid casting a widget
to a GObject, it saves a small amount of typing.
|
a GtkWidget |
Returns : |
the widget that was referenced |
void gtk_widget_unref (GtkWidget *widget
);
gtk_widget_unref
has been deprecated since version 2.12 and should not be used in newly-written code. Use g_object_unref()
instead.
Inverse of gtk_widget_ref()
. Equivalent to g_object_unref()
.
|
a GtkWidget |
void gtk_widget_destroy (GtkWidget *widget
);
Destroys a widget. Equivalent to gtk_object_destroy()
, except that
you don't have to cast the widget to GtkObject. When a widget is
destroyed, it will break any references it holds to other objects.
If the widget is inside a container, the widget will be removed
from the container. If the widget is a toplevel (derived from
GtkWindow), it will be removed from the list of toplevels, and the
reference GTK+ holds to it will be removed. Removing a
widget from its container or the list of toplevels results in the
widget being finalized, unless you've added additional references
to the widget with g_object_ref()
.
In most cases, only toplevel widgets (windows) require explicit destruction, because when you destroy a toplevel its children will be destroyed as well.
|
a GtkWidget |
void gtk_widget_destroyed (GtkWidget *widget
,GtkWidget **widget_pointer
);
This function sets *widget_pointer
to NULL
if widget_pointer
!=
NULL
. It's intended to be used as a callback connected to the
"destroy" signal of a widget. You connect gtk_widget_destroyed()
as a signal handler, and pass the address of your widget variable
as user data. Then when the widget is destroyed, the variable will
be set to NULL
. Useful for example to avoid multiple copies
of the same dialog.
|
a GtkWidget |
|
address of a variable that contains widget . [inout][transfer none]
|
void gtk_widget_set (GtkWidget *widget
,const gchar *first_property_name
,...
);
gtk_widget_set
has been deprecated since version 2.0 and should not be used in newly-written code. Use g_object_set()
instead.
Precursor of g_object_set()
.
|
a GtkWidget |
|
name of first property to set |
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.
|
a GtkWidget |
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 gtk_widget_show_all()
on the
container, instead of individually showing the widgets.
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.
|
a GtkWidget |
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.
|
a GtkWidget |
void gtk_widget_hide (GtkWidget *widget
);
Reverses the effects of gtk_widget_show()
, causing the widget to be
hidden (invisible to the user).
|
a GtkWidget |
void gtk_widget_show_all (GtkWidget *widget
);
Recursively shows a widget, and any child widgets (if the widget is a container).
|
a GtkWidget |
void gtk_widget_hide_all (GtkWidget *widget
);
gtk_widget_hide_all
has been deprecated since version 2.24 and should not be used in newly-written code. Use gtk_widget_hide()
instead.
Recursively hides a widget and any child widgets.
|
a GtkWidget |
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.
|
a GtkWidget |
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.
|
a GtkWidget |
void gtk_widget_realize (GtkWidget *widget
);
Creates the GDK (windowing system) resources associated with a
widget. For example, widget->window
will be created when a widget
is realized. Normally realization happens implicitly; if you show
a widget and all its parent containers, then the widget will be
realized and mapped automatically.
Realizing a widget requires all
the widget's parent widgets to be realized; calling
gtk_widget_realize()
realizes the widget's parents in addition to
widget
itself. If a widget is not yet inside a toplevel window
when you realize it, bad things will happen.
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 g_signal_connect()
to the
GtkWidget::realize signal.
|
a GtkWidget |
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 widget->window
).
|
a GtkWidget |
void gtk_widget_queue_draw (GtkWidget *widget
);
Equivalent to calling gtk_widget_queue_draw_area()
for the
entire area of a widget.
|
a GtkWidget |
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.
|
a GtkWidget |
void gtk_widget_queue_resize_no_redraw (GtkWidget *widget
);
This function works like gtk_widget_queue_resize()
,
except that the widget is not invalidated.
|
a GtkWidget |
Since 2.4
void gtk_widget_draw (GtkWidget *widget
,const GdkRectangle *area
);
gtk_widget_draw
is deprecated and should not be used in newly-written code.
In GTK+ 1.2, this function would immediately render the
region area
of a widget, by invoking the virtual draw method of a
widget. In GTK+ 2.0, the draw method is gone, and instead
gtk_widget_draw()
simply invalidates the specified region of the
widget, then updates the invalid region of the widget immediately.
Usually you don't want to update the region immediately for
performance reasons, so in general gtk_widget_queue_draw_area()
is
a better choice if you want to draw a region of a widget.
|
a GtkWidget |
|
area to draw |
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 gtk_widget_size_allocate()
.
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()
.
|
a GtkWidget |
|
a GtkRequisition to be filled in |
void gtk_widget_get_child_requisition (GtkWidget *widget
,GtkRequisition *requisition
);
This function is only for use in widget implementations. Obtains
widget->requisition
, unless someone has forced a particular
geometry on the widget (e.g. with gtk_widget_set_size_request()
),
in which case it returns that geometry instead of the widget's
requisition.
This function differs from gtk_widget_size_request()
in that
it retrieves the last size request value from widget->requisition
,
while gtk_widget_size_request()
actually calls the "size_request" method
on widget
to compute the size request and fill in widget->requisition
,
and only then returns widget->requisition
.
Because this function does not call the "size_request" method, it
can only be used when you know that widget->requisition
is
up-to-date, that is, gtk_widget_size_request()
has been called
since the last time a resize was queued. In general, only container
implementations have this information; applications should use
gtk_widget_size_request()
.
|
a GtkWidget |
|
a GtkRequisition to be filled in |
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.
|
a GtkWidget |
|
position and size to be allocated to widget
|
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 widget
in accel_group
that causes
accel_signal
to be emitted if the accelerator is activated.
The accel_group
needs to be added to the widget's toplevel via
gtk_window_add_accel_group()
, and the signal must be of type G_RUN_ACTION
.
Accelerators added through this function are not user changeable during
runtime. If you want to support accelerators that can be changed by the
user, use gtk_accel_map_add_entry()
and gtk_widget_set_accel_path()
or
gtk_menu_item_set_accel_path()
instead.
|
widget to install an accelerator on |
|
widget signal to emit on accelerator activation |
|
accel group for this widget, added to its toplevel |
|
GDK keyval of the accelerator |
|
modifier key combination of the accelerator |
|
flag accelerators, e.g. GTK_ACCEL_VISIBLE
|
gboolean gtk_widget_remove_accelerator (GtkWidget *widget
,GtkAccelGroup *accel_group
,guint accel_key
,GdkModifierType accel_mods
);
Removes an accelerator from widget
, previously installed with
gtk_widget_add_accelerator()
.
|
widget to install an accelerator on |
|
accel group for this widget |
|
GDK keyval of the accelerator |
|
modifier key combination of the accelerator |
Returns : |
whether an accelerator was installed and could be removed |
void gtk_widget_set_accel_path (GtkWidget *widget
,const gchar *accel_path
,GtkAccelGroup *accel_group
);
Given an accelerator group, accel_group
, and an accelerator path,
accel_path
, sets up an accelerator in accel_group
so whenever the
key binding that is defined for accel_path
is pressed, widget
will be activated. This removes any accelerators (for any
accelerator group) installed by previous calls to
gtk_widget_set_accel_path()
. Associating accelerators with
paths allows them to be modified by the user and the modifications
to be saved for future use. (See gtk_accel_map_save()
.)
This function is a low level function that would most likely be used by a menu creation system like 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 gtk_menu_item_set_accel_path()
provides a somewhat more convenient interface.
Note that accel_path
string will be stored in a GQuark. Therefore, if you
pass a static string, you can save some memory by interning it first with
g_intern_static_string()
.
|
a GtkWidget |
|
path used to look up the accelerator. [allow-none] |
|
a GtkAccelGroup. [allow-none] |
GList * gtk_widget_list_accel_closures (GtkWidget *widget
);
Lists the closures used by widget
for accelerator group connections
with gtk_accel_group_connect_by_path()
or gtk_accel_group_connect()
.
The closures can be used to monitor accelerator changes on widget
,
by connecting to the GtkAccelGroup
::accel-changed signal of the
GtkAccelGroup of a closure which can be found out with
gtk_accel_group_from_accel_closure()
.
|
widget to list accelerator closures for |
Returns : |
a newly allocated GList of closures. [transfer container][element-type GClosure] |
gboolean gtk_widget_can_activate_accel (GtkWidget *widget
,guint signal_id
);
Determines whether an accelerator that activates the signal
identified by signal_id
can currently be activated.
This is done by emitting the "can-activate-accel"
signal on widget
; if the signal isn't overridden by a
handler or in a derived widget, then the default check is
that the widget must be sensitive, and the widget and all
its ancestors mapped.
|
a GtkWidget |
|
the ID of a signal installed on widget
|
Returns : |
TRUE if the accelerator can be activated. |
Since 2.4
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_main_do_event()
so the event will behave as if
it were in the event queue. Don't synthesize expose events; instead,
use gdk_window_invalidate_rect()
to invalidate a region of the
window.
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 widget
isn't
activatable, the function returns FALSE
.
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.
|
a GtkWidget |
|
a GtkContainer to move the widget into |
gboolean gtk_widget_intersect (GtkWidget *widget
,const GdkRectangle *area
,GdkRectangle *intersection
);
Computes the intersection of a widget
's area and area
, storing
the intersection in intersection
, and returns TRUE
if there was
an intersection. intersection
may be NULL
if you're only
interested in whether there was an intersection.
gboolean gtk_widget_is_focus (GtkWidget *widget
);
Determines if the widget is the focus widget within its
toplevel. (This does not mean that the HAS_FOCUS
flag is
necessarily set; HAS_FOCUS
will only be set if the
toplevel widget additionally has the global input focus.)
void gtk_widget_grab_focus (GtkWidget *widget
);
Causes widget
to have the keyboard focus for the GtkWindow it's
inside. widget
must be a focusable widget, such as a GtkEntry;
something like GtkFrame won't work.
More precisely, it must have the GTK_CAN_FOCUS
flag set. Use
gtk_widget_set_can_focus()
to modify that flag.
The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.
|
a GtkWidget |
void gtk_widget_grab_default (GtkWidget *widget
);
Causes widget
to become the default widget. widget
must have the
GTK_CAN_DEFAULT
flag set; typically you have to set this flag
yourself by calling gtk_widget_set_can_default (
. The default widget is activated when
the user presses Enter in a window. Default widgets must be
activatable, that is, widget
,
TRUE
)gtk_widget_activate()
should affect them.
|
a GtkWidget |
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_path()
), so names with embedded periods may cause confusion.
|
a GtkWidget |
|
name for the widget |
const gchar * gtk_widget_get_name (GtkWidget *widget
);
Retrieves the name of a widget. See gtk_widget_set_name()
for the
significance of widget names.
|
a GtkWidget |
Returns : |
name of the widget. This string is owned by GTK+ and should not be modified or freed |
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()
.
|
a GtkWidget |
|
new state for widget
|
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.
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 widget
, and takes care of
some details such as updating the state and style of the child
to reflect its new location. The opposite function is
gtk_widget_unparent()
.
|
a GtkWidget |
|
parent container |
void gtk_widget_set_parent_window (GtkWidget *widget
,GdkWindow *parent_window
);
Sets a non default parent window for widget
.
|
a GtkWidget. |
|
the new parent window. |
GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget
);
Gets widget
's parent window.
|
a GtkWidget. |
Returns : |
the parent window of widget . [transfer none]
|
void gtk_widget_set_uposition (GtkWidget *widget
,gint x
,gint y
);
gtk_widget_set_uposition
is deprecated and should not be used in newly-written code.
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 gtk_window_set_transient_for()
, and it's really not
possible to get the centering to work correctly in all cases from
application code. But if you insist, use gtk_window_set_position()
to set GTK_WIN_POS_CENTER_ON_PARENT, don't do the centering
manually.
Note that although x
and y
can be individually unset, the position
is not honoured unless both x
and y
are set.
|
a GtkWidget |
|
x position; -1 to unset x; -2 to leave x unchanged |
|
y position; -1 to unset y; -2 to leave y unchanged |
void gtk_widget_set_usize (GtkWidget *widget
,gint width
,gint height
);
gtk_widget_set_usize
has been deprecated since version 2.2 and should not be used in newly-written code. Use gtk_widget_set_size_request()
instead.
Sets the minimum size of a widget; that is, the widget's size
request will be width
by height
. You can use this function to
force a widget to be either larger or smaller than it is. The
strange "usize" name dates from the early days of GTK+, and derives
from X Window System terminology. In many cases,
gtk_window_set_default_size()
is a better choice for toplevel
windows than this function; setting the default size will still
allow users to shrink the window. Setting the usize will force them
to leave the window at least as large as the usize. When dealing
with window sizes, gtk_window_set_geometry_hints()
can be a useful
function as well.
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.
|
a GtkWidget |
|
minimum width, or -1 to unset |
|
minimum height, or -1 to unset |
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()
for widgets that are
already realized, or if you want to preserve the existing event
mask. This function can't be used with GTK_NO_WINDOW widgets;
to get events on those widgets, place them inside a GtkEventBox
and receive events on the event box.
|
a GtkWidget |
|
event mask |
void gtk_widget_add_events (GtkWidget *widget
,gint events
);
Adds the events in the bitfield events
to the event mask for
widget
. See gtk_widget_set_events()
for details.
|
a GtkWidget |
|
an event mask, see GdkEventMask |
void gtk_widget_set_extension_events (GtkWidget *widget
,GdkExtensionMode mode
);
Sets the extension events mask to mode
. See GdkExtensionMode
and gdk_input_set_extension_events()
.
|
a GtkWidget |
|
bitfield of extension events to receive |
GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget
);
Retrieves the extension events the widget will receive; see
gdk_input_set_extension_events()
.
|
a GtkWidget |
Returns : |
extension events for widget
|
GtkWidget * gtk_widget_get_toplevel (GtkWidget *widget
);
This function returns the topmost widget in the container hierarchy
widget
is a part of. If widget
has no parent widgets, it will be
returned as the topmost widget. No reference will be added to the
returned widget; it should not be unreferenced.
Note the difference in behavior vs. gtk_widget_get_ancestor()
;
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)
would return
NULL
if widget
wasn't inside a toplevel window, and if the
window was inside a GtkWindow-derived widget which was in turn
inside the toplevel GtkWindow. While the second case may
seem unlikely, it actually happens when a GtkPlug is embedded
inside a GtkSocket within the same application.
To reliably find the toplevel GtkWindow, use
gtk_widget_get_toplevel()
and check if the TOPLEVEL
flags
is set on the result.
1 2 3 4 5 |
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); if (gtk_widget_is_toplevel (toplevel)) { /* Perform action on toplevel. */ } |
|
a GtkWidget |
Returns : |
the topmost ancestor of widget , or widget itself
if there's no ancestor. [transfer none]
|
GtkWidget * gtk_widget_get_ancestor (GtkWidget *widget
,GType widget_type
);
Gets the first ancestor of widget
with type widget_type
. For example,
gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)
gets
the first GtkBox that's an ancestor of widget
. No reference will be
added to the returned widget; it should not be unreferenced. See note
about checking for a toplevel GtkWindow in the docs for
gtk_widget_get_toplevel()
.
Note that unlike gtk_widget_is_ancestor()
, gtk_widget_get_ancestor()
considers widget
to be an ancestor of itself.
GdkColormap * gtk_widget_get_colormap (GtkWidget *widget
);
Gets the colormap that will be used to render widget
. No reference will
be added to the returned colormap; it should not be unreferenced.
|
a GtkWidget |
Returns : |
the colormap used by widget . [transfer none]
|
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
function (i.e. from the constructor
for the widget).
init()
|
a GtkWidget |
|
a colormap |
GdkVisual * gtk_widget_get_visual (GtkWidget *widget
);
Gets the visual that will be used to render widget
.
|
a GtkWidget |
Returns : |
the visual for widget . [transfer none]
|
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.
|
a GtkWidget |
Returns : |
event mask for widget
|
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 widget->window
coordinates for widgets that are not
GTK_NO_WINDOW widgets, and are relative to widget->allocation.x
,
widget->allocation.y
for widgets that are GTK_NO_WINDOW widgets.
gboolean gtk_widget_is_ancestor (GtkWidget *widget
,GtkWidget *ancestor
);
Determines whether widget
is somewhere inside ancestor
, possibly with
intermediate containers.
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 src_widget
's allocation to coordinates
relative to dest_widget
's allocations. In order to perform this
operation, both widgets must be realized, and must share a common
toplevel.
|
a GtkWidget |
|
a GtkWidget |
|
X position relative to src_widget
|
|
Y position relative to src_widget
|
|
location to store X position relative to dest_widget . [out]
|
|
location to store Y position relative to dest_widget . [out]
|
Returns : |
FALSE if either widget was not realized, or there
was no common ancestor. In this case, nothing is stored in
*dest_x and *dest_y . Otherwise TRUE . |
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_hide()
on its
argument, then returns TRUE
. If connected to ::delete-event, the
result is that clicking the close button for a window (on the
window frame, top right corner usually) will hide but not destroy
the window. By default, GTK+ destroys windows when ::delete-event
is received.
void gtk_widget_set_style (GtkWidget *widget
,GtkStyle *style
);
Sets the GtkStyle for a widget (widget->style
). You probably don't
want to use this function; it interacts badly with themes, because
themes work by replacing the GtkStyle. Instead, use
gtk_widget_modify_style()
.
|
a GtkWidget |
|
a GtkStyle, or NULL to remove the effect of a previous
gtk_widget_set_style() and go back to the default style. [allow-none]
|
#define gtk_widget_set_rc_style(widget) (gtk_widget_set_style (widget, NULL))
gtk_widget_set_rc_style
has been deprecated since version 2.0 and should not be used in newly-written code. Use gtk_widget_set_style()
with a NULL
style
argument instead.
Equivalent to gtk_widget_set_style (widget, NULL)
.
|
a GtkWidget. |
void gtk_widget_ensure_style (GtkWidget *widget
);
Ensures that widget
has a style (widget->style
). Not a very useful
function; most of the time, if you want the style, the widget is
realized, and realized widgets are guaranteed to have a style
already.
|
a GtkWidget |
GtkStyle * gtk_widget_get_style (GtkWidget *widget
);
Simply an accessor function that returns widget->style
.
#define gtk_widget_restore_default_style(widget) (gtk_widget_set_style (widget, NULL))
gtk_widget_restore_default_style
has been deprecated since version 2.0 and should not be used in newly-written code. Use gtk_widget_set_style()
with a NULL
style
argument instead.
Equivalent to gtk_widget_set_style (widget, NULL)
.
|
a GtkWidget. |
void gtk_widget_reset_rc_styles (GtkWidget *widget
);
Reset the styles of widget
and all descendents, so when
they are looked up again, they get the correct values
for the currently loaded RC file settings.
This function is not useful for applications.
|
a GtkWidget. |
void gtk_widget_push_colormap (GdkColormap *cmap
);
Pushes cmap
onto a global stack of colormaps; the topmost
colormap on the stack will be used to create all widgets.
Remove cmap
with gtk_widget_pop_colormap()
. There's little
reason to use this function.
|
a GdkColormap |
void gtk_widget_pop_colormap (void
);
Removes a colormap pushed with gtk_widget_push_colormap()
.
void gtk_widget_set_default_colormap (GdkColormap *colormap
);
Sets the default colormap to use when creating widgets.
gtk_widget_push_colormap()
is a better function to use if
you only want to affect a few widgets, rather than all widgets.
|
a GdkColormap |
GtkStyle * gtk_widget_get_default_style (void
);
Returns the default style used by all widgets initially.
Returns : |
the default style. This GtkStyle object is owned by GTK+ and should not be modified or freed. [transfer none] |
GdkColormap * gtk_widget_get_default_colormap (void
);
Obtains the default colormap used to create widgets.
Returns : |
default widget colormap. [transfer none] |
GdkVisual * gtk_widget_get_default_visual (void
);
Obtains the visual of the default colormap. Not really useful;
used to be useful before gdk_colormap_get_visual()
existed.
Returns : |
visual of the default colormap. [transfer none] |
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 GTK_TEXT_DIR_NONE
, then the value
set by gtk_widget_set_default_direction()
will be used.
|
a GtkWidget |
|
the new direction |
typedef enum { GTK_TEXT_DIR_NONE, GTK_TEXT_DIR_LTR, GTK_TEXT_DIR_RTL } GtkTextDirection;
GtkTextDirection gtk_widget_get_direction (GtkWidget *widget
);
Gets the reading direction for a particular widget. See
gtk_widget_set_direction()
.
|
a GtkWidget |
Returns : |
the reading direction for the widget. |
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_set_direction()
.
|
the new default direction. This cannot be
GTK_TEXT_DIR_NONE . |
GtkTextDirection gtk_widget_get_default_direction (void
);
Obtains the current default reading direction. See
gtk_widget_set_default_direction()
.
Returns : |
the current default direction. |
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 gdk_window_shape_combine_mask()
for more information.
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
gdk_window_input_shape_combine_mask()
for more information.
|
a GtkWidget |
|
shape to be added, or NULL to remove an existing shape. [allow-none]
|
|
X position of shape mask with respect to window
|
|
Y position of shape mask with respect to window
|
Since 2.10
void gtk_widget_path (GtkWidget *widget
,guint *path_length
,gchar **path
,gchar **path_reversed
);
Obtains the full path to widget
. The path is simply the name of a
widget and all its parents in the container hierarchy, separated by
periods. The name of a widget comes from
gtk_widget_get_name()
. Paths are used to apply styles to a widget
in gtkrc configuration files. Widget names are the type of the
widget by default (e.g. "GtkButton") or can be set to an
application-specific value with gtk_widget_set_name()
. By setting
the name of a widget, you allow users or theme authors to apply
styles to that specific widget in their gtkrc
file. path_reversed_p
fills in the path in reverse order,
i.e. starting with widget
's name instead of starting with the name
of widget
's outermost ancestor.
void gtk_widget_class_path (GtkWidget *widget
,guint *path_length
,gchar **path
,gchar **path_reversed
);
Same as gtk_widget_path()
, but always uses the name of a widget's type,
never uses a custom name set with gtk_widget_set_name()
.
|
a GtkWidget |
|
location to store the length of the class path, or NULL . [out][allow-none]
|
|
location to store the class path as an allocated string, or NULL . [out][allow-none]
|
|
location to store the reverse class path as an allocated
string, or NULL . [out][allow-none]
|
gchar * gtk_widget_get_composite_name (GtkWidget *widget
);
Obtains the composite name of a widget.
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 gtk_widget_set_style()
. The GtkRcStyle structure
is designed so each field can either be set or unset, so it is
possible, using this function, to modify some style values and
leave the others unchanged.
Note that modifications made with this function are not cumulative
with previous calls to gtk_widget_modify_style()
or with such
functions as gtk_widget_modify_fg()
. If you wish to retain
previous values, you must first call gtk_widget_get_modifier_style()
,
make your modifications to the returned style, then call
gtk_widget_modify_style()
with that style. On the other hand,
if you first call gtk_widget_modify_style()
, subsequent calls
to such functions gtk_widget_modify_fg()
will have a cumulative
effect with the initial modifications.
|
a GtkWidget |
|
the GtkRcStyle holding the style modifications |
GtkRcStyle * gtk_widget_get_modifier_style (GtkWidget *widget
);
Returns the current modifier style for the widget. (As set by
gtk_widget_modify_style()
.) If no style has previously set, a new
GtkRcStyle will be created with all values unset, and set as the
modifier style for the widget. If you make changes to this rc
style, you must call gtk_widget_modify_style()
, passing in the
returned rc style, to make sure that your changes take effect.
Caution: passing the style back to gtk_widget_modify_style()
will
normally end up destroying it, because gtk_widget_modify_style()
copies
the passed-in style and sets the copy as the new modifier style,
thus dropping any reference to the old modifier style. Add a reference
to the modifier style if you want to keep it alive.
|
a GtkWidget |
Returns : |
the modifier style for the widget. This rc style is
owned by the widget. If you want to keep a pointer to value this
around, you must add a refcount using g_object_ref() . [transfer none]
|
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_style()
.
|
a GtkWidget |
|
the state for which to set the foreground color |
|
the color to assign (does not need to be allocated),
or NULL to undo the effect of previous calls to
of gtk_widget_modify_fg() . [allow-none]
|
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
gtk_widget_modify_style()
.
Note that "no window" widgets (which have the GTK_NO_WINDOW
flag set)
draw on their parent container's window and thus may not draw any
background themselves. This is the case for e.g. GtkLabel. To modify
the background of such widgets, you have to set the background color
on their parent; if you want to set the background of a rectangular
area around a label, try placing the label in a GtkEventBox widget
and setting the background color on that.
|
a GtkWidget |
|
the state for which to set the background color |
|
the color to assign (does not need to be allocated),
or NULL to undo the effect of previous calls to
of gtk_widget_modify_bg() . [allow-none]
|
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()
)
for widgets such as GtkEntry and GtkTextView. See also
gtk_widget_modify_style()
.
|
a GtkWidget |
|
the state for which to set the text color |
|
the color to assign (does not need to be allocated),
or NULL to undo the effect of previous calls to
of gtk_widget_modify_text() . [allow-none]
|
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 gtk_widget_modify_text()
) for widgets such as GtkEntry
and GtkTextView. See also gtk_widget_modify_style()
.
Note that "no window" widgets (which have the GTK_NO_WINDOW
flag set)
draw on their parent container's window and thus may not draw any
background themselves. This is the case for e.g. GtkLabel. To modify
the background of such widgets, you have to set the base color on their
parent; if you want to set the background of a rectangular area around
a label, try placing the label in a GtkEventBox widget and setting
the base color on that.
|
a GtkWidget |
|
the state for which to set the base color |
|
the color to assign (does not need to be allocated),
or NULL to undo the effect of previous calls to
of gtk_widget_modify_base() . [allow-none]
|
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_style()
.
|
a GtkWidget |
|
the font description to use, or NULL to undo
the effect of previous calls to gtk_widget_modify_font() . [allow-none]
|
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 gtk_widget_modify_style()
.
|
a GtkWidget |
|
the color to use for primary cursor (does not need to be
allocated), or NULL to undo the effect of previous calls to
of gtk_widget_modify_cursor() . |
|
the color to use for secondary cursor (does not need to be
allocated), or NULL to undo the effect of previous calls to
of gtk_widget_modify_cursor() . |
Since 2.12
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()
.
|
a GtkWidget |
Returns : |
the new PangoContext. [transfer full] |
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 gtk_widget_create_pango_context()
, this context is owned by
the widget (it can be used until the screen for the widget changes
or the widget is removed from its toplevel), and will be updated to
match any changes to the widget's attributes.
If you create and keep a PangoLayout using this context, you must
deal with changes to the context by calling pango_layout_context_changed()
on the layout in response to the "style-set" and
"direction-changed" signals for the widget.
|
a GtkWidget |
Returns : |
the PangoContext for the widget. [transfer none] |
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 pango_layout_context_changed()
in response to
the "style-set" and "direction-changed" signals
for the widget.
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 widget
to look up stock_id
and render it to
a pixbuf. stock_id
should be a stock icon ID such as
GTK_STOCK_OPEN or GTK_STOCK_OK. size
should be a size
such as GTK_ICON_SIZE_MENU. detail
should be a string that
identifies the widget or code doing the rendering, so that
theme engines can special-case rendering for that widget or code.
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 g_object_unref()
.
|
a GtkWidget |
|
a stock ID |
|
(type int) a stock size. A size of (GtkIconSize)-1 means render at the size of the source and don't scale (if there are multiple source sizes, GTK+ picks one of the available sizes). |
|
render detail to pass to theme engine. [allow-none] |
Returns : |
a new pixbuf, or NULL if the
stock ID wasn't known. [transfer full]
|
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 gtk_widget_pop_composite_child()
call.
A composite child is a child that's an implementation detail of the
container it's inside and should not be visible to people using the
container. Composite children aren't treated differently by GTK (but
see gtk_container_foreach()
vs. gtk_container_forall()
), but e.g. GUI
builders might want to treat them in a different way.
Here is a simple example:
1 2 3 4 5 6 7 |
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); |
void gtk_widget_queue_clear (GtkWidget *widget
);
gtk_widget_queue_clear
has been deprecated since version 2.2 and should not be used in newly-written code. Use gtk_widget_queue_draw()
instead.
This function does the same as gtk_widget_queue_draw()
.
|
a GtkWidget |
void gtk_widget_queue_clear_area (GtkWidget *widget
,gint x
,gint y
,gint width
,gint height
);
gtk_widget_queue_clear_area
has been deprecated since version 2.2 and should not be used in newly-written code. Use gtk_widget_queue_draw_area()
instead.
This function is no longer different from
gtk_widget_queue_draw_area()
, though it once was. Now it just calls
gtk_widget_queue_draw_area()
. Originally
gtk_widget_queue_clear_area()
would force a redraw of the
background for GTK_NO_WINDOW
widgets, and
gtk_widget_queue_draw_area()
would not. Now both functions ensure
the background will be redrawn.
|
a GtkWidget |
|
x coordinate of upper-left corner of rectangle to redraw |
|
y coordinate of upper-left corner of rectangle to redraw |
|
width of region to draw |
|
height of region to draw |
void gtk_widget_queue_draw_area (GtkWidget *widget
,gint x
,gint y
,gint width
,gint height
);
Invalidates the rectangular area of widget
defined by x
, y
,
width
and height
by calling gdk_window_invalidate_rect()
on the
widget's window and all its child windows. Once the main loop
becomes idle (after the current batch of events has been processed,
roughly), the window will receive expose events for the union of
all regions that have been invalidated.
Normally you would only use this function in widget
implementations. You might also use it, or
gdk_window_invalidate_rect()
directly, to schedule a redraw of a
GtkDrawingArea or some portion thereof.
Frequently you can just call gdk_window_invalidate_rect()
or
gdk_window_invalidate_region()
instead of this function. Those
functions will invalidate only a single window, instead of the
widget and all its children.
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.
|
a GtkWidget |
|
x coordinate of upper-left corner of rectangle to redraw |
|
y coordinate of upper-left corner of rectangle to redraw |
|
width of region to draw |
|
height of region to draw |
void gtk_widget_reset_shapes (GtkWidget *widget
);
gtk_widget_reset_shapes
is deprecated and should not be used in newly-written code. This function is being removed in GTK+ 3.0. Don't use it.
Recursively resets the shape on this widget and its descendants.
|
a GtkWidget |
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:
1 2 3 |
gtk_widget_realize (window); gdk_window_set_back_pixmap (window->window, NULL, FALSE); gtk_widget_show (window); |
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
gdk_window_begin_paint_region()
and gdk_window_end_paint()
are called
automatically around expose events sent to the
widget. gdk_window_begin_paint()
diverts all drawing to a widget's
window to an offscreen buffer, and gdk_window_end_paint()
draws the
buffer to the screen. The result is that users see the window
update in one smooth step, and don't see individual graphics
primitives being rendered.
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
gdk_window_begin_paint()
).
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 TRUE
and
the entire widget is redrawn on every size change. If your widget
leaves the upper left unchanged when made bigger, turning this
setting off will improve performance.
Note that for NO_WINDOW
widgets setting this flag to FALSE
turns
off all allocation on resizing: the widget will not even redraw if
its position changes; this is to allow containers that don't draw
anything to avoid excess invalidations. If you set this flag on a
NO_WINDOW
widget that does draw on widget->window
,
you are responsible for invalidating both the old and new allocation
of the widget when the widget is moved and responsible for invalidating
regions newly when the widget increases size.
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_push_composite_child()
.
|
a GtkWidget. |
|
the name to set |
gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget
,GtkAdjustment *hadjustment
,GtkAdjustment *vadjustment
);
For widgets that support scrolling, sets the scroll adjustments and
returns TRUE
. For widgets that don't support scrolling, does
nothing and returns FALSE
. Widgets that don't support scrolling
can be scrolled by placing them in a GtkViewport, which does
support scrolling.
gboolean gtk_widget_mnemonic_activate (GtkWidget *widget
,gboolean group_cycling
);
Emits the "mnemonic-activate" signal.
The default handler for this signal activates the widget
if
group_cycling
is FALSE
, and just grabs the focus if group_cycling
is TRUE
.
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 pspec
.
|
a GtkWidgetClass |
|
the GParamSpec for the property |
void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass
,GParamSpec *pspec
,GtkRcPropertyParser parser
);
Installs a style property on a widget class.
|
a GtkWidgetClass |
|
the GParamSpec for the style property |
|
the parser for the 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.
|
a GtkWidgetClass |
|
the name of the style property to find |
Returns : |
the GParamSpec of the style property or
NULL if class has no style property with that name. [transfer none]
|
Since 2.2
GParamSpec ** gtk_widget_class_list_style_properties (GtkWidgetClass *klass
,guint *n_properties
);
Returns all style properties of a widget class.
|
a GtkWidgetClass |
|
location to return the number of style properties found |
Returns : |
an newly
allocated array of GParamSpec*. The array must be freed with
g_free() . [array length=n_properties][transfer container]
|
Since 2.2
GdkRegion * gtk_widget_region_intersect (GtkWidget *widget
,const GdkRegion *region
);
Computes the intersection of a widget
's area and region
, returning
the intersection. The result may be empty, use gdk_region_empty()
to
check.
|
a GtkWidget |
|
a GdkRegion, in the same coordinate system as
widget->allocation . That is, relative to widget->window
for NO_WINDOW widgets; relative to the parent window
of widget->window for widgets with their own window. |
Returns : |
A newly allocated region holding the intersection of widget
and region . The coordinates of the return value are
relative to widget->window for NO_WINDOW widgets, and
relative to the parent window of widget->window for
widgets with their own window. |
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 NO_WINDOW
widget, and
that is normally done using gtk_container_propagate_expose()
.
If you want to force an area of a window to be redrawn,
use gdk_window_invalidate_rect()
or gdk_window_invalidate_region()
.
To cause the redraw to be done immediately, follow that call
with a call to gdk_window_process_updates()
.
gboolean gtk_widget_send_focus_change (GtkWidget *widget
,GdkEvent *event
);
Sends the focus change event
to widget
This function is not meant to be used by applications. The only time it should be used is when it is necessary for a GtkWidget to assign focus to a widget that is semantically owned by the first widget even though it's not a direct child - for instance, a search entry in a floating window similar to the quick search in GtkTreeView.
An example of its usage is:
1 2 3 4 5 6 7 8 9 10 11 |
GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE); fevent->focus_change.type = GDK_FOCUS_CHANGE; fevent->focus_change.in = TRUE; fevent->focus_change.window = gtk_widget_get_window (widget); if (fevent->focus_change.window != NULL) g_object_ref (fevent->focus_change.window); gtk_widget_send_focus_change (widget, fevent); gdk_event_free (event); |
|
a GtkWidget |
|
a GdkEvent of type GDK_FOCUS_CHANGE |
Returns : |
the return value from the event signal emission: TRUE
if the event was handled, and FALSE otherwise |
Since 2.22
void gtk_widget_style_get (GtkWidget *widget
,const gchar *first_property_name
,...
);
Gets the values of a multiple style properties of widget
.
|
a GtkWidget |
|
the name of the first property to get |
void gtk_widget_style_get_property (GtkWidget *widget
,const gchar *property_name
,GValue *value
);
Gets the value of a style property of widget
.
|
a GtkWidget |
|
the name of a style property |
|
location to return the property value |
void gtk_widget_style_get_valist (GtkWidget *widget
,const gchar *first_property_name
,va_list var_args
);
Non-vararg variant of gtk_widget_style_get()
. Used primarily by language
bindings.
|
a GtkWidget |
|
the name of the first property to get |
|
a va_list of pairs of property names and
locations to return the property values, starting with the location
for first_property_name . |
void gtk_widget_style_attach (GtkWidget *style
);
This function attaches the widget's GtkStyle to the widget's GdkWindow. It is a replacement for
widget->style = gtk_style_attach (widget->style, widget->window);
and should only ever be called in a derived widget's "realize" implementation which does not chain up to its parent class' "realize" implementation, because one of the parent classes (finally GtkWidget) would attach the style itself.
Since 2.20
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 GTK_MODULES
or via another application library,
such as libgnome), then this AtkObject instance may be a no-op. Likewise,
if no class-specific AtkObject implementation is available for the widget
instance in question, it will inherit an AtkObject implementation from the
first ancestor class for which such an implementation is defined.
The documentation of the ATK library contains more information about accessible objects and their uses.
|
a GtkWidget |
Returns : |
the AtkObject associated with widget . [transfer none]
|
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 gtk_widget_grab_focus()
to move the focus
to a particular widget, and gtk_container_set_focus_chain()
to
change the focus tab order. So you may want to investigate those
functions instead.
gtk_widget_child_focus()
is called by containers as the user moves
around the window using keyboard shortcuts. direction
indicates
what kind of motion is taking place (up, down, left, right, tab
forward, tab backward). gtk_widget_child_focus()
emits the
"focus" signal; widgets override the default handler
for this signal in order to implement appropriate focus behavior.
The default ::focus handler for a widget should return TRUE
if
moving in direction
left the focus on a focusable location inside
that widget, and FALSE
if moving in direction
moved the focus
outside the widget. If returning TRUE
, widgets normally
call gtk_widget_grab_focus()
to place the focus accordingly;
if returning FALSE
, they don't modify the current focus location.
This function replaces gtk_container_focus()
from GTK+ 1.2.
It was necessary to check that the child was visible, sensitive,
and focusable before calling gtk_container_focus()
.
gtk_widget_child_focus()
returns FALSE
if the widget is not
currently in a focusable state, so there's no need for those checks.
void gtk_widget_child_notify (GtkWidget *widget
,const gchar *child_property
);
Emits a "child-notify" signal for the
child property child_property
on widget
.
This is the analogue of g_object_notify()
for child properties.
|
a GtkWidget |
|
the name of a child property installed on the
class of widget 's parent |
void gtk_widget_freeze_child_notify (GtkWidget *widget
);
Stops emission of "child-notify" signals on widget
. The
signals are queued until gtk_widget_thaw_child_notify()
is called
on widget
.
This is the analogue of g_object_freeze_notify()
for child properties.
|
a GtkWidget |
gboolean gtk_widget_get_child_visible (GtkWidget *widget
);
Gets the value set with gtk_widget_set_child_visible()
.
If you feel a need to use this function, your code probably
needs reorganization.
This function is only useful for container implementations and never should be called by an application.
GtkWidget * gtk_widget_get_parent (GtkWidget *widget
);
Returns the parent container of widget
.
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.
|
a GtkWidget |
Returns : |
the relevant GtkSettings object. [transfer none] |
GtkClipboard * gtk_widget_get_clipboard (GtkWidget *widget
,GdkAtom selection
);
Returns the clipboard object for the given selection to
be used with widget
. widget
must have a GdkDisplay
associated with it, so must be attached to a toplevel
window.
|
a GtkWidget |
|
a GdkAtom which identifies the clipboard
to use. GDK_SELECTION_CLIPBOARD gives the
default clipboard. Another common value
is GDK_SELECTION_PRIMARY , which gives
the primary X selection. |
Returns : |
the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time. [transfer none] |
Since 2.2
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.
|
a GtkWidget |
Returns : |
the GdkDisplay for the toplevel for this widget. [transfer none] |
Since 2.2
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 hierarchy 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.
|
a GtkWidget |
Returns : |
the GdkWindow root window for the toplevel for this widget. [transfer none] |
Since 2.2
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
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 hierarchy with a toplevel window at the top.
Since 2.2
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_set_size_request()
. A value of -1 stored in width
or
height
indicates that that dimension has not been set explicitly
and the natural requisition of the widget will be used intead. See
gtk_widget_set_size_request()
. To get the size a widget will
actually use, call gtk_widget_size_request()
instead of
this function.
#define gtk_widget_pop_visual() ((void) 0)
gtk_widget_pop_visual
is deprecated and should not be used in newly-written code.
This function is deprecated; it does nothing.
#define gtk_widget_push_visual(visual) ((void) 0)
gtk_widget_push_visual
is deprecated and should not be used in newly-written code.
This function is deprecated; it does nothing.
|
a visual |
void gtk_widget_set_child_visible (GtkWidget *widget
,gboolean is_visible
);
Sets whether widget
should be mapped along with its when its parent
is mapped and widget
has been shown with gtk_widget_show()
.
The child visibility can be set for widget before it is added to
a container with gtk_widget_set_parent()
, to avoid mapping
children unnecessary before immediately unmapping them. However
it will be reset to its default state of TRUE
when the widget
is removed from a container.
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.
#define gtk_widget_set_default_visual(visual) ((void) 0)
gtk_widget_set_default_visual
is deprecated and should not be used in newly-written code.
This function is deprecated; it does nothing.
|
a visual |
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 width
by height
. You can use this function to
force a widget to be either larger or smaller than it normally
would be.
In most cases, gtk_window_set_default_size()
is a better choice for
toplevel windows than this function; setting the default size will
still allow users to shrink the window. Setting the size request
will force them to leave the window at least as large as the size
request. When dealing with window sizes,
gtk_window_set_geometry_hints()
can be a useful function as well.
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."
|
a GtkWidget |
|
width widget should request, or -1 to unset |
|
height widget should request, or -1 to unset |
#define gtk_widget_set_visual(widget,visual) ((void) 0)
gtk_widget_set_visual
is deprecated and should not be used in newly-written code.
This function is deprecated; it does nothing.
|
a GtkWidget |
|
a visual |
void gtk_widget_thaw_child_notify (GtkWidget *widget
);
Reverts the effect of a previous call to gtk_widget_freeze_child_notify()
.
This causes all queued "child-notify" signals on widget
to be
emitted.
|
a GtkWidget |
void gtk_widget_set_no_show_all (GtkWidget *widget
,gboolean no_show_all
);
Sets the "no-show-all" property, which determines whether
calls to gtk_widget_show_all()
and gtk_widget_hide_all()
will affect
this widget.
This is mostly for use in constructing widget hierarchies with externally controlled visibility, see GtkUIManager.
|
a GtkWidget |
|
the new value for the "no-show-all" property |
Since 2.4
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 gtk_widget_show_all()
and
gtk_widget_hide_all()
will affect this widget.
|
a GtkWidget |
Returns : |
the current value of the "no-show-all" property. |
Since 2.4
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,
gtk_label_set_mnemonic_widget()
).
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 g_list_foreach (result,
(GFunc)g_object_ref, NULL)
first, and then unref all the
widgets afterwards.
|
a GtkWidget |
Returns : |
the list of
mnemonic labels; free this list
with g_list_free() when you are done with it. [element-type GtkWidget][transfer container]
|
Since 2.4
void gtk_widget_add_mnemonic_label (GtkWidget *widget
,GtkWidget *label
);
Adds a widget to the list of mnemonic labels for
this widget. (See gtk_widget_list_mnemonic_labels()
). Note the
list of mnemonic labels for the widget is cleared when the
widget is destroyed, so the caller must make sure to update
its internal state at this point as well, by using a connection
to the "destroy" signal or a weak notifier.
Since 2.4
void gtk_widget_remove_mnemonic_label (GtkWidget *widget
,GtkWidget *label
);
Removes a widget from the list of mnemonic labels for
this widget. (See gtk_widget_list_mnemonic_labels()
). The widget
must have previously been added to the list with
gtk_widget_add_mnemonic_label()
.
|
a GtkWidget |
|
a GtkWidget that was previously set as a mnemnic label for
widget with gtk_widget_add_mnemonic_label() . |
Since 2.4
GtkAction * gtk_widget_get_action (GtkWidget *widget
);
gtk_widget_get_action
has been deprecated since version 2.16 and should not be used in newly-written code. Use gtk_activatable_get_related_action()
instead.
Returns the GtkAction that widget
is a proxy for.
See also gtk_action_get_proxies()
.
|
a GtkWidget |
Returns : |
the action that a widget is a proxy for, or
NULL , if it is not attached to an action. |
Since 2.10
gboolean gtk_widget_is_composited (GtkWidget *widget
);
Whether widget
can rely on having its alpha channel
drawn correctly. On X11 this function returns whether a
compositing manager is running for widget
's screen.
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 hierarchy (as set by gdk_window_set_composited()
).
|
a GtkWidget |
Returns : |
TRUE if the widget can rely on its alpha
channel being drawn correctly. |
Since 2.10
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 TRUE
, it calls
gdk_window_beep()
, otherwise it does nothing.
Note that the effect of gdk_window_beep()
can be configured in many
ways, depending on the windowing backend and the desktop environment
or window manager that is used.
|
a GtkWidget |
Since 2.12
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
gtk_widget_child_focus()
:
When TRUE
is returned, stay in the widget, the failed keyboard
navigation is Ok and/or there is nowhere we can/should move the
focus to.
When FALSE
is returned, the caller should continue with keyboard
navigation outside the widget, e.g. by calling
gtk_widget_child_focus()
on the widget's toplevel.
The default ::keynav-failed handler returns TRUE
for
GTK_DIR_TAB_FORWARD
and GTK_DIR_TAB_BACKWARD
. For the other
values of GtkDirectionType, it looks at the
"gtk-keynav-cursor-only" setting and returns FALSE
if the setting is TRUE
. This way the entire user interface
becomes cursor-navigatable on input devices such as mobile phones
which only have cursor keys but no tab key.
Whenever the default handler returns TRUE
, it also calls
gtk_widget_error_bell()
to notify the user of the failed keyboard
navigation.
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.
|
a GtkWidget |
|
direction of focus movement |
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
gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget
);
Gets the contents of the tooltip for widget
.
|
a GtkWidget |
Returns : |
the tooltip text, or NULL . You should free the
returned string with g_free() when done. |
Since 2.12
void gtk_widget_set_tooltip_markup (GtkWidget *widget
,const gchar *markup
);
Sets markup
as the contents of the tooltip, which is marked up with
the Pango text markup language.
This function will take care of setting GtkWidget:has-tooltip to TRUE
and of the default handler for the GtkWidget::query-tooltip signal.
See also the GtkWidget:tooltip-markup property and
gtk_tooltip_set_markup()
.
Since 2.12
gchar * gtk_widget_get_tooltip_text (GtkWidget *widget
);
Gets the contents of the tooltip for widget
.
|
a GtkWidget |
Returns : |
the tooltip text, or NULL . You should free the
returned string with g_free() when done. |
Since 2.12
void gtk_widget_set_tooltip_text (GtkWidget *widget
,const gchar *text
);
Sets text
as the contents of the tooltip. This function will take
care of setting GtkWidget:has-tooltip to TRUE
and of the default
handler for the GtkWidget::query-tooltip signal.
See also the GtkWidget:tooltip-text property and gtk_tooltip_set_text()
.
|
a GtkWidget |
|
the contents of the tooltip for widget
|
Since 2.12
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 gtk_widget_set_tooltip_window()
.
Since 2.12
void gtk_widget_set_tooltip_window (GtkWidget *widget
,GtkWindow *custom_window
);
Replaces the default, usually yellow, window used for displaying
tooltips with custom_window
. GTK+ will take care of showing and
hiding custom_window
at the right moment, to behave likewise as
the default tooltip window. If custom_window
is NULL
, the default
tooltip window will be used.
If the custom window should have the default theming it needs to
have the name "gtk-tooltip", see gtk_widget_set_name()
.
Since 2.12
gboolean gtk_widget_get_has_tooltip (GtkWidget *widget
);
Returns the current value of the has-tooltip property. See GtkWidget:has-tooltip for more information.
|
a GtkWidget |
Returns : |
current value of has-tooltip on widget . |
Since 2.12
void gtk_widget_set_has_tooltip (GtkWidget *widget
,gboolean has_tooltip
);
Sets the has-tooltip property on widget
to has_tooltip
. See
GtkWidget:has-tooltip for more information.
|
a GtkWidget |
|
whether or not widget has a tooltip. |
Since 2.12
void gtk_widget_trigger_tooltip_query (GtkWidget *widget
);
Triggers a tooltip query on the display where the toplevel of widget
is located. See gtk_tooltip_trigger_tooltip_query()
for more
information.
|
a GtkWidget |
Since 2.12
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 gdk_pixbuf_get_from_drawable()
can be used to convert
the pixmap to a visual independant representation.
The snapshot area used by this function is the widget
's allocation plus
any extra space occupied by additional windows belonging to this widget
(such as the arrows of a spin button).
Thus, the resulting snapshot pixmap is possibly larger than the allocation.
If clip_rect
is non-NULL
, the resulting pixmap is shrunken to
match the specified clip_rect. The (x,y) coordinates of clip_rect
are
interpreted widget relative. If width or height of clip_rect
are 0 or
negative, the width or height of the resulting pixmap will be shrunken
by the respective amount.
For instance a clip_rect
{ +5, +5, -10, -10 }
will
chop off 5 pixels at each side of the snapshot pixmap.
If non-NULL
, clip_rect
will contain the exact widget-relative snapshot
coordinates upon return. A clip_rect
of { -1, -1, 0, 0 }
can be used to preserve the auto-grown snapshot area and use clip_rect
as a pure output parameter.
The returned pixmap can be NULL
, if the resulting clip_area
was empty.
|
a GtkWidget |
|
a GdkRectangle or NULL . [allow-none]
|
Returns : |
GdkPixmap snapshot of the widget |
Since 2.14
GdkWindow * gtk_widget_get_window (GtkWidget *widget
);
Returns the widget's window if it is realized, NULL
otherwise
|
a GtkWidget |
Returns : |
widget 's window. [transfer none]
|
Since 2.14
void gtk_widget_get_allocation (GtkWidget *widget
,GtkAllocation *allocation
);
Retrieves the widget's allocation.
|
a GtkWidget |
|
a pointer to a GtkAllocation to copy to. [out] |
Since 2.18
void gtk_widget_set_allocation (GtkWidget *widget
,const GtkAllocation *allocation
);
Sets the widget's allocation. This should not be used directly, but from within a widget's size_allocate method.
|
a GtkWidget |
|
a pointer to a GtkAllocation to copy from |
Since 2.18
gboolean gtk_widget_get_app_paintable (GtkWidget *widget
);
Determines whether the application intends to draw on the widget in an "expose-event" handler.
See gtk_widget_set_app_paintable()
Since 2.18
gboolean gtk_widget_get_can_default (GtkWidget *widget
);
Determines whether widget
can be a default widget. See
gtk_widget_set_can_default()
.
Since 2.18
void gtk_widget_set_can_default (GtkWidget *widget
,gboolean can_default
);
Specifies whether widget
can be a default widget. See
gtk_widget_grab_default()
for details about the meaning of
"default".
|
a GtkWidget |
|
whether or not widget can be a default widget. |
Since 2.18
gboolean gtk_widget_get_can_focus (GtkWidget *widget
);
Determines whether widget
can own the input focus. See
gtk_widget_set_can_focus()
.
Since 2.18
void gtk_widget_set_can_focus (GtkWidget *widget
,gboolean can_focus
);
Specifies whether widget
can own the input focus. See
gtk_widget_grab_focus()
for actually setting the input focus on a
widget.
|
a GtkWidget |
|
whether or not widget can own the input focus. |
Since 2.18
gboolean gtk_widget_get_double_buffered (GtkWidget *widget
);
Determines whether the widget is double buffered.
See gtk_widget_set_double_buffered()
Since 2.18
gboolean gtk_widget_get_has_window (GtkWidget *widget
);
Determines whether widget
has a GdkWindow of its own. See
gtk_widget_set_has_window()
.
Since 2.18
void gtk_widget_set_has_window (GtkWidget *widget
,gboolean has_window
);
Specifies whether widget
has a GdkWindow of its own. Note that
all realized widgets have a non-NULL
"window" pointer
(gtk_widget_get_window()
never returns a NULL
window when a widget
is realized), but for many of them it's actually the GdkWindow of
one of its parent widgets. Widgets that do not create a window
for
themselves in GtkWidget::realize()
must announce this by
calling this function with has_window
= FALSE
.
This function should only be called by widget implementations,
and they should call it in their init()
function.
|
a GtkWidget |
|
whether or not widget has a window. |
Since 2.18
gboolean gtk_widget_get_sensitive (GtkWidget *widget
);
Returns the widget's sensitivity (in the sense of returning
the value that has been set using gtk_widget_set_sensitive()
).
The effective sensitivity of a widget is however determined by both its
own and its parent widget's sensitivity. See gtk_widget_is_sensitive()
.
Since 2.18
gboolean gtk_widget_is_sensitive (GtkWidget *widget
);
Returns the widget's effective sensitivity, which means it is sensitive itself and also its parent widget is sensntive
Since 2.18
GtkStateType gtk_widget_get_state (GtkWidget *widget
);
Returns the widget's state. See gtk_widget_set_state()
.
|
a GtkWidget |
Returns : |
the state of widget . |
Since 2.18
gboolean gtk_widget_get_visible (GtkWidget *widget
);
Determines whether the widget is visible. Note that this doesn't take into account whether the widget's parent is also visible or the widget is obscured in any way.
Since 2.18
void gtk_widget_set_visible (GtkWidget *widget
,gboolean visible
);
Sets the visibility state of widget
. Note that setting this to
TRUE
doesn't mean the widget is actually viewable, see
gtk_widget_get_visible()
.
This function simply calls gtk_widget_show()
or gtk_widget_hide()
but is nicer to use when the visibility of the widget depends on
some condition.
|
a GtkWidget |
|
whether the widget should be shown or not |
Since 2.18
gboolean gtk_widget_has_default (GtkWidget *widget
);
Determines whether widget
is the current default widget within its
toplevel. See gtk_widget_set_can_default()
.
|
a GtkWidget |
Returns : |
TRUE if widget is the current default widget within
its toplevel, FALSE otherwise |
Since 2.18
gboolean gtk_widget_has_focus (GtkWidget *widget
);
Determines if the widget has the global input focus. See
gtk_widget_is_focus()
for the difference between having the global
input focus, and only having the focus within a toplevel.
Since 2.18
gboolean gtk_widget_has_grab (GtkWidget *widget
);
Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).
See also gtk_grab_add()
.
Since 2.18
gboolean gtk_widget_has_rc_style (GtkWidget *widget
);
Determines if the widget style has been looked up through the rc mechanism.
|
a GtkWidget |
Returns : |
TRUE if the widget has been looked up through the rc
mechanism, FALSE otherwise. |
Since 2.20
gboolean gtk_widget_is_drawable (GtkWidget *widget
);
Determines whether widget
can be drawn to. A widget can be drawn
to if it is mapped and visible.
Since 2.18
gboolean gtk_widget_is_toplevel (GtkWidget *widget
);
Determines whether widget
is a toplevel widget. Currently only
GtkWindow and GtkInvisible are toplevel widgets. Toplevel
widgets have no parent widget.
Since 2.18
void gtk_widget_set_window (GtkWidget *widget
,GdkWindow *window
);
Sets a widget's window. This function should only be used in a
widget's GtkWidget::realize()
implementation. The window
passed is
usually either new window created with gdk_window_new()
, or the
window of its parent widget as returned by
gtk_widget_get_parent_window()
.
Widgets must indicate whether they will create their own GdkWindow
by calling gtk_widget_set_has_window()
. This is usually done in the
widget's init()
function.
Since 2.18
void gtk_widget_set_receives_default (GtkWidget *widget
,gboolean receives_default
);
Specifies whether widget
will be treated as the default widget
within its toplevel when it has the focus, even if another widget
is the default.
See gtk_widget_grab_default()
for details about the meaning of
"default".
|
a GtkWidget |
|
whether or not widget can be a default widget. |
Since 2.18
gboolean gtk_widget_get_receives_default (GtkWidget *widget
);
Determines whether widget
is alyways treated as default widget
withing its toplevel when it has the focus, even if another widget
is the default.
See gtk_widget_set_receives_default()
.
Since 2.18
void gtk_widget_set_realized (GtkWidget *widget
,gboolean realized
);
Marks the widget as being realized.
This function should only ever be called in a derived widget's "realize" or "unrealize" implementation.
Since 2.20
gboolean gtk_widget_get_realized (GtkWidget *widget
);
Determines whether widget
is realized.
Since 2.20
void gtk_widget_set_mapped (GtkWidget *widget
,gboolean mapped
);
Marks the widget as being realized.
This function should only ever be called in a derived widget's "map" or "unmap" implementation.
Since 2.20
gboolean gtk_widget_get_mapped (GtkWidget *widget
);
Whether the widget is mapped.
Since 2.20
void gtk_widget_get_requisition (GtkWidget *widget
,GtkRequisition *requisition
);
Retrieves the widget's requisition.
This function should only be used by widget implementations in
order to figure whether the widget's requisition has actually
changed after some internal state change (so that they can call
gtk_widget_queue_resize()
instead of gtk_widget_queue_draw()
).
Normally, gtk_widget_size_request()
should be used.
|
a GtkWidget |
|
a pointer to a GtkRequisition to copy to. [out] |
Since 2.20
GtkRequisition * gtk_requisition_copy (const GtkRequisition *requisition
);
Copies a GtkRequisition.
|
a GtkRequisition |
Returns : |
a copy of requisition
|
void gtk_requisition_free (GtkRequisition *requisition
);
Frees a GtkRequisition.
|
a GtkRequisition |
"app-paintable"
property"app-paintable" gboolean : Read / Write
Whether the application will paint directly on the widget.
Default value: FALSE
"can-default"
property"can-default" gboolean : Read / Write
Whether the widget can be the default widget.
Default value: FALSE
"can-focus"
property"can-focus" gboolean : Read / Write
Whether the widget can accept the input focus.
Default value: FALSE
"composite-child"
property"composite-child" gboolean : Read
Whether the widget is part of a composite widget.
Default value: FALSE
"double-buffered"
property"double-buffered" gboolean : Read / Write
Whether or not the widget is double buffered.
Default value: TRUE
Since 2.18
"events"
property"events" GdkEventMask : Read / Write
The event mask that decides what kind of GdkEvents this widget gets.
Default value: GDK_STRUCTURE_MASK
"extension-events"
property"extension-events" GdkExtensionMode : Read / Write
The mask that decides what kind of extension events this widget gets.
Default value: GDK_EXTENSION_EVENTS_NONE
"has-default"
property"has-default" gboolean : Read / Write
Whether the widget is the default widget.
Default value: FALSE
"has-focus"
property"has-focus" gboolean : Read / Write
Whether the widget has the input focus.
Default value: FALSE
"has-tooltip"
property"has-tooltip" gboolean : Read / Write
Enables or disables the emission of "query-tooltip" on widget
.
A value of TRUE
indicates that widget
can have a tooltip, in this case
the widget will be queried using "query-tooltip" to determine
whether it will provide a tooltip or not.
Note that setting this property to TRUE
for the first time will change
the event masks of the GdkWindows of this widget to include leave-notify
and motion-notify events. This cannot and will not be undone when the
property is set to FALSE
again.
Default value: FALSE
Since 2.12
"height-request"
property"height-request" gint : Read / Write
Override for height request of the widget, or -1 if natural request should be used.
Allowed values: >= G_MAXULONG
Default value: -1
"is-focus"
property"is-focus" gboolean : Read / Write
Whether the widget is the focus widget within the toplevel.
Default value: FALSE
"no-show-all"
property"no-show-all" gboolean : Read / Write
Whether gtk_widget_show_all() should not affect this widget.
Default value: FALSE
"parent"
property"parent" GtkContainer* : Read / Write
The parent widget of this widget. Must be a Container widget.
"receives-default"
property"receives-default" gboolean : Read / Write
If TRUE, the widget will receive the default action when it is focused.
Default value: FALSE
"sensitive"
property"sensitive" gboolean : Read / Write
Whether the widget responds to input.
Default value: TRUE
"style"
property"style" GtkStyle* : Read / Write
The style of the widget, which contains information about how it will look (colors etc).
"tooltip-markup"
property"tooltip-markup" gchar* : Read / Write
Sets the text of tooltip to be the given string, which is marked up
with the Pango text markup language.
Also see gtk_tooltip_set_markup()
.
This is a convenience property which will take care of getting the
tooltip shown if the given string is not NULL
: "has-tooltip"
will automatically be set to TRUE
and there will be taken care of
"query-tooltip" in the default signal handler.
Default value: NULL
Since 2.12
"tooltip-text"
property"tooltip-text" gchar* : Read / Write
Sets the text of tooltip to be the given string.
Also see gtk_tooltip_set_text()
.
This is a convenience property which will take care of getting the
tooltip shown if the given string is not NULL
: "has-tooltip"
will automatically be set to TRUE
and there will be taken care of
"query-tooltip" in the default signal handler.
Default value: NULL
Since 2.12
"visible"
property"visible" gboolean : Read / Write
Whether the widget is visible.
Default value: FALSE
"width-request"
property"width-request" gint : Read / Write
Override for width request of the widget, or -1 if natural request should be used.
Allowed values: >= G_MAXULONG
Default value: -1
"cursor-aspect-ratio"
style property"cursor-aspect-ratio" gfloat : Read
Aspect ratio with which to draw insertion cursor.
Allowed values: [0,1]
Default value: 0.04
"cursor-color"
style property"cursor-color" GdkColor* : Read
Color with which to draw insertion cursor.
"draw-border"
style property"draw-border" GtkBorder* : Read
GtkWidget:draw-border
has been deprecated since version 2.22 and should not be used in newly-written code. This property will be removed in GTK+ 3
The "draw-border" style property defines the size of areas outside the widget's allocation to draw.
Since 2.8
"focus-line-pattern"
style property"focus-line-pattern" gchar* : Read
Dash pattern used to draw the focus indicator.
Default value: "\001\001"
"focus-line-width"
style property"focus-line-width" gint : Read
Width, in pixels, of the focus indicator line.
Allowed values: >= 0
Default value: 1
"focus-padding"
style property"focus-padding" gint : Read
Width, in pixels, between focus indicator and the widget 'box'.
Allowed values: >= 0
Default value: 1
"interior-focus"
style property"interior-focus" gboolean : Read
Whether to draw the focus indicator inside widgets.
Default value: TRUE
"link-color"
style property"link-color" GdkColor* : Read
The "link-color" style property defines the color of unvisited links.
Since 2.10
"scroll-arrow-hlength"
style property"scroll-arrow-hlength" gint : Read
The "scroll-arrow-hlength" style property defines the length of horizontal scroll arrows.
Allowed values: >= 1
Default value: 16
Since 2.10
"scroll-arrow-vlength"
style property"scroll-arrow-vlength" gint : Read
The "scroll-arrow-vlength" style property defines the length of vertical scroll arrows.
Allowed values: >= 1
Default value: 16
Since 2.10
"secondary-cursor-color"
style property"secondary-cursor-color" GdkColor* : Read
Color with which to draw the secondary insertion cursor when editing mixed right-to-left and left-to-right text.
"separator-height"
style property"separator-height" gint : Read
The "separator-height" style property defines the height of separators.
This property only takes effect if "wide-separators" is TRUE
.
Allowed values: >= 0
Default value: 0
Since 2.10
"separator-width"
style property"separator-width" gint : Read
The "separator-width" style property defines the width of separators.
This property only takes effect if "wide-separators" is TRUE
.
Allowed values: >= 0
Default value: 0
Since 2.10
"visited-link-color"
style property"visited-link-color" GdkColor* : Read
The "visited-link-color" style property defines the color of visited links.
Since 2.10
"wide-separators"
style property"wide-separators" gboolean : Read
The "wide-separators" style property defines whether separators have configurable width and should be drawn using a box instead of a line.
Default value: FALSE
Since 2.10
"accel-closures-changed"
signalvoid user_function (GtkWidget *widget, gpointer user_data)
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"button-press-event"
signalgboolean user_function (GtkWidget *widget,
GdkEvent *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. [type Gdk.EventButton] |
|
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,
GdkEvent *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. [type Gdk.EventButton] |
|
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) : 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,
GdkEvent *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. [type Gdk.EventClient] |
|
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) : 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,
GdkEvent *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. [type Gdk.EventConfigure] |
|
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.
"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.
"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()
.
Note that some widgets set up a drag icon in the default handler of
this signal, so you may have to use g_signal_connect_after()
to
override what the default handler did.
|
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
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()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
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,
GdkEvent *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. [type Gdk.EventCrossing] |
|
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,
GdkEvent *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.
Note that the ::expose-event signal has been replaced by a ::draw signal in GTK+ 3. The GTK+ 3 migration guide for hints on how to port from ::expose-event to ::draw.
|
the object which received the signal. |
|
the GdkEventExpose which triggered this signal. [type Gdk.EventExpose] |
|
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 direction,
gpointer user_data) : Run Last
"focus-in-event"
signalgboolean user_function (GtkWidget *widget,
GdkEvent *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. [type Gdk.EventFocus] |
|
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,
GdkEvent *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. [type Gdk.EventFocus] |
|
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) : 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.
"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. [allow-none]
|
|
user data set when the signal handler was connected. |
"key-press-event"
signalgboolean user_function (GtkWidget *widget,
GdkEvent *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. [type Gdk.EventKey] |
|
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,
GdkEvent *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. [type Gdk.EventKey] |
|
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,
GdkEvent *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. [type Gdk.EventCrossing] |
|
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. [type Gdk.EventAny] |
|
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. |
"motion-notify-event"
signalgboolean user_function (GtkWidget *widget,
GdkEvent *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. [type Gdk.EventMotion] |
|
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 direction,
gpointer user_data) : Action
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"no-expose-event"
signalgboolean user_function (GtkWidget *widget,
GdkEvent *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. [type Gdk.EventNoExpose] |
|
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,
GtkWidget *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. [allow-none]
|
|
user data set when the signal handler was connected. |
"popup-menu"
signalgboolean user_function (GtkWidget *widget,
gpointer user_data) : 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,
GdkEvent *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. [type Gdk.EventProperty] |
|
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,
GdkEvent *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. [type Gdk.EventProximity] |
|
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,
GdkEvent *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. [type Gdk.EventProximity] |
|
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 "has-tooltip" is TRUE
and 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. [allow-none]
|
|
user data set when the signal handler was connected. |
"scroll-event"
signalgboolean user_function (GtkWidget *widget,
GdkEvent *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. [type Gdk.EventScroll] |
|
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,
GdkEvent *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. [type Gdk.EventSelection] |
|
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,
GdkEvent *event,
gpointer user_data) : Run Last
"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,
GdkEvent *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. [type Gdk.EventSelection] |
|
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 help_type,
gpointer user_data) : Action
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"size-allocate"
signalvoid user_function (GtkWidget *widget,
GdkRectangle *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 ::state-changed signal is emitted when the widget state changes.
See gtk_widget_get_state()
.
|
the object which received the signal. |
|
the previous state |
|
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. [allow-none]
|
|
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. [type Gdk.EventAny] |
|
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,
GdkEvent *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. [type Gdk.EventVisibility] |
|
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,
GdkEvent *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. [type Gdk.EventWindowState] |
|
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. |