libui_paradise 0.2.49 → 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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +405 -259
  3. data/bin/libui_message +7 -0
  4. data/doc/README.gen +356 -131
  5. data/doc/todo/todo.md +14 -5
  6. data/lib/libui_paradise/autoinclude.rb +2 -1
  7. data/lib/libui_paradise/base/base.rb +51 -62
  8. data/lib/libui_paradise/base_module/base_module.rb +1514 -0
  9. data/lib/libui_paradise/colours/colours.rb +14 -2
  10. data/lib/libui_paradise/domain_specific_language/README.md +6 -0
  11. data/lib/libui_paradise/examples/complex/002_tabs_example.rb +1 -2
  12. data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +3 -5
  13. data/lib/libui_paradise/examples/complex/006_coloured_boxes_example.rb +2 -2
  14. data/lib/libui_paradise/examples/complex/007_slider_example.rb +10 -4
  15. data/lib/libui_paradise/examples/complex/008_radio_button_example.rb +2 -2
  16. data/lib/libui_paradise/examples/complex/009_separator_example.rb +2 -2
  17. data/lib/libui_paradise/examples/complex/010_table_example.rb +139 -49
  18. data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb +2 -1
  19. data/lib/libui_paradise/examples/complex/012_password_entry_example.rb +1 -1
  20. data/lib/libui_paradise/examples/complex/013_form_example.rb +1 -1
  21. data/lib/libui_paradise/examples/complex/014_text_example.rb +1 -1
  22. data/lib/libui_paradise/examples/complex/015_text_view_example.rb +4 -4
  23. data/lib/libui_paradise/examples/complex/016_grid_example.rb +20 -11
  24. data/lib/libui_paradise/examples/complex/017_unicode_text_example.rb +2 -2
  25. data/lib/libui_paradise/examples/complex/018_spinbutton_example.rb +1 -1
  26. data/lib/libui_paradise/examples/complex/019_combo_box_example.rb +1 -1
  27. data/lib/libui_paradise/examples/complex/020_checkbox_example.rb +5 -5
  28. data/lib/libui_paradise/examples/complex/021_font_example.rb +4 -3
  29. data/lib/libui_paradise/examples/complex/022_simple_notepad_example.rb +3 -3
  30. data/lib/libui_paradise/examples/complex/023_msg_box_error.rb +5 -5
  31. data/lib/libui_paradise/examples/complex/024_parse_config_file_example.rb +2 -2
  32. data/lib/libui_paradise/examples/complex/025_colour_button.rb +1 -1
  33. data/lib/libui_paradise/examples/complex/026_basic_table_image.rb +5 -8
  34. data/lib/libui_paradise/examples/complex/027_basic_button_example.rb +3 -3
  35. data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb +4 -5
  36. data/lib/libui_paradise/examples/complex/029_progressbar_example.rb +4 -5
  37. data/lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb +5 -6
  38. data/lib/libui_paradise/examples/complex/031_notification_functionality_example.rb +3 -2
  39. data/lib/libui_paradise/examples/complex/032_simple_window_example.rb +2 -1
  40. data/lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb +3 -2
  41. data/lib/libui_paradise/examples/complex/034_bold_text_example.rb +115 -0
  42. data/lib/libui_paradise/examples/complex/035_parse_into_table_example.rb +109 -0
  43. data/lib/libui_paradise/examples/simple/001_open_file_example.rb +1 -1
  44. data/lib/libui_paradise/examples/simple/002_histogram_example.rb +6 -6
  45. data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +80 -43
  46. data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +11 -11
  47. data/lib/libui_paradise/examples/simple/007_control_gallery.rb +21 -14
  48. data/lib/libui_paradise/examples/simple/009_spectrum.rb +7 -1
  49. data/lib/libui_paradise/examples/simple/010_font_button.rb +31 -0
  50. data/lib/libui_paradise/examples/simple/011_simple_notepad.rb +24 -0
  51. data/lib/libui_paradise/examples/simple/012_table_example.rb +71 -0
  52. data/lib/libui_paradise/examples/simple/013_scrolling_pane_example.rb +28 -0
  53. data/lib/libui_paradise/examples/simple/014_simple_entry_example.rb +30 -0
  54. data/lib/libui_paradise/examples/simple/015_slider_example.rb +32 -0
  55. data/lib/libui_paradise/fiddle/{pointer.rb → fiddle.rb} +768 -615
  56. data/lib/libui_paradise/generic_window/generic_window.rb +1 -1
  57. data/lib/libui_paradise/images/README.md +5 -2
  58. data/lib/libui_paradise/libui_classes/button.rb +31 -0
  59. data/lib/libui_paradise/libui_classes/entry.rb +35 -0
  60. data/lib/libui_paradise/libui_classes/grid.rb +14 -23
  61. data/lib/libui_paradise/libui_classes/hbox.rb +39 -0
  62. data/lib/libui_paradise/libui_classes/libui_classes.rb +9 -1595
  63. data/lib/libui_paradise/libui_classes/msg_box.rb +121 -0
  64. data/lib/libui_paradise/libui_classes/msg_box_error.rb +41 -0
  65. data/lib/libui_paradise/libui_classes/slider.rb +28 -0
  66. data/lib/libui_paradise/libui_classes/spinbox.rb +48 -0
  67. data/lib/libui_paradise/libui_classes/vbox.rb +38 -0
  68. data/lib/libui_paradise/project/project.rb +6 -1
  69. data/lib/libui_paradise/prototype/prototype.rb +8 -10
  70. data/lib/libui_paradise/requires/require_the_libui_classes.rb +2 -2
  71. data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +5 -3
  72. data/lib/libui_paradise/toplevel_methods/add_to_the_registered_widgets.rb +70 -0
  73. data/lib/libui_paradise/toplevel_methods/hash_fiddle_pointer_widgets.rb +37 -0
  74. data/lib/libui_paradise/toplevel_methods/toplevel_counters.rb +83 -0
  75. data/lib/libui_paradise/toplevel_methods/toplevel_methods.rb +792 -0
  76. data/lib/libui_paradise/version/version.rb +2 -2
  77. data/lib/libui_paradise.rb +0 -0
  78. data/libui_paradise.gemspec +5 -4
  79. data/test/testing_generic_window.rb +2 -0
  80. metadata +35 -30
  81. data/doc/SNIPPETS.md +0 -94
  82. data/lib/libui_paradise/extensions/counters.rb +0 -58
  83. data/lib/libui_paradise/extensions/extensions.rb +0 -29
  84. data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +0 -150
  85. data/lib/libui_paradise/extensions/misc.rb +0 -754
  86. data/lib/libui_paradise/libui_classes/box.rb +0 -156
  87. data/lib/libui_paradise/toplevel_methods/misc.rb +0 -13
