W Wrapl, The Programming Language

Libraries:Gtk:Gtk:Widget

Types

T

Inherits from:

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 ClassInstallStyleProperty to install style properties for a widget class, ClassFindStyleProperty or ClassListStyleProperties to get information about existing style properties and StyleGetProperty, StyleGet or StyleGetValist to obtain the value of a style property.


GtkWidget as GtkBuildable

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>




Constants

Nil : T

Functions

ClassFindStyleProperty(klass @ Std.Object.T, property_name @ Std.String.T) : Gtk.GObject.GParamSpec.T

Finds a style property of a widget class by name.

klass a GtkWidgetClass
property_name 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]


ClassInstallStyleProperty(klass @ Std.Object.T, pspec @ Gtk.GObject.GParamSpec.T) : Std.Object.T

Installs a style property on a widget class. The parser for the style property is determined by the value type of pspec.

klass a GtkWidgetClass
pspec the GParamSpec for the property


ClassInstallStylePropertyParser(klass @ Std.Object.T, pspec @ Gtk.GObject.GParamSpec.T, parser @ Std.Function.T) : Std.Object.T

Installs a style property on a widget class.

klass a GtkWidgetClass
pspec the GParamSpec for the style property
parser the parser for the style property


ClassListStyleProperties(klass @ Std.Object.T, n_properties @ Std.Object.T) : Std.Object.T

Returns all style properties of a widget class.

klass a GtkWidgetClass
n_properties 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]


GetDefaultColormap() : Gtk.Gdk.Colormap.T

Obtains the default colormap used to create widgets.

Returns default widget colormap. [transfer none]


GetDefaultDirection() : Gtk.Gtk.TextDirection.T

Obtains the current default reading direction. See SetDefaultDirection.

Returns the current default direction.


GetDefaultStyle() : Gtk.Gtk.Style.T

Returns the default style used by all widgets initially.

Returns the default style. This Gtk.Gtk.Style.T object is owned by GTK+ and should not be modified or freed. [transfer none]


GetDefaultVisual() : Gtk.Gdk.Visual.T

Obtains the visual of the default colormap. Not really useful; used to be useful before Gtk.Gdk.Colormap.GetVisual existed.

Returns visual of the default colormap. [transfer none]


GetType() : Gtk.GObject.Type.T



New(type @ Gtk.GObject.Type.T, first_property_name @ Std.String.T, ... @ Std.Object.T) : Gtk.Gtk.Widget.T

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 type ID of the widget to create
first_property_name name of first property to set
Returns a new T of type widget_type


PopColormap() : Std.Object.T

Removes a colormap pushed with PushColormap.



PopCompositeChild() : Std.Object.T

Cancels the effect of a previous call to PushCompositeChild.



PushColormap(cmap @ Gtk.Gdk.Colormap.T) : Std.Object.T

Pushes cmap onto a global stack of colormaps; the topmost colormap on the stack will be used to create all widgets. Remove cmap with PopColormap. There's little reason to use this function.



PushCompositeChild() : Std.Object.T

Makes all newly-created widgets as composite children until the corresponding PopCompositeChild 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.Gtk.Container.Foreach vs. Gtk.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);


SetDefaultColormap(colormap @ Gtk.Gdk.Colormap.T) : Std.Object.T

Sets the default colormap to use when creating widgets. PushColormap is a better function to use if you only want to affect a few widgets, rather than all widgets.

colormap a Gtk.Gdk.Colormap.T


SetDefaultDirection(dir @ Gtk.Gtk.TextDirection.T) : Std.Object.T

Sets the default reading direction for widgets where the direction has not been explicitly set by SetDirection.

dir the new default direction. This cannot be Gtk.Gtk.TextDirection.None.


Methods

:Activate(self @ T) : Std.Symbol.T

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.

widget a T that's activatable
Returns TRUE if the widget was activatable


:AddAccelerator(self @ T, accel_signal @ Std.String.T, accel_group @ Gtk.Gtk.AccelGroup.T, accel_key @ Std.Integer.SmallT, accel_mods @ Std.Integer.SmallT, accel_flags @ Std.Integer.SmallT) : Std.Object.T

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.Gtk.Window.AddAccelGroup, 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.Gtk.AccelMap.AddEntry and SetAccelPath or Gtk.Gtk.MenuItem.SetAccelPath instead.

widget widget to install an accelerator on
accel_signal widget signal to emit on accelerator activation
accel_group accel group for this widget, added to its toplevel
accel_key GDK keyval of the accelerator
accel_mods modifier key combination of the accelerator
accel_flags flag accelerators, e.g. Gtk.Gtk.AccelFlags.Visible


:AddEvents(self @ T, events @ Std.Integer.SmallT) : Std.Object.T

Adds the events in the bitfield events to the event mask for widget. See SetEvents for details.

widget a T
events an event mask, see Gtk.Gdk.EventMask.T


:AddMnemonicLabel(self @ T, label @ Gtk.Gtk.Widget.T) : Std.Object.T

Adds a widget to the list of mnemonic labels for this widget. (See ListMnemonicLabels). 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.

widget a T
label a T that acts as a mnemonic label for widget


:CanActivateAccel(self @ T, signal_id @ Std.Integer.SmallT) : Std.Symbol.T

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.

widget a T
signal_id the ID of a signal installed on widget
Returns TRUE if the accelerator can be activated.


:ChildFocus(self @ T, direction @ Gtk.Gtk.DirectionType.T) : Std.Symbol.T

This function is used by custom widget implementations; if you're writing an app, you'd use GrabFocus to move the focus to a particular widget, and Gtk.Gtk.Container.SetFocusChain to change the focus tab order. So you may want to investigate those functions instead.

ChildFocus 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). ChildFocus 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 GrabFocus 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(). ChildFocus returns FALSE if the widget is not currently in a focusable state, so there's no need for those checks.

widget a T
direction direction of focus movement
Returns TRUE if focus ended up inside widget


:ChildNotify(self @ T, child_property @ Std.String.T) : Std.Object.T

Emits a "child-notify" signal for the child property child_property on widget.

