### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: docs/content-docs/reference/Gtk3/Widget.md
### ----------------------------------------------------
### -- Chunk 1 of 4
Gnome::Gtk3::Widget
===================

Base class for all widgets

Description
===========

**Gnome::Gtk3::Widget** is the base class all widgets in this package derive from. It manages the widget lifecycle, states and style.

Height-for-width Geometry Management
------------------------------------

GTK+ uses a height-for-width (and width-for-height) geometry management system. Height-for-width means that a widget can change how much vertical space it needs, depending on the amount of horizontal space that it is given (and similar for width-for-height). The most common example is a label that reflows to fill up the available width, wraps to fewer lines, and therefore needs less height.

Height-for-width geometry management is implemented in GTK+ by way of five virtual methods:

  * `get_request_mode()`

  * `get_preferred_width()`

  * `get_preferred_height()`

  * `get_preferred_height_for_width()`

  * `get_preferred_width_for_height()`

  * `get_preferred_height_and_baseline_for_width()`

There are some important things to keep in mind when implementing height-for-width and when using it in container implementations.

The geometry management system will query a widget hierarchy in only one orientation at a time. When widgets are initially queried for their minimum sizes it is generally done in two initial passes in the `GtkSizeRequestMode` chosen by the toplevel.

For example, when queried in the normal `GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH` mode:

  * First, the default minimum and natural width for each widget in the interface will be computed using `gtk_widget_get_preferred_width()`. Because the preferred widths for each container depend on the preferre1d widths of their children, this information propagates up the hierarchy, and finally a minimum and natural width is determined for the entire toplevel.

  * Next, the toplevel will use the minimum width to query for the minimum height contextual to that width using `gtk_widget_get_preferred_height_for_width()`, which will also be a highly recursive operation. The minimum height for the minimum width is normally used to set the minimum size constraint on the toplevel (unless `gtk_window_set_geometry_hints()` is explicitly used instead).

After the toplevel window has initially requested its size in both dimensions it can go on to allocate itself a reasonable size (or a size previously specified with `gtk_window_set_default_size()`). During the recursive allocation process it’s important to note that request cycles will be recursively executed while container widgets allocate their children. Each container widget, once allocated a size, will go on to first share the space in one orientation among its children and then request each child's height for its target allocated width or its width for allocated height, depending.

In this way a **Gnome::Gtk3::Widget** will typically be requested its size a number of times before actually being allocated a size. The size a widget is finally allocated can of course differ from the size it has requested. For this reason, **Gnome::Gtk3::Widget** caches a small number of results to avoid re-querying for the same sizes in one allocation cycle.