@@ -2,13 +2,25 @@
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
+ #
12
+ # This is actually dodgerblue.
11
13
  # ========================================================================= #
12
14
  COLOR_BLUE = 0x1E90FF
13
15
 
16
+ # ========================================================================= #
17
+ # === LibuiParadise::COLOR_MIDNIGHTBLUE
18
+ # ========================================================================= #
19
+ COLOR_MIDNIGHTBLUE = 0x191970
20
+
21
+ # ========================================================================= #
22
+ # === LibuiParadise::COLOR_LIGHTSEAGREEN
23
+ # ========================================================================= #
24
+ COLOR_LIGHTSEAGREEN = 0x20b2aa
25
+
14
26
  end
@@ -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 = ui_main_window('A notebook with tabs example', 1200, 200, 15)
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,14 +8,14 @@
8
8
  # =========================================================================== #
9
9
  require 'libui_paradise/autoinclude'
10
10
 
11
- window = ui_padded_main_window('An open-file button-example', 1200, 200, 15)
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')
15
15
  button_open_file.on_clicked {
16
16
  begin
17
- #filename = ui_open_file(window).to_s
18
- filename = ::LibUI.open_file(main_window).to_s
17
+ # filename = ui_open_file(window).to_s
18
+ filename = LibUI.open_file(main_window).to_s
19
19
  e "The filename was: #{filename}"
20
20
  rescue ArgumentError => error # Rescue from "NULL pointer given"
21
21
  pp error
@@ -26,7 +26,6 @@ outer_vbox << button_open_file
26
26
  window.child = outer_vbox
27
27
  window.intelligent_quit
28
28
 
29
-
30
29
  if false
31
30
  LibUI.button_on_clicked(button) {
32
31
  result = ::LibUI.open_file(main_window).to_s
@@ -34,5 +33,4 @@ LibUI.button_on_clicked(button) {
34
33
  e 'The file exists. \o/'
35
34
  end
36
35
  }
37
-
38
36
  end
@@ -8,9 +8,9 @@ require 'libui_paradise/autoinclude'
8
8
 
9
9
  require 'colours' # Needs the colours gem.
10
10
 
11
- window = ui_main_window('Coloured boxes example', 320, 200, 1)
11
+ window = padded_main_window('Coloured boxes example', :default, 200, 1)
12
12
 
13
- outer_hbox = ui_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
- window = ui_main_window('Slider Example', 250, 70, 1)
9
+ # =========================================================================== #
10
+ # === UPPER_RANGE
11
+ # =========================================================================== #
12
+ UPPER_RANGE = 20
10
13
 
11
- slider = ui_slider(0, 100)
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: #{UI.slider_value(pointer)}"
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
- window.add(outer_vbox)
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, 320, 200, 0)
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.child = outer_vbox
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, 250, 150, 0)
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.child = outer_vbox
24
+ window << outer_vbox
25
25
  window.intelligent_quit
