LibUI

 view release on metacpan or  search on metacpan

lib/LibUI.pod  view on Meta::CPAN

Make sure to clamp the slider value to the nearest value in range - should it be out of range. Manually call
C<uiSliderOnChanged( ... )>'s callback in such a case.

=head3 C<uiNewSlider( ... )>

    my $slider = uiNewSlider( 1, 100 );

Creates a new slider.

The initial slider value equals the minimum value.

In the current implementation upstream, C<$min> and C<$max> are swapped if C<$min> is greater than C<$max>. This may
change in the future though.

=head2 ProgressBar Functions

A ProgressBar is a control that visualizes the progress of a task via the fill level of a horizontal bar.

Indeterminate values are supported via an animated bar.

=head3 C<uiProgressBarValue( ... )>

    my $value = uiProgressBarValue( $bar );

Returns the progress bar value.

=head3 C<uiProgressBarSetValue( ... )>

    uiProgressBarSetValue( $bar, 100 );

Sets the progress bar value.

Valid values are C<[0 .. 100]> for displaying a solid bar imitating a percent value.

Use a value of C<-1> to render an animated bar to convey an indeterminate value.

=head3 C<uiNewProgressBar( )>

Creates a new progress bar.

=head2 Separator Functions

A separator is a control to visually separate controls, horizontally or vertically.

Import these functions with the C<:separator> tag.

=head3 C<uiNewHorizontalSeparator( )>

    my $hsplit = uiNewHorizontalSeparator( );

Creates a new horizontal separator.

=head3 C<uiNewVerticalSeparator( )>

    my $hsplit = uiNewVerticalSeparator( );

Creates a new vertical separator.

=head2 Combobox Functions

A combobox is a control to select one item from a predefined list of items via a drop down menu.

You may import these functions with the C<:combobox> tag.

=head3 C<uiComboboxAppend( ... )>

    uiComboboxAppend( $combo, 'Candy' );

Appends an item to the combo box.

=head3 C<uiComboboxInsertAt( ... )>

    uiComboboxInsertAt( $combo, 4, 'Salty snacks' );

Inserts an item at C<$index> to the combo box.

=head3 C<uiComboboxDelete( ... )>

    uiComboboxDelete( $combo, 4 );

Deletes an item at C<$index> from the combo box.

Deleting the index of the item currently selected will move the selection to the next item in the combo box or C<-1> if
no such item exists.

=head3 C<uiComboboxClear( ... )>

    uiComboboxClear( $combo );

Deletes all items from the combo box.

=head3 C<uiComboboxNumItems( ... )>

    my $options = uiComboboxNumItems( $combo );

Returns the number of items contained within the combo box.

=head3 C<uiComboboxSelected( ... )>

    my $current = uiComboboxSelected( $combo );

Returns the index of the item selected or C<-1> on empty selection.

=head3 C<uiComboboxSetSelected( ... )>

    uiComboboxSetSelected( $combo, 2 );

Sets the item selected. C<-1> to clear selection.

=head3 C<uiComboboxOnSelected( ... )>

    uiComboboxOnSelected( $combo, sub { my ($c, $user_data) = @_; }, undef );

Registers a callback for when a combo box item is selected.

The callback is not triggered when calling C<uiComboboxSetSelected( ... )>, C<uiComboboxInsertAt( ... )>,
C<uiComboboxDelete( ... )>, or C<uiComboboxClear( ... )>.

=head3 C<uiNewCombobox( )>

    my $combo = uiNewCombobox( );

Creates a new combo box.

=head2 Editable Combobox Functions

An editable combobox is a control to select one item from a predefined list of items or enter ones own.

Predefined items can be selected from a drop down menu.

A customary item can be entered by the user via an editable text field.

You may import these functions with the C<:editablecombobox> tag.

=head3 C<uiEditableComboboxAppend( ... )>

    uiEditableComboboxAppend( $combo, 'Fire' );

Appends an item to the editable combo box.

=head3 C<uiEditableComboboxText( ... )>

    my $text = uiEditableComboboxText( $combo );

Returns the text of the editable combo box.

This text is either the text of one of the predefined list items or the text manually entered by the user.

=head3 C<uiEditableComboboxSetText( ... )>

    uiEditableComboboxSetText( $combo, "Floating" );

Sets the editable combo box text.

=head3 C<uiEditableComboboxOnChanged( )>

    uiEditableComboboxOnChanged( $combo, sub { my ($cb, user_data) = @_; }, undef );

Registers a callback for when an editable combo box item is selected or user text changed.

The callback is not triggered when calling C<uiEditableComboboxSetText( ... )>.

=head3 C<uiNewEditableCombobox( )>

    my $combo = uiNewEditableCombobox( );

Creates a new editable combo box.

=head2 Menu Functions

Menus provide the standard menu functionality found at the top of application windows.

Each menu has a name and can contain items, check items, quit, preferences, about, and separators.

You may import these functions with the C<:menu> tag.

=head3 C<uiNewMenu( ... )>

    my $menu = uiNewMenu( 'File' );

Creates a new menu with the given name.

=head3 C<uiMenuAppendItem( ... )>

    my $item = uiMenuAppendItem( $menu, 'Open' );

Appends a new item to the menu with the given name.

=head3 C<uiMenuAppendCheckItem( ... )>

    my $item = uiMenuAppendCheckItem( $menu, 'Show Toolbar' );

Appends a new item with a checkbox to the menu with the given name.

lib/LibUI.pod  view on Meta::CPAN


    my ($rw, $rh) = uiDrawMatrixTransformSize( $matrix, $w, $h );

=head1 TABLE SIMPLIFICATION

=head2 C<uiNewTable( ... )>

    # Just pass the model directly (RowBackgroundColorModelColumn defaults to -1)
    my $table = uiNewTable( $model );

    # Or pass a full hashref if you need control
    my $table = uiNewTable({ Model => $model, RowBackgroundColorModelColumn => 2 });

When passed a model pointer directly, C<RowBackgroundColorModelColumn> defaults to C<-1> (disabled).

=head1 AREA HANDLER ALIASES

C<uiNewArea> and C<uiNewScrollingArea> accept callbacks that trigger your coderef. Missing callbacks default to no-ops.

    my $area = uiNewArea({
        Draw        => sub { ... },
        MouseEvent  => sub { ... }
    });

=over

=item C<Draw>

=item C<MouseEvent>

=item C<MouseCrossed>

=item C<DragBroken>

=item C<KeyEvent>

=back

The C<Draw>, C<MouseEvent>, and C<KeyEvent> callbacks receive typed hashrefs instead of raw pointers.

=head1 Requirements

L<Affix> and L<Alien::libui>. LibUI builds and works on Linux, Windows, macOS, etc.

=head1 See Also

From simple 'Hello, World!' scripts to a full blown threaded L<Net::BitTorrent> wrapper may be found in F<eg/>.

=head1 LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=head1 AUTHOR

Sanko Robinson L<https://github.com/sanko>

=begin stopwords

draggable gotta userdata borderless uiWindow uiBox resizable checkbox readonly spinbox combobox

=end stopwords

=cut



( run in 0.788 second using v1.01-cache-2.11-cpan-8dfa8b56332 )