This is the analogue of g_object_notify() for child properties.

widget a T
child_property the name of a child property installed on the class of widget's parent


:ClassPath(self @ T, path_length @ Std.Object.T, path @ Agg.List.T, path_reversed @ Agg.List.T) : Std.Object.T

Same as Path, but always uses the name of a widget's type, never uses a custom name set with SetName.

widget a T
path_length location to store the length of the class path, or NULL. [out][allow-none]
path location to store the class path as an allocated string, or NULL. [out][allow-none]
path_reversed location to store the reverse class path as an allocated string, or NULL. [out][allow-none]


:CreatePangoContext(self @ T) : Gtk.Pango.Context.T

Creates a new PangoContext with the appropriate font map, font description, and base direction for drawing text for this widget. See also GetPangoContext.

widget a T
Returns the new PangoContext. [transfer full]


:CreatePangoLayout(self @ T, text @ Std.String.T) : Gtk.Pango.Layout.T

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.

widget a T
text text to set on the layout (can be NULL)
Returns the new PangoLayout. [transfer full]


:Destroy(self @ T) : Std.Object.T

Destroys a widget. Equivalent to Gtk.Gtk.Object.Destroy, except that you don't have to cast the widget to Gtk.Gtk.Object.T. 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 Gtk.Gtk.Window.T), 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.

widget a T


:Destroyed(self @ T, widget_pointer @ Std.Object.T) : Std.Object.T

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

widget a T
widget_pointer address of a variable that contains widget. [inout][transfer none]


:Draw(self @ T, area @ Gtk.Gdk.Rectangle.T) : Std.Object.T

Warning

Draw is deprecated and should not be used in newly-written code.



:EnsureStyle(self @ T) : Std.Object.T

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.

widget a T


:ErrorBell(self @ T) : Std.Object.T

Notifies the user about an input-related error on this widget. If the "gtk-error-bell" setting is TRUE, it calls Gtk.Gdk.Window.Beep, otherwise it does nothing.

Note that the effect of Gtk.Gdk.Window.Beep can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.

widget a T


:Event(self @ T, event @ Gtk.Gdk.Event.T) : Std.Symbol.T

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.Gtk.Main.DoEvent so the event will behave as if it were in the event queue. Don't synthesize expose events; instead, use Gtk.Gdk.Window.InvalidateRect to invalidate a region of the window.

widget a T
event a GdkEvent
Returns return from the event signal emission (TRUE if the event was handled)


:FreezeChildNotify(self @ T) : Std.Object.T

Stops emission of "child-notify" signals on widget. The signals are queued until ThawChildNotify is called on widget.

This is the analogue of g_object_freeze_notify() for child properties.

widget a T


:GetAccessible(self @ T) : Gtk.Atk.Object.T

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.

widget a T
Returns the AtkObject associated with widget. [transfer none]


:GetAction(self @ T) : Gtk.Gtk.Action.T

Warning

GetAction has been deprecated since version 2.16 and should not be used in newly-written code. Use Gtk.Gtk.Activatable.GetRelatedAction instead.



:GetAllocation(self @ T, allocation @ Gtk.Gdk.Rectangle.T) : Std.Object.T

Retrieves the widget's allocation.

widget a T
allocation a pointer to a GtkAllocation to copy to. [out]


:GetAncestor(self @ T, widget_type @ Gtk.GObject.Type.T) : Gtk.Gtk.Widget.T

Gets the first ancestor of widget with type widget_type. For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets the first Gtk.Gtk.Box.T 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 Gtk.Gtk.Window.T in the docs for GetToplevel.

Note that unlike IsAncestor, GetAncestor considers widget to be an ancestor of itself.

widget a T
widget_type ancestor type
Returns the ancestor widget, or NULL if not found. [transfer none]


:GetAppPaintable(self @ T) : Std.Symbol.T

Determines whether the application intends to draw on the widget in an "expose-event" handler.

See SetAppPaintable

widget a T
Returns TRUE if the widget is app paintable


:GetCanDefault(self @ T) : Std.Symbol.T

Determines whether widget can be a default widget. See SetCanDefault.

widget a T
Returns TRUE if widget can be a default widget, FALSE otherwise


:GetCanFocus(self @ T) : Std.Symbol.T

Determines whether widget can own the input focus. See SetCanFocus.

widget a T
Returns TRUE if widget can own the input focus, FALSE otherwise


:GetChildRequisition(self @ T, requisition @ Gtk.Gtk.Requisition.T) : Std.Object.T

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 SetSizeRequest), in which case it returns that geometry instead of the widget's requisition.

This function differs from SizeRequest in that it retrieves the last size request value from widget->requisition, while SizeRequest 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, SizeRequest has been called since the last time a resize was queued. In general, only container implementations have this information; applications should use SizeRequest.

widget a T
requisition a Gtk.Gtk.Requisition.T to be filled in


:GetChildVisible(self @ T) : Std.Symbol.T

Gets the value set with SetChildVisible. 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.

widget a T
Returns TRUE if the widget is mapped with the parent.


:GetClipboard(self @ T, selection @ Gtk.Gdk.Atom.T) : Gtk.Gtk.Clipboard.T

Returns the clipboard object for the given selection to be used with widget. widget must have a Gtk.Gdk.Display.T associated with it, so must be attached to a toplevel window.

widget a T
selection a Gtk.Gdk.Atom.T 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]


:GetColormap(self @ T) : Gtk.Gdk.Colormap.T

Gets the colormap that will be used to render widget. No reference will be added to the returned colormap; it should not be unreferenced.

widget a T
Returns the colormap used by widget. [transfer none]


:GetCompositeName(self @ T) : Std.String.T

Obtains the composite name of a widget.

widget a T
Returns the composite name of widget, or NULL if widget is not a composite child. The string should be freed when it is no longer needed.


:GetDirection(self @ T) : Gtk.Gtk.TextDirection.T

Gets the reading direction for a particular widget. See SetDirection.

widget a T
Returns the reading direction for the widget.


:GetDisplay(self @ T) : Gtk.Gdk.Display.T

