11.146Class GtkWidget

Base class for all widgets

Class GtkWidget

GtkWidget is the base class all widgets in GTK+ derive from. It manages the widget lifecycle, states and style.

[...]

Methods
activateFor widgets that can be "activated" (buttons, menu items, etc.) this function activates them.
add_acceleratorInstalls an accelerator for this widget in accel_group that causes accel_signal to be emitted if the accelerator is activated.
add_eventsAdds the events in the bitfield events to the event mask for widget.
can_activate_accelDetermines whether an accelerator that activates the signal identified by signal_id can currently be activated.
class_pathSame 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().
destroyDestroys a widget.
ensure_styleEnsures that widget has a style (widget->style).
eventThis function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so).
get_ancestorGets the first ancestor of widget with type widget_type.
get_child_requisitionThis function is only for use in widget implementations.
get_colormapGets the colormap that will be used to render widget.
get_composite_nameObtains the composite name of a widget.
get_default_colormapObtains the default colormap used to create widgets.
get_default_directionObtains the current default reading direction.
get_default_visualObtains the visual of the default colormap.
get_directionGets the reading direction for a particular widget.
get_eventsReturns the event mask for the widget.
get_extension_eventsRetrieves the extension events the widget will receive.
get_nameGet the name of the widget.
get_parent_windowGets widget's parent window.
get_pointerObtains the location of the mouse pointer in widget coordinates.
get_size_requestGet the size requested for the widget
get_toplevelThis function returns the topmost widget in the container hierarchy widget is a part of.
get_visualGets the visual that will be used to render widget.
grab_defaultCauses widget to become the default widget.
grab_focusCauses widget to have the keyboard focus for the GtkWindow it's inside.
hideReverses the effects of show(), causing the widget to be hidden (invisible to the user).
hide_allRecursively hides a widget and any child widgets.
hide_on_deleteUtility function.
input_shape_combine_maskSets an input shape for this widget's GDK window.
intersectComputes the intersection of a widget's area and area given as parameter.
is_ancestorDetermines whether widget is somewhere inside ancestor, possibly with intermediate containers.
is_focusDetermines if the widget is the focus widget within its toplevel.
mapThis function is only for use in widget implementations.
modify_baseSets the base color for a widget in a particular state.
modify_bgSets the background color for a widget in a particular state.
modify_fgSets the foreground color for a widget in a particular state.
modify_textSets the text color for a widget in a particular state.
pathObtains the full path to widget.
pop_colormapRemoves a colormap pushed with gtk_widget_push_colormap().
push_colormapPushes cmap onto a global stack of colormaps; the topmost colormap on the stack will be used to create all widgets.
queue_drawEquivalent to calling widget.queue_draw_area() for the entire area of a widget.
queue_resizeThis function is only for use in widget implementations.
queue_resize_no_redrawThis function works like gtk_widget_queue_resize(), except that the widget is not invalidated.
realizeCreates the GDK (windowing system) resources associated with a widget.
reparentMoves a widget from one container to another.
reset_rc_stylesReset 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.
set_colormapSets the colormap for the widget to the given value.
set_default_colormapSets the default colormap to use when creating widgets.
set_default_directionSets the default reading direction for widgets where the direction has not been explicitly set by gtk_widget_set_direction().
set_directionSets the reading direction on a particular widget.
set_eventsSets the event mask (see GdkEventMask) for a widget.
set_extension_eventsSets the extension events mask to mode.
set_nameAttribute a name to the widget.
set_parentThis function is useful only when implementing subclasses of GtkContainer.
set_parent_windowSets a non default parent window for widget.
set_sensitiveSets the sensitivity of a widget.
set_size_requestSets the minimum size of a widget
set_stateThis function is for use in widget implementations.
shape_combine_maskSets a shape for this widget's GDK window.
showFlags a widget to be displayed.
show_allRecursively shows a widget, and any child widgets (if the widget is a container).
show_nowShows a widget.
signal_accel_closures_changedConnect a VMSlot to the widget accel_closures_changed signal and return it
signal_button_press_eventConnect a VMSlot to the widget button_press_event signal and return it
signal_button_release_eventConnect a VMSlot to the widget button_release_event signal and return it
signal_can_activate_accelConnect a VMSlot to the widget can_activate_accel signal and return it
signal_child_notifyConnect a VMSlot to the widget child_notify signal and return it
signal_composited_changedConnect a VMSlot to the widget composited_changed signal and return it
signal_delete_eventConnect a VMSlot to the widget delete_event signal and return it
signal_destroy_eventConnect a VMSlot to the widget destroy signal and return it
signal_direction_changedThe ::direction-changed signal is emitted when the text direction of a widget changes.
signal_drag_beginThe ::drag-begin signal is emitted on the drag source when a drag is started.
signal_drag_data_deleteThe ::drag-data-delete signal is emitted on the drag source when a drag with the action GDK_ACTION_MOVE is successfully completed.
signal_drag_dropThe ::drag-drop signal is emitted on the drop site when the user drops the data onto the widget.
signal_hideConnect a VMSlot to the widget hide signal and return it
signal_showConnect a VMSlot to the widget show signal and return it
signal_size_requestConnect a VMSlot to the widget size-request signal and return it
size_requestGet the size requisition of the widget.
translate_coordinatesTranslate coordinates relative to src_widget's allocation to coordinates relative to dest_widget's allocations.
unmapThis function is only for use in widget implementations.
unparentThis function is only for use in widget implementations.
unrealizeThis function is only useful in widget implementations.

