libui_paradise 0.2.49

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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +2072 -0
  3. data/doc/README.gen +1931 -0
  4. data/doc/SNIPPETS.md +94 -0
  5. data/doc/todo/todo.md +16 -0
  6. data/lib/libui_paradise/autoinclude.rb +9 -0
  7. data/lib/libui_paradise/base/base.rb +154 -0
  8. data/lib/libui_paradise/colours/colours.rb +14 -0
  9. data/lib/libui_paradise/domain_specific_language/README.md +5 -0
  10. data/lib/libui_paradise/domain_specific_language/button.yml +7 -0
  11. data/lib/libui_paradise/examples/complex/001_hbox_example.rb +17 -0
  12. data/lib/libui_paradise/examples/complex/002_tabs_example.rb +25 -0
  13. data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +38 -0
  14. data/lib/libui_paradise/examples/complex/004_font_button.rb +41 -0
  15. data/lib/libui_paradise/examples/complex/005_search_entry_example.rb +18 -0
  16. data/lib/libui_paradise/examples/complex/006_coloured_boxes_example.rb +22 -0
  17. data/lib/libui_paradise/examples/complex/007_slider_example.rb +31 -0
  18. data/lib/libui_paradise/examples/complex/008_radio_button_example.rb +23 -0
  19. data/lib/libui_paradise/examples/complex/009_separator_example.rb +25 -0
  20. data/lib/libui_paradise/examples/complex/010_table_example.rb +55 -0
  21. data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb +32 -0
  22. data/lib/libui_paradise/examples/complex/012_password_entry_example.rb +29 -0
  23. data/lib/libui_paradise/examples/complex/013_form_example.rb +38 -0
  24. data/lib/libui_paradise/examples/complex/014_text_example.rb +18 -0
  25. data/lib/libui_paradise/examples/complex/015_text_view_example.rb +16 -0
  26. data/lib/libui_paradise/examples/complex/016_grid_example.rb +31 -0
  27. data/lib/libui_paradise/examples/complex/017_unicode_text_example.rb +30 -0
  28. data/lib/libui_paradise/examples/complex/018_spinbutton_example.rb +33 -0
  29. data/lib/libui_paradise/examples/complex/019_combo_box_example.rb +50 -0
  30. data/lib/libui_paradise/examples/complex/020_checkbox_example.rb +81 -0
  31. data/lib/libui_paradise/examples/complex/021_font_example.rb +115 -0
  32. data/lib/libui_paradise/examples/complex/022_simple_notepad_example.rb +25 -0
  33. data/lib/libui_paradise/examples/complex/023_msg_box_error.rb +27 -0
  34. data/lib/libui_paradise/examples/complex/024_parse_config_file_example.config +6 -0
  35. data/lib/libui_paradise/examples/complex/024_parse_config_file_example.rb +15 -0
  36. data/lib/libui_paradise/examples/complex/025_colour_button.rb +53 -0
  37. data/lib/libui_paradise/examples/complex/026_basic_table_image.rb +96 -0
  38. data/lib/libui_paradise/examples/complex/027_basic_button_example.rb +19 -0
  39. data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb +47 -0
  40. data/lib/libui_paradise/examples/complex/029_progressbar_example.rb +116 -0
  41. data/lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb +140 -0
  42. data/lib/libui_paradise/examples/complex/031_notification_functionality_example.rb +96 -0
  43. data/lib/libui_paradise/examples/complex/032_simple_window_example.rb +69 -0
  44. data/lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb +91 -0
  45. data/lib/libui_paradise/examples/simple/001_open_file_example.rb +35 -0
  46. data/lib/libui_paradise/examples/simple/002_histogram_example.rb +213 -0
  47. data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +220 -0
  48. data/lib/libui_paradise/examples/simple/004_date_time_picker.rb +52 -0
  49. data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +185 -0
  50. data/lib/libui_paradise/examples/simple/006_midi_player.rb +96 -0
  51. data/lib/libui_paradise/examples/simple/007_control_gallery.rb +191 -0
  52. data/lib/libui_paradise/examples/simple/008_basic_area_example.rb +56 -0
  53. data/lib/libui_paradise/examples/simple/009_spectrum.rb +107 -0
  54. data/lib/libui_paradise/examples/simple/README.md +7 -0
  55. data/lib/libui_paradise/experimental/dsl.rb +17 -0
  56. data/lib/libui_paradise/extensions/counters.rb +58 -0
  57. data/lib/libui_paradise/extensions/extensions.rb +29 -0
  58. data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +150 -0
  59. data/lib/libui_paradise/extensions/misc.rb +754 -0
  60. data/lib/libui_paradise/fiddle/pointer.rb +1158 -0
  61. data/lib/libui_paradise/generic_window/README.md +9 -0
  62. data/lib/libui_paradise/generic_window/generic_window.rb +79 -0
  63. data/lib/libui_paradise/images/LIBUI_PARADISE_LOGO.png +0 -0
  64. data/lib/libui_paradise/images/README.md +2 -0
  65. data/lib/libui_paradise/images/form_example.png +0 -0
  66. data/lib/libui_paradise/libui_classes/box.rb +156 -0
  67. data/lib/libui_paradise/libui_classes/grid.rb +55 -0
  68. data/lib/libui_paradise/libui_classes/libui_classes.rb +1611 -0
  69. data/lib/libui_paradise/project/project.rb +28 -0
  70. data/lib/libui_paradise/prototype/README.md +3 -0
  71. data/lib/libui_paradise/prototype/prototype.rb +107 -0
  72. data/lib/libui_paradise/requires/require_the_libui_classes.rb +29 -0
  73. data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +12 -0
  74. data/lib/libui_paradise/toplevel_methods/misc.rb +13 -0
  75. data/lib/libui_paradise/version/version.rb +17 -0
  76. data/lib/libui_paradise.rb +1 -0
  77. data/libui_paradise.gemspec +49 -0
  78. data/test/testing_generic_window.rb +20 -0
  79. metadata +156 -0
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require '020_checkbox_example'
6
+ # =========================================================================== #
7
+ require 'libui_paradise/autoinclude'
8
+
9
+ # =========================================================================== #
10
+ # === HEIGHT
11
+ # =========================================================================== #
12
+ HEIGHT = 120
13
+
14
+ should_quit_callback = proc {
15
+ LibUI.control_destroy(MAIN_WINDOW)
16
+ LibUI.quit
17
+ 0
18
+ }
19
+
20
+ MAIN_WINDOW = LibUI.window('Try for automatic button press event after a delay', 600, HEIGHT, 1)
21
+ vbox = LibUI.vbox
22
+ LibUI.box_set_padded(vbox, 1)
23
+ button1 = LibUI.new_button('Testing')
24
+
25
+ LibUI.button_on_clicked(button1) do
26
+ the_button_was_clicked
27
+ end
28
+
29
+ LibUI.box_append(vbox, button1, 0)
30
+
31
+ LibUI.window_set_margined(MAIN_WINDOW, 1)
32
+ LibUI.window_set_child(MAIN_WINDOW, vbox)
33
+ LibUI.window_on_closing(MAIN_WINDOW, should_quit_callback, nil)
34
+ Thread.new {
35
+ sleep 3
36
+ the_button_was_clicked
37
+ }
38
+
39
+ # =========================================================================== #
40
+ # === the_button_was_clicked
41
+ # =========================================================================== #
42
+ def the_button_was_clicked
43
+ LibUI.msg_box(MAIN_WINDOW, 'Information', 'You clicked the button!')
44
+ end
45
+
46
+ MAIN_WINDOW.control_show
47
+ LibUI.main_then_quit
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === LibuiParadise::GUI::LibUI::ProgressbarExample
6
+ # =========================================================================== #
7
+ module LibuiParadise
8
+
9
+ module GUI
10
+
11
+ module LibUI
12
+
13
+ class ProgressbarExample # === LibuiParadise::GUI::LibUI::ProgressbarExample
14
+
15
+ alias e puts
16
+
17
+ require 'libui_paradise'
18
+ include LibuiParadise::Extensions
19
+
20
+ # ========================================================================= #
21
+ # === TITLE
22
+ # ========================================================================= #
23
+ TITLE = 'A ProgressbarExample for LibUI'
24
+
25
+ # ========================================================================= #
26
+ # === WIDTH
27
+ # ========================================================================= #
28
+ WIDTH = 400
29
+
30
+ # ========================================================================= #
31
+ # === HEIGHT
32
+ # ========================================================================= #
33
+ HEIGHT = 220
34
+
35
+ # ========================================================================= #
36
+ # === initialize
37
+ # ========================================================================= #
38
+ def initialize(
39
+ run_already = true
40
+ )
41
+ reset
42
+ run if run_already
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === reset (reset tag)
47
+ # ========================================================================= #
48
+ def reset
49
+ title_width_height(TITLE, WIDTH, HEIGHT)
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === create_skeleton (create tag, skeleton tag)
54
+ # ========================================================================= #
55
+ def create_skeleton
56
+ # ======================================================================= #
57
+ # === @window
58
+ # ======================================================================= #
59
+ @window = ui_padded_main_window(title?, width?, height?, 0)
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === set_value_for_the_progress_bar
64
+ #
65
+ # Set to a new value for the progress-bar via this method here.
66
+ # ========================================================================= #
67
+ def set_value_for_the_progress_bar(i = 20)
68
+ @progress_bar.set_value(i)
69
+ end
70
+
71
+ # ========================================================================= #
72
+ # === run_the_outer_thread
73
+ # ========================================================================= #
74
+ def run_the_outer_thread
75
+ Thread.new {
76
+ loop {
77
+ set_value_for_the_progress_bar(
78
+ rand(100)+1
79
+ )
80
+ e 'The new value is: '+@progress_bar.value?.to_s
81
+ sleep 1
82
+ }
83
+ }
84
+ end
85
+
86
+ # ========================================================================= #
87
+ # === run
88
+ # ========================================================================= #
89
+ def run
90
+ create_skeleton_then_connect_skeleton
91
+ outer_vbox = padded_vbox
92
+ # ======================================================================= #
93
+ # First add the two buttons on top:
94
+ # ======================================================================= #
95
+ outer_vbox.add_hsep
96
+
97
+ grid = ui_padded_grid
98
+ # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
99
+ grid.ui_grid_append(text('Showcasing a progress bar:'), 0, 0, 1, 1, 0, 0.5, 1, 0)
100
+ outer_vbox.minimal(grid)
101
+
102
+ @progress_bar = wrapper_new_progress_bar
103
+ set_value_for_the_progress_bar(20)
104
+
105
+ outer_vbox.minimal(@progress_bar)
106
+ outer_vbox.minimal(quit_button)
107
+ run_the_outer_thread
108
+ @window.add(outer_vbox)
109
+ @window.intelligent_exit
110
+ end
111
+
112
+ end; end; end; end
113
+
114
+ if __FILE__ == $PROGRAM_NAME
115
+ LibuiParadise::GUI::LibUI::ProgressbarExample.new
116
+ end
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === LibuiParadise::GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample
6
+ # =========================================================================== #
7
+ module LibuiParadise
8
+
9
+ module GUI
10
+
11
+ module LibUI
12
+
13
+ class EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample # === LibuiParadise::GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample
14
+
15
+ alias e puts
16
+
17
+ require 'libui_paradise'
18
+ include LibuiParadise::Extensions
19
+
20
+ # ========================================================================= #
21
+ # === TITLE
22
+ # ========================================================================= #
23
+ TITLE = 'Showcasing how to use "#" as synonymous to the ENTER key pressed'
24
+
25
+ # ========================================================================= #
26
+ # === WIDTH
27
+ # ========================================================================= #
28
+ WIDTH = 1200
29
+
30
+ # ========================================================================= #
31
+ # === HEIGHT
32
+ # ========================================================================= #
33
+ HEIGHT = 120
34
+
35
+ # ========================================================================= #
36
+ # === initialize
37
+ # ========================================================================= #
38
+ def initialize(
39
+ run_already = true
40
+ )
41
+ reset
42
+ run if run_already
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === reset (reset tag)
47
+ # ========================================================================= #
48
+ def reset
49
+ title_width_height(TITLE, WIDTH, HEIGHT)
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === create_skeleton (create tag, skeleton tag)
54
+ # ========================================================================= #
55
+ def create_skeleton
56
+ # ======================================================================= #
57
+ # === @window
58
+ # ======================================================================= #
59
+ @window = ui_padded_main_window(title?, width?, height?, 0)
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === run
64
+ # ========================================================================= #
65
+ def run
66
+ create_skeleton_then_connect_skeleton
67
+ outer_vbox = padded_vbox
68
+ # ======================================================================= #
69
+ # First add the two buttons on top:
70
+ # ======================================================================= #
71
+ outer_vbox.add_hsep
72
+
73
+ grid = ui_padded_grid
74
+ # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
75
+ grid.left( text('Input something, then input "#" as the last character → '))
76
+ @entry = entry
77
+ grid.hash_grid(
78
+ @entry,
79
+ left: 1,
80
+ top: 0,
81
+ xspan: 2,
82
+ yspan: 1,
83
+ hexpand: 1,
84
+ halign: 0.5,
85
+ vexpand: 1,
86
+ valign: 1
87
+ )
88
+ grid.hash_grid(
89
+ quit_button,
90
+ left: 1,
91
+ top: 1,
92
+ xspan: 1,
93
+ yspan: 1,
94
+ hexpand: 1,
95
+ halign: 0.5,
96
+ vexpand: 1,
97
+ valign: 1
98
+ )
99
+ @entry.on_changed {|something|
100
+ proc { |pointer|
101
+ evaluate_the_current_input(@entry, pointer) {
102
+ run_this_method_on_enter_key_event
103
+ }
104
+ }
105
+ }
106
+ outer_vbox.minimal(grid)
107
+ @window.add(outer_vbox)
108
+ @window.intelligent_exit
109
+ end
110
+
111
+ # ========================================================================= #
112
+ # === run_this_method_on_enter_key_event
113
+ # ========================================================================= #
114
+ def run_this_method_on_enter_key_event(
115
+ entry = @entry
116
+ )
117
+ entry.set_text(
118
+ entry.text?[0 .. -2].to_s
119
+ )
120
+ end
121
+
122
+ # ========================================================================= #
123
+ # === evaluate_the_current_input
124
+ # ========================================================================= #
125
+ def evaluate_the_current_input(
126
+ entry = @entry,
127
+ pointer = nil,
128
+ &block
129
+ )
130
+ _ = entry.text?
131
+ if _[-1,1] == '#'
132
+ yield if block_given?
133
+ end
134
+ end
135
+
136
+ end; end; end; end
137
+
138
+ if __FILE__ == $PROGRAM_NAME
139
+ LibuiParadise::GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample.new
140
+ end
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === LibuiParadise::GUI::LibUI::NotificationFunctionalityExample
6
+ # =========================================================================== #
7
+ module LibuiParadise
8
+
9
+ module GUI
10
+
11
+ module LibUI
12
+
13
+ class NotificationFunctionalityExample # === LibuiParadise::GUI::LibUI::NotificationFunctionalityExample
14
+
15
+ alias e puts
16
+
17
+ require 'libui_paradise'
18
+ include LibuiParadise::Extensions
19
+
20
+ # ========================================================================= #
21
+ # === TITLE
22
+ # ========================================================================= #
23
+ TITLE = 'Showcasing LibuiParadise.notification()'
24
+
25
+ # ========================================================================= #
26
+ # === WIDTH
27
+ # ========================================================================= #
28
+ WIDTH = 1200
29
+
30
+ # ========================================================================= #
31
+ # === HEIGHT
32
+ # ========================================================================= #
33
+ HEIGHT = 120
34
+
35
+ # ========================================================================= #
36
+ # === initialize
37
+ # ========================================================================= #
38
+ def initialize(
39
+ run_already = true
40
+ )
41
+ reset
42
+ run if run_already
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === reset (reset tag)
47
+ # ========================================================================= #
48
+ def reset
49
+ title_width_height(TITLE, WIDTH, HEIGHT)
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === create_skeleton (create tag, skeleton tag)
54
+ # ========================================================================= #
55
+ def create_skeleton
56
+ # ======================================================================= #
57
+ # === @window
58
+ # ======================================================================= #
59
+ @window = ui_padded_main_window(title?, width?, height?, 0)
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === run
64
+ # ========================================================================= #
65
+ def run
66
+ create_skeleton_then_connect_skeleton
67
+ outer_vbox = padded_vbox
68
+ # ======================================================================= #
69
+ # First add the two buttons on top:
70
+ # ======================================================================= #
71
+ outer_vbox.add_hsep
72
+ button1 = button('Notify the user now.')
73
+ button1.on_clicked {
74
+ do_show_the_main_notification(
75
+ 'Hello world 123!'
76
+ )
77
+ }
78
+ outer_vbox.minimal(button1)
79
+ @window.add(outer_vbox)
80
+ @window.intelligent_exit
81
+ end
82
+
83
+ # ======================================================================= #
84
+ # === do_show_the_main_notification
85
+ # ======================================================================= #
86
+ def do_show_the_main_notification(
87
+ text = 'Hello world 123!'
88
+ )
89
+ ::LibuiParadise.notification(text)
90
+ end
91
+
92
+ end; end; end; end
93
+
94
+ if __FILE__ == $PROGRAM_NAME
95
+ LibuiParadise::GUI::LibUI::NotificationFunctionalityExample.new
96
+ end
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === LibuiParadise::NotificationFunctionalityExample
6
+ # =========================================================================== #
7
+ require 'libui_paradise/base/base.rb'
8
+
9
+ module LibuiParadise
10
+
11
+ class NotificationFunctionalityExample < LibuiParadise::Base # === LibuiParadise::NotificationFunctionalityExample
12
+
13
+ # ========================================================================= #
14
+ # === TITLE
15
+ # ========================================================================= #
16
+ TITLE = 'Showcasing LibuiParadise.notification()'
17
+
18
+ # ========================================================================= #
19
+ # === WIDTH
20
+ # ========================================================================= #
21
+ WIDTH = 1200
22
+
23
+ # ========================================================================= #
24
+ # === HEIGHT
25
+ # ========================================================================= #
26
+ HEIGHT = 120
27
+
28
+ # ========================================================================= #
29
+ # === initialize
30
+ # ========================================================================= #
31
+ def initialize(
32
+ run_already = true
33
+ )
34
+ reset
35
+ run if run_already
36
+ end
37
+
38
+ # ========================================================================= #
39
+ # === reset (reset tag)
40
+ # ========================================================================= #
41
+ def reset
42
+ default_title_width_height(TITLE, WIDTH, HEIGHT)
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === create_skeleton (create tag, skeleton tag)
47
+ # ========================================================================= #
48
+ def create_skeleton
49
+ # ======================================================================= #
50
+ # === @window
51
+ # ======================================================================= #
52
+ @window = ui_padded_main_window(title?, width?, height?, 0)
53
+ end
54
+
55
+ # ========================================================================= #
56
+ # === run
57
+ # ========================================================================= #
58
+ def run
59
+ super()
60
+ add_these_widgets_to_the_main_window(
61
+ text('Oki dokie!')
62
+ )
63
+ end
64
+
65
+ end; end
66
+
67
+ if __FILE__ == $PROGRAM_NAME
68
+ LibuiParadise::NotificationFunctionalityExample.new
69
+ end
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === LibuiParadise::GUI::LibUI::DaemonizeAndExitAfterDelayExample
6
+ #
7
+ # Unfortunately this example does not work. While Process.daemon works,
8
+ # the thread is not run.
9
+ # =========================================================================== #
10
+ require 'libui_paradise/base/base.rb'
11
+
12
+ module LibuiParadise
13
+
14
+ module GUI
15
+
16
+ module LibUI
17
+
18
+ class DaemonizeAndExitAfterDelayExample < LibuiParadise::Base # === LibuiParadise::GUI::LibUI::DaemonizeAndExitAfterDelayExample
19
+
20
+ # ========================================================================= #
21
+ # === TITLE
22
+ # ========================================================================= #
23
+ TITLE = 'Showcasing Process.daemonize() and exiting after 15 seconds'
24
+
25
+ # ========================================================================= #
26
+ # === DELAY
27
+ #
28
+ # Keep a delay of 15 seconds.
29
+ # ========================================================================= #
30
+ DELAY = 3
31
+
32
+ # ========================================================================= #
33
+ # === WIDTH
34
+ # ========================================================================= #
35
+ WIDTH = 1200
36
+
37
+ # ========================================================================= #
38
+ # === HEIGHT
39
+ # ========================================================================= #
40
+ HEIGHT = 120
41
+
42
+ # ========================================================================= #
43
+ # === initialize
44
+ # ========================================================================= #
45
+ def initialize(
46
+ run_already = true
47
+ )
48
+ reset
49
+ run if run_already
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === reset (reset tag)
54
+ # ========================================================================= #
55
+ def reset
56
+ default_title_width_height(TITLE, WIDTH, HEIGHT)
57
+ end
58
+
59
+ # ========================================================================= #
60
+ # === create_skeleton (create tag, skeleton tag)
61
+ # ========================================================================= #
62
+ def create_skeleton
63
+ # ======================================================================= #
64
+ # === @window
65
+ # ======================================================================= #
66
+ @window = ui_padded_main_window(title?, width?, height?, 0)
67
+ end
68
+
69
+ # ========================================================================= #
70
+ # === run
71
+ # ========================================================================= #
72
+ def run
73
+ super()
74
+ Thread.abort_on_exception = true
75
+ run_in_the_background
76
+ Thread.new {
77
+ add_these_widgets_to_the_main_window(
78
+ text('Oki dokie1!'),
79
+ text('Oki dokie2!')
80
+ )
81
+ # This part does not work yet, though:
82
+ e 'Exiting now.'
83
+ exit
84
+ }.join
85
+ end
86
+
87
+ end; end; end; end
88
+
89
+ if __FILE__ == $PROGRAM_NAME
90
+ LibuiParadise::GUI::LibUI::DaemonizeAndExitAfterDelayExample.new
91
+ end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === 'libuiparadise/examples/simple/001_open_file_example.rb'
6
+ # =========================================================================== #
7
+ require 'libui'
8
+
9
+ LibUI.init
10
+
11
+ alias e puts
12
+
13
+ main_window = LibUI.new_window('hello world', 200, 50, 1)
14
+
15
+ button = LibUI.new_button('Open File')
16
+
17
+ LibUI.button_on_clicked(button) {
18
+ result = ::LibUI.open_file(main_window).to_s
19
+ if File.exist?(result)
20
+ e 'The file exists. \o/'
21
+ end
22
+ }
23
+
24
+ LibUI.window_on_closing(main_window) {
25
+ e 'Exiting.'
26
+ LibUI.control_destroy(main_window)
27
+ LibUI.quit
28
+ 0
29
+ }
30
+
31
+ LibUI.window_set_child(main_window, button)
32
+ LibUI.control_show(main_window)
33
+
34
+ LibUI.main
35
+ LibUI.quit