Get the Gtk.Gdk.Display.T 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 Gtk.Gtk.Window.T 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.

widget a T
Returns the Gtk.Gdk.Display.T for the toplevel for this widget. [transfer none]


:GetDoubleBuffered(self @ T) : Std.Symbol.T

Determines whether the widget is double buffered.

See SetDoubleBuffered

widget a T
Returns TRUE if the widget is double buffered


:GetEvents(self @ T) : Std.Integer.SmallT

Returns the event mask for the widget (a bitfield containing flags from the Gtk.Gdk.EventMask.T enumeration). These are the events that the widget will receive.

widget a T
Returns event mask for widget


:GetExtensionEvents(self @ T) : Gtk.Gdk.ExtensionMode.T

Retrieves the extension events the widget will receive; see Gtk.Gdk.Input.SetExtensionEvents.

widget a T
Returns extension events for widget


:GetHasTooltip(self @ T) : Std.Symbol.T

Returns the current value of the has-tooltip property. See GtkWidget:has-tooltip for more information.

widget a T
Returns current value of has-tooltip on widget.


:GetHasWindow(self @ T) : Std.Symbol.T

Determines whether widget has a Gtk.Gdk.Window.T of its own. See SetHasWindow.

widget a T
Returns TRUE if widget has a window, FALSE otherwise


:GetMapped(self @ T) : Std.Symbol.T

Whether the widget is mapped.

widget a T
Returns TRUE if the widget is mapped, FALSE otherwise.


:GetModifierStyle(self @ T) : Gtk.Gtk.RcStyle.T

Returns the current modifier style for the widget. (As set by ModifyStyle.) If no style has previously set, a new Gtk.Gtk.RcStyle.T 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 ModifyStyle, passing in the returned rc style, to make sure that your changes take effect.

Caution: passing the style back to ModifyStyle will normally end up destroying it, because ModifyStyle 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.

widget a T
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]


:GetName(self @ T) : Std.String.T

Retrieves the name of a widget. See SetName for the significance of widget names.

widget a T
Returns name of the widget. This string is owned by GTK+ and should not be modified or freed


:GetNoShowAll(self @ T) : Std.Symbol.T

Returns the current value of the GtkWidget:no-show-all property, which determines whether calls to ShowAll and HideAll will affect this widget.

widget a T
Returns the current value of the "no-show-all" property.


:GetPangoContext(self @ T) : Gtk.Pango.Context.T

Gets a PangoContext with the appropriate font map, font description, and base direction for this widget. Unlike the context returned by CreatePangoContext, 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.

widget a T
Returns the PangoContext for the widget. [transfer none]


:GetParent(self @ T) : Gtk.Gtk.Widget.T

Returns the parent container of widget.

widget a T
Returns the parent container of widget, or NULL. [transfer none]


:GetParentWindow(self @ T) : Gtk.Gdk.Window.T

Gets widget's parent window.

widget a T.
Returns the parent window of widget. [transfer none]


:GetPointer(self @ T, x, y) : Std.Object.T

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.Gtk.WidgetFlags.NoWindow widgets, and are relative to widget->allocation.x, widget->allocation.y for widgets that are Gtk.Gtk.WidgetFlags.NoWindow widgets.

widget a T
x return location for the X coordinate, or NULL. [out][allow-none]
y return location for the Y coordinate, or NULL. [out][allow-none]


:GetRealized(self @ T) : Std.Symbol.T

Determines whether widget is realized.

widget a T
Returns TRUE if widget is realized, FALSE otherwise


:GetReceivesDefault(self @ T) : Std.Symbol.T

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

widget a T
Returns TRUE if widget acts as default widget when focussed, FALSE otherwise


:GetRequisition(self @ T, requisition @ Gtk.Gtk.Requisition.T) : Std.Object.T

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 QueueResize instead of QueueDraw).

Normally, SizeRequest should be used.

widget a T
requisition a pointer to a Gtk.Gtk.Requisition.T to copy to. [out]


:GetRootWindow(self @ T) : Gtk.Gdk.Window.T

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 Gtk.Gtk.Window.T at the top.

The root window is useful for such purposes as creating a popup Gtk.Gdk.Window.T 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.

widget a T
Returns the Gtk.Gdk.Window.T root window for the toplevel for this widget. [transfer none]


:GetScreen(self @ T) : Gtk.Gdk.Screen.T

Get the Gtk.Gdk.Screen.T 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 Gtk.Gtk.Window.T 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.

widget a T
Returns the Gtk.Gdk.Screen.T for the toplevel for this widget. [transfer none]


:GetSensitive(self @ T) : Std.Symbol.T

Returns the widget's sensitivity (in the sense of returning the value that has been set using SetSensitive).

The effective sensitivity of a widget is however determined by both its own and its parent widget's sensitivity. See IsSensitive.

widget a T
Returns TRUE if the widget is sensitive


:GetSettings(self @ T) : Gtk.Gtk.Settings.T

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 T is attached to a toplevel, since the settings object is specific to a particular Gtk.Gdk.Screen.T.

widget a T
Returns the relevant Gtk.Gtk.Settings.T object. [transfer none]


:GetSizeRequest(self @ T, width @ Std.Object.T, height @ Std.Object.T) : Std.Object.T

Gets the size request that was explicitly set for the widget using SetSizeRequest. 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 SetSizeRequest. To get the size a widget will actually use, call SizeRequest instead of this function.

widget a T
width return location for width, or NULL. [out][allow-none]
height return location for height, or NULL. [out][allow-none]


:GetSnapshot(self @ T, clip_rect @ Gtk.Gdk.Rectangle.T) : Gtk.Gdk.Pixmap.T

Create a Gtk.Gdk.Pixmap.T 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 Gtk.Gdk.Pixbuf.GetFromDrawable 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.

widget a T
clip_rect a Gtk.Gdk.Rectangle.T or NULL. [allow-none]
Returns Gtk.Gdk.Pixmap.T snapshot of the widget


:GetState(self @ T) : Gtk.Gtk.StateType.T

Returns the widget's state. See SetState.