Methods

activate

For widgets that can be "activated" (buttons, menu items, etc.) this function activates them.

GtkWidget.activate()
ReturnTRUE if the widget was activatable

Activation is what happens when you press Enter on a widget during key navigation. If widget isn't activatable, the function returns FALSE.

add_accelerator

Installs an accelerator for this widget in accel_group that causes accel_signal to be emitted if the accelerator is activated.

GtkWidget.add_accelerator( accel_signal, accel_group, accel_key, accel_mods, accel_flags )
accel_signal widget signal to emit on accelerator activation
accel_group accel group for this widget, added to its toplevel (GtkAccelGroup).
accel_key GDK keyval of the accelerator.
accel_mods modifier key combination of the accelerator (GdkModifierType).
accel_flags flag accelerators, e.g. GTK_ACCEL_VISIBLE (GtkAccelFlags).

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.

add_events

Adds the events in the bitfield events to the event mask for widget.

GtkWidget.add_events( events )
events an event mask, see GdkEventMask

can_activate_accel

Determines whether an accelerator that activates the signal identified by signal_id can currently be activated.

GtkWidget.can_activate_accel( signal_id )
signal_id the ID of a signal installed on widget
ReturnTRUE if the accelerator can 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.

class_path

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().

GtkWidget.class_path( reverse )
reverse TRUE to get the path in reverse order
Returnthe class path

destroy

Destroys a widget.

GtkWidget.destroy()

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.

ensure_style

Ensures that widget has a style (widget->style).

GtkWidget.ensure_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.

event

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).

GtkWidget.event( event )
event a GdkEvent
Returnreturn from the event signal emission (TRUE if the event was handled)

Rarely-used function.

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.

get_ancestor

Gets the first ancestor of widget with type widget_type.

GtkWidget.get_ancestor( widget_type )
widget_type ancestor type (GType)
Returnthe ancestor widget, or NULL if not found.

For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets the first GtkBox that's an ancestor of widget. 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.

get_child_requisition

This function is only for use in widget implementations.

GtkWidget.get_child_requisition()

Warning: gtk_widget_get_child_requisition has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_extended_layout_get_desired_size() instead.

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().

get_colormap

Gets the colormap that will be used to render widget.

GtkWidget.get_colormap()
Returnthe colormap used by widget (GdkColormap).

get_composite_name

Obtains the composite name of a widget.

GtkWidget.get_composite_name()
Returnthe composite name of widget, or NULL if widget is not a composite child.

get_default_colormap

Obtains the default colormap used to create widgets.

GtkWidget.get_default_colormap()
Returndefault widget colormap.

get_default_direction

Obtains the current default reading direction.

GtkWidget.get_default_direction()
Returnthe current default direction (GtkTextDirection).

get_default_visual

Obtains the visual of the default colormap.

GtkWidget.get_default_visual()
Returnvisual of the default colormap.

Not really useful; used to be useful before gdk_colormap_get_visual() existed.

