glimmer-dsl-libui 0.1.2 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +55 -0
  3. data/README.md +1127 -65
  4. data/VERSION +1 -1
  5. data/examples/area_gallery.rb +50 -0
  6. data/examples/area_gallery2.rb +111 -0
  7. data/examples/area_gallery3.rb +52 -0
  8. data/examples/area_gallery4.rb +113 -0
  9. data/examples/basic_area2.rb +1 -1
  10. data/examples/basic_button.rb +2 -2
  11. data/examples/basic_entry.rb +2 -2
  12. data/examples/basic_table_progress_bar.rb +13 -3
  13. data/examples/basic_transform.rb +27 -0
  14. data/examples/control_gallery.rb +3 -3
  15. data/examples/dynamic_area.rb +1 -1
  16. data/examples/form.rb +2 -2
  17. data/examples/histogram.rb +118 -0
  18. data/examples/meta_example.rb +71 -20
  19. data/examples/midi_player.rb +8 -10
  20. data/glimmer-dsl-libui.gemspec +0 -0
  21. data/lib/glimmer/dsl/libui/control_expression.rb +1 -3
  22. data/lib/glimmer/dsl/libui/dsl.rb +1 -0
  23. data/lib/glimmer/dsl/libui/file_expression.rb +5 -1
  24. data/lib/glimmer/dsl/libui/property_expression.rb +5 -1
  25. data/lib/glimmer/{libui/box.rb → dsl/libui/shape_expression.rb} +26 -29
  26. data/lib/glimmer/dsl/libui/tab_item_expression.rb +2 -2
  27. data/lib/glimmer/libui/control_proxy/area_proxy.rb +117 -0
  28. data/lib/glimmer/libui/{menu_item_proxy.rb → control_proxy/box/horizontal_box_proxy.rb} +9 -12
  29. data/lib/glimmer/libui/{vertical_box_proxy.rb → control_proxy/box/vertical_box_proxy.rb} +10 -6
  30. data/lib/glimmer/libui/control_proxy/box.rb +61 -0
  31. data/lib/glimmer/libui/{button_proxy.rb → control_proxy/button_proxy.rb} +14 -12
  32. data/lib/glimmer/libui/{checkbox_proxy.rb → control_proxy/checkbox_proxy.rb} +14 -12
  33. data/lib/glimmer/libui/control_proxy/color_button_proxy.rb +118 -0
  34. data/lib/glimmer/libui/control_proxy/column/button_column_proxy.rb +76 -0
  35. data/lib/glimmer/libui/control_proxy/column/checkbox_column_proxy.rb +46 -0
  36. data/lib/glimmer/libui/control_proxy/column/checkbox_text_column_proxy.rb +80 -0
  37. data/lib/glimmer/libui/{radio_buttons_proxy.rb → control_proxy/column/image_column_proxy.rb} +14 -13
  38. data/lib/glimmer/libui/control_proxy/column/image_text_column_proxy.rb +48 -0
  39. data/lib/glimmer/libui/{progress_bar_column_proxy.rb → control_proxy/column/progress_bar_column_proxy.rb} +14 -10
  40. data/lib/glimmer/libui/control_proxy/column/text_column_proxy.rb +46 -0
  41. data/lib/glimmer/libui/control_proxy/column.rb +55 -0
  42. data/lib/glimmer/libui/{checkbox_column_proxy.rb → control_proxy/combobox_proxy.rb} +16 -13
  43. data/lib/glimmer/libui/control_proxy/date_time_picker_proxy/date_picker_proxy.rb +43 -0
  44. data/lib/glimmer/libui/control_proxy/date_time_picker_proxy/time_picker_proxy.rb +43 -0
  45. data/lib/glimmer/libui/control_proxy/date_time_picker_proxy.rb +72 -0
  46. data/lib/glimmer/libui/control_proxy/dual_column.rb +40 -0
  47. data/lib/glimmer/libui/control_proxy/editable_column.rb +46 -0
  48. data/lib/glimmer/libui/control_proxy/editable_combobox_proxy.rb +45 -0
  49. data/lib/glimmer/libui/{dual_column.rb → control_proxy/enableable_column.rb} +18 -10
  50. data/lib/glimmer/libui/control_proxy/font_button_proxy.rb +70 -0
  51. data/lib/glimmer/libui/{form_proxy.rb → control_proxy/form_proxy.rb} +26 -24
  52. data/lib/glimmer/libui/{grid_proxy.rb → control_proxy/grid_proxy.rb} +29 -27
  53. data/lib/glimmer/libui/{group_proxy.rb → control_proxy/group_proxy.rb} +24 -22
  54. data/lib/glimmer/libui/{image_part_proxy.rb → control_proxy/image_part_proxy.rb} +20 -18
  55. data/lib/glimmer/libui/{image_proxy.rb → control_proxy/image_proxy.rb} +32 -30
  56. data/lib/glimmer/libui/{combobox_proxy.rb → control_proxy/label_proxy.rb} +13 -13
  57. data/lib/glimmer/libui/control_proxy/matrix_proxy.rb +147 -0
  58. data/lib/glimmer/libui/{editable_column.rb → control_proxy/menu_item_proxy/about_menu_item_proxy.rb} +13 -16
  59. data/lib/glimmer/libui/control_proxy/menu_item_proxy/check_menu_item_proxy.rb +41 -0
  60. data/lib/glimmer/libui/{preferences_menu_item_proxy.rb → control_proxy/menu_item_proxy/preferences_menu_item_proxy.rb} +11 -9
  61. data/lib/glimmer/libui/control_proxy/menu_item_proxy/quit_menu_item_proxy.rb +66 -0
  62. data/lib/glimmer/libui/control_proxy/menu_item_proxy/separator_menu_item_proxy.rb +41 -0
  63. data/lib/glimmer/libui/control_proxy/menu_item_proxy.rb +45 -0
  64. data/lib/glimmer/libui/{editable_combobox_proxy.rb → control_proxy/menu_proxy.rb} +13 -13
  65. data/lib/glimmer/libui/{horizontal_box_proxy.rb → control_proxy/message_box/msg_box_error_proxy.rb} +9 -6
  66. data/lib/glimmer/libui/{multiline_entry_proxy.rb → control_proxy/message_box/msg_box_proxy.rb} +8 -6
  67. data/lib/glimmer/libui/{check_menu_item_proxy.rb → control_proxy/message_box.rb} +11 -10
  68. data/lib/glimmer/libui/control_proxy/multiline_entry_proxy/non_wrapping_multiline_entry_proxy.rb +34 -0
  69. data/lib/glimmer/libui/{image_column_proxy.rb → control_proxy/multiline_entry_proxy.rb} +10 -11
  70. data/lib/glimmer/libui/control_proxy/path_proxy.rb +169 -0
  71. data/lib/glimmer/libui/control_proxy/radio_buttons_proxy.rb +45 -0
  72. data/lib/glimmer/libui/{button_column_proxy.rb → control_proxy/tab_item_proxy.rb} +37 -40
  73. data/lib/glimmer/libui/control_proxy/table_proxy.rb +182 -0
  74. data/lib/glimmer/libui/control_proxy/transformable.rb +74 -0
  75. data/lib/glimmer/libui/control_proxy/window_proxy.rb +128 -0
  76. data/lib/glimmer/libui/control_proxy.rb +41 -22
  77. data/lib/glimmer/libui/{enableable_column.rb → parent.rb} +7 -15
  78. data/lib/glimmer/libui/shape/arc.rb +43 -0
  79. data/lib/glimmer/libui/{date_picker_proxy.rb → shape/bezier.rb} +8 -9
  80. data/lib/glimmer/libui/{quit_menu_item_proxy.rb → shape/figure.rb} +24 -32
  81. data/lib/glimmer/libui/{non_wrapping_multiline_entry_proxy.rb → shape/line.rb} +11 -5
  82. data/lib/glimmer/libui/{time_picker_proxy.rb → shape/rectangle.rb} +8 -9
  83. data/lib/glimmer/libui/{about_menu_item_proxy.rb → shape/square.rb} +9 -8
  84. data/lib/glimmer/libui/shape.rb +145 -0
  85. data/lib/glimmer/libui.rb +92 -0
  86. data/lib/glimmer-dsl-libui.rb +2 -0
  87. metadata +82 -48
  88. data/lib/glimmer/libui/area_proxy.rb +0 -105
  89. data/lib/glimmer/libui/checkbox_text_column_proxy.rb +0 -76
  90. data/lib/glimmer/libui/color_button_proxy.rb +0 -64
  91. data/lib/glimmer/libui/column.rb +0 -51
  92. data/lib/glimmer/libui/date_time_picker_proxy.rb +0 -68
  93. data/lib/glimmer/libui/font_button_proxy.rb +0 -68
  94. data/lib/glimmer/libui/image_text_column_proxy.rb +0 -44
  95. data/lib/glimmer/libui/label_proxy.rb +0 -41
  96. data/lib/glimmer/libui/menu_proxy.rb +0 -41
  97. data/lib/glimmer/libui/path_proxy.rb +0 -167
  98. data/lib/glimmer/libui/rectangle_proxy.rb +0 -100
  99. data/lib/glimmer/libui/separator_menu_item_proxy.rb +0 -37
  100. data/lib/glimmer/libui/tab_item_proxy.rb +0 -67
  101. data/lib/glimmer/libui/table_proxy.rb +0 -180
  102. data/lib/glimmer/libui/text_column_proxy.rb +0 -42
  103. data/lib/glimmer/libui/window_proxy.rb +0 -119
