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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: 2.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: color
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.8'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.8'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: libui
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -194,6 +208,10 @@ files:
194
208
  - VERSION
195
209
  - bin/girb
196
210
  - bin/girb_runner.rb
211
+ - examples/area_gallery.rb
212
+ - examples/area_gallery2.rb
213
+ - examples/area_gallery3.rb
214
+ - examples/area_gallery4.rb
197
215
  - examples/basic_area.rb
198
216
  - examples/basic_area2.rb
199
217
  - examples/basic_button.rb
@@ -205,6 +223,7 @@ files:
205
223
  - examples/basic_table_image.rb
206
224
  - examples/basic_table_image_text.rb
207
225
  - examples/basic_table_progress_bar.rb
226
+ - examples/basic_transform.rb
208
227
  - examples/basic_window.rb
209
228
  - examples/basic_window2.rb
210
229
  - examples/color_button.rb
@@ -218,6 +237,7 @@ files:
218
237
  - examples/form.rb
219
238
  - examples/form_table.rb
220
239
  - examples/grid.rb
240
+ - examples/histogram.rb
221
241
  - examples/meta_example.rb
222
242
  - examples/midi_player.rb
223
243
  - examples/simple_notepad.rb
@@ -230,54 +250,68 @@ files:
230
250
  - lib/glimmer/dsl/libui/open_file_expression.rb
231
251
  - lib/glimmer/dsl/libui/property_expression.rb
232
252
  - lib/glimmer/dsl/libui/save_file_expression.rb
253
+ - lib/glimmer/dsl/libui/shape_expression.rb
233
254
  - lib/glimmer/dsl/libui/tab_item_expression.rb
234
255
  - lib/glimmer/fiddle_consumer.rb
235
- - lib/glimmer/libui/about_menu_item_proxy.rb
236
- - lib/glimmer/libui/area_proxy.rb
237
- - lib/glimmer/libui/box.rb
238
- - lib/glimmer/libui/button_column_proxy.rb
239
- - lib/glimmer/libui/button_proxy.rb
240
- - lib/glimmer/libui/check_menu_item_proxy.rb
241
- - lib/glimmer/libui/checkbox_column_proxy.rb
242
- - lib/glimmer/libui/checkbox_proxy.rb
243
- - lib/glimmer/libui/checkbox_text_column_proxy.rb
244
- - lib/glimmer/libui/color_button_proxy.rb
245
- - lib/glimmer/libui/column.rb
246
- - lib/glimmer/libui/combobox_proxy.rb
256
+ - lib/glimmer/libui.rb
247
257
  - lib/glimmer/libui/control_proxy.rb