@@ -2,54 +2,144 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # Todo:
6
- #
7
- # - Add editable entry to the table
8
- #
9
- # =========================================================================== #
10
5
  # require 'libui_paradise/010_table_example.rb'
11
6
  # =========================================================================== #
12
- require 'libui_paradise/autoinclude'
13
-
14
- main_window = padded_window('30) Table example', 300, 200, 1)
15
- hbox = padded_hbox
16
- data = [
17
- %w( cat calm meow ),
18
- %w( dog loyal woof ),
19
- %w( chicken bird cock-a-doodle-doo ),
20
- %w( horse fast neigh ),
21
- %w( cow slow moo )
22
- ]
23
-
24
- # Protect BlockCaller objects from garbage collection.
25
- @block_callers = []
26
- def rbcallback(*args, &block)
27
- args << [0] if args.size == 1 # Argument types are ommited
28
- block_caller = Fiddle::Closure::BlockCaller.new(*args, &block)
29
- @block_callers << block_caller
30
- block_caller
31
- end
32
-
33
- model_handler = LibUI::FFI::TableModelHandler.malloc
34
- model_handler.to_ptr.free = Fiddle::RUBY_FREE
35
-
36
- model_handler.NumColumns = rbcallback(4) { 2 }
37
- model_handler.ColumnType = rbcallback(4) { 0 }
38
- model_handler.NumRows = rbcallback(4) { 5 }
39
- model_handler.CellValue = rbcallback(1, [1, 1, 4, 4]) do |_, _, row, column|
40
- LibUI.new_table_value_string(data[row][column])
41
- end
42
- model_handler.SetCellValue = rbcallback(0, [0]) {}
43
-
44
- model = LibUI.new_table_model(model_handler)
45
-
46
- table_params = ui_table_params_malloc(model)
47
-
48
- table = ui_table(table_params)
49
- table.append_text_column('Animal', 0, -1)
50
- table.append_text_column('Description', 1, -1)
51
- table.append_text_column('Fancy Stuff', 2, -1)
52
-
53
- hbox.add(table, 1)
54
- main_window.child = hbox
55
- main_window.intelligent_quit
7
+ require 'libui_paradise/base/base.rb'
8
+
9
+ module LibuiParadise
10
+
11
+ module GUI
12
+
13
+ module LibUI
14
+
15
+ class TableExample < ::LibuiParadise::Base # === LibuiParadise::GUI::LibUI::TableExample
16
+
17
+ # ========================================================================= #
18
+ # === DATA
19
+ # ========================================================================= #
20
+ DATA = [
21
+ %w( cat calm meow ),
22
+ %w( dog loyal woof ),
23
+ %w( chicken bird cock-a-doodle-doo ),
24
+ %w( horse fast neigh ),
25
+ %w( cow slow moo ),
26
+ %w( one two three ),
27
+ %w( 1 2 3 ),
28
+ %w( 4 5 6 ),
29
+ %w( 7 8 9 )
30
+ ]
31
+
32
+ # ========================================================================= #
33
+ # === TITLE
34
+ # ========================================================================= #
35
+ TITLE = 'A TableExample for LibUI'
36
+
37
+ # ========================================================================= #
38
+ # === WIDTH
39
+ # ========================================================================= #
40
+ WIDTH = 800
41
+
42
+ # ========================================================================= #
43
+ # === HEIGHT
44
+ # ========================================================================= #
45
+ HEIGHT = 520
46
+
47
+ # ========================================================================= #
48
+ # === initialize
49
+ # ========================================================================= #
50
+ def initialize(
51
+ run_already = true
52
+ )
53
+ reset
54
+ run if run_already
55
+ end
56
+
57
+ # ========================================================================= #
58
+ # === reset (reset tag)
59
+ # ========================================================================= #
60
+ def reset
61
+ reset_the_internal_hash
62
+ title_width_height(TITLE, WIDTH, HEIGHT)
63
+ end
64
+
65
+ # ========================================================================= #
66
+ # === create_skeleton (create tag, skeleton tag)
67
+ # ========================================================================= #
68
+ def create_skeleton
69
+ # ======================================================================= #
70
+ # === @window
71
+ # ======================================================================= #
72
+ set_window(return_default_window)
73
+ # ======================================================================= #
74
+ # Protects BlockCaller objects from garbage collection.
75
+ # ======================================================================= #
76
+ @block_callers = []
77
+ end
78
+
79
+ # ========================================================================= #
80
+ # === rbcallback
81
+ # ========================================================================= #
82
+ def rbcallback(*args, &block)
83
+ args << [0] if args.size == 1 # Argument types are omitted
84
+ block_caller = Fiddle::Closure::BlockCaller.new(*args, &block)
85
+ @block_callers << block_caller
86
+ block_caller
87
+ end
88
+
89
+ # ========================================================================= #
90
+ # === run
91
+ # ========================================================================= #
92
+ def run
93
+ super()
94
+ outer_vbox = padded_vbox
95
+ # ======================================================================= #
96
+ # First add the two buttons on top:
97
+ # ======================================================================= #
98
+ outer_vbox.add_hsep
99
+
100
+ grid = padded_grid
101
+ # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
102
+ grid.ui_grid_append(text('Testing tables'), 0, 0, 1, 1, 0, 0.5, 1, 0)
103
+ outer_vbox.minimal(grid)
104
+
105
+ model_handler = ::LibUI::FFI::TableModelHandler.malloc
106
+ model_handler.to_ptr.free = Fiddle::RUBY_FREE
107
+ model_handler.NumColumns = rbcallback(4) { 2 }
108
+ model_handler.ColumnType = rbcallback(4) { 0 }
109
+ model_handler.NumRows = rbcallback(4) { 5 }
110
+ model_handler.CellValue = rbcallback(1, [1, 1, 4, 4]) do |_, _, row, column|
111
+ ::LibUI.new_table_value_string(
112
+ DATA[row][column] # Pass the data here.
113
+ )
114
+ end
115
+ model_handler.SetCellValue = rbcallback(0, [0]) {}
116
+
117
+ model = ::LibUI.new_table_model(model_handler)
118
+ table_params = ui_table_params_malloc(model)
119
+
120
+ table = create_table(table_params)
121
+ table.append_text_column('Animal', 0)
122
+ table.append_text_column('Description', 1)
123
+ table.append_text_column('TEST', 2)
124
+ # table.append_text_column('TEST', 3, -1) # This would crash it.
125
+ # ::LibUI.table_append_text_column(table, 'Animal', 0, -1)
126
+
127
+ outer_vbox.maximal(table)
128
+ button1 = button('Show the current selection in the table')
129
+ button1.on_clicked {
130
+ e 'This is currently not implemented.'
131
+ }
132
+ outer_vbox.minimal(
133
+ button1
134
+ )
135
+ outer_vbox.minimal(quit_button)
136
+ main_window? << outer_vbox
137
+ main_window?.intelligent_exit
138
+ free_table_model(model)
139
+ end
140
+
141
+ end; end; end; end
142
+
143
+ if __FILE__ == $PROGRAM_NAME
144
+ LibuiParadise::GUI::LibUI::TableExample.new
145
+ end
@@ -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.child = outer_hbox
32
+ main_window << outer_hbox
32
33
  main_window.intelligent_exit