@@ -0,0 +1,147 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class ControlProxy
27
+ # Proxy for LibUI matrix objects
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class MatrixProxy < ControlProxy
31
+ def libui_api_keyword
32
+ 'draw_matrix'
33
+ end
34
+
35
+ def clone
36
+ MatrixProxy.new('matrix', nil, [@libui.M11, @libui.M12, @libui.M21, @libui.M22, @libui.M31, @libui.M32])
37
+ end
38
+
39
+ def dup
40
+ clone
41
+ end
42
+
43
+ def m11(value = nil)
44
+ if value.nil?
45
+ @libui.M11
46
+ else
47
+ @libui.M11 = value.to_f
48
+ end
49
+ end
50
+ alias m11= m11
51
+ alias set_m11 m11
52
+
53
+ def m12(value = nil)
54
+ if value.nil?
55
+ @libui.M12
56
+ else
57
+ @libui.M12 = value.to_f
58
+ end
59
+ end
60
+ alias m12= m12
61
+ alias set_m12 m12
62
+
63
+ def m21(value = nil)
64
+ if value.nil?
65
+ @libui.M21
66
+ else
67
+ @libui.M21 = value.to_f
68
+ end
69
+ end
70
+ alias m21= m21
71
+ alias set_m21 m21
72
+
73
+ def m22(value = nil)
74
+ if value.nil?
75
+ @libui.M22
76
+ else
77
+ @libui.M22 = value.to_f
78
+ end
79
+ end
80
+ alias m22= m22
81
+ alias set_m22 m22
82
+
83
+ def m31(value = nil)
84
+ if value.nil?
85
+ @libui.M31
86
+ else
87
+ @libui.M31 = value.to_f
88
+ end
89
+ end
90
+ alias m31= m31
91
+ alias set_m31 m31
92
+
93
+ def m32(value = nil)
94
+ if value.nil?
95
+ @libui.M32
96
+ else
97
+ @libui.M32 = value.to_f
98
+ end
99
+ end
100
+ alias m32= m32
101
+ alias set_m32 m32
102
+
103
+ def identity
104
+ set_identity
105
+ end
106
+
107
+ def rotate(x = 0, y = 0, degrees)
108
+ super(x, y, (Math::PI*2.0/360.0)*degrees)
109
+ end
110
+
111
+ def scale(x_center = 0, y_center = 0, x, y)
112
+ super
113
+ end
114
+
115
+ def skew(x = 0, y = 0, x_amount, y_amount)
116
+ super
117
+ end
118
+
119
+ def multiply(matrix)
120
+ super(matrix.respond_to?(:libui) ? matrix.libui : matrix)
121
+ end
122
+
123
+ def invertible
124
+ Glimmer::LibUI.integer_to_boolean(super, allow_nil: false)
125
+ end
126
+ alias invertible? invertible
127
+
128
+ private
129
+
130
+ def build_control
131
+ @libui = ::LibUI::FFI::DrawMatrix.malloc
132
+ if @args.empty?
133
+ set_identity
134
+ else
135
+ @libui.M11 = @args[0].to_f
136
+ @libui.M12 = @args[1].to_f
137
+ @libui.M21 = @args[2].to_f
138
+ @libui.M22 = @args[3].to_f
139
+ @libui.M31 = @args[4].to_f
140
+ @libui.M32 = @args[5].to_f
141
+ end
142
+ end
143
+ end
144
+ TransformProxy = MatrixProxy # alias
145
+ end
146
+ end
147
+ end
@@ -19,26 +19,23 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
+ require 'glimmer/libui/control_proxy/menu_item_proxy'
23
+
22
24
  module Glimmer