widget a T
Returns the state of widget.


:GetStyle(self @ T) : Gtk.Gtk.Style.T

Simply an accessor function that returns widget->style.

widget a T
Returns the widget's Gtk.Gtk.Style.T. [transfer none]


:GetTooltipMarkup(self @ T) : Std.String.T

Gets the contents of the tooltip for widget.

widget a T
Returns the tooltip text, or NULL. You should free the returned string with g_free() when done.


:GetTooltipText(self @ T) : Std.String.T

Gets the contents of the tooltip for widget.

widget a T
Returns the tooltip text, or NULL. You should free the returned string with g_free() when done.


:GetTooltipWindow(self @ T) : Gtk.Gtk.Window.T

Returns the Gtk.Gtk.Window.T of the current tooltip. This can be the GtkWindow created by default, or the custom tooltip window set using SetTooltipWindow.

widget a T
Returns The Gtk.Gtk.Window.T of the current tooltip. [transfer none]


:GetToplevel(self @ T) : Gtk.Gtk.Widget.T

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. GetAncestor; 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 Gtk.Gtk.Window.T. While the second case may seem unlikely, it actually happens when a Gtk.Gtk.Plug.T is embedded inside a Gtk.Gtk.Socket.T within the same application.

To reliably find the toplevel Gtk.Gtk.Window.T, use GetToplevel 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. */
  }


:GetVisible(self @ T) : Std.Symbol.T

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.

See SetVisible.

widget a T
Returns TRUE if the widget is visible


:GetVisual(self @ T) : Gtk.Gdk.Visual.T

Gets the visual that will be used to render widget.

widget a T
Returns the visual for widget. [transfer none]


:GetWindow(self @ T) : Gtk.Gdk.Window.T

Returns the widget's window if it is realized, NULL otherwise

widget a T
Returns widget's window. [transfer none]


:GrabDefault(self @ T) : Std.Object.T

Causes widget to become the default widget. widget must have the Gtk.Gtk.WidgetFlags.CanDefault 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, Activate should affect them.

widget a T


:GrabFocus(self @ T) : Std.Object.T

Causes widget to have the keyboard focus for the Gtk.Gtk.Window.T it's inside. widget must be a focusable widget, such as a Gtk.Gtk.Entry.T; something like Gtk.Gtk.Frame.T won't work.

More precisely, it must have the Gtk.Gtk.WidgetFlags.CanFocus flag set. Use SetCanFocus 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.

widget a T


:HasDefault(self @ T) : Std.Symbol.T

Determines whether widget is the current default widget within its toplevel. See SetCanDefault.

widget a T
Returns TRUE if widget is the current default widget within its toplevel, FALSE otherwise


:HasFocus(self @ T) : Std.Symbol.T

Determines if the widget has the global input focus. See IsFocus for the difference between having the global input focus, and only having the focus within a toplevel.

widget a T
Returns TRUE if the widget has the global input focus.


:HasGrab(self @ T) : Std.Symbol.T

Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).

See also Gtk.Gtk.Grab.Add.

widget a T
Returns TRUE if the widget is in the grab_widgets stack


:HasRcStyle(self @ T) : Std.Symbol.T

Determines if the widget style has been looked up through the rc mechanism.

widget a T
Returns TRUE if the widget has been looked up through the rc mechanism, FALSE otherwise.


:HasScreen(self @ T) : Std.Symbol.T

Checks whether there is a Gtk.Gdk.Screen.T 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.

widget a T
Returns TRUE if there is a Gtk.Gdk.Screen.T associcated with the widget.


:Hide(self @ T) : Std.Object.T

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

widget a T


:HideAll(self @ T) : Std.Object.T

Warning

HideAll has been deprecated since version 2.24 and should not be used in newly-written code. Use Hide instead.



:HideOnDelete(self @ T) : Std.Symbol.T

Utility function; intended to be connected to the "delete-event" signal on a Gtk.Gtk.Window.T. The function calls 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.

widget a T
Returns TRUE


:InputShapeCombineMask(self @ T, shape_mask @ Gtk.Gdk.Pixmap.T, offset_x @ Std.Integer.SmallT, offset_y @ Std.Integer.SmallT) : Std.Object.T

Sets an input shape for this widget's GDK window. This allows for windows which react to mouse click in a nonrectangular region, see Gtk.Gdk.Window.InputShapeCombineMask for more information.

widget a T
shape_mask shape to be added, or NULL to remove an existing shape. [allow-none]
offset_x X position of shape mask with respect to window
offset_y Y position of shape mask with respect to window


:Intersect(self @ T, area @ Gtk.Gdk.Rectangle.T, intersection @ Gtk.Gdk.Rectangle.T) : Std.Symbol.T

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.

widget a T
area a rectangle
intersection rectangle to store intersection of widget and area
Returns TRUE if there was an intersection


:IsAncestor(self @ T, ancestor @ Gtk.Gtk.Widget.T) : Std.Symbol.T

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

widget a T
ancestor another T
Returns TRUE if ancestor contains widget as a child, grandchild, great grandchild, etc.


:IsComposited(self @ T) : Std.Symbol.T

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 Gtk.Gdk.Window.SetComposited).

widget a T
Returns TRUE if the widget can rely on its alpha channel being drawn correctly.


:IsDrawable(self @ T) : Std.Symbol.T

Determines whether widget can be drawn to. A widget can be drawn to if it is mapped and visible.

widget a T
Returns TRUE if widget is drawable, FALSE otherwise


:IsFocus(self @ T) : Std.Symbol.T

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

widget a T
Returns TRUE if the widget is the focus widget.


:IsSensitive(self @ T) : Std.Symbol.T

Returns the widget's effective sensitivity, which means it is sensitive itself and also its parent widget is sensntive

widget a T
Returns TRUE if the widget is effectively sensitive


:IsToplevel(self @ T) : Std.Symbol.T

Determines whether widget is a toplevel widget. Currently only Gtk.Gtk.Window.T and Gtk.Gtk.Invisible.T are toplevel widgets. Toplevel widgets have no parent widget.