See [Gnome::Gtk3::Container’s geometry management section](https://developer.gnome.org/gtk3/stable/GtkContainer.html) to learn more about how height-for-width allocations are performed by container widgets.

If a widget does move content around to intelligently use up the allocated size then it must support the request in both `GtkSizeRequestMode`s even if the widget in question only trades sizes in a single orientation.

For instance, a **Gnome::Gtk3::Label** that does height-for-width word wrapping will not expect to have `get_preferred_height()` called because that call is specific to a width-for-height request. In this case the label must return the height required for its own minimum possible width. By following this rule any widget that handles height-for-width or width-for-height requests will always be allocated at least enough space to fit its own content.

Since 3.10 GTK+ also supports baseline vertical alignment of widgets. This means that widgets are positioned such that the typographical baseline of widgets in the same row are aligned. This happens if a widget supports baselines, has a vertical alignment of `GTK_ALIGN_BASELINE`, and is inside a container that supports baselines and has a natural “row” that it aligns to the baseline, or a baseline assigned to it by the grandparent.

Baseline alignment support for a widget is done by the `get_preferred_height_and_baseline_for_width()` virtual function. It allows you to report a baseline in combination with the minimum and natural height. If there is no baseline you can return -1 to indicate this. The default implementation of this virtual function calls into the `get_preferred_height()` and `get_preferred_height_for_width()`, so if baselines are not supported it doesn’t need to be implemented.

If a widget ends up baseline aligned it will be allocated all the space in the parent as if it was `GTK_ALIGN_FILL`, but the selected baseline can be found via `gtk_widget_get_allocated_baseline()`. If this has a value other than -1 you need to align the widget such that the baseline appears at the position.

Style Properties
----------------

**Gnome::Gtk3::Widget** 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 gtk resource files. This mechanism is used for configuring such things as the location of the scrollbar arrows through the theme, giving theme authors more control over the look of applications without the need to write a theme engine in C.

Use `gtk_widget_class_install_style_property()` to install style properties for a widget class, `gtk_widget_class_find_style_property()` or `gtk_widget_class_list_style_properties()` to get information about existing style properties and `gtk_widget_style_get_property()`, `gtk_widget_style_get()` or `gtk_widget_style_get_valist()` to obtain the value of a style property.

Gnome::Gtk3::Widget as Gnome::Gtk3::Buildable
---------------------------------------------

The **Gnome::Gtk3::Widget** implementation of the **Gnome::Gtk3::Buildable** interface supports a custom <accelerator> element, which has attributes named ”key”, ”modifiers” and ”signal” and allows to specify accelerators.

An example of a UI definition fragment specifying an accelerator (please note that in this XML the C-Source widget class names must be used; GtkButton instead of Gnome::Gtk3::Button):

    <object class="GtkButton">
      <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/>
    </object>

In addition to accelerators, **Gnome::Gtk3::Widget** 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 **Gnome::Gtk3::Widget**.

An example of a UI definition fragment specifying an accessible:

    <object class="GtkButton" id="label1"/>
      <property name="label">I am a Label for a Button</property>
    </object>
    <object class="GtkButton" id="button1">
      <accessibility>
        <action action_name="click" 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="accessible-name">
            Clickable Button
          </property>
        </object>
      </child>
    </object>

Finally, **Gnome::Gtk3::Widget** allows style information such as style classes to be associated with widgets, using the custom <style> element:

    <object class="GtkButton>" id="button1">
      <style>
        <class name="my-special-button-class"/>
        <class name="dark-button"/>
      </style>
    </object>

Synopsis
========

Declaration
-----------

    unit class Gnome::Gtk3::Widget;
    also is Gnome::GObject::InitiallyUnowned;
    also does Gnome::Gtk3::Buildable;

Uml Diagram
-----------

![](plantuml/Widget.svg)

Example
-------

    # create a button and set a tooltip
    my Gnome::Gtk3::Button $start-button .= new(:label<Start>);
    $start-button.set-tooltip-text('Nooooo don\'t touch that button!!!!!!!');

Types
=====

enum GtkWidgetHelpType
----------------------

Kinds of widget-specific help. Used by the ::show-help signal.

  * GTK_WIDGET_HELP_TOOLTIP: Tooltip.

  * GTK_WIDGET_HELP_WHATS_THIS: What’s this.

class N-GtkRequisition
----------------------

A **Gnome::Gtk3::Requisition**-struct represents the desired size of a widget. See [**Gnome::Gtk3::Widget**’s geometry management section][geometry-management] for more information.

  * Int $.width: the widget’s desired width

  * Int $.height: the widget’s desired height

class N-GtkAllocation
---------------------

A N-GtkAllocation of a widget represents a region which has been allocated to the widget by its parent. It is a subregion of its parents allocation. See GtkWidget’s geometry management section for more information.

  * Int $.x;

  * Int $.y;

  * Int $.width;

  * Int $.height;

Methods
=======

activate
--------

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

Returns: `True` if the widget was activatable

    method activate ( --> Bool )

add-device-events
-----------------

Adds the device events in the bitfield *events* to the event mask for *widget*. See `set-device-events()` for details.

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

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

  * Int $events; an event mask. Mask bit values are from GdkEventMask.

add-events
----------

Adds the events in the bitfield *$events* to the event mask for *widget*. See `set-events()` and the [input handling overview](https://developer.gnome.org/gtk3/stable/chap-input-handling.html#event-masks) for details.

    method add-events ( Int $events )

  * Int $events; an event mask, see GdkEventMask in **Gnome::Gdk3::Types**.

add-mnemonic-label
------------------

Adds a widget to the list of mnemonic labels for this widget. (See `list-mnemonic-labels()`). Note the list of mnemonic labels for the widget is cleared when the widget is destroyed, so the caller must make sure to update its internal state at this point as well, by using a connection to the *destroy* signal or a weak notifier.

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

  * N-GObject $label; a **Gnome::Gtk3::Widget** that acts as a mnemonic label for *widget*

can-activate-accel
------------------

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.

Returns: `True` if the accelerator can be activated.

    method can-activate-accel ( UInt $signal_id --> Bool )

  * UInt $signal_id; the ID of a signal installed on *widget*

child-focus
-----------

This function is used by custom widget implementations; if you're writing an app, you’d use `grab-focus()` to move the focus to a particular widget, and `gtk-container-set-focus-chain()` to change the focus tab order. So you may want to investigate those functions instead.

`child-focus()` is called by containers as the user moves around the window using keyboard shortcuts. *direction* indicates what kind of motion is taking place (up, down, left, right, tab forward, tab backward). `child-focus()` emits the *focus* signal; widgets override the default handler for this signal in order to implement appropriate focus behavior.

The default *focus* handler for a widget should return `True` if moving in *direction* left the focus on a focusable location inside that widget, and `False` if moving in *direction* moved the focus outside the widget. If returning `True`, widgets normally call `grab-focus()` to place the focus accordingly; if returning `False`, they don’t modify the current focus location.

Returns: `True` if focus ended up inside *widget*

    method child-focus ( GtkDirectionType $direction --> Bool )

  * GtkDirectionType $direction; direction of focus movement

child-notify
------------

Emits a *child-notify* signal for the [child property][child-properties] *child-property* on *widget*.

This is the analogue of `g-object-notify()` for child properties.

Also see `gtk-container-child-notify()`.

    method child-notify ( Str $child_property )

  * Str $child_property; the name of a child property installed on the class of *widget*’s parent

compute-expand
--------------

Computes whether a container should give this widget extra space when possible. Containers should check this, rather than looking at `get-hexpand()` or `get-vexpand()`.

This function already checks whether the widget is visible, so visibility does not need to be checked separately. Non-visible widgets are not expanded.

The computed expand value uses either the expand setting explicitly set on the widget itself, or, if none has been explicitly set, the widget may expand if some of its children do.

Returns: whether widget tree rooted here should be expanded

    method compute-expand ( GtkOrientation $orientation --> Bool )

  * GtkOrientation $orientation; expand direction

destroy
-------

Destroys a widget.

When a widget is destroyed all references it holds on other objects will be released:

  * if the widget is inside a container, it will be removed from its parent

  * if the widget is a container, all its children will be destroyed, recursively

  * if the widget is a top level, it will be removed from the list of top level widgets that GTK+ maintains internally

It's expected that all references held on the widget will also be released; you should connect to the *destroy* signal if you hold a reference to *widget* and you wish to remove it when this function is called.

It's important to notice that `destroy()` will only cause the *widget* to be finalized if no additional references, acquired using `g-object-ref()`, are held on it. In case additional references are in place, the *widget* will be in an "inert" state after calling this function; *widget* will still point to valid memory, allowing you to release the references you hold, but you may not query the widget's own state.

You should typically call this function on top level widgets, and rarely on child widgets.

See also: `gtk-container-remove()`

    method destroy ( )

destroyed
---------

This function sets *$widget* to `undefined` if *$widget* != `undefined`. 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 `undefined`. Useful for example to avoid multiple copies of the same dialog.

    method destroyed ( N-GObject $widget )

  * N-GObject $widget; the widget to clear *widget*

device-is-shadowed
------------------

Returns `True` if *device* has been shadowed by a GTK+ device grab on another widget, so it would stop sending events to *widget*. This may be used in the *grab-notify* signal to check for specific devices. See `gtk-device-grab-add()`.

Returns: `True` if there is an ongoing grab on *device* by another **Gnome::Gtk3::Widget** than *widget*.

    method device-is-shadowed ( N-GObject $device --> Bool )

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

draw
----

Draws *widget* to *cr*. The top left corner of the widget will be drawn to the currently set origin point of *cr*.

You should pass a cairo context as *cr* argument that is in an original state. Otherwise the resulting drawing is undefined. For example changing the operator using `cairo-set-operator()` or the line width using `cairo-set-line-width()` might have unwanted side effects. You may however change the context’s transform matrix - like with `cairo-scale()`, `cairo-translate()` or `cairo-set-matrix()` and clip region with `cairo-clip()` prior to calling this function. Also, it is fine to modify the context with `cairo-save()` and `cairo-push-group()` prior to calling this function.

Note that special-purpose widgets may contain special code for rendering to the screen and might appear differently on screen and when rendered using `draw()`.

    method draw ( cairo_t $cr )

  * cairo_t $cr; a cairo context to draw to

error-bell
----------

Notifies the user about an input-related error on this widget. If the *gtk-error-bell* setting is `True`, it calls `gdk-window-beep()`, otherwise it does nothing.

Note that the effect of `gdk-window-beep()` can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.

    method error-bell ( )

event
-----

Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use `gtk-main-do-event()` so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use `gdk-window-invalidate-rect()` to invalidate a region of the window.

Returns: return from the event signal emission (`True` if the event was handled)

    method event ( GdkEvent $event --> Bool )

  * GdkEvent $event; a **Gnome::Gtk3::Event**

freeze-child-notify
-------------------

Stops emission of *child-notify* signals on *widget*. The signals are queued until `thaw-child-notify()` is called on *widget*.

This is the analogue of `g-object-freeze-notify()` for child properties.

    method freeze-child-notify ( )

get-allocated-baseline
----------------------

Returns the baseline that has currently been allocated to *widget*. This function is intended to be used when implementing handlers for the *draw* function, and when allocating child widgets in *size-allocate*.

Returns: the baseline of the *widget*, or -1 if none

    method get-allocated-baseline ( --> Int )

get-allocated-height
--------------------

Returns the height that has currently been allocated to *widget*. This function is intended to be used when implementing handlers for the *draw* function.

Returns: the height of the *widget*

    method get-allocated-height ( --> Int )

get-allocated-size
------------------

Retrieves the widget’s allocated size.

This function returns the last values passed to `size-allocate-with-baseline()`. The value differs from the size returned in `get-allocation()` in that functions like `set-halign()` can adjust the allocation, but not the value returned by this function.

If a widget is not visible, its allocated size is 0.

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

returns a List with

  * N-GtkAllocation

  * int32 $baseline

get-allocated-width
-------------------

Returns the width that has currently been allocated to *widget*. This function is intended to be used when implementing handlers for the *draw* function.

Returns: the width of the *widget*

    method get-allocated-width ( --> Int )

get-allocation
--------------

Retrieves the widget’s allocation.

Note, when implementing a **Gnome::Gtk3::Container**: a widget’s allocation will be its “adjusted” allocation, that is, the widget’s parent container typically calls `size-allocate()` with an allocation, and that allocation is then adjusted (to handle margin and alignment for example) before assignment to the widget.

`get-allocation()` returns the adjusted allocation that was actually assigned to the widget. The adjusted allocation is guaranteed to be completely contained within the `size-allocate()` allocation, however.

So a **Gnome::Gtk3::Container** is guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the container assigned. There is no way to get the original allocation assigned by `size-allocate()`, since it isn’t stored; if a container implementation needs that information it will have to track it itself.

    method get-allocation ( --> N-GtkAllocation )

Returns a N-GtkAllocation

get-ancestor, get-ancestor-rk
-----------------------------

Gets the first ancestor of *widget* with type *$widget-type*. For example, `$widget.get-ancestor(GTK-TYPE-BOX)` gets the first native **Gnome::Gtk3::Box** 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 **Gnome::Gtk3::Window** in the docs for `get-toplevel()`.

Note that unlike `is-ancestor()`, `get-ancestor()` considers this *widget* to be an ancestor of itself.

Returns: the ancestor widget, or `undefined` if not found

    method get-ancestor-rk (
      GType $widget-type, :$child-type? --> Gnome::GObject::Object
    )

    method get-ancestor-rk (
      Str $gtk-widget-type-name, :$child-type? --> Gnome::GObject::Object
    )

    method get-ancestor-rk (
      Gnome::Gtk3::Widget $widget, :$child-type?
      --> Gnome::GObject::Object
    )

    method get-ancestor ( GType $widget-type --> N-GObject )

  * N-GObject $widget-type; ancestor type. One can use `$widget.get-class-gtype` to get the GType of an object.

  * Str $gtk-widget-type-name; an ancester object name of how Gtk names these objects. Examples are `GtkWidget` and `GtkDialog`.

  * Gnome::Gtk3::Widget $widget; a raku 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.

The return value **Gnome::GObject::Object** means any child raku object. N-GObject is the type of the native object.

### Example

    class WGrid {
      submethod BUILD ( ) {
        my Gnome::Gtk3::Button $b .= new(:label<Start>);
        $b.register-signal( self, 'button-action', 'clicked');

        my Gnome::Gtk3::Grid $g .= new;
        $g.attach( $b, 0, 0, 1, 1);

        my Gnome::Gtk3::Window $w .= new;
        $w.set-title('My Button In My Window');
        $w.add($g);
        $w.show-all();
      }

      method button-action ( :_widget($button) ) {
        my Gnome::Gtk3::Window $window = $button.get-ancestor-rk('GtkWindow');
        …
      }
    }

    my WGrid $wgrid .= new;
    Gnome::Gtk3::Main.new.main;

get-app-paintable
-----------------

Determines whether the application intends to draw on the widget in an *draw* handler.

See `set-app-paintable()`

Returns: `True` if the widget is app paintable

    method get-app-paintable ( --> Bool )

get-can-default
---------------

Determines whether *widget* can be a default widget. See `set-can-default()`.

Returns: `True` if *widget* can be a default widget, `False` otherwise

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

get-can-focus
-------------

Determines whether *widget* can own the input focus. See `set-can-focus()`.

Returns: `True` if *widget* can own the input focus, `False` otherwise

    method get-can-focus ( --> Bool )

get-child-visible
-----------------

Gets the value set with `set-child-visible()`. If you feel a need to use this function, your code probably needs reorganization.

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

Returns: `True` if the widget is mapped with the parent.

    method get-child-visible ( --> Bool )

get-clip
--------

Retrieves the widget’s clip area.

The clip area is the area in which all of *widget*'s drawing will happen. Other toolkits call it the bounding box.

Historically, in GTK+ the clip area has been equal to the allocation retrieved via `get-allocation()`.

    method get-clip ( --> N-GtkAllocation )

Returns a N-GtkAllocation clip

get-default-direction
---------------------

Obtains the current default reading direction. See `set-default-direction()`.

Returns: the current default direction.

    method get-default-direction ( --> GtkTextDirection )

get-device-enabled
------------------

Returns whether *device* can interact with *widget* and its children. See `set-device-enabled()`.

Returns: `True` is *device* is enabled for *widget*

    method get-device-enabled ( N-GObject $device --> Bool )

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

get-device-events
-----------------

Returns the events mask for the widget corresponding to an specific device. These are the events that the widget will receive when *device* operates on it. Flags in this mask are from `GdkEventMask` in **Gnome::Gdk3::Types**.

Returns: device event mask for *widget*

    method get-device-events ( N-GObject $device --> Int )

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

get-direction
-------------

Gets the reading direction for a particular widget. See `set-direction()`.

Returns: the reading direction for the widget.

    method get-direction ( --> GtkTextDirection )

get-display, get-display-rk
---------------------------

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

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

    method get-display-rk ( --> Gnome::Gdk3::Display )
    method get-display ( --> N-GObject )

get-events
----------

Returns the event mask (see GdkEventMask) for the widget. These are the events that the widget will receive.

Note: Internally, the widget event mask will be the logical OR of the event mask set through `set-events()` or `add-events()`, and the event mask necessary to cater for every **Gnome::Gtk3::EventController** created for the widget.

Returns: event mask for *widget*

    method get-events ( --> Int )

get-focus-on-click
------------------

Returns whether the widget should grab focus when it is clicked with the mouse. See `set-focus-on-click()`.

Returns: `True` if the widget should grab focus when it is clicked with the mouse.

    method get-focus-on-click ( --> Bool )

get-font-options
----------------

Returns the **cairo-font-options-t** used for Pango rendering. When not set, the defaults font options for the **Gnome::Gdk3::Screen** will be used.

Returns: the **cairo-font-options-t** or `undefined` if not set

    method get-font-options ( --> cairo_font_options_t )

get-halign
----------

Gets the value of the *halign* property.

For backwards compatibility reasons this method will never return `GTK-ALIGN-BASELINE`, but instead it will convert it to `GTK-ALIGN-FILL`. Baselines are not supported for horizontal alignment.

Returns: the horizontal alignment of *widget*

    method get-halign ( --> GtkAlign )

get-has-tooltip
---------------

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

Returns: current value of has-tooltip on *widget*.

    method get-has-tooltip ( --> Bool )

get-has-window
--------------

Determines whether *widget* has a **Gnome::Gtk3::Window** of its own. See `set-has-window()`.

Returns: `True` if *widget* has a window, `False` otherwise

    method get-has-window ( --> Bool )

get-hexpand
-----------

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

Containers should use `compute-expand()` rather than this function, to see whether a widget, or any of its children, has the expand flag set. If any child of a widget wants to expand, the parent may ask to expand also.

This function only looks at the widget’s own hexpand flag, rather than computing whether the entire widget tree rooted at this widget wants to expand.

Returns: whether hexpand flag is set

    method get-hexpand ( --> Bool )

get-hexpand-set
---------------

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

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.

Returns: whether hexpand has been explicitly set

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

get-mapped
----------

Whether the widget is mapped.

Returns: `True` if the widget is mapped, `False` otherwise.

    method get-mapped ( --> Bool )

get-margin-bottom
-----------------

Gets the value of the *margin-bottom* property.

Returns: The bottom margin of *widget*

    method get-margin-bottom ( --> Int )

get-margin-end
--------------

Gets the value of the *margin-end* property.

Returns: The end margin of *widget*

    method get-margin-end ( --> Int )

get-margin-start
----------------

Gets the value of the *margin-start* property.

Returns: The start margin of *widget*

    method get-margin-start ( --> Int )

get-margin-top
--------------

Gets the value of the *margin-top* property.

Returns: The top margin of *widget*

    method get-margin-top ( --> Int )

get-modifier-mask
-----------------

Returns the modifier mask the *widget*’s windowing system backend uses for a particular purpose.

See `gdk-keymap-get-modifier-mask()`.

Returns: the modifier mask used for *intent*. The mask bits are GdkModifierType

    method get-modifier-mask ( GdkModifierIntent $intent --> Int )

  * GdkModifierIntent $intent; the use case for the modifier mask

get-name
--------

Retrieves the name of a widget. See `set-name()` for the significance of widget names.

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

    method get-name ( --> Str )

get-no-show-all
---------------

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

Returns: the current value of the “no-show-all” property.

    method get-no-show-all ( --> Bool )

get-opacity
-----------

Fetches the requested opacity for this widget. See `set-opacity()`.

Returns: the requested opacity for this widget.

    method get-opacity ( --> Num )

get-parent, get-parent-rk
-------------------------

Returns the parent object of this *widget* or `undefined` in the case of the native object or invalid in the case of a raku object.

    method get-parent ( --> N-GObject )
    method get-parent-rk ( :$child-type? --> Gnome::GObject::Object )

  * $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-parent-window, get-parent-window-rk
---------------------------------------

Gets *widget*’s parent window, or `undefined` if it does not have one.

Returns: the parent window of *widget*, or `undefined` if it does not have a parent window.

    method get-parent-window ( --> N-GObject )
    method get-parent-window-rk ( :$child-type? --> Gnome::GObject::Object )

  * $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-path, get-path-rk
---------------------

Returns the **Gnome::Gtk3::WidgetPath** representing *widget*, if the widget is not connected to a toplevel widget, a partial path will be created.

Returns: The **Gnome::Gtk3::WidgetPath** representing *widget*

    method get-path ( --> N-GObject )
    method get-path-rk ( --> Gnome::Gtk3::WidgetPath )

get-preferred-height
--------------------

Retrieves a widget’s initial minimum and natural height.

This call is specific to width-for-height requests.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    method get-preferred-height ( --> List )

Returns a List with

  * Int minimum_height;

  * Int natural_height;

get-preferred-height-and-baseline-for-width
-------------------------------------------

Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width , or the default height if width is -1. The baselines may be -1 which means that no baseline is requested for this widget.

The returned request will be modified by the GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    method get-preferred-height-and-baseline-for-width (
      Int $width --> List
    )

  * Int $width;

Returns a List containing;

  * Int minimum_height;

  * Int natural_height;

  * Int minimum_baseline;

  * Int natural_baseline;

get-preferred-height-for-width
------------------------------

Retrieves a widget’s minimum and natural height if it would be given the specified width .

    method get-preferred-height-for-width ( Int $width --> List )

  * Int $width;

Returning a List with

  * Int minimum_height;

  * Int natural_height;

get-preferred-size
------------------

Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management.

This is used to retrieve a suitable size by container widgets which do not impose any restrictions on the child placement. It can be used to deduce toplevel window and menu sizes as well as child widgets in free-form containers such as GtkLayout.

Handle with care. Note that the natural height of a height-for-width widget will generally be a smaller size than the minimum height, since the required height for the natural width is generally smaller than the required height for the minimum width.

Use gtk_widget_get_preferred_height_and_baseline_for_width() if you want to support baseline alignment.

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

The returned list holds

  * N-GtkRequisition $minimum_size;

  * N-GtkRequisition $natural_size;

get-preferred-width
-------------------

Retrieves a widget’s initial minimum and natural width.

This call is specific to height-for-width requests.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    method get-preferred-width ( --> List )

Returned List holds;

  * Int minimum_width;

  * Int natural_width;

get-preferred-width-for-height
------------------------------

Retrieves a widget’s minimum and natural width if it would be given the specified height .

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    method get-preferred-width-for-height ( Int $height --> List )

  * Int $height;

The returned List holds

  * Int minimum_width;

  * Int natural_width;

get-realized
------------

Determines whether *widget* is realized.

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

    method get-realized ( --> Bool )

get-receives-default
--------------------

Determines whether *widget* is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

See `set-receives-default()`.

Returns: `True` if *widget* acts as the default widget when