23
25
  module LibUI
24
- module EditableColumn
25
- def editable(value = nil)
26
- if value.nil?
27
- @editable = false if @editable.nil?
28
- @editable
29
- else
30
- @editable = !!value
26
+ class ControlProxy
27
+ class MenuItemProxy < ControlProxy
28
+ # Proxy for LibUI about menu item object
29
+ #
30
+ # Follows the Proxy Design Pattern
31
+ class AboutMenuItemProxy < MenuItemProxy
32
+ private
33
+
34
+ def build_control
35
+ @libui = @parent_proxy.append_about_item(*@args)
36
+ end
31
37
  end
32
38
  end
33
- alias editable= editable
34
- alias set_editable editable
35
- alias editable? editable
36
-
37
- private
38
-
39
- def editable_value
40
- (@parent_proxy.editable? || editable?) ? -2 : -1
41
- end
42
39
  end
43
40
  end
44
41
  end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy/menu_item_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class ControlProxy
27
+ class MenuItemProxy < ControlProxy
28
+ # Proxy for LibUI check menu item object
29
+ #
30
+ # Follows the Proxy Design Pattern
31
+ class CheckMenuItemProxy < MenuItemProxy
32
+ private
33
+
34
+ def build_control
35
+ @libui = @parent_proxy.append_check_item(*@args)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -19,18 +19,20 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- require 'glimmer/libui/menu_item_proxy'
22
+ require 'glimmer/libui/control_proxy/menu_item_proxy'
23
23
 
