### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/Widget.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 8
 property or C<undefined> if I<class> has no style property with that name.

  method class-find-style-property ( GtkWidgetClass $klass, Str $property_name --> GParamSpec )

=item GtkWidgetClass $klass; a B<Gnome::Gtk3::WidgetClass>
=item Str $property_name; the name of the style property to find

=end pod

method class-find-style-property ( GtkWidgetClass $klass, Str $property_name --> GParamSpec ) {

  gtk_widget_class_find_style_property(
    self._f('GtkWidget'), $klass, $property_name
  )
}

sub gtk_widget_class_find_style_property (
  GtkWidgetClass $klass, gchar-ptr $property_name --> GParamSpec
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-get-css-name:
=begin pod
=head2 class-get-css-name

Gets the name used by this class for matching in CSS code. See C<class-set-css-name()> for details.

Returns: the CSS name of the given class

  method class-get-css-name ( GtkWidgetClass $widget_class --> Str )

=item GtkWidgetClass $widget_class; class to set the name on

=end pod

method class-get-css-name ( GtkWidgetClass $widget_class --> Str ) {

  gtk_widget_class_get_css_name(
    self._f('GtkWidget'), $widget_class
  )
}

sub gtk_widget_class_get_css_name (
  GtkWidgetClass $widget_class --> gchar-ptr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-install-style-property:
=begin pod
=head2 class-install-style-property

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

  method class-install-style-property ( GtkWidgetClass $klass, GParamSpec $pspec )

=item GtkWidgetClass $klass; a B<Gnome::Gtk3::WidgetClass>
=item GParamSpec $pspec; the B<Gnome::Gtk3::ParamSpec> for the property

=end pod

method class-install-style-property ( GtkWidgetClass $klass, GParamSpec $pspec ) {

  gtk_widget_class_install_style_property(
    self._f('GtkWidget'), $klass, $pspec
  );
}

sub gtk_widget_class_install_style_property (
  GtkWidgetClass $klass, GParamSpec $pspec
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-install-style-property-parser:
=begin pod
=head2 class-install-style-property-parser

Installs a style property on a widget class.

  method class-install-style-property-parser ( GtkWidgetClass $klass, GParamSpec $pspec, GtkRcPropertyParser $parser )

=item GtkWidgetClass $klass; a B<Gnome::Gtk3::WidgetClass>
=item GParamSpec $pspec; the B<Gnome::Gtk3::ParamSpec> for the style property
=item GtkRcPropertyParser $parser; the parser for the style property

=end pod

method class-install-style-property-parser ( GtkWidgetClass $klass, GParamSpec $pspec, GtkRcPropertyParser $parser ) {

  gtk_widget_class_install_style_property_parser(
    self._f('GtkWidget'), $klass, $pspec, $parser
  );
}

sub gtk_widget_class_install_style_property_parser (
  GtkWidgetClass $klass, GParamSpec $pspec, GtkRcPropertyParser $parser
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-list-style-properties:
=begin pod
=head2 class-list-style-properties

Returns all style properties of a widget class.

Returns: (array length=n-properties) (transfer container): a newly allocated array of B<Gnome::Gtk3::ParamSpec>*. The array must be freed with C<g-free()>.

  method class-list-style-properties ( GtkWidgetClass $klass, guint $n_properties --> GParamSpec )

=item GtkWidgetClass $klass; a B<Gnome::Gtk3::WidgetClass>
=item guInt-ptr $n_properties; location to return the number of style properties found

=end pod

method class-list-style-properties ( GtkWidgetClass $klass, guInt-ptr $n_properties --> GParamSpec ) {

  gtk_widget_class_list_style_properties(
    self._f('GtkWidget'), $klass, $n_properties
  )
}

sub gtk_widget_class_list_style_properties (
  GtkWidgetClass $klass, gugint-ptr $n_properties --> GParamSpec
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-set-accessible-role:
=begin pod
=head2 class-set-accessible-role

Sets the default B<AtkRole> to be set on accessibles created for widgets of I<widget-class>. Accessibles may decide to not honor this setting if their role reporting is more refined. Calls to C<class-set-accessible-type()> will reset this value.

In cases where you want more fine-grained control over the role of accessibles created for I<widget-class>, you should provide your own accessible type and use C<class-set-accessible-type()> instead.

If I<role> is B<ATK-ROLE-INVALID>, the default role will not be changed and the accessible’s default role will be used instead.

This function should only be called from class init functions of widgets.

  method class-set-accessible-role ( GtkWidgetClass $widget_class, AtkRole $role )

=item GtkWidgetClass $widget_class; class to set the accessible role for
=item AtkRole $role; The role to use for accessibles created for I<widget-class>

=end pod

method class-set-accessible-role ( GtkWidgetClass $widget_class, AtkRole $role ) {

  gtk_widget_class_set_accessible_role(
    self._f('GtkWidget'), $widget_class, $role
  );
}

sub gtk_widget_class_set_accessible_role (
  GtkWidgetClass $widget_class, AtkRole $role
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-set-accessible-type:
=begin pod
=head2 class-set-accessible-type

Sets the type to be used for creating accessibles for widgets of I<widget-class>. The given I<type> must be a subtype of the type used for accessibles of the parent class.

This function should only be called from class init functions of widgets.

  method class-set-accessible-type ( GtkWidgetClass $widget_class, N-GObject $type )

=item GtkWidgetClass $widget_class; class to set the accessible type for
=item N-GObject $type; The object type that implements the accessible for I<widget-class>

=end pod

method class-set-accessible-type ( GtkWidgetClass $widget_class, $type is copy ) {
  $type .= _get-native-object-no-reffing unless $type ~~ N-GObject;

  gtk_widget_class_set_accessible_type(
    self._f('GtkWidget'), $widget_class, $type
  );
}

sub gtk_widget_class_set_accessible_type (
  GtkWidgetClass $widget_class, N-GObject $type
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-set-connect-func:
=begin pod
=head2 class-set-connect-func

For use in language bindings, this will override the default B<Gnome::Gtk3::BuilderConnectFunc> to be used when parsing GtkBuilder XML from this class’s template data.

Note that this must be called from a composite widget classes class initializer after calling C<class-set-template()>.

  method class-set-connect-func ( GtkWidgetClass $widget_class, GtkBuilderConnectFunc $connect_func, Pointer $connect_data, GDestroyNotify $connect_data_destroy )

=item GtkWidgetClass $widget_class; A B<Gnome::Gtk3::WidgetClass>
=item GtkBuilderConnectFunc $connect_func; The B<Gnome::Gtk3::BuilderConnectFunc> to use when connecting signals in the class template
=item Pointer $connect_data; The data to pass to I<connect-func>
=item GDestroyNotify $connect_data_destroy; The B<Gnome::Gtk3::DestroyNotify> to free I<connect-data>, this will only be used at class finalization time, when no classes of type I<widget-type> are in use anymore.

=end pod

method class-set-connect-func ( GtkWidgetClass $widget_class, GtkBuilderConnectFunc $connect_func, Pointer $connect_data, GDestroyNotify $connect_data_destroy ) {

  gtk_widget_class_set_connect_func(
    self._f('GtkWidget'), $widget_class, $connect_func, $connect_data, $connect_data_destroy
  );
}

sub gtk_widget_class_set_connect_func (
  GtkWidgetClass $widget_class, GtkBuilderConnectFunc $connect_func, gpointer $connect_data, GDestroyNotify $connect_data_destroy
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-set-css-name:
=begin pod
=head2 class-set-css-name

Sets the name to be used for CSS matching of widgets.

If this function is not called for a given class, the name of the parent class is used.

  method class-set-css-name ( GtkWidgetClass $widget_class, Str $name )

=item GtkWidgetClass $widget_class; class to set the name on
=item Str $name; name to use

=end pod

method class-set-css-name ( GtkWidgetClass $widget_class, Str $name ) {

  gtk_widget_class_set_css_name(
    self._f('GtkWidget'), $widget_class, $name
  );
}

sub gtk_widget_class_set_css_name (
  GtkWidgetClass $widget_class, gchar-ptr $name
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-set-template:
=begin pod
=head2 class-set-template

This should be called at class initialization time to specify the GtkBuilder XML to be used to extend a widget.

For convenience, C<class-set-template-from-resource()> is also provided.

Note that any class that installs templates must call C<init-template()> in the widget’s instance initializer.

  method class-set-template ( GtkWidgetClass $widget_class, N-GObject $template_bytes )

=item GtkWidgetClass $widget_class; A B<Gnome::Gtk3::WidgetClass>
=item N-GObject $template_bytes; A B<Gnome::Gtk3::Bytes> holding the B<Gnome::Gtk3::Builder> XML

=end pod

method class-set-template ( GtkWidgetClass $widget_class, $template_bytes is copy ) {
  $template_bytes .= _get-native-object-no-reffing unless $template_bytes ~~ N-GObject;

  gtk_widget_class_set_template(
    self._f('GtkWidget'), $widget_class, $template_bytes
  );
}

sub gtk_widget_class_set_template (
  GtkWidgetClass $widget_class, N-GObject $template_bytes
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:class-set-template-from-resource:
=begin pod
=head2 class-set-template-from-resource

A convenience function to call C<class-set-template()>.

Note that any class that installs templates must call C<init-template()> in the widget’s instance initializer.

  method class-set-template-from-resource ( GtkWidgetClass $widget_class, Str $resource_name )

=item GtkWidgetClass $widget_class; A B<Gnome::Gtk3::WidgetClass>
=item Str $resource_name; The name of the resource to load the template from

=end pod

method class-set-template-from-resource ( GtkWidgetClass $widget_class, Str $resource_name ) {

  gtk_widget_class_set_template_from_resource(
    self._f('GtkWidget'), $widget_class, $resource_name
  );
}

sub gtk_widget_class_set_template_from_resource (
  GtkWidgetClass $widget_class, gchar-ptr $resource_name
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:compute-expand:
=begin pod
=head2 compute-expand

Computes whether a container should give this widget extra space when possible. Containers should check this, rather than looking at C<get-hexpand()> or C<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 )

=item GtkOrientation $orientation; expand direction

=end pod

method compute-expand ( GtkOrientation $orientation --> Bool ) {
  gtk_widget_compute_expand( self._f('GtkWidget'), $orientation).Bool
}

sub gtk_widget_compute_expand (
  N-GObject $widget, GEnum $orientation --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:create-pango-context:
=begin pod
=head2 create-pango-context

Creates a new native B<Gnome::Pango::Context> with the appropriate font map, font options, font description, and base direction for drawing text for this widget. See also C<.get-pango-context()>.

  method create-pango-context ( --> N-GObject )

=head3 Example

  use Gnome::Gtk3::Button:api<1>;
  use Gnome::Pango::Context:api<1>;
  
  my $button .= new(:label<start>);
  my Gnome::Pango::Context() $pcontext = $button.create-pango-context;

=end pod

method create-pango-context ( --> N-GObject ) {
  gtk_widget_create_pango_context(self._f('GtkWidget'))
}

sub gtk_widget_create_pango_context (
  N-GObject $widget --> N-GObject
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:create-pango-layout:
=begin pod
=head2 create-pango-layout

Creates a new B<PangoLayout> with the appropriate font map, font description, and base direction for drawing text for this widget.

If you keep a B<PangoLayout> created in this way around, you need to re-create it when the widget B<PangoContext> is replaced. This can be tracked by using the  I<screen-changed> signal on the widget.

Returns: the new B<PangoLayout>

  method create-pango-layout ( Str $text --> N-GObject )

=item Str $text; text to set on the layout (can be C<undefined>)

=end pod

method create-pango-layout ( Str $text --> N-GObject ) {
  gtk_widget_create_pango_layout( self._f('GtkWidget'), $text)
}

sub gtk_widget_create_pango_layout (
  N-GObject $widget, gchar-ptr $text --> N-GObject
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:destroy:
=begin pod
=head2 destroy

Destroys a widget.

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

=item if the widget is inside a container, it will be removed from its parent
=item if the widget is a container, all its children will be destroyed, recursively
=item 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  I<destroy> signal if you hold a reference to I<widget> and you wish to remove it when this function is called.
=comment It is not necessary to do so if you are implementing a B<Gnome::Gtk3::Container>, as you'll be able to use the C<Gnome::Gtk3::ContainerClass.remove()> virtual function for that.

It's important to notice that C<destroy()> will only cause the I<widget> to be finalized if no additional references, acquired using C<g-object-ref()>, are held on it. In case additional references are in place, the I<widget> will be in an "inert" state after calling this function; I<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: C<gtk-container-remove()>

  method destroy ( )

=end pod

method destroy ( ) {
  gtk_widget_destroy(self._f('GtkWidget'));
  self._set_invalid;
}

sub gtk_widget_destroy (
  N-GObject $widget
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:destroyed:
=begin pod
=head2 destroyed

This function sets I<$widget> to C<undefined> if I<$widget> != C<undefined>. It’s intended to be used as a callback connected to the “destroy” signal of a widget. You connect C<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 C<undefined>. Useful for example to avoid multiple copies of the same dialog.

  method destroyed ( N-GObject $widget )

=item N-GObject $widget; the widget to clear I<widget>

=end pod

method destroyed ( $widget ) {
  my $no = $widget;
  if $no !~~ N-GObject {
    $no .= _get-native-object-no-reffing;
    $widget._set_invalid;
  }

  gtk_widget_destroyed( self._f('GtkWidget'), $no);
}

sub gtk_widget_destroyed (
  N-GObject $widget, N-GObject $widget_pointer
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:device-is-shadowed:
=begin pod
=head2 device-is-shadowed

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

Returns: C<True> if there is an ongoing grab on I<device> by another B<Gnome::Gtk3::Widget> than I<widget>.

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

=item N-GObject $device; a B<Gnome::Gdk3::Device>

=end pod

method device-is-shadowed ( $device is copy --> Bool ) {
  $device .= _get-native-object-no-reffing unless $device ~~ N-GObject;

  gtk_widget_device_is_shadowed( self._f('GtkWidget'), $device).Bool
}

sub gtk_widget_device_is_shadowed (
  N-GObject $widget, N-GObject $device --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:4:draw:Gnome::Cairo tests
=begin pod
=head2 draw

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

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

  method draw ( cairo_t $cr )

=item cairo_t $cr; a cairo context to draw to

=end pod

method draw ( $cr is copy ) {
  $cr .= _get-native-object-no-reffing unless $cr ~~ cairo_t;
  gtk_widget_draw( self._f('GtkWidget'), $cr);
}

sub gtk_widget_draw (
  N-GObject $widget, cairo_t $cr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:error-bell:
=begin pod
=head2 error-bell

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

Note that the effect of C<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 ( )

=end pod

method error-bell ( ) {
  gtk_widget_error_bell(self._f('GtkWidget'));
}

sub gtk_widget_error_bell (
  N-GObject $widget
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:event:
=begin pod
=head2 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 C<gtk-main-do-event()> so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use C<gdk-window-invalidate-rect()> to invalidate a region of the window.

Returns: return from the event signal emission (C<True> if the event was handled)

  method event ( GdkEvent $event --> Bool )

=item GdkEvent $event; a B<Gnome::Gtk3::Event>

=end pod

method event ( GdkEvent $event --> Bool ) {
  gtk_widget_event( self._f('GtkWidget'), $event ).Bool
}

sub gtk_widget_event (
  N-GObject $widget, GdkEvent $event --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:freeze-child-notify:
=begin pod
=head2 freeze-child-notify

Stops emission of  I<child-notify> signals on I<widget>. The signals are queued until C<thaw-child-notify()> is called on I<widget>.

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

  method freeze-child-notify ( )

=end pod

method freeze-child-notify ( ) {
  gtk_widget_freeze_child_notify(self._f('GtkWidget'));
}

sub gtk_widget_freeze_child_notify (
  N-GObject $widget
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:get-accessible:
=begin pod
=head2 get-accessible

Returns the accessible object that describes the widget to an assistive technology.

If accessibility support is not available, this B<AtkObject> instance may be a no-op. Likewise, if no class-specific B<AtkObject> implementation is available for the widget instance in question, it will inherit an B<AtkObject> implementation from the first ancestor class for which such an implementation is defined.

The documentation of the [ATK](http://developer.gnome.org/atk/stable/) library contains more information about accessible objects and their uses.

Returns: the B<AtkObject> associated with I<widget>

  method get-accessible ( --> AtkObject )

=end pod

method get-accessible ( --> AtkObject ) {

  gtk_widget_get_accessible(
    self._f('GtkWidget'),
  )
}

sub gtk_widget_get_accessible (
  N-GObject $widget --> AtkObject
) is native(&gtk-lib)
  { * }
}}

#`{{ ActionGroup is deprecated
#-------------------------------------------------------------------------------
# TM:0:get-action-group:
=begin pod
=head2 get-action-group

Retrieves the B<Gnome::Gtk3::ActionGroup> that was registered using I<$prefix>. The resulting B<Gnome::Gtk3::ActionGroup> may have been registered to I<widget> or any B<Gnome::Gtk3::Widget> in its ancestry.

If no action group was found matching I<prefix>, then C<undefined> is returned.

Returns: A B<Gnome::Gtk3::ActionGroup> based object or C<undefined>.

  method get-action-group ( Str $prefix --> N-GObject )

=item Str $prefix; The “prefix” of the action group.

=end pod

method get-action-group ( Str $prefix --> N-GObject ) {
  gtk_widget_get_action_group( self._f('GtkWidget'), $prefix)
}

sub gtk_widget_get_action_group (
  N-GObject $widget, gchar-ptr $prefix --> N-GObject
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:get-allocated-baseline:
=begin pod
=head2 get-allocated-baseline

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

Returns: the baseline of the I<widget>, or -1 if none

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

=end pod

method get-allocated-baseline ( --> Int ) {
  gtk_widget_get_allocated_baseline(self._f('GtkWidget'))
}

sub gtk_widget_get_allocated_baseline (
  N-GObject $widget --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-allocated-height:
=begin pod
=head2 get-allocated-height

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

Returns: the height of the I<widget>

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

=end pod

method get-allocated-height ( --> Int ) {
  gtk_widget_get_allocated_height(self._f('GtkWidget'))
}

sub gtk_widget_get_allocated_height (
  N-GObject $widget --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-allocated-size:
=begin pod
=head2 get-allocated-size

Retrieves the widget’s allocated size.

This function returns the last values passed to C<size-allocate-with-baseline()>. The value differs from the size returned in C<get-allocation()> in that functions like C<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
=item N-GtkAllocation
=item int32 $baseline

=end pod

method get-allocated-size ( --> List ) {
  my N-GtkAllocation $a .= new;
  my gint32 $b;
  gtk_widget_get_allocated_size(
    self._f('GtkWidget'), $a, $b
  );

  ( $a, $b)
}

#`{{
sub gtk_widget_get_allocated_size ( N-GObject $widget --> List ) {
   my N-GtkAllocation $a .= new;
   my int32 $b;
   _gtk_widget_get_allocated_size( $widget, $a, $b);

  ( $a, $b)
}
}}

sub gtk_widget_get_allocated_size (
  N-GObject $widget, N-GtkAllocation $allocation, gint $baseline is rw
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-allocated-width:
=begin pod
=head2 get-allocated-width

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

Returns: the width of the I<widget>

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

=end pod

method get-allocated-width ( --> Int ) {
  gtk_widget_get_allocated_width(self._f('GtkWidget'))
}

sub gtk_widget_get_allocated_width (
  N-GObject $widget --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-allocation:
=begin pod
=head2 get-allocation

Retrieves the widget’s allocation.

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

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

So a B<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 C<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

=end pod

method get-allocation ( --> N-GtkAllocation ) {
  my N-GtkAllocation $allocation .= new;
  gtk_widget_get_allocation( self._f('GtkWidget'), $allocation);
  $allocation
}

sub gtk_widget_get_allocation (
  N-GObject $widget, N-GtkAllocation $allocation
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-ancestor:
#TM:0:get-ancestor-rk:
=begin pod
=head2 get-ancestor, get-ancestor-rk

Gets the first ancestor of I<widget> with type I<$widget-type>. For example, C<$widget.get-ancestor(GTK-TYPE-BOX)> gets the first native B<Gnome::Gtk3::Box> that’s an ancestor of I<widget>. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel B<Gnome::Gtk3::Window> in the docs for C<get-toplevel()>.

Note that unlike C<is-ancestor()>, C<get-ancestor()> considers this I<widget> to be an ancestor of itself.

Returns: the ancestor widget, or C<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 )

=item N-GObject $widget-type; ancestor type. One can use C<$widget.get-class-gtype> to get the GType of an object.
=item Str $gtk-widget-type-name; an ancester object name of how Gtk names these objects. Examples are C<GtkWidget> and C<GtkDialog>.
=item Gnome::Gtk3::Widget $widget; a raku widget.
=item $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 B<Gnome::GObject::Object> means any child raku object. N-GObject is the type of the native object.

=head3 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;

=end pod

proto method get-ancestor-rk (|){*}
multi method get-ancestor-rk ( Int $widget-type, *%options --> Gnome::GObject::Object ) {
  self._wrap-native-type-from-no(
    gtk_widget_get_ancestor( self._f('GtkWidget'), $widget-type),
    |%options
  )
}

multi method get-ancestor-rk (
  Str $gtk-widget-type-name, *%options --> Gnome::GObject::Object
) {
  my GType $widget-type = Gnome::GObject::Type.new().g_type_from_name(
    $gtk-widget-type-name
  );
  self._wrap-native-type-from-no(
    gtk_widget_get_ancestor( self._f('GtkWidget'), $widget-type),
    |%options
  )
}

multi method get-ancestor-rk (
  Gnome::Gtk3::Widget $widget, *%options --> Gnome::GObject::Object
) {
  my GType $widget-type = $widget.get-class-gtype;
  self._wrap-native-type-from-no(
    gtk_widget_get_ancestor( self._f('GtkWidget'), $widget-type),
    |%options
  )
}

method get-ancestor ( Int $widget-type --> N-GObject ) {
  gtk_widget_get_ancestor( self._f('GtkWidget'), $widget-type)
}

sub gtk_widget_get_ancestor (
  N-GObject $widget, GType $widget_type --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-app-paintable:
=begin pod
=head2 get-app-paintable

Determines whether the application intends to draw on the widget in an  I<draw> handler.

See C<set-app-paintable()>

Returns: C<True> if the widget is app paintable

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

=end pod

method get-app-paintable ( --> Bool ) {
  gtk_widget_get_app_paintable(self._f('GtkWidget')).Bool
}

sub gtk_widget_get_app_paintable (
  N-GObject $widget --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-can-default:
=begin pod
=head2 get-can-default

Determines whether I<widget> can be a default widget. See C<set-can-default()>.

Returns: C<True> if I<widget> can be a default widget, C<False> otherwise

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

=end pod

method get-can-default ( --> Bool ) {
  gtk_widget_get_can_default(self._f('GtkWidget')).Bool
}

sub gtk_widget_get_can_default (
  N-GObject $widget --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-can-focus:
=begin pod
=head2 get-can-focus

Determines whether I<widget> can own the input focus. See C<set-can-focus()>.

Returns: C<True> if I<widget> can own the input focus, C<False> otherwise

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


=end pod

method get-can-focus ( --> Bool ) {
  gtk_widget_get_can_focus(self._f('GtkWidget')).Bool
}

sub gtk_widget_get_can_focus (
  N-GObject $widget --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-child-visible:
=begin pod
=head2 get-child-visible

Gets the value set with C<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: C<True> if the widget is mapped with the parent.

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

=end pod

method get-child-visible ( --> Bool ) {
  gtk_widget_get_child_visible(self._f('GtkWidget')).Bool
}

sub gtk_widget_get_child_visible (
  N-GObject $widget --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-clip:
=begin pod
=head2 get-clip

Retrieves the widget’s clip area.

The clip area is the area in which all of I<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 C<get-allocation()>.

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

Returns a N-GtkAllocation clip

=end pod

method get-clip ( --> N-GtkAllocation ) {
  my N-GtkAllocation $clip .= new;
  gtk_widget_get_clip( self._f('GtkWidget'), $clip);
  $clip
}

sub gtk_widget_get_clip (
  N-GObject $widget, N-GtkAllocation $clip
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:0:get-clipboard:
=begin pod
=head2 get-clipboard

Returns the clipboard object for the given selection to be used with I<widget>. I<widget> must have a B<Gnome::Gdk3::Display> associated with it, so must be attached to a toplevel window.

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.

  method get-clipboard ( GdkAtom $selection --> N-GObject )

=item GdkAtom $selection; a B<Gnome::Gtk3::Atom> which identifies the clipboard to use. C<GDK-SELECTION-CLIPBOARD> gives the default clipboard. Another common value is C<GDK-SELECTION-PRIMARY>, which gives the primary X selection.

=end pod

method get-clipboard ( GdkAtom $selection --> N-GObject ) {

  gtk_widget_get_clipboard(
    self._f('GtkWidget'), $selection
  )
}

sub gtk_widget_get_clipboard (
  N-GObject $widget, GdkAtom $selection --> N-GObject
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:get-default-direction:
=begin pod
=head2 get-default