widget a T
Returns TRUE if widget is a toplevel, FALSE otherwise


:KeynavFailed(self @ T, direction @ Gtk.Gtk.DirectionType.T) : Std.Symbol.T

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 ChildFocus:

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 ChildFocus on the widget's toplevel.

The default ::keynav-failed handler returns TRUE for Gtk.Gtk.DirectionType.TabForward and Gtk.Gtk.DirectionType.TabBackward. For the other values of Gtk.Gtk.DirectionType.T, 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 ErrorBell 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 Gtk.Gtk.Entry.T 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.

widget a T
direction 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).


:ListAccelClosures(self @ T) : Std.Object.T

Lists the closures used by widget for accelerator group connections with Gtk.Gtk.AccelGroup.ConnectByPath or Gtk.Gtk.AccelGroup.Connect. The closures can be used to monitor accelerator changes on widget, by connecting to the GtkAccelGroup::accel-changed signal of the Gtk.Gtk.AccelGroup.T of a closure which can be found out with Gtk.Gtk.AccelGroup.FromAccelClosure.

widget widget to list accelerator closures for
Returns a newly allocated GList of closures. [transfer container][element-type GClosure]


:ListMnemonicLabels(self @ T) : Std.Object.T

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.Gtk.Label.SetMnemonicWidget).

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.

widget a T
Returns the list of mnemonic labels; free this list with g_list_free() when you are done with it. [element-type GtkWidget][transfer container]


:Map(self @ T) : Std.Object.T

This function is only for use in widget implementations. Causes a widget to be mapped if it isn't already.

widget a T


:MnemonicActivate(self @ T, group_cycling @ Std.Symbol.T) : Std.Symbol.T

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.

widget a T
group_cycling TRUE if there are other widgets with the same mnemonic
Returns TRUE if the signal has been handled


:ModifyBase(self @ T, state @ Gtk.Gtk.StateType.T, color @ Gtk.Gdk.Color.T) : Std.Object.T

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 ModifyText) for widgets such as Gtk.Gtk.Entry.T and Gtk.Gtk.TextView.T. See also ModifyStyle.

Note that "no window" widgets (which have the Gtk.Gtk.WidgetFlags.NoWindow flag set) draw on their parent container's window and thus may not draw any background themselves. This is the case for e.g. Gtk.Gtk.Label.T. 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 Gtk.Gtk.EventBox.T widget and setting the base color on that.

widget a T
state the state for which to set the base color
color the color to assign (does not need to be allocated), or NULL to undo the effect of previous calls to of ModifyBase. [allow-none]


:ModifyBg(self @ T, state @ Gtk.Gtk.StateType.T, color @ Gtk.Gdk.Color.T) : Std.Object.T

Sets the background color for a widget in a particular state. All other style values are left untouched. See also ModifyStyle.

Note that "no window" widgets (which have the Gtk.Gtk.WidgetFlags.NoWindow flag set) draw on their parent container's window and thus may not draw any background themselves. This is the case for e.g. Gtk.Gtk.Label.T. 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 Gtk.Gtk.EventBox.T widget and setting the background color on that.

widget a T
state the state for which to set the background color
color the color to assign (does not need to be allocated), or NULL to undo the effect of previous calls to of ModifyBg. [allow-none]


:ModifyCursor(self @ T, primary @ Gtk.Gdk.Color.T, secondary @ Gtk.Gdk.Color.T) : Std.Object.T

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

widget a T
primary the color to use for primary cursor (does not need to be allocated), or NULL to undo the effect of previous calls to of ModifyCursor.
secondary the color to use for secondary cursor (does not need to be allocated), or NULL to undo the effect of previous calls to of ModifyCursor.


:ModifyFg(self @ T, state @ Gtk.Gtk.StateType.T, color @ Gtk.Gdk.Color.T) : Std.Object.T

Sets the foreground color for a widget in a particular state. All other style values are left untouched. See also ModifyStyle.

widget a T
state the state for which to set the foreground color
color the color to assign (does not need to be allocated), or NULL to undo the effect of previous calls to of ModifyFg. [allow-none]


:ModifyFont(self @ T, font_desc @ Gtk.Pango.FontDescription.T) : Std.Object.T

Sets the font to use for a widget. All other style values are left untouched. See also ModifyStyle.

widget a T
font_desc the font description to use, or NULL to undo the effect of previous calls to ModifyFont. [allow-none]


:ModifyStyle(self @ T, style @ Gtk.Gtk.RcStyle.T) : Std.Object.T

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 SetStyle. The Gtk.Gtk.RcStyle.T 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 ModifyStyle or with such functions as ModifyFg. If you wish to retain previous values, you must first call GetModifierStyle, make your modifications to the returned style, then call ModifyStyle with that style. On the other hand, if you first call ModifyStyle, subsequent calls to such functions ModifyFg will have a cumulative effect with the initial modifications.

widget a T
style the Gtk.Gtk.RcStyle.T holding the style modifications


:ModifyText(self @ T, state @ Gtk.Gtk.StateType.T, color @ Gtk.Gdk.Color.T) : Std.Object.T

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 ModifyBase) for widgets such as Gtk.Gtk.Entry.T and Gtk.Gtk.TextView.T. See also ModifyStyle.

widget a T
state the state for which to set the text color
color the color to assign (does not need to be allocated), or NULL to undo the effect of previous calls to of ModifyText. [allow-none]


:Path(self @ T, path_length @ Std.Object.T, path @ Agg.List.T, path_reversed @ Agg.List.T) : Std.Object.T

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

widget a T
path_length location to store length of the path, or NULL. [out][allow-none]
path location to store allocated path string, or NULL. [out][allow-none]
path_reversed location to store allocated reverse path string, or NULL. [out][allow-none]


:QueueClear(self @ T) : Std.Object.T

Warning

QueueClear has been deprecated since version 2.2 and should not be used in newly-written code. Use QueueDraw instead.



:QueueClearArea(self @ T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT, width @ Std.Integer.SmallT, height @ Std.Integer.SmallT) : Std.Object.T

Warning