248
- - lib/glimmer/libui/date_picker_proxy.rb
249
- - lib/glimmer/libui/date_time_picker_proxy.rb
250
- - lib/glimmer/libui/dual_column.rb
251
- - lib/glimmer/libui/editable_column.rb
252
- - lib/glimmer/libui/editable_combobox_proxy.rb
253
- - lib/glimmer/libui/enableable_column.rb
254
- - lib/glimmer/libui/font_button_proxy.rb
255
- - lib/glimmer/libui/form_proxy.rb
256
- - lib/glimmer/libui/grid_proxy.rb
257
- - lib/glimmer/libui/group_proxy.rb
258
- - lib/glimmer/libui/horizontal_box_proxy.rb
259
- - lib/glimmer/libui/image_column_proxy.rb
260
- - lib/glimmer/libui/image_part_proxy.rb
261
- - lib/glimmer/libui/image_proxy.rb
262
- - lib/glimmer/libui/image_text_column_proxy.rb
263
- - lib/glimmer/libui/label_proxy.rb
264
- - lib/glimmer/libui/menu_item_proxy.rb
265
- - lib/glimmer/libui/menu_proxy.rb
266
- - lib/glimmer/libui/multiline_entry_proxy.rb
267
- - lib/glimmer/libui/non_wrapping_multiline_entry_proxy.rb
268
- - lib/glimmer/libui/path_proxy.rb
269
- - lib/glimmer/libui/preferences_menu_item_proxy.rb
270
- - lib/glimmer/libui/progress_bar_column_proxy.rb
271
- - lib/glimmer/libui/quit_menu_item_proxy.rb
272
- - lib/glimmer/libui/radio_buttons_proxy.rb
273
- - lib/glimmer/libui/rectangle_proxy.rb
274
- - lib/glimmer/libui/separator_menu_item_proxy.rb
275
- - lib/glimmer/libui/tab_item_proxy.rb
276
- - lib/glimmer/libui/table_proxy.rb
277
- - lib/glimmer/libui/text_column_proxy.rb
278
- - lib/glimmer/libui/time_picker_proxy.rb
279
- - lib/glimmer/libui/vertical_box_proxy.rb
280
- - lib/glimmer/libui/window_proxy.rb
258
+ - lib/glimmer/libui/control_proxy/area_proxy.rb
259
+ - lib/glimmer/libui/control_proxy/box.rb
260
+ - lib/glimmer/libui/control_proxy/box/horizontal_box_proxy.rb
261
+ - lib/glimmer/libui/control_proxy/box/vertical_box_proxy.rb
262
+ - lib/glimmer/libui/control_proxy/button_proxy.rb
263
+ - lib/glimmer/libui/control_proxy/checkbox_proxy.rb
264
+ - lib/glimmer/libui/control_proxy/color_button_proxy.rb
265
+ - lib/glimmer/libui/control_proxy/column.rb
266
+ - lib/glimmer/libui/control_proxy/column/button_column_proxy.rb
267
+ - lib/glimmer/libui/control_proxy/column/checkbox_column_proxy.rb
268
+ - lib/glimmer/libui/control_proxy/column/checkbox_text_column_proxy.rb
269
+ - lib/glimmer/libui/control_proxy/column/image_column_proxy.rb
270
+ - lib/glimmer/libui/control_proxy/column/image_text_column_proxy.rb
271
+ - lib/glimmer/libui/control_proxy/column/progress_bar_column_proxy.rb
272
+ - lib/glimmer/libui/control_proxy/column/text_column_proxy.rb
273
+ - lib/glimmer/libui/control_proxy/combobox_proxy.rb
274
+ - lib/glimmer/libui/control_proxy/date_time_picker_proxy.rb
275
+ - lib/glimmer/libui/control_proxy/date_time_picker_proxy/date_picker_proxy.rb
276
+ - lib/glimmer/libui/control_proxy/date_time_picker_proxy/time_picker_proxy.rb
277
+ - lib/glimmer/libui/control_proxy/dual_column.rb
278
+ - lib/glimmer/libui/control_proxy/editable_column.rb
279
+ - lib/glimmer/libui/control_proxy/editable_combobox_proxy.rb
280
+ - lib/glimmer/libui/control_proxy/enableable_column.rb
281
+ - lib/glimmer/libui/control_proxy/font_button_proxy.rb
282
+ - lib/glimmer/libui/control_proxy/form_proxy.rb
283
+ - lib/glimmer/libui/control_proxy/grid_proxy.rb
284
+ - lib/glimmer/libui/control_proxy/group_proxy.rb
285
+ - lib/glimmer/libui/control_proxy/image_part_proxy.rb
286
+ - lib/glimmer/libui/control_proxy/image_proxy.rb
287
+ - lib/glimmer/libui/control_proxy/label_proxy.rb
288
+ - lib/glimmer/libui/control_proxy/matrix_proxy.rb
289
+ - lib/glimmer/libui/control_proxy/menu_item_proxy.rb
290
+ - lib/glimmer/libui/control_proxy/menu_item_proxy/about_menu_item_proxy.rb
291
+ - lib/glimmer/libui/control_proxy/menu_item_proxy/check_menu_item_proxy.rb
292
+ - lib/glimmer/libui/control_proxy/menu_item_proxy/preferences_menu_item_proxy.rb
293
+ - lib/glimmer/libui/control_proxy/menu_item_proxy/quit_menu_item_proxy.rb
294
+ - lib/glimmer/libui/control_proxy/menu_item_proxy/separator_menu_item_proxy.rb
295
+ - lib/glimmer/libui/control_proxy/menu_proxy.rb
296
+ - lib/glimmer/libui/control_proxy/message_box.rb
297
+ - lib/glimmer/libui/control_proxy/message_box/msg_box_error_proxy.rb
298
+ - lib/glimmer/libui/control_proxy/message_box/msg_box_proxy.rb
299
+ - lib/glimmer/libui/control_proxy/multiline_entry_proxy.rb
300
+ - lib/glimmer/libui/control_proxy/multiline_entry_proxy/non_wrapping_multiline_entry_proxy.rb
301
+ - lib/glimmer/libui/control_proxy/path_proxy.rb
302
+ - lib/glimmer/libui/control_proxy/radio_buttons_proxy.rb
303
+ - lib/glimmer/libui/control_proxy/tab_item_proxy.rb
304
+ - lib/glimmer/libui/control_proxy/table_proxy.rb
305
+ - lib/glimmer/libui/control_proxy/transformable.rb
306
+ - lib/glimmer/libui/control_proxy/window_proxy.rb
307
+ - lib/glimmer/libui/parent.rb
308
+ - lib/glimmer/libui/shape.rb
309
+ - lib/glimmer/libui/shape/arc.rb
310
+ - lib/glimmer/libui/shape/bezier.rb
311
+ - lib/glimmer/libui/shape/figure.rb
312
+ - lib/glimmer/libui/shape/line.rb
313
+ - lib/glimmer/libui/shape/rectangle.rb
314
+ - lib/glimmer/libui/shape/square.rb
281
315
  homepage: http://github.com/AndyObtiva/glimmer-dsl-libui