24
24
  module Glimmer
25
25
  module LibUI
26
- # Proxy for LibUI preferences menu item object
27
- #
28
- # Follows the Proxy Design Pattern
29
- class PreferencesMenuItemProxy < MenuItemProxy
30
- private
31
-
32
- def build_control
33
- @libui = @parent_proxy.append_preferences_item(*@args)
26
+ class ControlProxy
27
+ # Proxy for LibUI preferences menu item object
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class PreferencesMenuItemProxy < MenuItemProxy
31
+ private
32
+
33
+ def build_control
34
+ @libui = @parent_proxy.append_preferences_item(*@args)
35
+ end
34
36
  end
35
37
  end
36
38
  end
@@ -0,0 +1,66 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy/menu_item_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class ControlProxy
27
+ class MenuItemProxy < ControlProxy
28
+ # Proxy for LibUI quit menu item object
29
+ #
30
+ # Follows the Proxy Design Pattern
31
+ class QuitMenuItemProxy < MenuItemProxy
32
+ def can_handle_listener?(listener_name)
33
+ listener_name == 'on_clicked' || super
34
+ end
35
+
36
+ def handle_listener(listener_name, &listener)
37
+ if listener_name == 'on_clicked'
38
+ @default_behavior_listener = Proc.new do
39
+ return_value = listener.call(self)
40
+ if return_value.is_a?(Numeric)
41
+ return_value
42
+ else
43
+ destroy
44
+ ::LibUI.quit
45
+ 0
46
+ end
47
+ end
48
+ ::LibUI.on_should_quit(&@default_behavior_listener)
49
+ end
50
+ end
51
+
52
+ private
53
+
54
+ def build_control
55
+ @libui = @parent_proxy.append_quit_item(*@args)
56
+ handle_listener('on_clicked') do
57
+ ControlProxy.main_window_proxy&.destroy
58
+ ::LibUI.quit
59
+ 0
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy/menu_item_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class ControlProxy
27
+ class MenuItemProxy < ControlProxy
28
+ # Proxy for LibUI separator menu item object
29
+ #
30
+ # Follows the Proxy Design Pattern
31
+ class SeparatorMenuItemProxy < MenuItemProxy
32
+ private
33
+
34
+ def build_control
35
+ @libui = @parent_proxy.append_separator(*@args)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,45 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class ControlProxy
27
+ # Proxy for LibUI menu item objects
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class MenuItemProxy < ControlProxy
31
+ def libui_api_keyword
32
+ 'menu_item'
33
+ end
34
+
35
+ private
36
+
37
+ def build_control
38
+ @libui = @parent_proxy.append_item(*@args)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
@@ -23,21 +23,21 @@ require 'glimmer/libui/control_proxy'
23
23
 
