### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: docs/content-docs/reference/Gtk3/Widget.md
### ----------------------------------------------------
### -- Chunk 2 of 4
 focused, `False` otherwise

    method get-receives-default ( --> Bool )

get-request-mode
----------------

Gets whether the widget prefers a height-for-width layout or a width-for-height layout.

GtkBin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.

    method get-request-mode ( --> GtkSizeRequestMode )

get-scale-factor
----------------

Retrieves the internal scale factor that maps from window coordinates to the actual device pixels. On traditional systems this is 1, on high density outputs, it can be a higher value (typically 2).

See `gdk-window-get-scale-factor()`.

Returns: the scale factor for *widget*

    method get-scale-factor ( --> Int )

get-screen, get-screen-rk
-------------------------

Get the **Gnome::Gdk3::Screen** 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 **Gnome::Gdk3::Window** 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.

Returns: the **Gnome::Gdk3::Screen** for the toplevel for this widget.

    method get-screen-rk ( --> Gnome::Gdk3::Screen )
    method get-screen ( --> N-GObject )

get-sensitive
-------------

Returns the widget’s sensitivity (in the sense of returning the value that has been set using `set-sensitive()`).

The effective sensitivity of a widget is however determined by both its own and its parent widget’s sensitivity. See `is-sensitive()`.

Returns: `True` if the widget is sensitive

    method get-sensitive ( --> Bool )

get-size-request
----------------

