libui_paradise 0.3.9 → 0.4.13
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 +176 -155
- data/bin/libui_message +1 -1
- data/doc/README.gen +175 -85
- data/doc/todo/todo.md +9 -5
- data/lib/libui_paradise/autoinclude.rb +2 -1
- data/lib/libui_paradise/base/base.rb +17 -67
- data/lib/libui_paradise/base_module/base_module.rb +1514 -0
- data/lib/libui_paradise/colours/colours.rb +4 -4
- data/lib/libui_paradise/domain_specific_language/README.md +6 -0
- data/lib/libui_paradise/examples/complex/002_tabs_example.rb +1 -2
- data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/006_coloured_boxes_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/007_slider_example.rb +10 -4
- data/lib/libui_paradise/examples/complex/008_radio_button_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/009_separator_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/010_table_example.rb +5 -9
- data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb +2 -1
- data/lib/libui_paradise/examples/complex/012_password_entry_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/013_form_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/014_text_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/015_text_view_example.rb +4 -4
- data/lib/libui_paradise/examples/complex/016_grid_example.rb +20 -11
- data/lib/libui_paradise/examples/complex/017_unicode_text_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/018_spinbutton_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/019_combo_box_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/020_checkbox_example.rb +5 -5
- data/lib/libui_paradise/examples/complex/021_font_example.rb +4 -3
- data/lib/libui_paradise/examples/complex/022_simple_notepad_example.rb +3 -3
- data/lib/libui_paradise/examples/complex/023_msg_box_error.rb +5 -5
- data/lib/libui_paradise/examples/complex/024_parse_config_file_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/025_colour_button.rb +1 -1
- data/lib/libui_paradise/examples/complex/026_basic_table_image.rb +5 -8
- data/lib/libui_paradise/examples/complex/027_basic_button_example.rb +3 -3
- data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb +4 -5
- data/lib/libui_paradise/examples/complex/029_progressbar_example.rb +4 -5
- data/lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb +5 -6
- data/lib/libui_paradise/examples/complex/031_notification_functionality_example.rb +3 -2
- data/lib/libui_paradise/examples/complex/032_simple_window_example.rb +2 -1
- data/lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb +3 -2
- data/lib/libui_paradise/examples/complex/034_bold_text_example.rb +115 -0
- data/lib/libui_paradise/examples/complex/035_parse_into_table_example.rb +109 -0
- data/lib/libui_paradise/examples/simple/001_open_file_example.rb +1 -1
- data/lib/libui_paradise/examples/simple/002_histogram_example.rb +6 -6
- data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +63 -35
- data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +3 -3
- data/lib/libui_paradise/examples/simple/007_control_gallery.rb +2 -1
- data/lib/libui_paradise/examples/simple/009_spectrum.rb +7 -1
- data/lib/libui_paradise/examples/simple/012_table_example.rb +5 -5
- data/lib/libui_paradise/examples/simple/013_scrolling_pane_example.rb +28 -0
- data/lib/libui_paradise/examples/simple/014_simple_entry_example.rb +30 -0
- data/lib/libui_paradise/examples/simple/015_slider_example.rb +32 -0
- data/lib/libui_paradise/fiddle/fiddle.rb +771 -636
- data/lib/libui_paradise/libui_classes/button.rb +31 -0
- data/lib/libui_paradise/libui_classes/entry.rb +35 -0
- data/lib/libui_paradise/libui_classes/grid.rb +14 -26
- data/lib/libui_paradise/libui_classes/hbox.rb +39 -0
- data/lib/libui_paradise/libui_classes/libui_classes.rb +9 -1630
- data/lib/libui_paradise/libui_classes/msg_box.rb +121 -0
- data/lib/libui_paradise/libui_classes/msg_box_error.rb +41 -0
- data/lib/libui_paradise/libui_classes/slider.rb +28 -0
- data/lib/libui_paradise/libui_classes/spinbox.rb +48 -0
- data/lib/libui_paradise/libui_classes/vbox.rb +38 -0
- data/lib/libui_paradise/project/project.rb +2 -1
- data/lib/libui_paradise/prototype/prototype.rb +8 -8
- data/lib/libui_paradise/requires/require_the_libui_classes.rb +2 -2
- data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +4 -2
- data/lib/libui_paradise/toplevel_methods/add_to_the_registered_widgets.rb +70 -0
- data/lib/libui_paradise/toplevel_methods/hash_fiddle_pointer_widgets.rb +37 -0
- data/lib/libui_paradise/{extensions → toplevel_methods}/toplevel_counters.rb +26 -1
- data/lib/libui_paradise/toplevel_methods/toplevel_methods.rb +792 -0
- data/lib/libui_paradise/version/version.rb +2 -2
- data/test/testing_generic_window.rb +2 -0
- metadata +22 -8
- data/doc/SNIPPETS.md +0 -65
- data/lib/libui_paradise/extensions/extensions.rb +0 -979
- data/lib/libui_paradise/libui_classes/box.rb +0 -157
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
# Encoding: UTF-8
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
# =========================================================================== #
|
|
5
|
-
# require 'libui_paradise/colours/colours.rb
|
|
5
|
+
# require 'libui_paradise/colours/colours.rb'
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
module LibuiParadise
|
|
8
8
|
|
|
9
9
|
# ========================================================================= #
|
|
10
|
-
# === COLOR_BLUE
|
|
10
|
+
# === LibuiParadise::COLOR_BLUE
|
|
11
11
|
#
|
|
12
12
|
# This is actually dodgerblue.
|
|
13
13
|
# ========================================================================= #
|
|
14
14
|
COLOR_BLUE = 0x1E90FF
|
|
15
15
|
|
|
16
16
|
# ========================================================================= #
|
|
17
|
-
# === COLOR_MIDNIGHTBLUE
|
|
17
|
+
# === LibuiParadise::COLOR_MIDNIGHTBLUE
|
|
18
18
|
# ========================================================================= #
|
|
19
19
|
COLOR_MIDNIGHTBLUE = 0x191970
|
|
20
20
|
|
|
21
21
|
# ========================================================================= #
|
|
22
|
-
# === COLOR_LIGHTSEAGREEN
|
|
22
|
+
# === LibuiParadise::COLOR_LIGHTSEAGREEN
|
|
23
23
|
# ========================================================================= #
|
|
24
24
|
COLOR_LIGHTSEAGREEN = 0x20b2aa
|
|
25
25
|
|
|
@@ -3,3 +3,9 @@ libui_paradise even more.
|
|
|
3
3
|
|
|
4
4
|
For instance, the user should be able to parse widgets that
|
|
5
5
|
are described in pure yaml.
|
|
6
|
+
|
|
7
|
+
As of December 2023 this is probably no longer as important,
|
|
8
|
+
as the gem called universal_widgets uses a simplified YAML
|
|
9
|
+
format that is more terse. But, in the event that we may
|
|
10
|
+
wish to revisit this idea, the directory here will be
|
|
11
|
+
retained.
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
# require '002_tabs_example.rb'
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
|
-
#require 'libui_paradise/requires/require_the_libui_paradise_project.rb'
|
|
9
8
|
|
|
10
|
-
window =
|
|
9
|
+
window = main_window('A notebook with tabs example', 1200, 200, 15)
|
|
11
10
|
|
|
12
11
|
tab = ui_tabs
|
|
13
12
|
tab.add('Page 1', hbox(text('One! 😎️')))
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# =========================================================================== #
|
|
9
9
|
require 'libui_paradise/autoinclude'
|
|
10
10
|
|
|
11
|
-
window =
|
|
11
|
+
window = padded_main_window('An open-file button-example', 1200, 200, 15)
|
|
12
12
|
|
|
13
13
|
outer_vbox = ui_padded_vbox
|
|
14
14
|
button_open_file = ui_button('Open file')
|
|
@@ -8,9 +8,9 @@ require 'libui_paradise/autoinclude'
|
|
|
8
8
|
|
|
9
9
|
require 'colours' # Needs the colours gem.
|
|
10
10
|
|
|
11
|
-
window =
|
|
11
|
+
window = padded_main_window('Coloured boxes example', :default, 200, 1)
|
|
12
12
|
|
|
13
|
-
outer_hbox =
|
|
13
|
+
outer_hbox = create_hbox
|
|
14
14
|
outer_hbox.maximal LibuiParadise.draw_rectangle(:default, :default, Colours.random_html_colour)
|
|
15
15
|
outer_hbox.maximal LibuiParadise.draw_rectangle(:default, :default, :seagreen)
|
|
16
16
|
outer_hbox.maximal LibuiParadise.draw_rectangle(:default, :default, :springgreen)
|
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
# =========================================================================== #
|
|
10
|
+
# === UPPER_RANGE
|
|
11
|
+
# =========================================================================== #
|
|
12
|
+
UPPER_RANGE = 20
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
window = padded_main_window('Slider Example', :default, 70, 1)
|
|
15
|
+
|
|
16
|
+
slider = create_slider(0, UPPER_RANGE)
|
|
12
17
|
|
|
13
18
|
# =========================================================================== #
|
|
14
19
|
# === callback_for_the_slider
|
|
15
20
|
# =========================================================================== #
|
|
16
21
|
def callback_for_the_slider
|
|
17
22
|
proc { |pointer|
|
|
18
|
-
puts "New Slider value: #{
|
|
23
|
+
puts "New Slider value: #{LibUI.slider_value(pointer)}"
|
|
19
24
|
}
|
|
20
25
|
end
|
|
21
26
|
slider.on_changed { callback_for_the_slider }
|
|
@@ -27,5 +32,6 @@ slider.on_changed { callback_for_the_slider }
|
|
|
27
32
|
#
|
|
28
33
|
# =========================================================================== #
|
|
29
34
|
outer_vbox = ui_padded_vbox(slider)
|
|
30
|
-
|
|
35
|
+
|
|
36
|
+
window << outer_vbox
|
|
31
37
|
window.intelligent_quit
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
|
-
window = margined_window(:filename,
|
|
9
|
+
window = margined_window(:filename, :default, 200, 0)
|
|
10
10
|
|
|
11
11
|
outer_vbox = padded_vbox
|
|
12
12
|
array_to_use = ['Radio Button 1', 'Radio Button 2', 'Radio Button 3']
|
|
@@ -19,5 +19,5 @@ rb = ui_radio_buttons(array_to_use)
|
|
|
19
19
|
outer_vbox.minimal(rb)
|
|
20
20
|
outer_vbox.minimal(hsep, 0)
|
|
21
21
|
|
|
22
|
-
window
|
|
22
|
+
window << outer_vbox
|
|
23
23
|
window.intelligent_quit
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
|
-
window = margined_window(:filename,
|
|
9
|
+
window = margined_window(:filename, :default, 150, 0)
|
|
10
10
|
|
|
11
11
|
outer_vbox = padded_vbox
|
|
12
12
|
|
|
@@ -21,5 +21,5 @@ outer_vbox.minimal(button_hello_world, 1)
|
|
|
21
21
|
outer_vbox.minimal(hsep, 0)
|
|
22
22
|
outer_vbox.minimal(hsep, 1)
|
|
23
23
|
|
|
24
|
-
window
|
|
24
|
+
window << outer_vbox
|
|
25
25
|
window.intelligent_quit
|
|
@@ -12,7 +12,7 @@ module GUI
|
|
|
12
12
|
|
|
13
13
|
module LibUI
|
|
14
14
|
|
|
15
|
-
class TableExample < Base # === LibuiParadise::GUI::LibUI::TableExample
|
|
15
|
+
class TableExample < ::LibuiParadise::Base # === LibuiParadise::GUI::LibUI::TableExample
|
|
16
16
|
|
|
17
17
|
# ========================================================================= #
|
|
18
18
|
# === DATA
|
|
@@ -29,11 +29,6 @@ class TableExample < Base # === LibuiParadise::GUI::LibUI::TableExample
|
|
|
29
29
|
%w( 7 8 9 )
|
|
30
30
|
]
|
|
31
31
|
|
|
32
|
-
alias e puts
|
|
33
|
-
|
|
34
|
-
require 'libui_paradise'
|
|
35
|
-
include LibuiParadise::Extensions
|
|
36
|
-
|
|
37
32
|
# ========================================================================= #
|
|
38
33
|
# === TITLE
|
|
39
34
|
# ========================================================================= #
|
|
@@ -63,6 +58,7 @@ class TableExample < Base # === LibuiParadise::GUI::LibUI::TableExample
|
|
|
63
58
|
# === reset (reset tag)
|
|
64
59
|
# ========================================================================= #
|
|
65
60
|
def reset
|
|
61
|
+
reset_the_internal_hash
|
|
66
62
|
title_width_height(TITLE, WIDTH, HEIGHT)
|
|
67
63
|
end
|
|
68
64
|
|
|
@@ -73,7 +69,7 @@ class TableExample < Base # === LibuiParadise::GUI::LibUI::TableExample
|
|
|
73
69
|
# ======================================================================= #
|
|
74
70
|
# === @window
|
|
75
71
|
# ======================================================================= #
|
|
76
|
-
|
|
72
|
+
set_window(return_default_window)
|
|
77
73
|
# ======================================================================= #
|
|
78
74
|
# Protects BlockCaller objects from garbage collection.
|
|
79
75
|
# ======================================================================= #
|
|
@@ -137,8 +133,8 @@ class TableExample < Base # === LibuiParadise::GUI::LibUI::TableExample
|
|
|
137
133
|
button1
|
|
138
134
|
)
|
|
139
135
|
outer_vbox.minimal(quit_button)
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
main_window? << outer_vbox
|
|
137
|
+
main_window?.intelligent_exit
|
|
142
138
|
free_table_model(model)
|
|
143
139
|
end
|
|
144
140
|
|
data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb
CHANGED
|
@@ -19,6 +19,7 @@ button2.disable # Start-state for this button.
|
|
|
19
19
|
outer_hbox << button1
|
|
20
20
|
outer_hbox << button2
|
|
21
21
|
|
|
22
|
+
# The two buttons will toggle one another.
|
|
22
23
|
button1.on_clicked {|widget|
|
|
23
24
|
button2.enable
|
|
24
25
|
button1.disable
|
|
@@ -28,5 +29,5 @@ button2.on_clicked {|widget|
|
|
|
28
29
|
button2.disable
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
main_window
|
|
32
|
+
main_window << outer_hbox
|
|
32
33
|
main_window.intelligent_exit
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
# Encoding: UTF-8
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
# =========================================================================== #
|
|
5
|
-
#
|
|
5
|
+
# 015_text_view_example.rb
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
|
-
window = padded_main_window('Text View Example',
|
|
9
|
+
window = padded_main_window('Text View Example', :default, 300, 0)
|
|
10
10
|
|
|
11
11
|
outer_vbox = padded_vbox
|
|
12
12
|
text = multiline_entry('Hello world! This can be set to read only via .is_read_only().')
|
|
13
|
-
# text.is_read_only
|
|
13
|
+
# text.is_read_only # This can be used to set it to read-only.
|
|
14
14
|
outer_vbox.minimal(text, 1)
|
|
15
|
-
window
|
|
15
|
+
window << outer_vbox
|
|
16
16
|
window.intelligent_quit
|
|
@@ -10,22 +10,31 @@ require 'libui_paradise/autoinclude'
|
|
|
10
10
|
|
|
11
11
|
window = padded_main_window('A simple grid-example', 1200, 200, 15)
|
|
12
12
|
|
|
13
|
-
grid =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
grid = padded_grid
|
|
14
|
+
grid.grid_append(text('Yo1'))
|
|
15
|
+
grid.grid_append(text('Yo2'))
|
|
16
|
+
grid.grid_append(text('Yo3'))
|
|
17
|
+
LibuiParadise.new_row
|
|
18
|
+
# ======================================================================= #
|
|
19
|
+
# left, top, xspan, yspan, hexpand, halign, vexpand, valign
|
|
20
|
+
# 0, 0, 1, 1, 0, 0, 1, 0
|
|
21
|
+
# ======================================================================= #
|
|
22
|
+
grid.grid_append(text('Yo4'))
|
|
23
|
+
grid.grid_append(text('Yo5'))
|
|
24
|
+
grid.grid_append(text('Yo6'))
|
|
25
|
+
LibuiParadise.new_row
|
|
21
26
|
|
|
27
|
+
# ========================================================================= #
|
|
28
|
+
# This one will add at a specific position - it's a little more complicated
|
|
29
|
+
# than the prior methods, but this shows how it can be done.
|
|
30
|
+
# ========================================================================= #
|
|
22
31
|
grid.hash_grid(
|
|
23
32
|
text('Yo7'),
|
|
24
|
-
{ left:
|
|
33
|
+
{ left: 3, top: 3, xspan: 3, yspan: 3, hexpand: 1, halign: 0, vexpand: 1, valign: 0 }
|
|
25
34
|
)
|
|
26
35
|
|
|
27
36
|
vbox = padded_vbox
|
|
28
37
|
vbox << grid
|
|
29
38
|
|
|
30
|
-
window
|
|
31
|
-
window.intelligent_exit
|
|
39
|
+
#window << vbox
|
|
40
|
+
window.intelligent_exit(vbox)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# =========================================================================== #
|
|
9
9
|
require 'libui_paradise/autoinclude'
|
|
10
10
|
|
|
11
|
-
window =
|
|
11
|
+
window = margined_main_window('Unicode Text Example', 1200, 200, 15)
|
|
12
12
|
|
|
13
13
|
outer_vbox = padded_vbox
|
|
14
14
|
text = text(
|
|
@@ -26,5 +26,5 @@ Let's test this next with some unicode:
|
|
|
26
26
|
|
|
27
27
|
outer_vbox << text
|
|
28
28
|
|
|
29
|
-
window
|
|
29
|
+
window << outer_vbox
|
|
30
30
|
window.intelligent_quit
|
|
@@ -71,11 +71,11 @@ checkbox_toggle_callback = proc { |ptr|
|
|
|
71
71
|
UI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
|
72
72
|
inner.add(checkbox, 0)
|
|
73
73
|
|
|
74
|
-
MAIN_WINDOW = UI.window('hello world',
|
|
74
|
+
MAIN_WINDOW = UI.window('hello world', :default, HEIGHT, 1)
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
LibUI.window_set_margined(MAIN_WINDOW, 1)
|
|
77
|
+
MAIN_WINDOW << vbox
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
LibUI.window_on_closing(MAIN_WINDOW, should_quit_callback, nil)
|
|
80
80
|
MAIN_WINDOW.control_show
|
|
81
|
-
|
|
81
|
+
LibUI.main_then_quit
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
class FontExample
|
|
16
16
|
|
|
17
17
|
require 'libui_paradise'
|
|
18
|
-
include LibuiParadise::
|
|
18
|
+
include LibuiParadise::BaseModule
|
|
19
19
|
|
|
20
20
|
# ========================================================================= #
|
|
21
21
|
# === USE_THIS_FONT
|
|
@@ -45,6 +45,7 @@ class FontExample
|
|
|
45
45
|
def initialize(
|
|
46
46
|
run_already = true
|
|
47
47
|
)
|
|
48
|
+
reset
|
|
48
49
|
run if run_already
|
|
49
50
|
end
|
|
50
51
|
|
|
@@ -67,7 +68,7 @@ class FontExample
|
|
|
67
68
|
handler_draw_event = Fiddle::Closure::BlockCaller.new(0, [1, 1, 1]) { |_, _, adp|
|
|
68
69
|
area_draw_params = LibUI::FFI::AreaDrawParams.new(adp)
|
|
69
70
|
default_font = font {{
|
|
70
|
-
font_size: USE_THIS_FONT_SIZE,
|
|
71
|
+
font_size: USE_THIS_FONT_SIZE, # Pass in the font-size here.
|
|
71
72
|
font_family: USE_THIS_FONT,
|
|
72
73
|
italic: false,
|
|
73
74
|
stretch: 2,
|
|
@@ -102,7 +103,7 @@ class FontExample
|
|
|
102
103
|
|
|
103
104
|
main_window = ui_main_window(TITLE, WIDTH, 400, 1)
|
|
104
105
|
LibUI.window_set_margined(main_window, 1)
|
|
105
|
-
main_window
|
|
106
|
+
main_window << box
|
|
106
107
|
main_window.simple_exit
|
|
107
108
|
main_window.control_show
|
|
108
109
|
main_window.intelligent_exit
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
|
-
window = padded_window('Notepad',
|
|
9
|
+
window = padded_window('Notepad', :default, 300, 1)
|
|
10
10
|
|
|
11
|
-
vbox =
|
|
11
|
+
vbox = create_vbox
|
|
12
12
|
|
|
13
13
|
text_view = ui_text_view
|
|
14
14
|
text_view.set_text(
|
|
@@ -21,5 +21,5 @@ button_show_content.on_clicked {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
vbox << button_show_content
|
|
24
|
-
window
|
|
24
|
+
window << vbox
|
|
25
25
|
window.intelligent_exit
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
9
|
TITLE = 'msg box error'
|
|
10
|
-
main_window = ui_padded_window(TITLE,
|
|
10
|
+
main_window = ui_padded_window(TITLE, 320, 240, 1)
|
|
11
11
|
|
|
12
|
-
button1 =
|
|
12
|
+
button1 = create_button('Text (click me)')
|
|
13
13
|
button1.on_clicked {
|
|
14
|
-
LibuiParadise
|
|
14
|
+
LibuiParadise.message_box_error(
|
|
15
15
|
main_window,
|
|
16
16
|
'Error',
|
|
17
17
|
"You clicked \nthe button"
|
|
@@ -22,6 +22,6 @@ button1.on_clicked {
|
|
|
22
22
|
hbox = padded_hbox
|
|
23
23
|
hbox << button1
|
|
24
24
|
main_window.close_properly
|
|
25
|
-
main_window
|
|
25
|
+
main_window << hbox
|
|
26
26
|
main_window.control_show
|
|
27
|
-
|
|
27
|
+
LibUI.main_then_quit
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Encoding: UTF-8
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
# =========================================================================== #
|
|
5
|
-
# require '
|
|
5
|
+
# require '024_parse'
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
@@ -11,5 +11,5 @@ window = LibuiParadise.parse_this_config_file(use_this_config_file)
|
|
|
11
11
|
outer_vbox = padded_vbox
|
|
12
12
|
text = text('The config file was '+use_this_config_file)
|
|
13
13
|
outer_vbox << text
|
|
14
|
-
window
|
|
14
|
+
window << outer_vbox
|
|
15
15
|
window.intelligent_quit
|
|
@@ -17,11 +17,11 @@ N_TIMES = 10
|
|
|
17
17
|
# =========================================================================== #
|
|
18
18
|
REMOTE_URL = 'https://www.ghibli.jp/gallery/thumb-redturtle%03d.png'
|
|
19
19
|
|
|
20
|
-
main_window =
|
|
20
|
+
main_window = padded_main_window('The Red Turtle', 310, 350, 0)
|
|
21
21
|
|
|
22
22
|
hbox = ui_padded_hbox
|
|
23
23
|
main_window.simple_exit
|
|
24
|
-
main_window
|
|
24
|
+
main_window << hbox
|
|
25
25
|
|
|
26
26
|
# =========================================================================== #
|
|
27
27
|
# === IMAGES
|
|
@@ -43,10 +43,8 @@ N_TIMES.times { |i|
|
|
|
43
43
|
# Add a new image next:
|
|
44
44
|
# ========================================================================= #
|
|
45
45
|
image = UI.new_image(width, height)
|
|
46
|
-
|
|
46
|
+
LibUI.image_append(image, data, width, height, width * 4)
|
|
47
47
|
IMAGES << image # Store all images in the following area.
|
|
48
|
-
rescue StandardError => error
|
|
49
|
-
warn url, error.message
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
# =========================================================================== #
|
|
@@ -84,8 +82,7 @@ hbox.maximal(table)
|
|
|
84
82
|
|
|
85
83
|
main_window.show_the_controls
|
|
86
84
|
|
|
87
|
-
|
|
88
|
-
e 'Bye Bye'
|
|
85
|
+
LibUI.window_on_closing(main_window) {
|
|
89
86
|
UI.control_destroy(main_window)
|
|
90
87
|
UI.free_table_model(model)
|
|
91
88
|
IMAGES.each { |i| UI.free_image(i) }
|
|
@@ -93,4 +90,4 @@ UI.window_on_closing(main_window) {
|
|
|
93
90
|
0
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
|
|
93
|
+
LibUI.main_then_quit
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
9
|
-
main_window =
|
|
9
|
+
main_window = create_window('hello world', 300, 200, 0)
|
|
10
10
|
|
|
11
11
|
button = button('Button')
|
|
12
12
|
button.on_clicked {|widget| # is a <Fiddle::Pointer:0x00005590774f1ca0 ptr=0x0000559077484c90 size=0 free=0x0000000000000000>
|
|
13
13
|
e 'The main button was clicked.'
|
|
14
|
-
ui_msg_box(main_window, 'Information', '
|
|
14
|
+
ui_msg_box(main_window, 'Information', 'The main button has been clicked.')
|
|
15
15
|
0
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
main_window
|
|
18
|
+
main_window << button
|
|
19
19
|
main_window.intelligent_exit
|
data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Encoding: UTF-8
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
# =========================================================================== #
|
|
5
|
-
# require '
|
|
5
|
+
# require '028_try_for_automatic_button_press_event_after_a_delay.rb'
|
|
6
6
|
# =========================================================================== #
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
|
8
8
|
|
|
@@ -17,10 +17,9 @@ should_quit_callback = proc {
|
|
|
17
17
|
0
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
MAIN_WINDOW =
|
|
21
|
-
vbox =
|
|
22
|
-
|
|
23
|
-
button1 = LibUI.new_button('Testing')
|
|
20
|
+
MAIN_WINDOW = create_window('Try for automatic button press event after a delay', :default, HEIGHT, 1)
|
|
21
|
+
vbox = create_padded_vbox
|
|
22
|
+
button1 = create_button('Testing')
|
|
24
23
|
|
|
25
24
|
LibUI.button_on_clicked(button1) do
|
|
26
25
|
the_button_was_clicked
|
|
@@ -12,10 +12,8 @@ module LibUI
|
|
|
12
12
|
|
|
13
13
|
class ProgressbarExample # === LibuiParadise::GUI::LibUI::ProgressbarExample
|
|
14
14
|
|
|
15
|
-
alias e puts
|
|
16
|
-
|
|
17
15
|
require 'libui_paradise'
|
|
18
|
-
include LibuiParadise::
|
|
16
|
+
include LibuiParadise::BaseModule
|
|
19
17
|
|
|
20
18
|
# ========================================================================= #
|
|
21
19
|
# === TITLE
|
|
@@ -46,6 +44,7 @@ class ProgressbarExample # === LibuiParadise::GUI::LibUI::ProgressbarExample
|
|
|
46
44
|
# === reset (reset tag)
|
|
47
45
|
# ========================================================================= #
|
|
48
46
|
def reset
|
|
47
|
+
reset_the_internal_hash
|
|
49
48
|
title_width_height(TITLE, WIDTH, HEIGHT)
|
|
50
49
|
end
|
|
51
50
|
|
|
@@ -56,7 +55,7 @@ class ProgressbarExample # === LibuiParadise::GUI::LibUI::ProgressbarExample
|
|
|
56
55
|
# ======================================================================= #
|
|
57
56
|
# === @window
|
|
58
57
|
# ======================================================================= #
|
|
59
|
-
@window =
|
|
58
|
+
@window = create_padded_main_window(title?, width?, height?, 0)
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
# ========================================================================= #
|
|
@@ -105,7 +104,7 @@ class ProgressbarExample # === LibuiParadise::GUI::LibUI::ProgressbarExample
|
|
|
105
104
|
outer_vbox.minimal(@progress_bar)
|
|
106
105
|
outer_vbox.minimal(quit_button)
|
|
107
106
|
run_the_outer_thread
|
|
108
|
-
@window
|
|
107
|
+
@window << outer_vbox
|
|
109
108
|
@window.intelligent_exit
|
|
110
109
|
end
|
|
111
110
|
|
|
@@ -12,10 +12,8 @@ module LibUI
|
|
|
12
12
|
|
|
13
13
|
class EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample # === LibuiParadise::GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample
|
|
14
14
|
|
|
15
|
-
alias e puts
|
|
16
|
-
|
|
17
15
|
require 'libui_paradise'
|
|
18
|
-
include LibuiParadise::
|
|
16
|
+
include LibuiParadise::BaseModule
|
|
19
17
|
|
|
20
18
|
# ========================================================================= #
|
|
21
19
|
# === TITLE
|
|
@@ -46,6 +44,7 @@ class EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample # === LibuiP
|
|
|
46
44
|
# === reset (reset tag)
|
|
47
45
|
# ========================================================================= #
|
|
48
46
|
def reset
|
|
47
|
+
reset_the_internal_hash
|
|
49
48
|
title_width_height(TITLE, WIDTH, HEIGHT)
|
|
50
49
|
end
|
|
51
50
|
|
|
@@ -56,7 +55,7 @@ class EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample # === LibuiP
|
|
|
56
55
|
# ======================================================================= #
|
|
57
56
|
# === @window
|
|
58
57
|
# ======================================================================= #
|
|
59
|
-
@window =
|
|
58
|
+
@window = create_padded_main_window(title?, width?, height?, 0)
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
# ========================================================================= #
|
|
@@ -104,7 +103,7 @@ class EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample # === LibuiP
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
outer_vbox.minimal(grid)
|
|
107
|
-
@window
|
|
106
|
+
@window << outer_vbox
|
|
108
107
|
@window.intelligent_exit
|
|
109
108
|
end
|
|
110
109
|
|
|
@@ -128,7 +127,7 @@ class EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample # === LibuiP
|
|
|
128
127
|
&block
|
|
129
128
|
)
|
|
130
129
|
_ = entry.text?
|
|
131
|
-
if _
|
|
130
|
+
if _.end_with?('#')
|
|
132
131
|
yield if block_given?
|
|
133
132
|
end
|
|
134
133
|
end
|
|
@@ -15,7 +15,7 @@ class NotificationFunctionalityExample # === LibuiParadise::GUI::LibUI::Notifica
|
|
|
15
15
|
alias e puts
|
|
16
16
|
|
|
17
17
|
require 'libui_paradise'
|
|
18
|
-
include LibuiParadise::
|
|
18
|
+
include LibuiParadise::BaseModule
|
|
19
19
|
|
|
20
20
|
# ========================================================================= #
|
|
21
21
|
# === TITLE
|
|
@@ -46,6 +46,7 @@ class NotificationFunctionalityExample # === LibuiParadise::GUI::LibUI::Notifica
|
|
|
46
46
|
# === reset (reset tag)
|
|
47
47
|
# ========================================================================= #
|
|
48
48
|
def reset
|
|
49
|
+
reset_the_internal_hash
|
|
49
50
|
title_width_height(TITLE, WIDTH, HEIGHT)
|
|
50
51
|
end
|
|
51
52
|
|
|
@@ -56,7 +57,7 @@ class NotificationFunctionalityExample # === LibuiParadise::GUI::LibUI::Notifica
|
|
|
56
57
|
# ======================================================================= #
|
|
57
58
|
# === @window
|
|
58
59
|
# ======================================================================= #
|
|
59
|
-
@window =
|
|
60
|
+
@window = create_padded_main_window(title?, width?, height?, 0)
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
# ========================================================================= #
|