libui_paradise 0.2.49 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cacc003686df08d02f1de8ff360f704eae2c1b4a678bb5040ffc6e193d3e0b3
|
4
|
+
data.tar.gz: fd46f7096a785932ba3806ab82e31df87f902a7fa969c703542e74100710a34a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0940f2cc4cd87f2bb28d568ad2ee41b8f5fb552463daeeb8717487e7934beca29670296cc1fc768240da0ae89ef2e28ee16ba580c926815466cfc4c37f44336
|
7
|
+
data.tar.gz: 108d2613bfacb5945285f31ce6827150863bc98cd887dfe4b3b2d4174e3795fe5d4dacb416dcb1eede79498d4f34d75c7fc5cbab570fb8b12cea049551ce576f
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/libui_paradise.svg)](https://badge.fury.io/rb/libui_paradise)
|
4
4
|
|
5
|
-
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">12.12.2023</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">14:47:37</span> o'clock.
|
6
6
|
|
7
7
|
## The libui_paradise project
|
8
8
|
|
@@ -478,7 +478,7 @@ pointer types (struct):
|
|
478
478
|
.DragBroken
|
479
479
|
.KeyEvent
|
480
480
|
|
481
|
-
The handlerDraw() function in C looks like this:
|
481
|
+
The <b>handlerDraw() function</b> in C looks like this:
|
482
482
|
|
483
483
|
static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
|
484
484
|
{
|
@@ -518,9 +518,9 @@ label / ui_text widget.
|
|
518
518
|
|
519
519
|
## Working with combo-boxes
|
520
520
|
|
521
|
-
To create a combo-box in vanilla libui, do this:
|
521
|
+
To create a combo-box in vanilla libui, do this in plain ruby-libui:
|
522
522
|
|
523
|
-
alignment = LibUI.new_combobox
|
523
|
+
alignment = LibUI.new_combobox # Here we actually create the combobox.
|
524
524
|
LibUI.combobox_append(alignment, 'Left')
|
525
525
|
LibUI.combobox_append(alignment, 'Center')
|
526
526
|
LibUI.combobox_append(alignment, 'Right')
|
@@ -578,6 +578,10 @@ So:
|
|
578
578
|
There are probably more elegant ways to solve this, but I only
|
579
579
|
wanted to solve this quickly and move on.
|
580
580
|
|
581
|
+
To add content to an editable combobox youc an use:
|
582
|
+
|
583
|
+
LibUI.append() # .append() adds the named item to the end of the EditableCombobox.
|
584
|
+
|
581
585
|
The **source code** to the combo-box in libui, at the least
|
582
586
|
for UNIX/Linux, can be seen here:
|
583
587
|
|
@@ -606,21 +610,36 @@ respectively.
|
|
606
610
|
**Form** is a container that takes labels for its contents. This is currently
|
607
611
|
just a stub though - we may have to research this with better examples.
|
608
612
|
|
609
|
-
## Libui
|
613
|
+
## Checkboxes in Libui-ng
|
610
614
|
|
611
615
|
A simple checkbox example in **plain** ruby-libui follows:
|
612
616
|
|
613
|
-
checkbox =
|
614
|
-
checkbox_toggle_callback = proc { |
|
615
|
-
checked =
|
616
|
-
|
617
|
+
checkbox = LibUI.checkbox('Checkbox')
|
618
|
+
checkbox_toggle_callback = proc { |pointer|
|
619
|
+
checked = LibUI.checkbox_checked(pointer) == 1
|
620
|
+
LibUI.checkbox_set_text(ptr, "I am the checkbox (#{checked})")
|
617
621
|
}
|
618
622
|
|
623
|
+
Or:
|
624
|
+
|
625
|
+
checkbox = LibUI.new_checkbox('Checkbox')
|
626
|
+
# ui_checkbox can be used if you use the libui_paradise gem.
|
627
|
+
|
619
628
|
This may look like so on Linux:
|
620
629
|
|
621
630
|
<img src="https://i.imgur.com/d7qWalZ.png" style="margin-left: 2em; padding: 4px; border: 1px solid black;">
|
622
631
|
|
623
|
-
To
|
632
|
+
To set such a checkbox to the checked-state (that is, as if the
|
633
|
+
user clicked on it), use the following method, if you use the
|
634
|
+
libui_paradise gem:
|
635
|
+
|
636
|
+
checkbox.set_checked(1)
|
637
|
+
|
638
|
+
To query its state use:
|
639
|
+
|
640
|
+
checked = LibUI.checkbox_checked(pointer) == 1
|
641
|
+
|
642
|
+
To <b>query</b> whether a checkbox is **active**, use code such as the
|
624
643
|
following:
|
625
644
|
|
626
645
|
checkbox.is_active?
|
@@ -633,6 +652,19 @@ registered in a main, toplevel Hash in the
|
|
633
652
|
**libui_paradise project**. Not very elegant, but simple, and
|
634
653
|
it works (for the most part).
|
635
654
|
|
655
|
+
The toggle-event for a checkbox can be triggered via:
|
656
|
+
|
657
|
+
checkbox_toggle_callback = proc { |pointer|
|
658
|
+
checked = LibLibUI.checkbox_checked(pointer) == 1
|
659
|
+
LibUI.window_set_title(MAIN_WINDOW, "Checkbox is #{checked}")
|
660
|
+
LibUI.checkbox_set_text(pointer, "I am the checkbox (#{checked})")
|
661
|
+
0
|
662
|
+
}
|
663
|
+
|
664
|
+
To respond to on-toggled events, do:
|
665
|
+
|
666
|
+
LibUI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
667
|
+
|
636
668
|
## Adding a widget into another widget
|
637
669
|
|
638
670
|
I chose the following **API** for this:
|
@@ -686,6 +718,20 @@ The notebook-tab may look like this:
|
|
686
718
|
|
687
719
|
<img src="https://i.imgur.com/olWQAIJ.png" style="margin-left: 2em">
|
688
720
|
|
721
|
+
A new tab can be created via:
|
722
|
+
|
723
|
+
tab = LibUI.new_tab
|
724
|
+
|
725
|
+
To populate the notebook-tab you can use .tab_append() such as
|
726
|
+
shown next:
|
727
|
+
|
728
|
+
hbox1 = LibUI.new_horizontal_box
|
729
|
+
hbox2 = LibUI.new_horizontal_box
|
730
|
+
LibUI.tab_append(tab, 'Page 1', hbox1)
|
731
|
+
LibUI.tab_append(tab, 'Page 2', hbox2)
|
732
|
+
LibUI.tab_append(tab, 'Page 3', UI.new_horizontal_box)
|
733
|
+
LibUI.box_append(inner2, tab, 1)
|
734
|
+
|
689
735
|
## Create a vertical box:
|
690
736
|
|
691
737
|
Use code like this:
|
@@ -832,7 +878,7 @@ hand. Only the raw filename will be used, so if you
|
|
832
878
|
have a file at **/tmp/foo/bar.rb** then the title
|
833
879
|
of the window will be **bar.rb**.
|
834
880
|
|
835
|
-
## Entry
|
881
|
+
## Entry in libui
|
836
882
|
|
837
883
|
An entry in libui may look like this:
|
838
884
|
|
@@ -844,6 +890,12 @@ The upstream C code for libui-entry, for **unix/**, can be seen here:
|
|
844
890
|
|
845
891
|
https://github.com/andlabs/libui/blob/master/unix/entry.c
|
846
892
|
|
893
|
+
In ruby, for the LibUI namespace, you can set text on an entry
|
894
|
+
by calling <b>LibUI.entry_set_text()</b>, such as shown in
|
895
|
+
the following example:
|
896
|
+
|
897
|
+
LibUI.entry_set_text(entry, 'Please enter your feelings')
|
898
|
+
|
847
899
|
## Borderless windows and fullscreen windows
|
848
900
|
|
849
901
|
A window that is **borderless: true** will not show any title or
|
@@ -857,14 +909,14 @@ To set the main window to full screen (occupy the whole monitor) do:
|
|
857
909
|
|
858
910
|
You can use the following API for a spinbox:
|
859
911
|
|
860
|
-
|
912
|
+
LibUI.new_spinbox
|
861
913
|
|
862
914
|
To create a new spinbox.
|
863
915
|
|
864
916
|
To specify the **min** and **max** range, pass them as parameters
|
865
917
|
on creation-time:
|
866
918
|
|
867
|
-
|
919
|
+
LibUI.new_spinbox(0, 100)
|
868
920
|
|
869
921
|
If you use the extensions found in the libui_paradise gem then
|
870
922
|
you can do this instead:
|
@@ -884,9 +936,9 @@ to see how this works.
|
|
884
936
|
|
885
937
|
Relevant methods in regard to the spinbox in libui are as follows:
|
886
938
|
|
887
|
-
|
888
|
-
|
889
|
-
|
939
|
+
LibUI.spinbox_on_changed()
|
940
|
+
LibUI.spinbox_set_value()
|
941
|
+
LibUI.spinbox_value()
|
890
942
|
|
891
943
|
To **set** a value use either of the following two methods:
|
892
944
|
|
@@ -903,7 +955,7 @@ A text-view widget shows content, such as the content of a local file.
|
|
903
955
|
|
904
956
|
In libui the general API for this is:
|
905
957
|
|
906
|
-
|
958
|
+
LibUI.new_multiline_entry # this is a textview
|
907
959
|
|
908
960
|
## Control Gallery
|
909
961
|
|
@@ -911,17 +963,19 @@ Here is an image, from kotlin-libui, how this may look on windows:
|
|
911
963
|
|
912
964
|
<img src="https://raw.githubusercontent.com/msink/kotlin-libui/master/samples/controlgallery/controlgallery-windows7.png" style="margin-left: 2em">
|
913
965
|
|
914
|
-
## LibUI.new_button() - how to work with buttons in LibUI
|
966
|
+
## LibUI.new_button() - how to work with buttons in LibUI in general
|
915
967
|
|
916
|
-
<b>LibUI.new_button</b> allows us to create a new button
|
968
|
+
<b>LibUI.new_button</b> allows us to create a new button via
|
969
|
+
LibUI.
|
917
970
|
|
918
|
-
Examples:
|
971
|
+
Examples for this:
|
919
972
|
|
920
973
|
button1 = LibUI.new_button('Text')
|
921
974
|
button2 = LibUI.new_button('▶')
|
975
|
+
button3 = LibUI.new_button('■') # You can use Unicode / Emojis here just fine.
|
922
976
|
|
923
|
-
Now, we need to "tell" this button what to do when it is
|
924
|
-
|
977
|
+
Now, we need to "tell" this button what to do when it is clicked.
|
978
|
+
This is done via Libui.button_on_clicked().
|
925
979
|
|
926
980
|
Example:
|
927
981
|
|
@@ -1110,27 +1164,6 @@ subsequently removed one day.
|
|
1110
1164
|
UI.control_show(main_window)
|
1111
1165
|
main_window.show_the_controls # Or use this one here.
|
1112
1166
|
|
1113
|
-
|
1114
|
-
# Add a checkbox (checkbox tag, checkbutton)
|
1115
|
-
|
1116
|
-
checkbox = UI.new_checkbox('Checkbox') # or ui_checkbox
|
1117
|
-
checkbox_toggle_callback = proc { |pointer|
|
1118
|
-
checked = UI.checkbox_checked(pointer) == 1
|
1119
|
-
UI.window_set_title(MAIN_WINDOW, "Checkbox is #{checked}")
|
1120
|
-
UI.checkbox_set_text(pointer, "I am the checkbox (#{checked})")
|
1121
|
-
0
|
1122
|
-
}
|
1123
|
-
UI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
1124
|
-
UI.box_append(inner, checkbox, 0)
|
1125
|
-
|
1126
|
-
To set it checked:
|
1127
|
-
|
1128
|
-
checkbox.set_checked(1)
|
1129
|
-
|
1130
|
-
To query its state:
|
1131
|
-
|
1132
|
-
checked = UI.checkbox_checked(pointer) == 1
|
1133
|
-
|
1134
1167
|
# And the control:
|
1135
1168
|
|
1136
1169
|
UI.control_show(main_window)
|
@@ -1162,19 +1195,11 @@ subsequently removed one day.
|
|
1162
1195
|
UI.combobox_on_selected(cbox, combobox_selected_callback, nil)
|
1163
1196
|
|
1164
1197
|
# Or more concise:
|
1165
|
-
combo_box =
|
1198
|
+
combo_box = LibUI.combobox {
|
1166
1199
|
['combobox Item 1', 'combobox Item 2', 'combobox Item 3']
|
1167
1200
|
}
|
1168
1201
|
|
1169
1202
|
|
1170
|
-
# Add content to an editable combox:
|
1171
|
-
|
1172
|
-
UI.append() # .append() adds the named item to the end of the EditableCombobox.
|
1173
|
-
|
1174
|
-
# How to build a menu-interface (menu tag):
|
1175
|
-
|
1176
|
-
help_menu = UI.new_menu('Help')
|
1177
|
-
version_item = UI.menu_append_item(help_menu, 'Version')
|
1178
1203
|
|
1179
1204
|
|
1180
1205
|
</pre>
|
@@ -1390,9 +1415,9 @@ shows how this may look (on icewm):
|
|
1390
1415
|
The syntax goes something like this:
|
1391
1416
|
|
1392
1417
|
rb = ui_radio_buttons
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1418
|
+
LibUI.radio_buttons_append(rb, 'Radio Button 1')
|
1419
|
+
LibUI.radio_buttons_append(rb, 'Radio Button 2')
|
1420
|
+
LibUI.radio_buttons_append(rb, 'Radio Button 3')
|
1396
1421
|
outer_vbox.minimal(rb) # add the radio-button control to the box.
|
1397
1422
|
|
1398
1423
|
In other words: you instantiate a new rb-radio-button 'pointer';
|
@@ -1427,26 +1452,67 @@ For "raw" libui, use this:
|
|
1427
1452
|
|
1428
1453
|
## Tables in LibUI
|
1429
1454
|
|
1430
|
-
|
1455
|
+
The API for creating a new table in <b>LibUI</b> is this:
|
1431
1456
|
|
1432
1457
|
table = LibUI.new_table
|
1433
|
-
|
1434
|
-
|
1458
|
+
table = LibUI.new_table(table_model)
|
1459
|
+
|
1460
|
+
You need to use a model for the table, and pass it as
|
1461
|
+
its first argument. The next line of code shows how
|
1462
|
+
this is done:
|
1463
|
+
|
1464
|
+
model = LibUI.new_table_model(model_handler) # create the model here
|
1465
|
+
|
1466
|
+
Next you have to prevent segfaults by .malloc-ating the
|
1467
|
+
table params. This can be done in the following manner:
|
1435
1468
|
|
1436
1469
|
table_params = LibUI::FFI::TableParams.malloc
|
1437
1470
|
table_params = Fiddle::RUBY_FREE
|
1438
1471
|
table_params.Model = model
|
1439
1472
|
table_params.RowBackgroundColorModelColumn = -1
|
1440
|
-
table = LibUI.new_table(table_params)
|
1473
|
+
table = LibUI.new_table(table_params) # And pass it here.
|
1441
1474
|
|
1442
|
-
The table header is an array that contains the following attributes:
|
1475
|
+
The <b>table header</b> is an array that contains the following attributes:
|
1443
1476
|
|
1444
|
-
1. editable, bool type
|
1477
|
+
1. editable, bool type: determines whether column is editable
|
1445
1478
|
2. textColor
|
1446
1479
|
3. title
|
1447
1480
|
4. type, specify value of button, image, imgtext, progress, checkbox, checkboxtext, color, text
|
1448
1481
|
|
1449
|
-
|
1482
|
+
See the example distributed in this gem, in the file at
|
1483
|
+
<b>examples/simple/012_table_example.rb</b>.
|
1484
|
+
|
1485
|
+
This will yield the following result - at the least on Linux and IceWM:
|
1486
|
+
|
1487
|
+
<img src="https://i.imgur.com/Y7m58DH.png" style="margin: 1em">
|
1488
|
+
|
1489
|
+
You can append a new text column via:
|
1490
|
+
|
1491
|
+
::LibUI.table_append_text_column(table, 'Header goes in here', 0, -1)
|
1492
|
+
|
1493
|
+
As this is a bit cumbersome to type, libui_paradise simplifies this
|
1494
|
+
a tiny bit into:
|
1495
|
+
|
1496
|
+
table.append_text_column('Header goes in here', 0, -1)
|
1497
|
+
|
1498
|
+
Be careful to <b>only</b> append entries there if the underlying
|
1499
|
+
dataset - our Array - also contains these entries; otherwise the
|
1500
|
+
application would segfault. The example at
|
1501
|
+
<b>examples/complex/010_table_example.rb</b> shows this - look
|
1502
|
+
at the commented out example to test it.
|
1503
|
+
|
1504
|
+
In November 2023 the API was a bit simplified, towards this:
|
1505
|
+
|
1506
|
+
table.append_text_column('Header goes in here', 0)
|
1507
|
+
table.append_text_column('Another header goes in here', 1)
|
1508
|
+
table.append_text_column('And this is yet another header', 2)
|
1509
|
+
|
1510
|
+
So you can now omit the last -1 part. Expect more simplifications
|
1511
|
+
in the future - all that malloc stuff should be handled by
|
1512
|
+
libui_paradise, rather than in the downstream application
|
1513
|
+
code.
|
1514
|
+
|
1515
|
+
Note that this section is incomplete; it's a bit complicated.
|
1450
1516
|
|
1451
1517
|
In the end, this is possible though:
|
1452
1518
|
|
@@ -1525,7 +1591,7 @@ Available "**new**"-widgets in LibUI:
|
|
1525
1591
|
LibUI.new_table_value_color
|
1526
1592
|
LibUI.new_table_value_string
|
1527
1593
|
LibUI.new_time_picker
|
1528
|
-
LibUI.new_menu
|
1594
|
+
LibUI.new_menu # this is a menu, appearing on the upper area
|
1529
1595
|
LibUI.new_multiline_entry # this is a textview
|
1530
1596
|
LibUI.new_non_wrapping_multiline_entry
|
1531
1597
|
LibUI.new_open_type_features
|
@@ -1572,9 +1638,14 @@ Example for this:
|
|
1572
1638
|
width = canvas.width
|
1573
1639
|
height = canvas.height
|
1574
1640
|
|
1575
|
-
##
|
1641
|
+
## How to to build a menu-interface (menu tag):
|
1576
1642
|
|
1577
|
-
|
1643
|
+
help_menu = LibUI.new_menu('Help')
|
1644
|
+
version_item = LibUI.menu_append_item(help_menu, 'Version')
|
1645
|
+
|
1646
|
+
## Creating a new drawing area in LibUI
|
1647
|
+
|
1648
|
+
The following code should suffice:
|
1578
1649
|
|
1579
1650
|
handler = LibUI::FFI::AreaHandler.malloc
|
1580
1651
|
handler.to_ptr.free = Fiddle::RUBY_FREE
|
@@ -1582,12 +1653,19 @@ This should suffice:
|
|
1582
1653
|
|
1583
1654
|
## Horizontal boxes
|
1584
1655
|
|
1585
|
-
A HBox represents a horizontal box
|
1586
|
-
|
1587
|
-
|
1656
|
+
A <b>HBox</b> represents a <b>horizontal box</b>.
|
1657
|
+
|
1658
|
+
In pure ruby-libui a new horizontal box (hbox) can be created via:
|
1659
|
+
|
1660
|
+
hbox = LibUI.new_horizontal_box
|
1661
|
+
|
1662
|
+
The API for putting something into a hbox goes as follows, such as
|
1663
|
+
when you wish to put a text-entry into the hbox:
|
1588
1664
|
|
1589
1665
|
LibUI.box_append(hbox1, text_entry, 1)
|
1590
1666
|
|
1667
|
+
If you use libui_paradise then you can also use << instead.
|
1668
|
+
|
1591
1669
|
## The slider widget
|
1592
1670
|
|
1593
1671
|
If you use the LibuiParadise gem then you can create and use a new slider
|
@@ -1600,7 +1678,7 @@ like this:
|
|
1600
1678
|
puts "New Slider value: #{UI.slider_value(ptr)}"
|
1601
1679
|
0
|
1602
1680
|
}
|
1603
|
-
|
1681
|
+
LibUI.slider_on_changed(slider, slider_changed_callback) # last element is nil, but it seems we can omit it
|
1604
1682
|
|
1605
1683
|
This may look like so on Linux:
|
1606
1684
|
|
@@ -1668,7 +1746,7 @@ For instance, the text-weight part accepts these values
|
|
1668
1746
|
maximum
|
1669
1747
|
# or any number between minimum and maximum
|
1670
1748
|
|
1671
|
-
To create an attributed String you can use the following API:
|
1749
|
+
To create an <b>attributed String</b> you can use the following API:
|
1672
1750
|
|
1673
1751
|
string = LibUI.new_attributed_string
|
1674
1752
|
attributes = LibUI.new_family_attribute("Courier New 30") # Specify a certain font.
|
@@ -1844,26 +1922,27 @@ expand horizontally or vertically. halign and valign, I think,
|
|
1844
1922
|
are used to align the grid-cell horizontally and vertically, so you
|
1845
1923
|
can position them exactly in the middle.
|
1846
1924
|
|
1847
|
-
Recently (August 2021) I discovered that you can actually
|
1848
|
-
a button-in-a-button. I don't know whether this is a bug or
|
1849
|
-
a feature, but it is hilarious.
|
1925
|
+
Recently (in <b>August 2021</b>) I discovered that you can actually
|
1926
|
+
put a button-in-a-button. I don't know whether this is a bug or
|
1927
|
+
a feature, but it is hilarious nonetheless.
|
1850
1928
|
|
1851
|
-
The 'raw' code I used for this was the following:
|
1929
|
+
The '<b>raw</b>' code I used for this was the following:
|
1852
1930
|
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1931
|
+
LibUI.grid_append(grid, UI.new_button('3'),0,1,1,1,1,1,1,1)
|
1932
|
+
LibUI.grid_append(grid, UI.new_button('4'),1,1,1,1,1,1,1,1)
|
1933
|
+
LibUI.grid_append(grid, UI.new_button('5'),0,1,1,1,1,0,1,0)
|
1934
|
+
LibUI.grid_append(grid, UI.new_button('6'),1,1,1,1,1,0,1,0)
|
1857
1935
|
|
1858
|
-
This led to the following
|
1936
|
+
This led to the following widget setup, as shown in this
|
1937
|
+
image:
|
1859
1938
|
|
1860
1939
|
<img src="https://i.imgur.com/6sWwWKh.png" style="margin-left: 1em">
|
1861
1940
|
|
1862
1941
|
The smaller buttons and the larger buttons can be clicked. They
|
1863
|
-
reside in the same grid-cell. I
|
1864
|
-
bug or a feature really, but this was quite hilarious to see.
|
1865
|
-
In the event that I may forget this, I'll keep this here as
|
1866
|
-
|
1942
|
+
reside in the same grid-cell. As stated I do not know whether this is
|
1943
|
+
a bug or a feature really, but this was quite hilarious to see.
|
1944
|
+
In the event that I may forget this, I'll keep this here as a
|
1945
|
+
<b>reference</b>.
|
1867
1946
|
|
1868
1947
|
If you want to pad the grid you can use the following method:
|
1869
1948
|
|
@@ -1998,9 +2077,10 @@ An entry can be <b>set read only</b> via:
|
|
1998
2077
|
|
1999
2078
|
entry.read_only # This has not been added into libui-paradise yet.
|
2000
2079
|
|
2001
|
-
To <b>respond</b> to <b>on-changed events</b>, you can use
|
2080
|
+
To <b>respond</b> to <b>on-changed events</b>, you can use the following
|
2081
|
+
toplevel API:
|
2002
2082
|
|
2003
|
-
|
2083
|
+
LibUI.entry_on_changed()
|
2004
2084
|
|
2005
2085
|
A more complete example of this:
|
2006
2086
|
|
@@ -2029,8 +2109,35 @@ following simplified method call instead:
|
|
2029
2109
|
puts 'The text is now: '+entry.text?
|
2030
2110
|
}
|
2031
2111
|
|
2112
|
+
## Using a pop-up message box in plain libui:
|
2113
|
+
|
2114
|
+
LibUI.msg_box(MAIN_WINDOW, 'Information', 'You clicked the button')
|
2115
|
+
LibUI.msg_box(main_window,
|
2116
|
+
'Tiny Midi Player',
|
2117
|
+
"Written in Ruby\n" \
|
2118
|
+
"https://github.com/kojix2/libui\n Version #{VERSION}"
|
2119
|
+
)
|
2120
|
+
|
2121
|
+
## How to create an .exe file on Windows via libui
|
2122
|
+
|
2123
|
+
First check: https://github.com/larsch/ocra/
|
2124
|
+
|
2125
|
+
In order to build an .exe file with Ocra, include 3 DLLs from ruby_builtin_dlls
|
2126
|
+
folder:
|
2127
|
+
|
2128
|
+
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
|
2129
|
+
|
2130
|
+
Add additional options below if necessary.
|
2131
|
+
|
2132
|
+
--window
|
2133
|
+
--add-all-core
|
2134
|
+
--chdir-first
|
2135
|
+
--icon assets\app.ico
|
2136
|
+
--verbose
|
2137
|
+
--output out\gallery.exe
|
2138
|
+
|
2032
2139
|
|
2033
|
-
## Contact information and mandatory 2FA coming up in 2022
|
2140
|
+
## Contact information and mandatory 2FA (no longer) coming up in 2022 / 2023
|
2034
2141
|
|
2035
2142
|
If your creative mind has ideas and specific suggestions to make this gem
|
2036
2143
|
more useful in general, feel free to drop me an email at any time, via:
|
@@ -2038,35 +2145,53 @@ more useful in general, feel free to drop me an email at any time, via:
|
|
2038
2145
|
shevy@inbox.lt
|
2039
2146
|
|
2040
2147
|
Before that email I used an email account at Google gmail, but in **2021** I
|
2041
|
-
decided to slowly abandon gmail for various reasons. In order to limit
|
2148
|
+
decided to slowly abandon gmail, for various reasons. In order to limit the
|
2042
2149
|
explanation here, allow me to just briefly state that I do not feel as if I
|
2043
|
-
want to promote any Google service anymore
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2150
|
+
want to promote any Google service anymore when the user becomes the end
|
2151
|
+
product (such as via data collection by upstream services, including other
|
2152
|
+
proxy-services). My feeling is that this is a hugely flawed business model
|
2153
|
+
to begin with, and I no longer wish to support this in any way, even if
|
2154
|
+
only indirectly so, such as by using services of companies that try to
|
2155
|
+
promote this flawed model.
|
2156
|
+
|
2157
|
+
In regards to responding to emails: please keep in mind that responding
|
2158
|
+
may take some time, depending on the amount of work I may have at that
|
2159
|
+
moment. So it is not that emails are ignored; it is more that I have not
|
2160
|
+
(yet) found the time to read and reply. This means there may be a delay
|
2161
|
+
of days, weeks and in some instances also months. There is, unfortunately,
|
2162
|
+
not much I can do when I need to prioritise my time investment, but I try
|
2163
|
+
to consider <b>all</b> feedback as an opportunity to improve my projects
|
2164
|
+
nonetheless.
|
2165
|
+
|
2166
|
+
In <b>2022</b> rubygems.org decided to make 2FA mandatory for every
|
2167
|
+
gem owner eventually:
|
2168
|
+
|
2169
|
+
see
|
2170
|
+
https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
|
2171
|
+
|
2172
|
+
Mandatory 2FA will eventually be extended to all rubygems.org developers and
|
2173
|
+
maintainers. As I can not use 2FA, for reasons I will skip explaining here,
|
2174
|
+
this means that my projects will eventually be removed, as I no longer
|
2175
|
+
have any control over my projects hosted on rubygems.org (because I
|
2176
|
+
can not use 2FA).
|
2177
|
+
|
2178
|
+
At that point, I no longer have any control what is done to my projects
|
2179
|
+
since whoever is controlling the gems ecosystem took away our control
|
2180
|
+
here. I am not sure at which point ruby became corporate-controlled -
|
2181
|
+
that was not the case several years ago, so something has
|
2182
|
+
changed.
|
2183
|
+
|
2184
|
+
Ruby also only allows 2FA users to participate on the issue tracker these
|
2185
|
+
days:
|
2186
|
+
|
2187
|
+
https://bugs.ruby-lang.org/issues/18800
|
2188
|
+
|
2189
|
+
But this has been reverted some months ago, so it is no longer applicable.
|
2190
|
+
Suffice to say that I do not think that we should only be allowed to
|
2191
|
+
interact on the world wide web when some 'authority' authenticated us,
|
2192
|
+
such as via mandatory 2FA, so I hope this won't come back again.
|
2193
|
+
|
2194
|
+
Fighting spam is a noble goal, but when it also means you lock out
|
2195
|
+
real human people then this is definitely NOT a good situation
|
2196
|
+
to be had.
|
2072
2197
|
|