Gets the size request that was explicitly set for the widget using `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 instead. See `set-size-request()`. To get the size a widget will actually request, call `get-preferred-size()` instead of this function.

    method get-size-request ( --> List )

Returned List holds;

  * Int width; return location for width, or `undefined`

  * Int height; return location for height, or `undefined`

get-state-flags
---------------

Returns the widget state as a flag set. It is worth mentioning that the effective `GTK-STATE-FLAG-INSENSITIVE` state will be returned, that is, also based on parent insensitivity, even if *widget* itself is sensitive.

Also note that if you are looking for a way to obtain the **Gnome::Gtk3::StateFlags** to pass to a **Gnome::Gtk3::StyleContext** method, you should look at `Gnome::Gtk3::StyleContext.get-state()`.

Returns: The state flags for widget. Flags are defined by GtkStateFlags.

    method get-state-flags ( --> UInt )

get-style-context, get-style-context-rk
---------------------------------------

Returns the style context associated to *widget*. The returned object is guaranteed to be the same for the lifetime of *widget*.

Returns: a **Gnome::Gtk3::StyleContext**. This memory is owned by *widget* and must not be freed.

    method get-style-context ( --> N-GObject )
    method get-style-context-rk ( --> Gnome::Gtk3::StyleContext )

get-support-multidevice
-----------------------

Returns `True` if *widget* is multiple pointer aware. See `set-support-multidevice()` for more information.

Returns: `True` if *widget* is multidevice aware.

    method get-support-multidevice ( --> Bool )

get-tooltip-markup
------------------

Gets the contents of the tooltip for *widget*.

Returns: the tooltip text, or `undefined`. You should free the returned string with `g-free()` when done.

    method get-tooltip-markup ( --> Str )

get-tooltip-text
----------------

Gets the contents of the tooltip for *widget*.

Returns: the tooltip text, or `undefined`. You should free the returned string with `g-free()` when done.

    method get-tooltip-text ( --> Str )

get-tooltip-window, get-tooltip-window-rk
-----------------------------------------

Returns the **Gnome::Gtk3::Window** of the current tooltip. This can be the GtkWindow created by default, or the custom tooltip window set using `set-tooltip-window()`.

Returns: The **Gnome::Gtk3::Window** of the current tooltip. It can be undefined or invalid when there is no window defined.

    method get-tooltip-window ( --> N-GObject )
    method get-tooltip-window-rk ( :$child-type? --> Gnome::Gtk3::Window )

  * $child-type: This is an optional argument. You can specify a real type or a type as a string. In the latter case the type must be defined in a module which can be found by the Raku require call.

get-toplevel, get-toplevel-rk
-----------------------------

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. `get-ancestor()`; `gtk-widget-get-ancestor (widget, GTK-TYPE-WINDOW)` would return `undefined` if *widget* wasn’t inside a toplevel window, and if the window was inside a **Gnome::Gtk3::Window**-derived widget which was in turn inside the toplevel **Gnome::Gtk3::Window**. While the second case may seem unlikely, it actually happens when a **Gnome::Gtk3::Plug** is embedded inside a **Gnome::Gtk3::Socket** within the same application.

To reliably find the toplevel **Gnome::Gtk3::Window**, use `get-toplevel()` and call `GTK-IS-WINDOW()` on the result. For instance, to get the title of a widget's toplevel window, one might use:

    sub get-widget-toplevel-title ( Gnome::Gtk3::Widget $widget --> Str ) {
      Gnome::Gtk3::Widget $toplevel = $widget.get-toplevel-rk;
      ( $toplevel.is-valid and $toplevel.is-toplevel )
        ?? $toplevel.gtk-window-get-title !! ''
    }

Returns: the topmost ancestor of *widget*, or *widget* itself if there’s no ancestor.

    method get-toplevel ( --> N-GObject )
    method get-toplevel-rk ( :$child-type? --> Gnome::GObject::Widget )

  * $child-type: This is an optional argument. You can specify a real type or a type as a string. In the latter case the type must be defined in a module which can be found by the Raku require call.

get-valign
----------

Gets the value of the *valign* property.

For backwards compatibility reasons this method will never return `GTK-ALIGN-BASELINE`, but instead it will convert it to `GTK-ALIGN-FILL`. If your widget want to support baseline aligned children it must use `get-valign-with-baseline()`, or `g-object-get (widget, "valign", &value, NULL)`, which will also report the true value.

Returns: the vertical alignment of *widget*, ignoring baseline alignment

    method get-valign ( --> GtkAlign )

get-valign-with-baseline
------------------------

Gets the value of the *valign* property, including `GTK-ALIGN-BASELINE`.

Returns: the vertical alignment of *widget*

    method get-valign-with-baseline ( --> GtkAlign )

get-vexpand
-----------

Gets whether the widget would like any available extra vertical space.

See `get-hexpand()` for more detail.

Returns: whether vexpand flag is set

    method get-vexpand ( --> Bool )

get-vexpand-set
---------------

Gets whether `set-vexpand()` has been used to explicitly set the expand flag on this widget.

See `get-hexpand-set()` for more detail.

Returns: whether vexpand has been explicitly set

    method get-vexpand-set ( --> Bool )

get-visible
-----------

Determines whether the widget is visible. If you want to take into account whether the widget’s parent is also marked as visible, use `is-visible()` instead.

This function does not check if the widget is obscured in any way.

See `set-visible()`.

Returns: `True` if the widget is visible

    method get-visible ( --> Bool )

get-visual, get-visual-rk
-------------------------

Gets the visual that will be used to render *widget*.

Returns: the visual for *widget*

    method get-visual-rk ( --> Gnome::Gdk3::Visual )
    method get-visual ( --> N-GObject )

get-window
----------

Returns the widget’s window if it is realized, `undefined` otherwise

Returns: *widget*’s window.

    method get-window ( --> N-GObject )

grab-default
------------

Causes *widget* to become the default widget. *widget* must be able to be a default widget; typically you would ensure this yourself by calling `set-can-default()` with a `True` value. The default widget is activated when the user presses Enter in a window. Default widgets must be activatable, that is, `activate()` should affect them. Note that **Gnome::Gtk3::Entry** widgets require the “activates-default” property set to `True` before they activate the default widget when Enter is pressed and the **Gnome::Gtk3::Entry** is focused.

    method grab-default ( )

grab-focus
----------

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

More precisely, it must have the `GTK-CAN-FOCUS` flag set. Use `set-can-focus()` to modify that flag.

The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.

    method grab-focus ( )

gtk-cairo-should-draw-window
----------------------------

This function is supposed to be called in *draw* implementations for widgets that support multiple windows. *$cr* must be untransformed from invoking of the draw function. This function will return `True` if the contents of the given *$window* are supposed to be drawn and `False` otherwise. Note that when the drawing was not initiated by the windowing system this function will return `True` for all windows, so you need to draw the bottommost window first. Also, do not use “else if” statements to check which window should be drawn.

Returns: `True` if *window* should be drawn

    method gtk-cairo-should-draw-window (
      cairo_t $cr, N-GObject $window --> Bool
    )

  * cairo_t $cr; a cairo context

  * N-GObject $window; the window to check. *window* may not be an input-only window.

gtk-cairo-transform-to-window
-----------------------------

Transforms the given cairo context *cr* that from *widget*-relative coordinates to *window*-relative coordinates. If the *widget*’s window is not an ancestor of *window*, no modification will be applied.

This is the inverse to the transformation GTK applies when preparing an expose event to be emitted with the *draw* signal. It is intended to help porting multiwindow widgets from GTK+ 2 to the rendering architecture of GTK+ 3.

    method gtk-cairo-transform-to-window (
      cairo_t $cr, N-GObject $widget, N-GObject $window
    )

  * cairo_t $cr; the cairo context to transform

  * N-GObject $widget; the widget the context is currently centered for

  * N-GObject $window; the window to transform the context to

gtk-requisition-copy
--------------------

Copies a **Gnome::Gtk3::Requisition**.

Returns: a copy of *requisition*

    method gtk-requisition-copy (
      N-GtkRequisition $requisition --> N-GtkRequisition
    )

  * N-GtkRequisition $requisition; a **Gnome::Gtk3::Requisition**

gtk-requisition-free
--------------------

Frees a **Gnome::Gtk3::Requisition**.

    method gtk-requisition-free ( N-GtkRequisition $requisition )

  * N-GtkRequisition $requisition; a **Gnome::Gtk3::Requisition**

gtk-requisition-new
-------------------

Allocates a new **Gnome::Gtk3::Requisition**-struct and initializes its elements to zero.

Returns: a new empty **Gnome::Gtk3::Requisition**. The newly allocated **Gnome::Gtk3::Requisition** should be freed with `requisition-free()`.

    method gtk-requisition-new ( --> N-GtkRequisition )

has-default
-----------

Determines whether *widget* is the current default widget within its toplevel. See `set-can-default()`.

Returns: `True` if *widget* is the current default widget within its toplevel, `False` otherwise

    method has-default ( --> Bool )

has-focus
---------

Determines if the widget has the global input focus. See `is-focus()` for the difference between having the global input focus, and only having the focus within a toplevel.

Returns: `True` if the widget has the global input focus.

    method has-focus ( --> Bool )

has-grab
--------

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

See also `gtk-grab-add()`.

Returns: `True` if the widget is in the grab-widgets stack

    method has-grab ( --> Bool )

has-screen
----------

Checks whether there is a **Gnome::Gdk3::Screen** 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.

Returns: `True` if there is a **Gnome::Gdk3::Screen** associated with the widget.

    method has-screen ( --> Bool )

has-visible-focus
-----------------

Determines if the widget should show a visible indication that it has the global input focus. This is a convenience function for use in *draw* handlers that takes into account whether focus indication should currently be shown in the toplevel window of *widget*. See `gtk-window-get-focus-visible()` for more information about focus indication.

To find out if the widget has the global input focus, use `has-focus()`.

Returns: `True` if the widget should display a “focus rectangle”

    method has-visible-focus ( --> Bool )

hide
----

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

    method hide ( )

hide-on-delete
--------------

Utility function; intended to be connected to the *delete-event* signal on a **Gnome::Gtk3::Window**. 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.

Returns: `True`

    method hide-on-delete ( --> Bool )

in-destruction
--------------

Returns whether the widget is currently being destroyed. This information can sometimes be used to avoid doing unnecessary work.

Returns: `True` if *widget* is being destroyed

    method in-destruction ( --> Bool )

insert-action-group
-------------------

Inserts *$group* into *widget*. Children of *widget* that implement **Gnome::Gtk3::Actionable** can then be associated with actions in *$group* by setting their “action-name” to *$prefix*.`action-name`.

If *group* is `undefined`, a previously inserted group for *name* is removed from *widget*.

    method insert-action-group ( Str $name, N-GObject $group )

  * Str $name; the prefix for actions in *group*

  * N-GObject $group; a **Gnome::Gio::ActionGroup**, or `undefined`

intersect
---------

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 `undefined` if you’re only interested in whether there was an intersection.

Returns: `True` if there was an intersection

    method intersect ( N-GObject $area, N-GObject $intersection --> Bool )

  * N-GObject $area; a N-GdkRectangle

  * N-GObject $intersection; N-GdkRectangle to store intersection of *widget* and *area*

is-ancestor
-----------

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

Returns: `True` if *$ancestor* contains *widget* as a child, grandchild, great grandchild, etc.

    method is-ancestor ( N-GObject $ancestor --> Bool )

  * N-GObject $ancestor; another **Gnome::Gtk3::Widget**

is-drawable
-----------

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

Returns: `True` if *widget* is drawable, `False` otherwise

    method is-drawable ( --> Bool )

is-focus
--------

Determines if the widget is the focus widget within its toplevel. (This does not mean that the *has-focus* property is necessarily set; *has-focus* will only be set if the toplevel widget additionally has the global input focus.)

Returns: `True` if the widget is the focus widget.

    method is-focus ( --> Bool )

is-sensitive
------------

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

Returns: `True` if the widget is effectively sensitive

    method is-sensitive ( --> Bool )

is-toplevel
-----------

Determines whether *widget* is a toplevel widget.

Currently only **Gnome::Gtk3::Window** and **Gnome::Gtk3::Invisible** (and out-of-process **Gnome::Gtk3::Plugs**) are toplevel widgets. Toplevel widgets have no parent widget.

Returns: `True` if *widget* is a toplevel, `False` otherwise

    method is-toplevel ( --> Bool )

is-visible
----------

Determines whether the widget and all its parents are marked as visible.

This function does not check if the widget is obscured in any way.

See also `get-visible()` and `set-visible()`

Returns: `True` if the widget and all its parents are visible

    method is-visible ( --> Bool )

keynav-failed
-------------

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 `child-focus()`:

When `True` is returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.

When `False` is returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling `child-focus()` on the widget’s toplevel.

The default *keynav-failed* handler returns `False` for `GTK-DIR-TAB-FORWARD` and `GTK-DIR-TAB-BACKWARD`. For the other values of **Gnome::Gtk3::DirectionType** it returns `True`.

Whenever the default handler returns `True`, it also calls `error-bell()` to notify the user of the failed keyboard navigation.

A use case for providing an own implementation of *keynav-failed* (either by connecting to it or by overriding it) would be a row of **Gnome::Gtk3::Entry** 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.

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

    method keynav-failed ( GtkDirectionType $direction --> Bool )

  * GtkDirectionType $direction; direction of focus movement

list-action-prefixes
--------------------

Retrieves a `undefined`-terminated array of strings containing the prefixes of **Gnome::Gtk3::ActionGroup**'s available to *widget*.

Returns: an array of strings.

    method list-action-prefixes ( --> List )

list-mnemonic-labels, list-mnemonic-labels-rk
---------------------------------------------

Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, `Gnome::Gtk3::Label.set-mnemonic-widget()`). The widgets in the list are not individually referenced.

Returns: the list of mnemonic labels; free this list with `clear-object()` when you are done with it.

    method list-mnemonic-labels ( --> N-GList )
    method list-mnemonic-labels-rk ( --> Gnome::Glib::List )

mnemonic-activate
-----------------

Emits the *mnemonic-activate* signal.

Returns: `True` if the signal has been handled

    method mnemonic-activate ( Bool $group_cycling --> Bool )

  * Bool $group_cycling; `True` if there are other widgets with the same mnemonic

queue-compute-expand
--------------------

Mark *widget* as needing to recompute its expand flags. Call this function when setting legacy expand child properties on the child of a container.

See `compute-expand()`.

    method queue-compute-expand ( )

queue-draw
----------

Equivalent to calling `queue-draw-area()` for the entire area of a widget.

    method queue-draw ( )

queue-draw-area
---------------

Convenience function that calls `queue-draw-region()` on the region created from the given coordinates.

The region here is specified in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as *widget*->window coordinates for widgets that return `True` for `get-has-window()`, and are relative to *widget*->allocation.x, *widget*->allocation.y otherwise.

*width* or *height* may be 0, in this case this function does nothing. Negative values for *width* and *height* are not allowed.

    method queue-draw-area ( Int $x, Int $y, Int $width, Int $height )

  * Int $x; x coordinate of upper-left corner of rectangle to redraw

  * Int $y; y coordinate of upper-left corner of rectangle to redraw

  * Int $width; width of region to draw

  * Int $height; height of region to draw

register-window
---------------

Registers a **Gnome::Gtk3::Window** with the widget and sets it up so that the widget receives events for it. Call `unregister-window()` when destroying the window.

    method register-window ( N-GObject $window )

  * N-GObject $window; a **Gnome::Gtk3::Window**

remove-mnemonic-label
---------------------

Removes a widget from the list of mnemonic labels for this widget. (See `list-mnemonic-labels()`). The widget must have previously been added to the list with `add-mnemonic-label()`.

    method remove-mnemonic-label ( N-GObject $label )

  * N-GObject $label; a **Gnome::Gtk3::Widget** that was previously set as a mnemonic label for *widget* with `add-mnemonic-label()`.

reset-style
-----------

Updates the style context of *widget* and all descendants by updating its widget path. **Gnome::Gtk3::Containers** may want to use this on a child when reordering it in a way that a different style might apply to it. See also `gtk-container-get-path-for-child()`.

    method reset-style ( )

set-allocation
--------------

Sets the widget’s allocation. This should not be used directly, but from within a widget’s size-allocate method.

The allocation set should be the “adjusted” or actual allocation. If you’re implementing a **Gnome::Gtk3::Container**, you want to use `size-allocate()` instead of `set-allocation()`. The GtkWidgetClass::adjust-size-allocation virtual method adjusts the allocation inside `size-allocate()` to create an adjusted allocation.

    method set-allocation ( N-GtkAllocation $allocation )

  * N-GtkAllocation $allocation; a pointer to a **Gnome::Gtk3::Allocation** to copy from

set-app-paintable
-----------------

Sets whether the application intends to draw on the widget in an *draw* 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 **Gnome::Gtk3::EventBox** and **Gnome::Gtk3::Window**, 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.

    method set-app-paintable ( Bool $app_paintable )

  * Bool $app_paintable; `True` if the application will paint on the widget

set-can-default
---------------

Specifies whether *widget* can be a default widget. See `grab-default()` for details about the meaning of “default”.

    method set-can-default ( Bool $can_default )

  * Bool $can_default; whether or not *widget* can be a default widget.

set-can-focus
-------------

Specifies whether *widget* can own the input focus. See `grab-focus()` for actually setting the input focus on a widget.

    method set-can-focus ( Bool $can_focus )

  * Bool $can_focus; whether or not *widget* can own the input focus.

set-child-visible
-----------------

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 `set-parent()`, to avoid mapping children unnecessary before immediately unmapping them. However it will be reset to its default state of `True` when the widget is removed from a container.

Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself.

This function is only useful for container implementations and never should be called by an application.

    method set-child-visible ( Bool $is_visible )

  * Bool $is_visible; if `True`, *widget* should be mapped along with its parent.

set-clip
--------

Sets the widget’s clip. This must not be used directly, but from within a widget’s size-allocate method. It must be called after `set-allocation()` (or after chaining up to the parent class), because that function resets the clip.

The clip set should be the area that *widget* draws on. If *widget* is a **Gnome::Gtk3::Container**, the area must contain all children's clips.

If this function is not called by *widget* during a *size-allocate* handler, the clip will be set to *widget*'s allocation.

    method set-clip ( N-GtkAllocation $clip )

  * N-GtkAllocation $clip; a pointer to a **Gnome::Gtk3::Allocation** to copy from

set-default-direction
---------------------

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

    method set-default-direction ( GtkTextDirection $dir )

  * GtkTextDirection $dir; the new default direction. This cannot be `GTK-TEXT-DIR-NONE`.

set-device-enabled
------------------

Enables or disables a **Gnome::Gdk3::Device** to interact with *widget* and all its children.

It does so by descending through the **Gnome::Gtk3::Window** hierarchy and enabling the same mask that is has for core events (i.e. the one that `gdk-window-get-events()` returns).

    method set-device-enabled ( N-GObject $device, Bool $enabled )

  * N-GObject $device; a **Gnome::Gdk3::Device**

  * Bool $enabled; whether to enable the device

set-device-events
-----------------

Sets the device event mask (see **Gnome::Gtk3::EventMask**) for a widget. The event mask determines which events a widget will receive from *device*. 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-device-events()` for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with windowless widgets (which return `False` from `get-has-window()`); to get events on those widgets, place them inside a **Gnome::Gtk3::EventBox** and receive events on the event box.

    method set-device-events ( N-GObject $device, Int $events )

  * N-GObject $device; a **Gnome::Gdk3::Device**

  * Int $events; event mask with GdkEventMask flag values