get_direction

Gets the reading direction for a particular widget.

GtkWidget.get_direction()
Returnthe reading direction for the widget (GtkTextDirection).

get_events

Returns the event mask for the widget.

GtkWidget.get_events()
Returnevent mask for widget (GdkEventMask)

(A bitfield containing flags from the GdkEventMask enumeration.) These are the events that the widget will receive.

get_extension_events

Retrieves the extension events the widget will receive.

GtkWidget.get_extension_events()
Returnextension events for widget (GdkExtensionMode).

See gdk_input_set_extension_events().

get_name

Get the name of the widget.

GtkWidget.get_name()
Returnname of the widget.

See GtkWidget.set_name() for the significance of widget names.

get_parent_window

Gets widget's parent window.

GtkWidget.get_parent_window()
Returnthe parent window of widget (GdkWindow).

get_pointer

Obtains the location of the mouse pointer in widget coordinates.

GtkWidget.get_pointer()
ReturnAn array [ x coordinate, y coordinate ]

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.

get_size_request

Get the size requested for the widget

GtkWidget.get_size_request()
Return[ width, 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.

get_toplevel

This function returns the topmost widget in the container hierarchy widget is a part of.

GtkWidget.get_toplevel()
Returnthe topmost ancestor of widget, or widget itself if there's no ancestor.

If widget has no parent widgets, it will be returned as the topmost widget.

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.

get_visual

Gets the visual that will be used to render widget.

GtkWidget.get_visual()
Returnthe GdkVisual for widget.

grab_default

Causes widget to become the default widget.

GtkWidget.grab_default()

The widget must have the GTK_CAN_DEFAULT flag set; typically you have to set this flag yourself by calling gtk_widget_set_can_default (widget, TRUE). The default widget is activated when the user presses Enter in a window. Default widgets must be activatable, that is, gtk_widget_activate() should affect them.

grab_focus

Causes widget to have the keyboard focus for the GtkWindow it's inside.

GtkWidget.grab_focus()

The 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.

hide

Reverses the effects of show(), causing the widget to be hidden (invisible to the user).

GtkWidget.hide()

hide_all

Recursively hides a widget and any child widgets.

GtkWidget.hide_all()

hide_on_delete

Utility function.

GtkWidget.hide_on_delete()
Returnalways true

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.

input_shape_combine_mask

Sets an input shape for this widget's GDK window.

GtkWidget.input_shape_combine_mask( shape_mask, offset_x, offset_y )
shape_mask shape to be added, or NULL to remove an existing shape (GdkBitmap).
offset_x X position of shape mask with respect to window
offset_y Y position of shape mask with respect to window

This allows for windows which react to mouse click in a nonrectangular region, see gdk_window_input_shape_combine_mask() for more information.

intersect

Computes the intersection of a widget's area and area given as parameter.

GtkWidget.intersect( area )
area a GdkRectangle
Returna GdkRectangle intersection of the widget and area, or nil if there was no intersection

is_ancestor

Determines whether widget is somewhere inside ancestor, possibly with intermediate containers.

GtkWidget.is_ancestor( ancestor )
ancestor another GtkWidget
ReturnTRUE if ancestor contains widget as a child, grandchild, great grandchild, etc.

is_focus

Determines if the widget is the focus widget within its toplevel.

GtkWidget.is_focus()
ReturnTRUE if the widget is the focus widget.

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.

map

This function is only for use in widget implementations.

GtkWidget.map()

Causes a widget to be mapped if it isn't already.

modify_base

Sets the base color for a widget in a particular state.

GtkWidget.modify_base( state, the )
state the state for which to set the base color (GtkStateType).
the color to assign, or NULL to undo the effect of previous calls to of gtk_widget_modify_base().

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.

modify_bg

Sets the background color for a widget in a particular state.

GtkWidget.modify_bg( state, color )
state the state for which to set the background color (GtkStateType).
color the color to assign, or NULL to undo the effect of previous calls to of gtk_widget_modify_bg().

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.

modify_fg

Sets the foreground color for a widget in a particular state.

GtkWidget.modify_fg( state, color )
state the state for which to set the foreground color (GtkStateType).
color the color to assign, or NULL to undo the effect of previous calls to of gtk_widget_modify_fg()

All other style values are left untouched. See also gtk_widget_modify_style().

modify_text

Sets the text color for a widget in a particular state.

GtkWidget.modify_text( state, color )
state the state for which to set the text color (GtkStateType).
color the color to assign, or NULL to undo the effect of previous calls to of gtk_widget_modify_text().

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().

path

Obtains the full path to widget.

GtkWidget.path( reverse )
reverse TRUE to get the path in reverse order
Returnthe path

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.

Setting reverse to TRUE returns the path in reverse order, i.e. starting with widget's name instead of starting with the name of widget's outermost ancestor.

pop_colormap

Removes a colormap pushed with gtk_widget_push_colormap().

GtkWidget.pop_colormap()

push_colormap

Pushes cmap onto a global stack of colormaps; the topmost colormap on the stack will be used to create all widgets.

GtkWidget.push_colormap( cmap )
cmap a GdkColormap

Remove cmap with gtk_widget_pop_colormap(). There's little reason to use this function.

queue_draw

Equivalent to calling widget.queue_draw_area() for the entire area of a widget.

GtkWidget.queue_draw()

queue_resize

This function is only for use in widget implementations.

GtkWidget.queue_resize()

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.

queue_resize_no_redraw

This function works like gtk_widget_queue_resize(), except that the widget is not invalidated.

GtkWidget.queue_resize_no_redraw()

realize

Creates the GDK (windowing system) resources associated with a widget.

GtkWidget.realize()

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.

reparent

Moves a widget from one container to another.

GtkWidget.reparent( new_parent )
new_parent a GtkContainer to move the widget into

reset_rc_styles

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.

GtkWidget.reset_rc_styles()

This function is not useful for applications.

set_colormap

Sets the colormap for the widget to the given value.

GtkWidget.set_colormap( colormap )
colormap a GdkColormap

Widget must not have been previously realized. This probably should only be used from an init() function (i.e. from the constructor for the widget).

set_default_colormap

Sets the default colormap to use when creating widgets.

GtkWidget.set_default_colormap( colormap )
colormap a GdkColormap

gtk_widget_push_colormap() is a better function to use if you only want to affect a few widgets, rather than all widgets.

set_default_direction

Sets the default reading direction for widgets where the direction has not been explicitly set by gtk_widget_set_direction().

GtkWidget.set_default_direction( dir )
dir the new default direction (GtkTextDirection). This cannot be GTK_TEXT_DIR_NONE.

set_direction

Sets the reading direction on a particular widget.

GtkWidget.set_direction( dir )
dir the new direction (GtkTextDirection).

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.

set_events

Sets the event mask (see GdkEventMask) for a widget.

GtkWidget.set_events( an )
an event mask, see GdkEventMask

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 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.

set_extension_events

Sets the extension events mask to mode.

GtkWidget.set_extension_events( mode )
mode bitfield of extension events to receive (GdkExtensionMode).

See GdkExtensionMode and gdk_input_set_extension_events().

set_name

Attribute a name to the widget.

GtkWidget.set_name( name )
name name for the widget

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.

set_parent

This function is useful only when implementing subclasses of GtkContainer.

GtkWidget.set_parent( parent )
parent parent container

Sets the container as the parent of widget, and takes care of some deta ils such as updating the state and style of the child to reflect its new location. The opposite function is gtk_widget_unparent().

set_parent_window

Sets a non default parent window for widget.

GtkWidget.set_parent_window( parent_window )
parent_window the new parent window (GdkWindow).

set_sensitive

Sets the sensitivity of a widget.

GtkWidget.set_sensitive( sensitive )
sensitive TRUE to make the widget sensitive

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.

set_size_request

Sets the minimum size of a widget

GtkWidget.set_size_request( width, height )
width (integer)
height (integer)

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."

set_state

This function is for use in widget implementations.

GtkWidget.set_state( state )
state new state for widget (GtkStateType)

Sets the state of a widget (insensitive, prelighted, etc.) Usually you should set the state using wrapper functions such as gtk_widget_set_sensitive().

shape_combine_mask

Sets a shape for this widget's GDK window.

GtkWidget.shape_combine_mask( shape_mask, offset_x, offset_y )
shape_mask shape to be added, or NULL to remove an existing shape (GdkBitmap).
offset_x X position of shape mask with respect to window
offset_y Y position of shape mask with respect to window

This allows for transparent windows etc., see gdk_window_shape_combine_mask() for more information.

show

Flags a widget to be displayed.

GtkWidget.show()

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.

show_all

Recursively shows a widget, and any child widgets (if the widget is a container).

GtkWidget.show_all()

show_now

Shows a widget.

GtkWidget.show_now()

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.

signal_accel_closures_changed

Connect a VMSlot to the widget accel_closures_changed signal and return it

GtkWidget.signal_accel_closures_changed()

signal_button_press_event

Connect a VMSlot to the widget button_press_event signal and return it

GtkWidget.signal_button_press_event()

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.

Your callback function gets a GdkEventButton as parameter, and must return a boolean, true to stop other handlers from being invoked for the event, false to propagate the event further.

signal_button_release_event

Connect a VMSlot to the widget button_release_event signal and return it

GtkWidget.signal_button_release_event()

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.

signal_can_activate_accel

Connect a VMSlot to the widget can_activate_accel signal and return it

GtkWidget.signal_can_activate_accel()

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 callback function must return a boolean (returning true if the signal can be activated). It will get an integer as parameter, that is the ID of a signal installed on widget.

signal_child_notify

Connect a VMSlot to the widget child_notify signal and return it

GtkWidget.signal_child_notify()

The child-notify signal is emitted for each child property that has changed on an object. The signal's detail holds the property name.

signal_composited_changed

Connect a VMSlot to the widget composited_changed signal and return it

GtkWidget.signal_composited_changed()

The composited-changed signal is emitted when the composited status of widgets screen changes.

signal_delete_event

Connect a VMSlot to the widget delete_event signal and return it

GtkWidget.signal_delete_event()

The callback function must return a boolean, that if is true, will block the event.

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.

signal_destroy_event

Connect a VMSlot to the widget destroy signal and return it

GtkWidget.signal_destroy_event()

The callback function must return a boolean, true to stop other handlers from being invoked for the event, false to propagate the event further.

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.

signal_direction_changed

The ::direction-changed signal is emitted when the text direction of a widget changes.

GtkWidget.signal_direction_changed()

signal_drag_begin

The ::drag-begin signal is emitted on the drag source when a drag is started.

GtkWidget.signal_drag_begin()

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.

signal_drag_data_delete

The ::drag-data-delete signal is emitted on the drag source when a drag with the action GDK_ACTION_MOVE is successfully completed.

GtkWidget.signal_drag_data_delete()

The signal handler is responsible for deleting the data that has been dropped. What "delete" means depends on the context of the drag operation.

signal_drag_drop

The ::drag-drop signal is emitted on the drop site when the user drops the data onto the widget.

GtkWidget.signal_drag_drop()

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.

signal_hide

Connect a VMSlot to the widget hide signal and return it

GtkWidget.signal_hide()

signal_show

Connect a VMSlot to the widget show signal and return it

GtkWidget.signal_show()

signal_size_request

Connect a VMSlot to the widget size-request signal and return it

GtkWidget.signal_size_request()

size_request

Get the size requisition of the widget.

GtkWidget.size_request()
ReturnGtkRequisition object

Warning: gtk_widget_size_request has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_extended_layout_get_desired_size() instead.

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.

translate_coordinates

Translate coordinates relative to src_widget's allocation to coordinates relative to dest_widget's allocations.

GtkWidget.translate_coordinates( dest_widget, src_x, src_y )
dest_widget a GtkWidget
src_x X position relative to src_widget
src_y Y position relative to src_widget
ReturnAn array [ X position, Y position ] relative to dest_widget, or nil if either widget was not realized, or there was no common ancestor.

In order to perform this operation, both widgets must be realized, and must share a common toplevel.

unmap

This function is only for use in widget implementations.

GtkWidget.unmap()

Causes a widget to be unmapped if it's currently mapped.

unparent

This function is only for use in widget implementations.

GtkWidget.unparent()

Should be called by implementations of the remove method on GtkContainer, to dissociate a child from the container.

unrealize

This function is only useful in widget implementations.

GtkWidget.unrealize()

Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as widget->window).

Made with http://www.falconpl.org