282
316
  licenses:
283
317
  - MIT
@@ -298,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
332
  - !ruby/object:Gem::Version
299
333
  version: '0'
300
334
  requirements: []
301
- rubygems_version: 3.2.22
335
+ rubygems_version: 3.2.28
302
336
  signing_key:
303
337
  specification_version: 4
304
338
  summary: Glimmer DSL for LibUI
@@ -1,105 +0,0 @@
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
- require 'glimmer/fiddle_consumer'
24
-
25
- module Glimmer
26
- module LibUI
27
- # Proxy for LibUI area objects
28
- #
29
- # Follows the Proxy Design Pattern
30
- class AreaProxy < ControlProxy
31
- include Glimmer::FiddleConsumer
32
-
33
- attr_reader :area_handler
34
-
35
- def post_initialize_child(child)
36
- super
37
- children << child
38
- end
39
-
40
- def post_add_content
41
- super
42
- install_listeners
43
- end
44
-
45
- def children
46
- @children ||= []
47
- end
48
-
49
- def on_draw(&block)
50
- @on_draw_procs ||= []
51
- if block.nil?
52
- @on_draw_procs
53
- else
54
- @on_draw_procs << block
55
- block
56
- end
57
- end
58
-
59
- def can_handle_listener?(listener_name)
60
- listener_name == 'on_draw' || super
61
- end
62
-
63
- def handle_listener(listener_name, &listener)
64
- case listener_name
65
- when 'on_draw'
66
- on_draw(&listener)
67
- else
68
- super
69
- end
70
- end
71
-
72
- private
73
-
74
- def build_control
75
- @area_handler = ::LibUI::FFI::AreaHandler.malloc
76
- @libui = ::LibUI.new_area(@area_handler)
77
- end
78
-
79
- def install_listeners
80
- @area_handler.Draw = fiddle_closure_block_caller(0, [1, 1, 1]) do |_, _, area_draw_params|
81
- area_draw_params = ::LibUI::FFI::AreaDrawParams.new(area_draw_params)
82
- area_draw_params = area_draw_params_hash(area_draw_params)
83
- children.each {|child| child.draw(area_draw_params)}
84
- on_draw.each {|listener| listener.call(area_draw_params) }
85
- end
86
- @area_handler.MouseEvent = fiddle_closure_block_caller(0, [0]) {}
87
- @area_handler.MouseCrossed = fiddle_closure_block_caller(0, [0]) {}
88
- @area_handler.DragBroken = fiddle_closure_block_caller(0, [0]) {}
89
- @area_handler.KeyEvent = fiddle_closure_block_caller(0, [0]) {}
90
- end
91
-
92
- def area_draw_params_hash(area_draw_params)
93
- {
94
- context: area_draw_params.Context,
95
- area_width: area_draw_params.AreaWidth,
96
- area_height: area_draw_params.AreaHeight,
97
- clip_x: area_draw_params.ClipX,
98
- clip_y: area_draw_params.ClipY,
99
- clip_width: area_draw_params.ClipWidth,
100
- clip_height: area_draw_params.ClipHeight,
101
- }
102
- end
103
- end
104
- end
105
- end
@@ -1,76 +0,0 @@
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
- require 'glimmer/libui/column'
24
- require 'glimmer/libui/dual_column'
25
- require 'glimmer/libui/editable_column'
26
-
27
- module Glimmer
28
- module LibUI
29
- # Proxy for LibUI checkbox text column objects
30
- #
31
- # Follows the Proxy Design Pattern
32
- class CheckboxTextColumnProxy < ControlProxy
33
- include Column
34
- include DualColumn
35
- include EditableColumn
36
-
37
- def editable_checkbox(value = nil)
38
- if value.nil?
39
- @editable_checkbox = false if @editable_checkbox.nil?
40
- @editable_checkbox
41
- else
42
- @editable_checkbox = !!value
43
- end
44
- end
45
- alias editable_checkbox= editable_checkbox
46
- alias set_editable_checkbox editable_checkbox
47
- alias editable_checkbox? editable_checkbox
48
-
49
- def editable_text(value = nil)
50
- if value.nil?
51
- @editable_text = false if @editable_text.nil?
52
- @editable_text
53
- else
54
- @editable_text = !!value
55
- end
56
- end
57
- alias editable_text= editable_text
58
- alias set_editable_text editable_text
59
- alias editable_text? editable_text
60
-
61
- private
62
-
63
- def build_control
64
- @parent_proxy.append_checkbox_text_column(name, column_index, editable_checkbox_value, second_column_index, editable_text_value)
65
- end
66
-
67
- def editable_checkbox_value
68
- (@parent_proxy.editable? || editable? || editable_checkbox?) ? -2 : -1
69
- end
70
-
71
- def editable_text_value
72
- (@parent_proxy.editable? || editable? || editable_text?) ? -2 : -1
73
- end
74
- end
75
- end
76
- end
@@ -1,64 +0,0 @@
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
- # Proxy for LibUI color button objects
27
- #
28
- # Follows the Proxy Design Pattern
29
- class ColorButtonProxy < ControlProxy
30
- def color
31
- @red ||= Fiddle::Pointer.malloc(8) # double
32
- @green ||= Fiddle::Pointer.malloc(8) # double
33
- @blue ||= Fiddle::Pointer.malloc(8) # double
34
- @alpha ||= Fiddle::Pointer.malloc(8) # double
35
- ::LibUI.color_button_color(@libui, @red, @green, @blue, @alpha)
36
- [@red[0, 8].unpack1('d') * 255.0, @green[0, 8].unpack1('d') * 255.0, @blue[0, 8].unpack1('d') * 255.0, @alpha[0, 8].unpack1('d')]
37
- end
38
-
39
- def red
40
- color[0]
41
- end
42
-
43
- def green
44
- color[1]
45
- end
46
-
47
- def blue
48
- color[2]
49
- end
50
-
51
- def alpha
52
- color[3]
53
- end
54
-
55
- def destroy
56
- Fiddle.free @red unless @red.nil?
57
- Fiddle.free @green unless @green.nil?
58
- Fiddle.free @blue unless @blue.nil?
59
- Fiddle.free @alpha unless @alpha.nil?
60
- super
61
- end
62
- end
63
- end
64
- end
@@ -1,51 +0,0 @@
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
- module Glimmer
23
- module LibUI
24
- # Common logic for all column proxy objects
25
- module Column
26
- def initialize(keyword, parent, args, &block)
27
- @keyword = keyword
28
- @parent_proxy = parent
29
- @args = args
30
- @block = block
31
- @enabled = true
32
- post_add_content if @block.nil?
33
- end
34
-
35
- def name
36
- @args.first
37
- end
38
-
39
- # column index used in table append column API call
40
- # expanded to ensure DualColumn index accounts for two columns acting as one
41
- def column_index
42
- @column_index ||= @parent_proxy.send(:next_column_index)
43
- end
44
-
45
- # actual index within table columns (disregarding nil fillings that account for DualColumn instances)
46
- def index
47
- @parent_proxy.columns.compact.index(self)
48
- end
49
- end
50
- end
51
- end
@@ -1,68 +0,0 @@
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
- # Proxy for LibUI date time picker objects
27
- #
28
- # Follows the Proxy Design Pattern
29
- class DateTimePickerProxy < ControlProxy
30
- def libui_api_keyword
31
- 'date_time_picker'
32
- end
33
-
34
- def time(value = nil)
35
- @time ||= ::LibUI::FFI::TM.malloc
36
- ::LibUI.date_time_picker_time(@libui, @time)
37
- if value.nil?
38
- {
39
- sec: @time.tm_sec,
40
- min: @time.tm_min,
41
- hour: @time.tm_hour,
42
- mday: @time.tm_mday,
43
- mon: @time.tm_mon + 1,
44
- year: @time.tm_year + 1900,
45
- wday: @time.tm_wday + 1,
46
- yday: @time.tm_yday + 1,
47
- dst: @time.tm_isdst == 1
48
- }
49
- else
50
- @time.tm_sec = value[:sec] unless value[:sec].nil?
51
- @time.tm_min = value[:min] unless value[:min].nil?
52
- @time.tm_hour = value[:hour] unless value[:hour].nil?
53
- @time.tm_mday = value[:mday] unless value[:mday].nil?
54
- @time.tm_mon = value[:mon] - 1 unless value[:mon].nil?
55
- @time.tm_year = value[:year] - 1900 unless value[:year].nil?
56
- ::LibUI.date_time_picker_set_time(@libui, @time)
57
- end
58
- end
59
- alias set_time time
60
- alias time= time
61
-
62
- def destroy
63
- Fiddle.free @time unless @time.nil?
64
- super
65
- end
66
- end
67
- end
68
- end
@@ -1,68 +0,0 @@
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
- # Proxy for LibUI font button objects
27
- #
28
- # Follows the Proxy Design Pattern
29
- class FontButtonProxy < ControlProxy
30
- def font
31
- @font_descriptor ||= ::LibUI::FFI::FontDescriptor.malloc
32
- ::LibUI.font_button_font(@libui, @font_descriptor)
33
- {
34
- family: @font_descriptor.Family.to_s,
35
- size: @font_descriptor.Size,
36
- weight: @font_descriptor.Weight,
37
- italic: @font_descriptor.Italic,
38
- stretch: @font_descriptor.Stretch
39
- }
40
- end
41
-
42
- def family
43
- font[:family]
44
- end
45
-
46
- def size
47
- font[:size]
48
- end
49
-
50
- def weight
51
- font[:weight]
52
- end
53
-
54
- def italic
55
- font[:italic]
56
- end
57
-
58
- def stretch
59
- font[:stretch]
60
- end
61
-
62
- def destroy
63
- ::LibUI.free_font_button_font(@font_descriptor) unless @font_descriptor.nil?
64
- super
65
- end
66
- end
67
- end
68
- end
@@ -1,44 +0,0 @@
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
- require 'glimmer/libui/column'
24
- require 'glimmer/libui/dual_column'
25
- require 'glimmer/libui/editable_column'
26
-
27
- module Glimmer
28
- module LibUI
29
- # Proxy for LibUI image text column objects
30
- #
31
- # Follows the Proxy Design Pattern
32
- class ImageTextColumnProxy < ControlProxy
33
- include Column
34
- include DualColumn
35
- include EditableColumn
36
-
37
- private
38
-
39
- def build_control
40
- @parent_proxy.append_image_text_column(name, column_index, second_column_index, editable_value)
41
- end
42
- end
43
- end
44
- end