@@ -25,5 +25,5 @@ button.on_clicked {
25
25
  }
26
26
  outer_vbox.minimal(button, 0)
27
27
 
28
- window.child = outer_vbox
28
+ window << outer_vbox
29
29
  window.intelligent_quit
@@ -34,5 +34,5 @@ button_display_name.on_clicked {
34
34
  outer_vbox.minimal(hsep, 0)
35
35
  outer_vbox.minimal(button_display_name, 1)
36
36
 
37
- window.child = outer_vbox
37
+ window << outer_vbox
38
38
  window.intelligent_quit
@@ -14,5 +14,5 @@ text = ui_text
14
14
  outer_vbox.minimal(text, 1)
15
15
 
16
16
  text.set_text('Hello world!')
17
- window.child = outer_vbox
17
+ window << outer_vbox
18
18
  window.intelligent_quit
@@ -2,15 +2,15 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # 024_text_view_example.rb
5
+ # 015_text_view_example.rb
6
6
  # =========================================================================== #
7
7
  require 'libui_paradise/autoinclude'
8
8
 
9
- window = padded_main_window('Text View Example', 500, 300, 0)
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.child = outer_vbox
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 = ui_padded_grid
14
- UI.grid_append(grid, text('Yo1'), 0, 0, 1, 1, 0, 0, 1, 0)
15
- UI.grid_append(grid, text('Yo2'), 1, 0, 1, 1, 0, 0, 1, 0)
16
- UI.grid_append(grid, text('Yo3'), 2, 0, 1, 1, 0, 0, 1, 0)
17
-
18
- UI.grid_append(grid, text('Yo4'), 0, 1, 1, 1, 0, 0, 1, 0)
19
- UI.grid_append(grid, text('Yo5'), 1, 1, 1, 1, 0, 0, 1, 0)
20
- UI.grid_append(grid, text('Yo6'), 2, 1, 1, 1, 0, 0, 1, 0)
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: 2, top: 3, xspan: 3, yspan: 3, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
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.child = vbox
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 = ui_margined_main_window('Unicode Text Example', 1200, 200, 15)
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.child = outer_vbox
29
+ window << outer_vbox
30
30
  window.intelligent_quit
@@ -29,5 +29,5 @@ LibUI.spinbox_on_changed(spinbutton, spinbox_changed_callback, nil)
29
29
 
30
30
  outer_vbox << spinbutton
31
31
 
32
- window.child = outer_vbox
32
+ window << outer_vbox
33
33
  window.intelligent_quit
@@ -46,5 +46,5 @@ button_clear_the_combo_box.on_clicked {
46
46
  }
47
47
 
48
48
  box.minimal(button_clear_the_combo_box)
49
- main_window.child = box
49
+ main_window << box
50
50
  main_window.intelligent_exit
@@ -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', 600, HEIGHT, 1)
74
+ MAIN_WINDOW = UI.window('hello world', :default, HEIGHT, 1)
75
75
 
76
- UI.window_set_margined(MAIN_WINDOW, 1)
77
- UI.window_set_child(MAIN_WINDOW, vbox)
76
+ LibUI.window_set_margined(MAIN_WINDOW, 1)
77
+ MAIN_WINDOW << vbox
78
78
 
79
- UI.window_on_closing(MAIN_WINDOW, should_quit_callback, nil)
79
+ LibUI.window_on_closing(MAIN_WINDOW, should_quit_callback, nil)
80
80
  MAIN_WINDOW.control_show
81
- UI.main_then_quit
81
+ LibUI.main_then_quit
@@ -15,7 +15,7 @@
15
15
  class FontExample
16
16
 
17
17
  require 'libui_paradise'
18
- include LibuiParadise::Extensions
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.child = box
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', 500, 300, 1)
9
+ window = padded_window('Notepad', :default, 300, 1)
10
10
 
11
- vbox = ui_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.child = vbox
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, 300, 200, 1)
10
+ main_window = ui_padded_window(TITLE, 320, 240, 1)
11
11
 
12
- button1 = ui_button('Text (click me)')
12
+ button1 = create_button('Text (click me)')
13
13
  button1.on_clicked {
14
- LibuiParadise::Extensions.message_box_error(
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.child = hbox
25
+ main_window << hbox
26
26
  main_window.control_show
27
- UI.main_then_quit
27
+ LibUI.main_then_quit
@@ -2,7 +2,7 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # require '022_'
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.child = outer_vbox
14
+ window << outer_vbox
15
15
  window.intelligent_quit
@@ -49,5 +49,5 @@ LibUI.color_button_on_changed(our_colour_button, xyz, nil)
49
49
  #end
50
50
 
51
51
  outer_vbox.minimal(our_colour_button, 1)
52
- window.child = outer_vbox
52
+ window << outer_vbox
53
53
  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 = ui_main_window('The Red Turtle', 310, 350, 0)
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.child = hbox
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
- UI.image_append(image, data, width, height, width * 4)
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
- UI.window_on_closing(main_window) {
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
- UI.main_then_quit
93
+ LibUI.main_then_quit