set-direction
-------------

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 explicitly 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 `set-default-direction()` will be used.

    method set-direction ( GtkTextDirection $dir )

  * GtkTextDirection $dir; the new direction

set-events
----------

Sets the event mask (see **Gnome::Gtk3::EventMask**) 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 `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 widgets that have no window. (See `get-has-window()`). To get events on those widgets, place them inside a **Gnome::Gtk3::EventBox** and receive events on the event box.

    method set-events ( Int $events )

  * Int $events; event mask

set-focus-on-click
------------------

Sets whether the widget should grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

    method set-focus-on-click ( Bool $focus_on_click )

  * Bool $focus_on_click; whether the widget should grab focus when clicked with the mouse

set-font-map
------------

Sets the font map to use for Pango rendering. When not set, the widget will inherit the font map from its parent.

    method set-font-map ( N-GObject $font_map )

  * N-GObject $font_map; a **PangoFontMap**, or `undefined` to unset any previously set font map

set-font-options
----------------

Sets the **cairo-font-options-t** used for Pango rendering in this widget. When not set, the default font options for the **Gnome::Gdk3::Screen** will be used.

    method set-font-options ( cairo_font_options_t $options )

  * cairo_font_options_t $options; a **cairo-font-options-t**, or `undefined` to unset any previously set default font options.

set-halign
----------

Sets the horizontal alignment of *widget*. See the *halign* property.

    method set-halign ( GtkAlign $align )

  * GtkAlign $align; the horizontal alignment

set-has-tooltip
---------------

Sets the has-tooltip property on *widget* to *has-tooltip*. See *has-tooltip* for more information.

    method set-has-tooltip ( Bool $has_tooltip )

  * Bool $has_tooltip; whether or not *widget* has a tooltip.

set-has-window
--------------

Specifies whether *widget* has a **Gnome::Gtk3::Window** of its own. Note that all realized widgets have a non-`undefined` “window” pointer (`get-window()` never returns a `undefined` window when a widget is realized), but for many of them it’s actually the **Gnome::Gtk3::Window** of one of its parent widgets. Widgets that do not create a `window` for themselves in *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.

    method set-has-window ( Bool $has_window )

  * Bool $has_window; whether or not *widget* has a window.

set-hexpand
-----------

Sets whether the widget would like any available extra horizontal space. When a user resizes a **Gnome::Gtk3::Window**, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room.

By default, widgets automatically expand if any of their children want to expand. (To see if a widget will automatically expand given its current children and state, call `compute-expand()`. A container can decide how the expandability of children affects the expansion of the container by overriding the compute-expand virtual method on **Gnome::Gtk3::Widget**.).

Setting hexpand explicitly with this function will override the automatic expand behavior.

This function forces the widget to expand or not to expand, regardless of children. The override occurs because `set-hexpand()` sets the hexpand-set property (see `set-hexpand-set()`) which causes the widget’s hexpand value to be used, rather than looking at children and widget state.

    method set-hexpand ( Bool $expand )

  * Bool $expand; whether to expand

set-hexpand-set
---------------

Sets whether the hexpand flag (see `get-hexpand()`) will be used.

The hexpand-set property will be set automatically when you call `set-hexpand()` to set hexpand, so the most likely reason to use this function would be to unset an explicit expand flag.

If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

There are few reasons to use this function, but it’s here for completeness and consistency.

    method set-hexpand-set ( Bool $set )

  * Bool $set; value for hexpand-set property

set-mapped
----------

Marks the widget as being mapped.

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

    method set-mapped ( Bool $mapped )

  * Bool $mapped; `True` to mark the widget as mapped

set-margin-bottom
-----------------

Sets the bottom margin of *widget*. See the *margin-bottom* property.

    method set-margin-bottom ( Int $margin )

  * Int $margin; the bottom margin

set-margin-end
--------------

Sets the end margin of *widget*. See the *margin-end* property.

    method set-margin-end ( Int $margin )

  * Int $margin; the end margin

set-margin-start
----------------

Sets the start margin of *widget*. See the *margin-start* property.

    method set-margin-start ( Int $margin )

  * Int $margin; the start margin

set-margin-top
--------------

Sets the top margin of *widget*. See the *margin-top* property.

    method set-margin-top ( Int $margin )

  * Int $margin; the top margin

set-name
--------

Widgets can be named, which allows you to refer to them from a CSS file. You can apply a style to widgets with a particular name in the CSS file. See the documentation for the CSS syntax (on the same page as the docs for **Gnome::Gtk3::StyleContext**).

Note that the CSS syntax has certain special characters to delimit and represent elements in a selector (period, #, >, *…), so using these will make your widget impossible to match by name. Any combination of alphanumeric symbols, dashes and underscores will suffice.

    method set-name ( Str $name )

  * Str $name; name for the widget

set-no-show-all
---------------

Sets the *no-show-all* property, which determines whether calls to `show-all()` will affect this widget.

This is mostly for use in constructing widget hierarchies with externally controlled visibility, see **Gnome::Gtk3::UIManager**.

    method set-no-show-all ( Bool $no_show_all )

  * Bool $no_show_all; the new value for the “no-show-all” property

set-opacity
-----------

Request the *widget* to be rendered partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Opacity values are clamped to the [0,1] range.). This works on both toplevel widget, and child widgets, although there are some limitations:

For toplevel widgets this depends on the capabilities of the windowing system. On X11 this has any effect only on X screens with a compositing manager running. See `is