24
24
  module Glimmer
25
25
  module LibUI
26
- # Proxy for LibUI editable combobox objects
27
- #
28
- # Follows the Proxy Design Pattern
29
- class EditableComboboxProxy < ControlProxy
30
- def items(*values)
31
- values = values.first if values.first.is_a?(Array)
32
- if values.empty?
33
- @values
34
- else
35
- @values = values
36
- @values.each { |value| append value }
26
+ class ControlProxy
27
+ # Proxy for LibUI menu objects
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class MenuProxy < ControlProxy
31
+ DEFAULT_TEXT = ''
32
+
33
+ private
34
+
35
+ def build_control
36
+ construction_args = @args.dup
37
+ construction_args[0] = DEFAULT_TEXT if construction_args.size == 0
38
+ @libui = ControlProxy.new_control(@keyword, construction_args)
37
39
  end
38
40
  end
39
- alias set_items items
40
- alias items= items
41
41
  end
42
42
  end
43
43
  end
@@ -20,15 +20,18 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/libui/control_proxy'
23
- require 'glimmer/libui/box'
24
23
 
25
24
  module Glimmer
26
25
  module LibUI
27
- # Proxy for LibUI horizontal box objects
28
- #
29
- # Follows the Proxy Design Pattern
30
- class HorizontalBoxProxy < ControlProxy
31
- include Box
26
+ class ControlProxy
27
+ module MessageBox
28
+ # Proxy for LibUI msg_box_error objects
29
+ #
30
+ # Follows the Proxy Design Pattern
31
+ class MsgBoxErrorProxy < ControlProxy
32
+ include MessageBox
33
+ end
34
+ end
32
35
  end
33
36
  end
34
37
  end
@@ -23,12 +23,14 @@ require 'glimmer/libui/control_proxy'
23
23
 
24
24
  module Glimmer
25
25
  module LibUI
26
- # Proxy for LibUI multiline entry objects
27
- #
28
- # Follows the Proxy Design Pattern
29
- class MultilineEntryProxy < ControlProxy
30
- def libui_api_keyword
31
- 'multiline_entry'
26
+ class ControlProxy
27
+ module MessageBox
28
+ # Proxy for LibUI msg_box objects
29
+ #
30
+ # Follows the Proxy Design Pattern
31
+ class MsgBoxProxy < ControlProxy
32
+ include MessageBox
33
+ end
32
34
  end
33
35
  end
34
36
  end
@@ -19,19 +19,20 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- require 'glimmer/libui/menu_item_proxy'
23
-
24
22
  module Glimmer
25
23
  module LibUI
26
- # Proxy for LibUI check menu item object
27
- #
28
- # Follows the Proxy Design Pattern
29
- class CheckMenuItemProxy < MenuItemProxy
30
- private
31
-
32
- def build_control
33
- @libui = @parent_proxy.append_check_item(*@args)
24
+ class ControlProxy
25
+ # Represents LibUI message box objects
26
+ module MessageBox
27
+ def build_control
28
+ @args.prepend ControlProxy.main_window_proxy if @args[0].nil? || @args[0].is_a?(String)
29
+ @args[1] ||= ''
30
+ @args[2] ||= ''
31
+ super
32
+ end
34
33
  end
35
34
  end
36
35
  end
37
36
  end
37
+
38
+ Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
@@ -0,0 +1,34 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy/multiline_entry_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class ControlProxy
27
+ # Proxy for LibUI non wrapping multiline entry objects
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class NonWrappingMultilineEntryProxy < MultilineEntryProxy
31
+ end
32
+ end
33
+ end
34
+ end
@@ -20,21 +20,20 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/libui/control_proxy'
23
- require 'glimmer/libui/column'
24
23
 
25
24
  module Glimmer
26
25
  module LibUI
27
- # Proxy for LibUI image column objects
28
- #
29
- # Follows the Proxy Design Pattern
30
- class ImageColumnProxy < ControlProxy
31
- include Column
32
-
33
- private
34
-
35
- def build_control
36
- @parent_proxy.append_image_column(name, column_index)
26
+ class ControlProxy
27
+ # Proxy for LibUI multiline entry objects
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class MultilineEntryProxy < ControlProxy
31
+ def libui_api_keyword
32
+ 'multiline_entry'
33
+ end
37
34
  end
38
35
  end
39
36
  end
40
37
  end
38
+
39
+ Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}