QueueClearArea has been deprecated since version 2.2 and should not be used in newly-written code. Use QueueDrawArea instead.



:QueueDraw(self @ T) : Std.Object.T

Equivalent to calling QueueDrawArea for the entire area of a widget.

widget a T


:QueueDrawArea(self @ T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT, width @ Std.Integer.SmallT, height @ Std.Integer.SmallT) : Std.Object.T

Invalidates the rectangular area of widget defined by x, y, width and height by calling Gtk.Gdk.Window.InvalidateRect 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 Gtk.Gdk.Window.InvalidateRect directly, to schedule a redraw of a Gtk.Gtk.DrawingArea.T or some portion thereof.

Frequently you can just call Gtk.Gdk.Window.InvalidateRect or Gtk.Gdk.Window.InvalidateRegion 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.

widget a T
x x coordinate of upper-left corner of rectangle to redraw
y y coordinate of upper-left corner of rectangle to redraw
width width of region to draw
height height of region to draw


:QueueResize(self @ T) : Std.Object.T

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 Gtk.Gtk.Label.T, Gtk.Gtk.Label.T queues a resize to ensure there's enough space for the new text.

widget a T


:QueueResizeNoRedraw(self @ T) : Std.Object.T

This function works like QueueResize, except that the widget is not invalidated.

widget a T


:Realize(self @ T) : Std.Object.T

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

widget a T


:Ref(self @ T) : Gtk.Gtk.Widget.T

Warning

Ref has been deprecated since version 2.12 and should not be used in newly-written code. Use g_object_ref() instead.



:RegionIntersect(self @ T, region @ Gtk.Gdk.Region.T) : Gtk.Gdk.Region.T

Computes the intersection of a widget's area and region, returning the intersection. The result may be empty, use Gtk.Gdk.Region.Empty to check.

widget a T
region a Gtk.Gdk.Region.T, 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.


:RemoveAccelerator(self @ T, accel_group @ Gtk.Gtk.AccelGroup.T, accel_key @ Std.Integer.SmallT, accel_mods @ Std.Integer.SmallT) : Std.Symbol.T

Removes an accelerator from widget, previously installed with AddAccelerator.

widget widget to install an accelerator on
accel_group accel group for this widget
accel_key GDK keyval of the accelerator
accel_mods modifier key combination of the accelerator
Returns whether an accelerator was installed and could be removed


:RemoveMnemonicLabel(self @ T, label @ Gtk.Gtk.Widget.T) : Std.Object.T

Removes a widget from the list of mnemonic labels for this widget. (See ListMnemonicLabels). The widget must have previously been added to the list with AddMnemonicLabel.

widget a T
label a T that was previously set as a mnemnic label for widget with AddMnemonicLabel.


:RenderIcon(self @ T, stock_id @ Std.String.T, size @ Gtk.Gtk.IconSize.T, detail @ Std.String.T) : Gtk.Gdk.Pixbuf.T

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 Gtk.Gdk.Pixbuf.T are shared with the rest of the application and should not be modified. The pixbuf should be freed after use with g_object_unref().

widget a T
stock_id a stock ID
size (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).
detail render detail to pass to theme engine. [allow-none]
Returns a new pixbuf, or NULL if the stock ID wasn't known. [transfer full]


:Reparent(self @ T, new_parent @ Gtk.Gtk.Widget.T) : Std.Object.T

Moves a widget from one Gtk.Gtk.Container.T to another, handling reference count issues to avoid destroying the widget.

widget a T
new_parent a Gtk.Gtk.Container.T to move the widget into


:ResetRcStyles(self @ T) : Std.Object.T

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.

widget a T.


:ResetShapes(self @ T) : Std.Object.T

Warning

ResetShapes is deprecated and should not be used in newly-written code. This function is being removed in GTK+ 3.0. Don't use it.



:SendExpose(self @ T, event @ Gtk.Gdk.Event.T) : Std.Integer.SmallT

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.Gtk.Container.PropagateExpose.

If you want to force an area of a window to be redrawn, use Gtk.Gdk.Window.InvalidateRect or Gtk.Gdk.Window.InvalidateRegion. To cause the redraw to be done immediately, follow that call with a call to Gtk.Gdk.Window.ProcessUpdates.

widget a T
event a expose GdkEvent
Returns return from the event signal emission (TRUE if the event was handled)


:SendFocusChange(self @ T, event @ Gtk.Gdk.Event.T) : Std.Symbol.T

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 T 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 Gtk.Gtk.TreeView.T.

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


:Set(self @ T, first_property_name @ Std.String.T, ... @ Std.Object.T) : Std.Object.T

Warning

Set has been deprecated since version 2.0 and should not be used in newly-written code. Use g_object_set() instead.



:SetAccelPath(self @ T, accel_path @ Std.String.T, accel_group @ Gtk.Gtk.AccelGroup.T) : Std.Object.T

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 SetAccelPath. Associating accelerators with paths allows them to be modified by the user and the modifications to be saved for future use. (See Gtk.Gtk.AccelMap.Save.)

This function is a low level function that would most likely be used by a menu creation system like Gtk.Gtk.UIManager.T. If you use Gtk.Gtk.UIManager.T, setting up accelerator paths will be done automatically.

Even when you you aren't using Gtk.Gtk.UIManager.T, if you only want to set up accelerators on menu items Gtk.Gtk.MenuItem.SetAccelPath 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().

widget a T
accel_path path used to look up the accelerator. [allow-none]
accel_group a Gtk.Gtk.AccelGroup.T. [allow-none]


:SetAllocation(self @ T, allocation @ Gtk.Gdk.Rectangle.T) : Std.Object.T

Sets the widget's allocation. This should not be used directly, but from within a widget's size_allocate method.

widget a T
allocation a pointer to a GtkAllocation to copy from


:SetAppPaintable(self @ T, app_paintable @ Std.Symbol.T) : Std.Object.T

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 Gtk.Gtk.EventBox.T and Gtk.Gtk.Window.T, 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);


:SetCanDefault(self @ T, can_default @ Std.Symbol.T) : Std.Object.T

