### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/ListBox.rakumod
### ----------------------------------------------------
### -- Chunk 3 of 3
 * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:gtk_list_box_bind_model:
=begin pod
=head2 [[gtk_] list_box_] bind_model

Binds I<model> to I<box>.

If I<box> was already bound to a model, that previous binding is
destroyed.

The contents of I<box> are cleared and then filled with widgets that
represent items from I<model>. I<box> is updated whenever I<model> changes.
If I<model> is C<Any>, I<box> is left empty.

It is undefined to add or remove widgets directly (for example, with
C<gtk_list_box_insert()> or C<gtk_container_add()>) while I<box> is bound to a
model.

Note that using a model is incompatible with the filtering and sorting
functionality in B<Gnome::Gtk3::ListBox>. When using a model, filtering and sorting
should be implemented by the model.

Since: 3.16

  method gtk_list_box_bind_model ( N-GList $model, GtkListBoxCreateWidgetFunc $create_widget_func, Pointer $user_data, GDestroyNotify $user_data_free_func )

=item N-GList $model; (nullable): the B<GListModel> to be bound to I<box>
=item GtkListBoxCreateWidgetFunc $create_widget_func; (nullable): a function that creates widgets for items or C<Any> in case you also passed C<Any> as I<model>
=item Pointer $user_data; user data passed to I<create_widget_func>
=item GDestroyNotify $user_data_free_func; function for freeing I<user_data>

=end pod

sub gtk_list_box_bind_model ( N-GObject $box, N-GList $model, GtkListBoxCreateWidgetFunc $create_widget_func, Pointer $user_data, GDestroyNotify $user_data_free_func )
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
=begin pod
=head1 Signals

There are two ways to connect to a signal. The first option you have is to use C<register-signal()> from B<Gnome::GObject::Object>. The second option is to use C<g_signal_connect_object()> directly from B<Gnome::GObject::Signal>.

=head2 First method

The positional arguments of the signal handler are all obligatory as well as their types. The named attributes C<:$widget> and user data are optional.

  # handler method
  method mouse-event ( N-GdkEvent $event, :$widget ) { ... }

  # connect a signal on window object
  my Gnome::Gtk3::Window $w .= new( ... );
  $w.register-signal( self, 'mouse-event', 'button-press-event');

=head2 Second method

  my Gnome::Gtk3::Window $w .= new( ... );
  my Callable $handler = sub (
    N-GObject $native, N-GdkEvent $event, OpaquePointer $data
  ) {
    ...
  }

  $w.connect-object( 'button-press-event', $handler);

Also here, the types of positional arguments in the signal handler are important. This is because both methods C<register-signal()> and C<g_signal_connect_object()> are using the signatures of the handler routines to setup the native call interface.

=head2 Supported signals


=comment #TS:0:row-selected:
=head3 row-selected

The I<row-selected> signal is emitted when a new row is selected, or
(with a C<Any> I<row>) when the selection is cleared.

When the I<box> is using B<GTK_SELECTION_MULTIPLE>, this signal will not
give you the full picture of selection changes, and you should use
the  I<selected-rows-changed> signal instead.

Since: 3.10

  method handler (
    N-GObject $row,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($box),
    *%user-options
  );

=item $box; the B<Gnome::Gtk3::ListBox> on which the signal is emitted
=item $row; the selected row, a native ListBoxRow


=comment #TS:0:selected-rows-changed:
=head3 selected-rows-changed

The I<selected-rows-changed> signal is emitted when the
set of selected rows changes.

Since: 3.14

  method handler (
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($box),
    *%user-options
  );

=item $box; the B<Gnome::Gtk3::ListBox> on wich the signal is emitted


=comment #TS:0:select-all:
=head3 select-all

The I<select-all> signal is a [keybinding signal][B<Gnome::Gtk3::BindingSignal>]
which gets emitted to select all children of the box, if the selection
mode permits it.

The default bindings for this signal is Ctrl-a.

Since: 3.14

  method handler (
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($box),
    *%user-options
  );

=item $box; the B<Gnome::Gtk3::ListBox> on which the signal is emitted


=comment #TS:0:unselect-all:
=head3 unselect-all

The I<unselect-all> signal is a keybinding signal
which gets emitted to unselect all children of the box, if the selection
mode permits it.

The default bindings for this signal is Ctrl-Shift-a.

Since: 3.14

  method handler (
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($box),
    *%user-options
  );

=item $box; the B<Gnome::Gtk3::ListBox> on which the signal is emitted


=comment #TS:0:row-activated:
=head3 row-activated

The I<row-activated> signal is emitted when a row has been activated by the user.

Since: 3.10

  method handler (
    N-GObject $row,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($box),
    *%user-options
  );

=item $box; the B<Gnome::Gtk3::ListBox> on which the signal is emitted
=item $row; the activated row, a native ListBoxRow


=comment #TS:0:activate-cursor-row:
=head3 activate-cursor-row

  method handler (
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($listbox),
    *%user-options
  );

=item $listbox; the B<Gnome::Gtk3::ListBox> on which the signal is emitted

=comment #TS:0:toggle-cursor-row:
=head3 toggle-cursor-row

  method handler (
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($listbox),
    *%user-options
  );

=item $listbox; object receiving the signal

=comment #TS:0:move-cursor:
=head3 move-cursor

  method handler (
    GtkMovementStep $arg1,
    Int $arg2,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($listbox),
    *%user-options
  );

=item $listbox; the B<Gnome::Gtk3::ListBox> on which the signal is emitted
=item $arg1; a GtkMovementStep
=item $arg2; ?

=comment #TS:0:activate:
=head3 activate

  method handler (
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($listbox),
    *%user-options
  );

=item $listbox;

=end pod


