libui_paradise 0.2.49 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +241 -116
- data/bin/libui_message +7 -0
- data/doc/README.gen +191 -56
- data/doc/SNIPPETS.md +1 -30
- data/doc/todo/todo.md +13 -8
- data/lib/libui_paradise/base/base.rb +64 -25
- data/lib/libui_paradise/colours/colours.rb +12 -0
- data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +2 -4
- data/lib/libui_paradise/examples/complex/010_table_example.rb +143 -49
- data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +18 -9
- data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +8 -8
- data/lib/libui_paradise/examples/simple/007_control_gallery.rb +19 -13
- data/lib/libui_paradise/examples/simple/010_font_button.rb +31 -0
- data/lib/libui_paradise/examples/simple/011_simple_notepad.rb +24 -0
- data/lib/libui_paradise/examples/simple/012_table_example.rb +71 -0
- data/lib/libui_paradise/extensions/extensions.rb +961 -11
- data/lib/libui_paradise/extensions/toplevel_counters.rb +58 -0
- data/lib/libui_paradise/fiddle/{pointer.rb → fiddle.rb} +162 -144
- data/lib/libui_paradise/generic_window/generic_window.rb +1 -1
- data/lib/libui_paradise/images/README.md +5 -2
- data/lib/libui_paradise/libui_classes/box.rb +3 -2
- data/lib/libui_paradise/libui_classes/grid.rb +4 -1
- data/lib/libui_paradise/libui_classes/libui_classes.rb +113 -78
- data/lib/libui_paradise/project/project.rb +5 -1
- data/lib/libui_paradise/prototype/prototype.rb +1 -3
- data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +1 -1
- data/lib/libui_paradise/version/version.rb +2 -2
- data/lib/libui_paradise.rb +0 -0
- data/libui_paradise.gemspec +5 -4
- metadata +18 -27
- data/lib/libui_paradise/extensions/counters.rb +0 -58
- data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +0 -150
- data/lib/libui_paradise/extensions/misc.rb +0 -754
- data/lib/libui_paradise/toplevel_methods/misc.rb +0 -13
data/doc/README.gen
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
ADD_LAST_UPDATE
|
1
|
+
DEFAULT_HEADER
|
3
2
|
|
4
3
|
## The libui_paradise project
|
5
4
|
|
@@ -475,7 +474,7 @@ pointer types (struct):
|
|
475
474
|
.DragBroken
|
476
475
|
.KeyEvent
|
477
476
|
|
478
|
-
The handlerDraw() function in C looks like this:
|
477
|
+
The <b>handlerDraw() function</b> in C looks like this:
|
479
478
|
|
480
479
|
static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
|
481
480
|
{
|
@@ -515,9 +514,9 @@ label / ui_text widget.
|
|
515
514
|
|
516
515
|
## Working with combo-boxes
|
517
516
|
|
518
|
-
To create a combo-box in vanilla libui, do this:
|
517
|
+
To create a combo-box in vanilla libui, do this in plain ruby-libui:
|
519
518
|
|
520
|
-
alignment = LibUI.new_combobox
|
519
|
+
alignment = LibUI.new_combobox # Here we actually create the combobox.
|
521
520
|
LibUI.combobox_append(alignment, 'Left')
|
522
521
|
LibUI.combobox_append(alignment, 'Center')
|
523
522
|
LibUI.combobox_append(alignment, 'Right')
|
@@ -575,6 +574,10 @@ So:
|
|
575
574
|
There are probably more elegant ways to solve this, but I only
|
576
575
|
wanted to solve this quickly and move on.
|
577
576
|
|
577
|
+
To add content to an editable combobox youc an use:
|
578
|
+
|
579
|
+
LibUI.append() # .append() adds the named item to the end of the EditableCombobox.
|
580
|
+
|
578
581
|
The **source code** to the combo-box in libui, at the least
|
579
582
|
for UNIX/Linux, can be seen here:
|
580
583
|
|
@@ -603,21 +606,36 @@ respectively.
|
|
603
606
|
**Form** is a container that takes labels for its contents. This is currently
|
604
607
|
just a stub though - we may have to research this with better examples.
|
605
608
|
|
606
|
-
## Libui
|
609
|
+
## Checkboxes in Libui-ng
|
607
610
|
|
608
611
|
A simple checkbox example in **plain** ruby-libui follows:
|
609
612
|
|
610
|
-
checkbox =
|
611
|
-
checkbox_toggle_callback = proc { |
|
612
|
-
checked =
|
613
|
-
|
613
|
+
checkbox = LibUI.checkbox('Checkbox')
|
614
|
+
checkbox_toggle_callback = proc { |pointer|
|
615
|
+
checked = LibUI.checkbox_checked(pointer) == 1
|
616
|
+
LibUI.checkbox_set_text(ptr, "I am the checkbox (#{checked})")
|
614
617
|
}
|
615
618
|
|
619
|
+
Or:
|
620
|
+
|
621
|
+
checkbox = LibUI.new_checkbox('Checkbox')
|
622
|
+
# ui_checkbox can be used if you use the libui_paradise gem.
|
623
|
+
|
616
624
|
This may look like so on Linux:
|
617
625
|
|
618
626
|
<img src="https://i.imgur.com/d7qWalZ.png" style="margin-left: 2em; padding: 4px; border: 1px solid black;">
|
619
627
|
|
620
|
-
To
|
628
|
+
To set such a checkbox to the checked-state (that is, as if the
|
629
|
+
user clicked on it), use the following method, if you use the
|
630
|
+
libui_paradise gem:
|
631
|
+
|
632
|
+
checkbox.set_checked(1)
|
633
|
+
|
634
|
+
To query its state use:
|
635
|
+
|
636
|
+
checked = LibUI.checkbox_checked(pointer) == 1
|
637
|
+
|
638
|
+
To <b>query</b> whether a checkbox is **active**, use code such as the
|
621
639
|
following:
|
622
640
|
|
623
641
|
checkbox.is_active?
|
@@ -630,6 +648,19 @@ registered in a main, toplevel Hash in the
|
|
630
648
|
**libui_paradise project**. Not very elegant, but simple, and
|
631
649
|
it works (for the most part).
|
632
650
|
|
651
|
+
The toggle-event for a checkbox can be triggered via:
|
652
|
+
|
653
|
+
checkbox_toggle_callback = proc { |pointer|
|
654
|
+
checked = LibLibUI.checkbox_checked(pointer) == 1
|
655
|
+
LibUI.window_set_title(MAIN_WINDOW, "Checkbox is #{checked}")
|
656
|
+
LibUI.checkbox_set_text(pointer, "I am the checkbox (#{checked})")
|
657
|
+
0
|
658
|
+
}
|
659
|
+
|
660
|
+
To respond to on-toggled events, do:
|
661
|
+
|
662
|
+
LibUI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
663
|
+
|
633
664
|
## Adding a widget into another widget
|
634
665
|
|
635
666
|
I chose the following **API** for this:
|
@@ -683,6 +714,20 @@ The notebook-tab may look like this:
|
|
683
714
|
|
684
715
|
<img src="https://i.imgur.com/olWQAIJ.png" style="margin-left: 2em">
|
685
716
|
|
717
|
+
A new tab can be created via:
|
718
|
+
|
719
|
+
tab = LibUI.new_tab
|
720
|
+
|
721
|
+
To populate the notebook-tab you can use .tab_append() such as
|
722
|
+
shown next:
|
723
|
+
|
724
|
+
hbox1 = LibUI.new_horizontal_box
|
725
|
+
hbox2 = LibUI.new_horizontal_box
|
726
|
+
LibUI.tab_append(tab, 'Page 1', hbox1)
|
727
|
+
LibUI.tab_append(tab, 'Page 2', hbox2)
|
728
|
+
LibUI.tab_append(tab, 'Page 3', UI.new_horizontal_box)
|
729
|
+
LibUI.box_append(inner2, tab, 1)
|
730
|
+
|
686
731
|
## Create a vertical box:
|
687
732
|
|
688
733
|
Use code like this:
|
@@ -829,7 +874,7 @@ hand. Only the raw filename will be used, so if you
|
|
829
874
|
have a file at **/tmp/foo/bar.rb** then the title
|
830
875
|
of the window will be **bar.rb**.
|
831
876
|
|
832
|
-
## Entry
|
877
|
+
## Entry in libui
|
833
878
|
|
834
879
|
An entry in libui may look like this:
|
835
880
|
|
@@ -841,6 +886,12 @@ The upstream C code for libui-entry, for **unix/**, can be seen here:
|
|
841
886
|
|
842
887
|
https://github.com/andlabs/libui/blob/master/unix/entry.c
|
843
888
|
|
889
|
+
In ruby, for the LibUI namespace, you can set text on an entry
|
890
|
+
by calling <b>LibUI.entry_set_text()</b>, such as shown in
|
891
|
+
the following example:
|
892
|
+
|
893
|
+
LibUI.entry_set_text(entry, 'Please enter your feelings')
|
894
|
+
|
844
895
|
## Borderless windows and fullscreen windows
|
845
896
|
|
846
897
|
A window that is **borderless: true** will not show any title or
|
@@ -854,14 +905,14 @@ To set the main window to full screen (occupy the whole monitor) do:
|
|
854
905
|
|
855
906
|
You can use the following API for a spinbox:
|
856
907
|
|
857
|
-
|
908
|
+
LibUI.new_spinbox
|
858
909
|
|
859
910
|
To create a new spinbox.
|
860
911
|
|
861
912
|
To specify the **min** and **max** range, pass them as parameters
|
862
913
|
on creation-time:
|
863
914
|
|
864
|
-
|
915
|
+
LibUI.new_spinbox(0, 100)
|
865
916
|
|
866
917
|
If you use the extensions found in the libui_paradise gem then
|
867
918
|
you can do this instead:
|
@@ -881,9 +932,9 @@ to see how this works.
|
|
881
932
|
|
882
933
|
Relevant methods in regard to the spinbox in libui are as follows:
|
883
934
|
|
884
|
-
|
885
|
-
|
886
|
-
|
935
|
+
LibUI.spinbox_on_changed()
|
936
|
+
LibUI.spinbox_set_value()
|
937
|
+
LibUI.spinbox_value()
|
887
938
|
|
888
939
|
To **set** a value use either of the following two methods:
|
889
940
|
|
@@ -900,7 +951,7 @@ A text-view widget shows content, such as the content of a local file.
|
|
900
951
|
|
901
952
|
In libui the general API for this is:
|
902
953
|
|
903
|
-
|
954
|
+
LibUI.new_multiline_entry # this is a textview
|
904
955
|
|
905
956
|
## Control Gallery
|
906
957
|
|
@@ -908,17 +959,19 @@ Here is an image, from kotlin-libui, how this may look on windows:
|
|
908
959
|
|
909
960
|
<img src="https://raw.githubusercontent.com/msink/kotlin-libui/master/samples/controlgallery/controlgallery-windows7.png" style="margin-left: 2em">
|
910
961
|
|
911
|
-
## LibUI.new_button() - how to work with buttons in LibUI
|
962
|
+
## LibUI.new_button() - how to work with buttons in LibUI in general
|
912
963
|
|
913
|
-
<b>LibUI.new_button</b> allows us to create a new button
|
964
|
+
<b>LibUI.new_button</b> allows us to create a new button via
|
965
|
+
LibUI.
|
914
966
|
|
915
|
-
Examples:
|
967
|
+
Examples for this:
|
916
968
|
|
917
969
|
button1 = LibUI.new_button('Text')
|
918
970
|
button2 = LibUI.new_button('▶')
|
971
|
+
button3 = LibUI.new_button('■') # You can use Unicode / Emojis here just fine.
|
919
972
|
|
920
|
-
Now, we need to "tell" this button what to do when it is
|
921
|
-
|
973
|
+
Now, we need to "tell" this button what to do when it is clicked.
|
974
|
+
This is done via Libui.button_on_clicked().
|
922
975
|
|
923
976
|
Example:
|
924
977
|
|
@@ -1289,9 +1342,9 @@ shows how this may look (on icewm):
|
|
1289
1342
|
The syntax goes something like this:
|
1290
1343
|
|
1291
1344
|
rb = ui_radio_buttons
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1345
|
+
LibUI.radio_buttons_append(rb, 'Radio Button 1')
|
1346
|
+
LibUI.radio_buttons_append(rb, 'Radio Button 2')
|
1347
|
+
LibUI.radio_buttons_append(rb, 'Radio Button 3')
|
1295
1348
|
outer_vbox.minimal(rb) # add the radio-button control to the box.
|
1296
1349
|
|
1297
1350
|
In other words: you instantiate a new rb-radio-button 'pointer';
|
@@ -1326,26 +1379,67 @@ For "raw" libui, use this:
|
|
1326
1379
|
|
1327
1380
|
## Tables in LibUI
|
1328
1381
|
|
1329
|
-
|
1382
|
+
The API for creating a new table in <b>LibUI</b> is this:
|
1330
1383
|
|
1331
1384
|
table = LibUI.new_table
|
1332
|
-
|
1333
|
-
|
1385
|
+
table = LibUI.new_table(table_model)
|
1386
|
+
|
1387
|
+
You need to use a model for the table, and pass it as
|
1388
|
+
its first argument. The next line of code shows how
|
1389
|
+
this is done:
|
1390
|
+
|
1391
|
+
model = LibUI.new_table_model(model_handler) # create the model here
|
1392
|
+
|
1393
|
+
Next you have to prevent segfaults by .malloc-ating the
|
1394
|
+
table params. This can be done in the following manner:
|
1334
1395
|
|
1335
1396
|
table_params = LibUI::FFI::TableParams.malloc
|
1336
1397
|
table_params = Fiddle::RUBY_FREE
|
1337
1398
|
table_params.Model = model
|
1338
1399
|
table_params.RowBackgroundColorModelColumn = -1
|
1339
|
-
table = LibUI.new_table(table_params)
|
1400
|
+
table = LibUI.new_table(table_params) # And pass it here.
|
1340
1401
|
|
1341
|
-
The table header is an array that contains the following attributes:
|
1402
|
+
The <b>table header</b> is an array that contains the following attributes:
|
1342
1403
|
|
1343
|
-
1. editable, bool type
|
1404
|
+
1. editable, bool type: determines whether column is editable
|
1344
1405
|
2. textColor
|
1345
1406
|
3. title
|
1346
1407
|
4. type, specify value of button, image, imgtext, progress, checkbox, checkboxtext, color, text
|
1347
1408
|
|
1348
|
-
|
1409
|
+
See the example distributed in this gem, in the file at
|
1410
|
+
<b>examples/simple/012_table_example.rb</b>.
|
1411
|
+
|
1412
|
+
This will yield the following result - at the least on Linux and IceWM:
|
1413
|
+
|
1414
|
+
<img src="https://i.imgur.com/Y7m58DH.png" style="margin: 1em">
|
1415
|
+
|
1416
|
+
You can append a new text column via:
|
1417
|
+
|
1418
|
+
::LibUI.table_append_text_column(table, 'Header goes in here', 0, -1)
|
1419
|
+
|
1420
|
+
As this is a bit cumbersome to type, libui_paradise simplifies this
|
1421
|
+
a tiny bit into:
|
1422
|
+
|
1423
|
+
table.append_text_column('Header goes in here', 0, -1)
|
1424
|
+
|
1425
|
+
Be careful to <b>only</b> append entries there if the underlying
|
1426
|
+
dataset - our Array - also contains these entries; otherwise the
|
1427
|
+
application would segfault. The example at
|
1428
|
+
<b>examples/complex/010_table_example.rb</b> shows this - look
|
1429
|
+
at the commented out example to test it.
|
1430
|
+
|
1431
|
+
In November 2023 the API was a bit simplified, towards this:
|
1432
|
+
|
1433
|
+
table.append_text_column('Header goes in here', 0)
|
1434
|
+
table.append_text_column('Another header goes in here', 1)
|
1435
|
+
table.append_text_column('And this is yet another header', 2)
|
1436
|
+
|
1437
|
+
So you can now omit the last -1 part. Expect more simplifications
|
1438
|
+
in the future - all that malloc stuff should be handled by
|
1439
|
+
libui_paradise, rather than in the downstream application
|
1440
|
+
code.
|
1441
|
+
|
1442
|
+
Note that this section is incomplete; it's a bit complicated.
|
1349
1443
|
|
1350
1444
|
In the end, this is possible though:
|
1351
1445
|
|
@@ -1424,7 +1518,7 @@ Available "**new**"-widgets in LibUI:
|
|
1424
1518
|
LibUI.new_table_value_color
|
1425
1519
|
LibUI.new_table_value_string
|
1426
1520
|
LibUI.new_time_picker
|
1427
|
-
LibUI.new_menu
|
1521
|
+
LibUI.new_menu # this is a menu, appearing on the upper area
|
1428
1522
|
LibUI.new_multiline_entry # this is a textview
|
1429
1523
|
LibUI.new_non_wrapping_multiline_entry
|
1430
1524
|
LibUI.new_open_type_features
|
@@ -1471,9 +1565,14 @@ Example for this:
|
|
1471
1565
|
width = canvas.width
|
1472
1566
|
height = canvas.height
|
1473
1567
|
|
1474
|
-
##
|
1568
|
+
## How to to build a menu-interface (menu tag):
|
1475
1569
|
|
1476
|
-
|
1570
|
+
help_menu = LibUI.new_menu('Help')
|
1571
|
+
version_item = LibUI.menu_append_item(help_menu, 'Version')
|
1572
|
+
|
1573
|
+
## Creating a new drawing area in LibUI
|
1574
|
+
|
1575
|
+
The following code should suffice:
|
1477
1576
|
|
1478
1577
|
handler = LibUI::FFI::AreaHandler.malloc
|
1479
1578
|
handler.to_ptr.free = Fiddle::RUBY_FREE
|
@@ -1481,12 +1580,19 @@ This should suffice:
|
|
1481
1580
|
|
1482
1581
|
## Horizontal boxes
|
1483
1582
|
|
1484
|
-
A HBox represents a horizontal box
|
1485
|
-
|
1486
|
-
|
1583
|
+
A <b>HBox</b> represents a <b>horizontal box</b>.
|
1584
|
+
|
1585
|
+
In pure ruby-libui a new horizontal box (hbox) can be created via:
|
1586
|
+
|
1587
|
+
hbox = LibUI.new_horizontal_box
|
1588
|
+
|
1589
|
+
The API for putting something into a hbox goes as follows, such as
|
1590
|
+
when you wish to put a text-entry into the hbox:
|
1487
1591
|
|
1488
1592
|
LibUI.box_append(hbox1, text_entry, 1)
|
1489
1593
|
|
1594
|
+
If you use libui_paradise then you can also use << instead.
|
1595
|
+
|
1490
1596
|
## The slider widget
|
1491
1597
|
|
1492
1598
|
If you use the LibuiParadise gem then you can create and use a new slider
|
@@ -1499,7 +1605,7 @@ like this:
|
|
1499
1605
|
puts "New Slider value: #{UI.slider_value(ptr)}"
|
1500
1606
|
0
|
1501
1607
|
}
|
1502
|
-
|
1608
|
+
LibUI.slider_on_changed(slider, slider_changed_callback) # last element is nil, but it seems we can omit it
|
1503
1609
|
|
1504
1610
|
This may look like so on Linux:
|
1505
1611
|
|
@@ -1567,7 +1673,7 @@ For instance, the text-weight part accepts these values
|
|
1567
1673
|
maximum
|
1568
1674
|
# or any number between minimum and maximum
|
1569
1675
|
|
1570
|
-
To create an attributed String you can use the following API:
|
1676
|
+
To create an <b>attributed String</b> you can use the following API:
|
1571
1677
|
|
1572
1678
|
string = LibUI.new_attributed_string
|
1573
1679
|
attributes = LibUI.new_family_attribute("Courier New 30") # Specify a certain font.
|
@@ -1743,26 +1849,27 @@ expand horizontally or vertically. halign and valign, I think,
|
|
1743
1849
|
are used to align the grid-cell horizontally and vertically, so you
|
1744
1850
|
can position them exactly in the middle.
|
1745
1851
|
|
1746
|
-
Recently (August 2021) I discovered that you can actually
|
1747
|
-
a button-in-a-button. I don't know whether this is a bug or
|
1748
|
-
a feature, but it is hilarious.
|
1852
|
+
Recently (in <b>August 2021</b>) I discovered that you can actually
|
1853
|
+
put a button-in-a-button. I don't know whether this is a bug or
|
1854
|
+
a feature, but it is hilarious nonetheless.
|
1749
1855
|
|
1750
|
-
The 'raw' code I used for this was the following:
|
1856
|
+
The '<b>raw</b>' code I used for this was the following:
|
1751
1857
|
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1858
|
+
LibUI.grid_append(grid, UI.new_button('3'),0,1,1,1,1,1,1,1)
|
1859
|
+
LibUI.grid_append(grid, UI.new_button('4'),1,1,1,1,1,1,1,1)
|
1860
|
+
LibUI.grid_append(grid, UI.new_button('5'),0,1,1,1,1,0,1,0)
|
1861
|
+
LibUI.grid_append(grid, UI.new_button('6'),1,1,1,1,1,0,1,0)
|
1756
1862
|
|
1757
|
-
This led to the following
|
1863
|
+
This led to the following widget setup, as shown in this
|
1864
|
+
image:
|
1758
1865
|
|
1759
1866
|
<img src="https://i.imgur.com/6sWwWKh.png" style="margin-left: 1em">
|
1760
1867
|
|
1761
1868
|
The smaller buttons and the larger buttons can be clicked. They
|
1762
|
-
reside in the same grid-cell. I
|
1763
|
-
bug or a feature really, but this was quite hilarious to see.
|
1764
|
-
In the event that I may forget this, I'll keep this here as
|
1765
|
-
|
1869
|
+
reside in the same grid-cell. As stated I do not know whether this is
|
1870
|
+
a bug or a feature really, but this was quite hilarious to see.
|
1871
|
+
In the event that I may forget this, I'll keep this here as a
|
1872
|
+
<b>reference</b>.
|
1766
1873
|
|
1767
1874
|
If you want to pad the grid you can use the following method:
|
1768
1875
|
|
@@ -1897,9 +2004,10 @@ An entry can be <b>set read only</b> via:
|
|
1897
2004
|
|
1898
2005
|
entry.read_only # This has not been added into libui-paradise yet.
|
1899
2006
|
|
1900
|
-
To <b>respond</b> to <b>on-changed events</b>, you can use
|
2007
|
+
To <b>respond</b> to <b>on-changed events</b>, you can use the following
|
2008
|
+
toplevel API:
|
1901
2009
|
|
1902
|
-
|
2010
|
+
LibUI.entry_on_changed()
|
1903
2011
|
|
1904
2012
|
A more complete example of this:
|
1905
2013
|
|
@@ -1928,4 +2036,31 @@ following simplified method call instead:
|
|
1928
2036
|
puts 'The text is now: '+entry.text?
|
1929
2037
|
}
|
1930
2038
|
|
2039
|
+
## Using a pop-up message box in plain libui:
|
2040
|
+
|
2041
|
+
LibUI.msg_box(MAIN_WINDOW, 'Information', 'You clicked the button')
|
2042
|
+
LibUI.msg_box(main_window,
|
2043
|
+
'Tiny Midi Player',
|
2044
|
+
"Written in Ruby\n" \
|
2045
|
+
"https://github.com/kojix2/libui\n Version #{VERSION}"
|
2046
|
+
)
|
2047
|
+
|
2048
|
+
## How to create an .exe file on Windows via libui
|
2049
|
+
|
2050
|
+
First check: https://github.com/larsch/ocra/
|
2051
|
+
|
2052
|
+
In order to build an .exe file with Ocra, include 3 DLLs from ruby_builtin_dlls
|
2053
|
+
folder:
|
2054
|
+
|
2055
|
+
ocra examples/control_gallery.rb --dll ruby_builtin_dlls/libssp-0.dll --dll ruby_builtin_dlls/libgmp-10.dll --dll ruby_builtin_dlls/libffi-7.dll --gem-all=fiddle
|
2056
|
+
|
2057
|
+
Add additional options below if necessary.
|
2058
|
+
|
2059
|
+
--window
|
2060
|
+
--add-all-core
|
2061
|
+
--chdir-first
|
2062
|
+
--icon assets\app.ico
|
2063
|
+
--verbose
|
2064
|
+
--output out\gallery.exe
|
2065
|
+
|
1931
2066
|
ADD_CONTACT_INFORMATION
|
data/doc/SNIPPETS.md
CHANGED
@@ -26,27 +26,6 @@
|
|
26
26
|
UI.control_show(main_window)
|
27
27
|
main_window.show_the_controls # Or use this one here.
|
28
28
|
|
29
|
-
|
30
|
-
# Add a checkbox (checkbox tag, checkbutton)
|
31
|
-
|
32
|
-
checkbox = UI.new_checkbox('Checkbox') # or ui_checkbox
|
33
|
-
checkbox_toggle_callback = proc { |pointer|
|
34
|
-
checked = UI.checkbox_checked(pointer) == 1
|
35
|
-
UI.window_set_title(MAIN_WINDOW, "Checkbox is #{checked}")
|
36
|
-
UI.checkbox_set_text(pointer, "I am the checkbox (#{checked})")
|
37
|
-
0
|
38
|
-
}
|
39
|
-
UI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
40
|
-
UI.box_append(inner, checkbox, 0)
|
41
|
-
|
42
|
-
To set it checked:
|
43
|
-
|
44
|
-
checkbox.set_checked(1)
|
45
|
-
|
46
|
-
To query its state:
|
47
|
-
|
48
|
-
checked = UI.checkbox_checked(pointer) == 1
|
49
|
-
|
50
29
|
# And the control:
|
51
30
|
|
52
31
|
UI.control_show(main_window)
|
@@ -78,17 +57,9 @@
|
|
78
57
|
UI.combobox_on_selected(cbox, combobox_selected_callback, nil)
|
79
58
|
|
80
59
|
# Or more concise:
|
81
|
-
combo_box =
|
60
|
+
combo_box = LibUI.combobox {
|
82
61
|
['combobox Item 1', 'combobox Item 2', 'combobox Item 3']
|
83
62
|
}
|
84
63
|
|
85
64
|
|
86
|
-
# Add content to an editable combox:
|
87
|
-
|
88
|
-
UI.append() # .append() adds the named item to the end of the EditableCombobox.
|
89
|
-
|
90
|
-
# How to build a menu-interface (menu tag):
|
91
|
-
|
92
|
-
help_menu = UI.new_menu('Help')
|
93
|
-
version_item = UI.menu_append_item(help_menu, 'Version')
|
94
65
|
|
data/doc/todo/todo.md
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
-
|
2
|
-
re-use existing screenshots from other projects.
|
3
|
-
|
4
|
-
- Make sure the project is API compatible to glimmer-libui.
|
5
|
-
|
1
|
+
------------------------------------------------------------------------------------
|
6
2
|
- Rewrite the project from the get-go. Also integrate
|
7
3
|
@main_window into the main hash, rather than have it
|
8
4
|
standalone. ^^^ this should be fixed ASAP - it is not
|
9
5
|
elegant to have a separate @main_window ... but for
|
10
6
|
now we'll keep it as-is.
|
11
|
-
|
7
|
+
As we rewrite it, improve the documentation.
|
8
|
+
------------------------------------------------------------------------------------
|
9
|
+
- Make sure that each component has a screenshot. It's ok to
|
10
|
+
re-use existing screenshots from other projects.
|
11
|
+
Perhaps also look at the examples again to show how this
|
12
|
+
can be used.
|
13
|
+
------------------------------------------------------------------------------------
|
14
|
+
- Make sure the project is API compatible to glimmer-libui.
|
15
|
+
------------------------------------------------------------------------------------
|
12
16
|
- Re-organize the examples, perhaps starting with another
|
13
17
|
one.
|
14
|
-
|
18
|
+
------------------------------------------------------------------------------------
|
15
19
|
- Check for image and font support again. Something isn't
|
16
|
-
working!
|
20
|
+
working there!
|
21
|
+
------------------------------------------------------------------------------------
|
@@ -3,6 +3,11 @@
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
5
|
# === LibuiParadise::Base
|
6
|
+
#
|
7
|
+
# Usage example:
|
8
|
+
#
|
9
|
+
# LibuiParadise::Base.new(ARGV)
|
10
|
+
#
|
6
11
|
# =========================================================================== #
|
7
12
|
# require 'libui_paradise/base/base.rb'
|
8
13
|
# < LibuiParadise::Base
|
@@ -13,7 +18,7 @@ class Base # === LibuiParadise::Base
|
|
13
18
|
|
14
19
|
alias e puts
|
15
20
|
|
16
|
-
require 'libui_paradise'
|
21
|
+
require 'libui_paradise/extensions/extensions.rb'
|
17
22
|
include LibuiParadise::Extensions
|
18
23
|
|
19
24
|
# ========================================================================= #
|
@@ -23,28 +28,15 @@ class Base # === LibuiParadise::Base
|
|
23
28
|
|
24
29
|
# ========================================================================= #
|
25
30
|
# === WIDTH
|
31
|
+
#
|
32
|
+
# The default width.
|
26
33
|
# ========================================================================= #
|
27
|
-
WIDTH =
|
34
|
+
WIDTH = 880
|
28
35
|
|
29
36
|
# ========================================================================= #
|
30
37
|
# === HEIGHT
|
31
38
|
# ========================================================================= #
|
32
|
-
HEIGHT =
|
33
|
-
|
34
|
-
# ========================================================================= #
|
35
|
-
# === default_title_width_height
|
36
|
-
# ========================================================================= #
|
37
|
-
def default_title_width_height(
|
38
|
-
title = TITLE,
|
39
|
-
width = WIDTH,
|
40
|
-
height = HEIGHT
|
41
|
-
)
|
42
|
-
title_width_height(
|
43
|
-
title,
|
44
|
-
width,
|
45
|
-
height
|
46
|
-
)
|
47
|
-
end
|
39
|
+
HEIGHT = 680
|
48
40
|
|
49
41
|
# ========================================================================= #
|
50
42
|
# === reset (reset tag)
|
@@ -79,13 +71,28 @@ class Base # === LibuiParadise::Base
|
|
79
71
|
return ui_padded_main_window(title, width, height, 0)
|
80
72
|
end
|
81
73
|
|
82
|
-
#
|
74
|
+
# ========================================================================= #
|
83
75
|
# === set_window
|
84
76
|
#
|
85
77
|
# Simply assign to @window here.
|
86
|
-
#
|
78
|
+
# ========================================================================= #
|
87
79
|
def set_window(i = return_default_window)
|
88
|
-
|
80
|
+
::LibuiParadise::Extensions.set_window(i)
|
81
|
+
end
|
82
|
+
|
83
|
+
# ========================================================================= #
|
84
|
+
# === default_title_width_height
|
85
|
+
# ========================================================================= #
|
86
|
+
def default_title_width_height(
|
87
|
+
title = TITLE,
|
88
|
+
width = WIDTH,
|
89
|
+
height = HEIGHT
|
90
|
+
)
|
91
|
+
title_width_height(
|
92
|
+
title,
|
93
|
+
width,
|
94
|
+
height
|
95
|
+
)
|
89
96
|
end
|
90
97
|
|
91
98
|
# ========================================================================= #
|
@@ -125,7 +132,7 @@ class Base # === LibuiParadise::Base
|
|
125
132
|
end
|
126
133
|
outer_vbox.minimal(this_widget)
|
127
134
|
}
|
128
|
-
|
135
|
+
window?.add(outer_vbox)
|
129
136
|
if i.size > 0
|
130
137
|
Thread.new {
|
131
138
|
sleep 5
|
@@ -134,9 +141,16 @@ class Base # === LibuiParadise::Base
|
|
134
141
|
exit
|
135
142
|
}
|
136
143
|
end
|
137
|
-
|
144
|
+
window?.intelligent_exit
|
138
145
|
end; alias add_these_widgets add_these_widgets_to_the_main_window # === add_these_widgets
|
139
146
|
|
147
|
+
# ========================================================================= #
|
148
|
+
# === window?
|
149
|
+
# ========================================================================= #
|
150
|
+
def window?
|
151
|
+
::LibuiParadise::Extensions.window?
|
152
|
+
end; alias main_window? window? # === main_window?
|
153
|
+
|
140
154
|
# ========================================================================= #
|
141
155
|
# === run_in_the_background
|
142
156
|
# ========================================================================= #
|
@@ -145,10 +159,35 @@ class Base # === LibuiParadise::Base
|
|
145
159
|
end
|
146
160
|
|
147
161
|
# ========================================================================= #
|
148
|
-
# === run
|
162
|
+
# === run (run tag)
|
149
163
|
# ========================================================================= #
|
150
164
|
def run
|
151
165
|
create_skeleton_then_connect_skeleton
|
152
166
|
end
|
153
167
|
|
154
|
-
|
168
|
+
# ========================================================================= #
|
169
|
+
# === create_table
|
170
|
+
# ========================================================================= #
|
171
|
+
def create_table(model)
|
172
|
+
LibuiParadise::Extensions.table(model)
|
173
|
+
end
|
174
|
+
|
175
|
+
# ========================================================================= #
|
176
|
+
# === free_table_model
|
177
|
+
# ========================================================================= #
|
178
|
+
def free_table_model(model)
|
179
|
+
::LibUI.free_table_model(model)
|
180
|
+
end
|
181
|
+
|
182
|
+
# ========================================================================= #
|
183
|
+
# === LibuiParadise::Base[]
|
184
|
+
# ========================================================================= #
|
185
|
+
def self.[](i = ARGV)
|
186
|
+
new(i)
|
187
|
+
end
|
188
|
+
|
189
|
+
end; end
|
190
|
+
|
191
|
+
if __FILE__ == $PROGRAM_NAME
|
192
|
+
LibuiParadise::Base.new(ARGV)
|
193
|
+
end # base.rb
|
@@ -8,7 +8,19 @@ module LibuiParadise
|
|
8
8
|
|
9
9
|
# ========================================================================= #
|
10
10
|
# === COLOR_BLUE
|
11
|
+
#
|
12
|
+
# This is actually dodgerblue.
|
11
13
|
# ========================================================================= #
|
12
14
|
COLOR_BLUE = 0x1E90FF
|
13
15
|
|
16
|
+
# ========================================================================= #
|
17
|
+
# === COLOR_MIDNIGHTBLUE
|
18
|
+
# ========================================================================= #
|
19
|
+
COLOR_MIDNIGHTBLUE = 0x191970
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === COLOR_LIGHTSEAGREEN
|
23
|
+
# ========================================================================= #
|
24
|
+
COLOR_LIGHTSEAGREEN = 0x20b2aa
|
25
|
+
|
14
26
|
end
|