Specifies whether widget can be a default widget. See GrabDefault for details about the meaning of "default".

widget a T
can_default whether or not widget can be a default widget.


:SetCanFocus(self @ T, can_focus @ Std.Symbol.T) : Std.Object.T

Specifies whether widget can own the input focus. See GrabFocus for actually setting the input focus on a widget.

widget a T
can_focus whether or not widget can own the input focus.


:SetChildVisible(self @ T, is_visible @ Std.Symbol.T) : Std.Object.T

Sets whether widget should be mapped along with its when its parent is mapped and widget has been shown with Show.

The child visibility can be set for widget before it is added to a container with SetParent, 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.

widget a T
is_visible if TRUE, widget should be mapped along with its parent.


:SetColormap(self @ T, colormap @ Gtk.Gdk.Colormap.T) : Std.Object.T

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 <span class="code"><span class="var">init</span><span class="delimiter">()</span></span> function (i.e. from the constructor for the widget).

widget a T
colormap a colormap


:SetCompositeName(self @ T, name @ Std.String.T) : Std.Object.T

Sets a widgets composite name. The widget must be a composite child of its parent; see PushCompositeChild.

widget a T.
name the name to set


:SetDirection(self @ T, dir @ Gtk.Gtk.TextDirection.T) : Std.Object.T

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.Gtk.TextDirection.None, then the value set by SetDefaultDirection will be used.

widget a T
dir the new direction


:SetDoubleBuffered(self @ T, double_buffered @ Std.Symbol.T) : Std.Object.T

Widgets are double buffered by default; you can use this function to turn off the buffering. "Double buffered" simply means that Gtk.Gdk.Window.BeginPaintRegion and Gtk.Gdk.Window.EndPaint 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 Gtk.Gdk.Window.EndPaint 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()).

widget a T
double_buffered TRUE to double-buffer a widget


:SetEvents(self @ T, events @ Std.Integer.SmallT) : Std.Object.T

Sets the event mask (see Gtk.Gdk.EventMask.T) 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 AddEvents for widgets that are already realized, or if you want to preserve the existing event mask. This function can't be used with Gtk.Gtk.WidgetFlags.NoWindow widgets; to get events on those widgets, place them inside a Gtk.Gtk.EventBox.T and receive events on the event box.

widget a T
events event mask


:SetExtensionEvents(self @ T, mode @ Gtk.Gdk.ExtensionMode.T) : Std.Object.T

Sets the extension events mask to mode. See Gtk.Gdk.ExtensionMode.T and Gtk.Gdk.Input.SetExtensionEvents.

widget a T
mode bitfield of extension events to receive


:SetHasTooltip(self @ T, has_tooltip @ Std.Symbol.T) : Std.Object.T

Sets the has-tooltip property on widget to has_tooltip. See GtkWidget:has-tooltip for more information.

widget a T
has_tooltip whether or not widget has a tooltip.


:SetHasWindow(self @ T, has_window @ Std.Symbol.T) : Std.Object.T

Specifies whether widget has a Gtk.Gdk.Window.T of its own. Note that all realized widgets have a non-NULL "window" pointer (GetWindow never returns a NULL window when a widget is realized), but for many of them it's actually the Gtk.Gdk.Window.T 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.

widget a T
has_window whether or not widget has a window.


:SetMapped(self @ T, mapped @ Std.Symbol.T) : Std.Object.T

Marks the widget as being realized.

This function should only ever be called in a derived widget's "map" or "unmap" implementation.

widget a T
mapped TRUE to mark the widget as mapped


:SetName(self @ T, name @ Std.String.T) : Std.Object.T

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 Gtk.Gtk.RcStyle.T).

Note that widget names are separated by periods in paths (see Path), so names with embedded periods may cause confusion.

widget a T
name name for the widget


:SetNoShowAll(self @ T, no_show_all @ Std.Symbol.T) : Std.Object.T

Sets the "no-show-all" property, which determines whether calls to ShowAll and HideAll will affect this widget.

This is mostly for use in constructing widget hierarchies with externally controlled visibility, see Gtk.Gtk.UIManager.T.

widget a T
no_show_all the new value for the "no-show-all" property


:SetParent(self @ T, parent @ Gtk.Gtk.Widget.T) : Std.Object.T

This function is useful only when implementing subclasses of Gtk.Gtk.Container.T. 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 Unparent.

widget a T
parent parent container


:SetParentWindow(self @ T, parent_window @ Gtk.Gdk.Window.T) : Std.Object.T

Sets a non default parent window for widget.

widget a T.
parent_window the new parent window.


:SetRealized(self @ T, realized @ Std.Symbol.T) : Std.Object.T

Marks the widget as being realized.

This function should only ever be called in a derived widget's "realize" or "unrealize" implementation.

widget a T
realized TRUE to mark the widget as realized


:SetReceivesDefault(self @ T, receives_default @ Std.Symbol.T) : Std.Object.T

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 GrabDefault for details about the meaning of "default".

widget a T
receives_default whether or not widget can be a default widget.


:SetRedrawOnAllocate(self @ T, redraw_on_allocate @ Std.Symbol.T) : Std.Object.T

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.

widget a T
redraw_on_allocate if TRUE, the entire widget will be redrawn when it is allocated to a new size. Otherwise, only the new portion of the widget will be redrawn.


:SetScrollAdjustments(self @ T, hadjustment @ Gtk.Gtk.Adjustment.T, vadjustment @ Gtk.Gtk.Adjustment.T) : Std.Symbol.T

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 Gtk.Gtk.Viewport.T, which does support scrolling.

widget a T
hadjustment an adjustment for horizontal scrolling, or NULL. [allow-none]
vadjustment an adjustment for vertical scrolling, or NULL. [allow-none]
Returns TRUE if the widget supports scrolling


:SetSensitive(self @ T, sensitive @ Std.Symbol.T) : Std.Object.T

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.

widget a T
sensitive TRUE to make the widget sensitive


:SetSizeRequest(self @ T, width @ Std.Integer.SmallT, height @ Std.Integer.SmallT) : Std.Object.T

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.Gtk.Window.SetDefaultSize 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.Gtk.Window.SetGeometryHints 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."

