Rand Stats

The uploading author of github:0rir does not match the META author of zef:rir.

IUP

github:0rir

Raku IUP IUP Logo

Raku interface to the IUP toolkit for building GUI's.

Operating SystemBuild Status
LinuxNone

Description

IUP is a multi-platform toolkit for building graphical user interfaces. IUP's purpose is to allow a program source code to be compiled in different systems without any modification. Its main advantages are:

Installation

Get this IUP library, or later, and install it:

mkdir libiup
cd libiup
curl -L https://sourceforge.net/projects/iup/files/3.25/Linux%20Libraries/iup-3.25_Linux44_64_lib.tar.gz > libiup.tar.gz
tar xvzf libiup.tar.gz
sudo bash install
sudo bash install_dev
cd ..

Install the Raku module with Zef:

zef update
zef install IUP

Synopsis

WARNING: This module is in its early stages and should be considered a Work in Progress. The interface is not final and may change in the future.

Some of these methods also have longer names or names with underscores instead of hyphens.

MethodDescription
destroyDestroy self
detachNYI
appendAppend control to child-list
insertInsert control after child
get-childGet child by position in list
get-child-posNYI
get-child-countNYI
get-next-childGet next child from list
get-brotherNYI
get-parentGet parent of self
get-dialogGet the dialog (top-level) of self
get-dialog-childI don't remember this one
reparentNYI
popupPopup self at x,y
showShow widget, optionally at x,y
hideHide self
mapMap self into the display layout
unmapNYI Unmap self out of the display layout
set-attrWorkhorse to set attribute(s) by ref or by :copy and etc
get-attrGet attribute by name
get-attrsGet attributes of self
get-intGet integer attribute by name
set-globalSet global by key (name) and value
set-str-globalSet string global by key (name) and value
get-globalGet named global's value
set-focusSet focus on self
get-focusGet widget that has focus
set-callbackSet a callback for a widget
set-callbacksSet callbacks with key value pairs
get-handleGet named widget by name
set-handleSet a name for self
set-attr-handleName a referenced widget
fillFill space in layout
radioCreate a radio button widget
vboxCreate a vertical box with 1..N child widgets
zboxCreate a zbox with 1..N child widgets.
hboxCreate a horizontal box with 1..N child widgets.
sboxCreate a sbox (split box)
gridboxCreate a grid box
multiboxCreate a multibox
expanderCreate an expander
backgroundboxCreate a backgroundbox
frameCreate a frame
imageCreate an image by dimensions and pixel list
itemCreate an item
submenuCreate a titled submenu
separatorCreate a separator in a menu
menuCreate a menu with 0..N members
buttonCreate a button with label and action
canvasCreate a canvas NOT WORKING
dialogCreate a dialog Perhaps the top-level or a nodal
userCreate a user widget
labelCreate a label
listCreate a list with a string
textCreate a text widget
multilineCreate a multiline widget Text & multiline are same
toggleCreate a toggle switch
valCreate a Val (aka slider or scale) for choosing a value
dialCreate a dial widget
file-dlgFile choice dialog
message-dlgMessage displaying dialog
color-dlgColor choice dialog
font-dlgFont choice dialog
progress-dlgProgress displaying dialog
get-fileGet file by name
messageDisplay message with title
alarmDisplay message and title with three user choices
list-dialogList choices for one or more selection, opt w/ defaults
opencreate the IUP system
closeshutdown the IUP system
image-lib-openopen the widget library
main-loopstart an event loop on user inputs
set-languageSet the language to English, Portuguese or Spanish
get-languageGet the language
versionGet the IUP library version
get-versionGet the IUP library version
get-version-dateReturn version's date
get-version-numberGet version number

Sample GUI:

Hello World IUP Application

Sample code:

use IUP;

# initialize iup
my $iup = IUP.new;

$iup.image-lib-open;
$iup.open;

# create widgets and set their attributes

my $btn = $iup.button("&Ok", "");

$btn.set-callback("ACTION", &exit_callback);

$btn.set-attr("IMAGE", "IUP_ActionOk");
$btn.set-attr("EXPAND", "YES");
$btn.set-attr("TIP", "Exit button");

my $lbl = $iup.label("Hello, world!");

my $vb = $iup.vbox($lbl, $btn);
$vb.set-attr("MARGIN", "10x10");
$vb.set-attr("GAP", "10");
$vb.set-attribute("ALIGNMENT", "ACENTER");

my $dlg = $iup.dialog($vb);
$dlg.set_attribute("TITLE", "Hello");

# Map widgets and show dialog

$dlg.show;

# Wait for user interaction

$iup.main-loop;

# Clean up

$dlg.destroy;
$iup.close;

exit;

sub exit-callback( --> Int) {
    return IUP_CLOSE;
}

Authors and Contributors

Blame

Robert Ransbottom, as I have messed with most of the code.

See Also

License

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