widget a T
width width widget should request, or -1 to unset
height height widget should request, or -1 to unset


:SetState(self @ T, state @ Gtk.Gtk.StateType.T) : Std.Object.T

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

widget a T
state new state for widget


:SetStyle(self @ T, style @ Gtk.Gtk.Style.T) : Std.Object.T

Sets the Gtk.Gtk.Style.T 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 Gtk.Gtk.Style.T. Instead, use ModifyStyle.

widget a T
style a Gtk.Gtk.Style.T, or NULL to remove the effect of a previous SetStyle and go back to the default style. [allow-none]


:SetTooltipMarkup(self @ T, markup @ Std.String.T) : Std.Object.T

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.Gtk.Tooltip.SetMarkup.

widget a T
markup the contents of the tooltip for widget, or NULL. [allow-none]


:SetTooltipText(self @ T, text @ Std.String.T) : Std.Object.T

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.Gtk.Tooltip.SetText.

widget a T
text the contents of the tooltip for widget


:SetTooltipWindow(self @ T, custom_window @ Gtk.Gtk.Window.T) : Std.Object.T

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

widget a T
custom_window a Gtk.Gtk.Window.T, or NULL. [allow-none]


:SetUposition(self @ T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT) : Std.Object.T

Warning

SetUposition is deprecated and should not be used in newly-written code.



:SetUsize(self @ T, width @ Std.Integer.SmallT, height @ Std.Integer.SmallT) : Std.Object.T

Warning

SetUsize has been deprecated since version 2.2 and should not be used in newly-written code. Use SetSizeRequest instead.



:SetVisible(self @ T, visible @ Std.Symbol.T) : Std.Object.T

Sets the visibility state of widget. Note that setting this to TRUE doesn't mean the widget is actually viewable, see GetVisible.

This function simply calls Show or Hide but is nicer to use when the visibility of the widget depends on some condition.

widget a T
visible whether the widget should be shown or not


:SetWindow(self @ T, window @ Gtk.Gdk.Window.T) : Std.Object.T

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

Widgets must indicate whether they will create their own Gtk.Gdk.Window.T by calling SetHasWindow. This is usually done in the widget's init() function.

widget a T
window a Gtk.Gdk.Window.T


:ShapeCombineMask(self @ T, shape_mask @ Gtk.Gdk.Pixmap.T, offset_x @ Std.Integer.SmallT, offset_y @ Std.Integer.SmallT) : Std.Object.T

Sets a shape for this widget's GDK window. This allows for transparent windows etc., see Gtk.Gdk.Window.ShapeCombineMask for more information.

widget a T
shape_mask shape to be added, or NULL to remove an existing shape. [allow-none]
offset_x X position of shape mask with respect to window
offset_y Y position of shape mask with respect to window


:Show(self @ T) : Std.Object.T

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

widget a T


:ShowAll(self @ T) : Std.Object.T

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

widget a T


:ShowNow(self @ T) : Std.Object.T

Shows a widget. If the widget is an unmapped toplevel widget (i.e. a Gtk.Gtk.Window.T 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.

widget a T


:SizeAllocate(self @ T, allocation @ Gtk.Gdk.Rectangle.T) : Std.Object.T

This function is only used by Gtk.Gtk.Container.T subclasses, to assign a size and position to their child widgets.

widget a T
allocation position and size to be allocated to widget


:SizeRequest(self @ T, requisition @ Gtk.Gtk.Requisition.T) : Std.Object.T

This function is typically used when implementing a Gtk.Gtk.Container.T 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 SizeAllocate.

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

widget a T
requisition a Gtk.Gtk.Requisition.T to be filled in


:StyleAttach(self @ T) : Std.Object.T

This function attaches the widget's Gtk.Gtk.Style.T to the widget's Gtk.Gdk.Window.T. 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 T) would attach the style itself.

Since 2.20



:StyleGet(self @ T, first_property_name @ Std.String.T, ... @ Std.Object.T) : Std.Object.T

Gets the values of a multiple style properties of widget.

widget a T
first_property_name the name of the first property to get


:StyleGetProperty(self @ T, property_name @ Std.String.T, value @ Gtk.GObject.Value.T) : Std.Object.T

Gets the value of a style property of widget.

widget a T
property_name the name of a style property
value location to return the property value


:StyleGetValist(self @ T, first_property_name @ Std.String.T, var_args @ Agg.List.T) : Std.Object.T

Non-vararg variant of StyleGet. Used primarily by language bindings.

widget a T
first_property_name the name of the first property to get
var_args a va_list of pairs of property names and locations to return the property values, starting with the location for first_property_name.


:ThawChildNotify(self @ T) : Std.Object.T

Reverts the effect of a previous call to FreezeChildNotify. This causes all queued "child-notify" signals on widget to be emitted.

widget a T


:TranslateCoordinates(self @ T, dest_widget @ Gtk.Gtk.Widget.T, src_x @ Std.Integer.SmallT, src_y @ Std.Integer.SmallT, dest_x, dest_y) : Std.Symbol.T

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.

src_widget a T
dest_widget a T
src_x X position relative to src_widget
src_y Y position relative to src_widget
dest_x location to store X position relative to dest_widget. [out]
dest_y 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.


:TriggerTooltipQuery(self @ T) : Std.Object.T

Triggers a tooltip query on the display where the toplevel of widget is located. See Gtk.Gtk.Tooltip.TriggerTooltipQuery for more information.

widget a T


:Unmap(self @ T) : Std.Object.T

This function is only for use in widget implementations. Causes a widget to be unmapped if it's currently mapped.

widget a T


:Unparent(self @ T) : Std.Object.T

This function is only for use in widget implementations. Should be called by implementations of the remove method on Gtk.Gtk.Container.T, to dissociate a child from the container.

widget a T


:Unrealize(self @ T) : Std.Object.T

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

widget a T


:Unref(self @ T) : Std.Object.T

Warning

Unref has been deprecated since version 2.12 and should not be used in newly-written code. Use g_object_unref() instead.