libui_paradise 0.2.48

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of libui_paradise might be problematic. Click here for more details.

Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +2064 -0
  3. data/doc/README.gen +1923 -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 +207 -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 +1157 -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 +1610 -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 +19 -0
  79. metadata +156 -0
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'libui_paradise/extensions/hash_fiddle_pointer_widgets.rb'
6
+ # =========================================================================== #
7
+ module LibuiParadise
8
+
9
+ module Extensions # === LibuiParadise::Extensions
10
+
11
+ # ========================================================================= #
12
+ # === @hash_fiddle_pointer_widgets
13
+ #
14
+ # This hash will contain all widgets, via pointer.
15
+ # ========================================================================= #
16
+ @hash_fiddle_pointer_widgets = {}
17
+
18
+ # ========================================================================= #
19
+ # === LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
20
+ # ========================================================================= #
21
+ def self.hash_fiddle_pointer_widgets?
22
+ @hash_fiddle_pointer_widgets
23
+ end
24
+
25
+ # ========================================================================= #
26
+ # === main_hash?
27
+ #
28
+ # Access the main hash defined above.
29
+ # ========================================================================= #
30
+ def main_hash?
31
+ ::LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
32
+ end; alias toplevel_hash? main_hash? # === toplevel_hash?
33
+
34
+ # ========================================================================= #
35
+ # === LibuiParadise::Extensions.register_this_fiddle_pointer_widget
36
+ #
37
+ # This method registers the particular widget in use.
38
+ #
39
+ # Every new_* method available via LibUI.new* that creates a new widget
40
+ # has to be registered via this method here, by calling it.
41
+ #
42
+ # That way we have a main Hash that contains lots of Fiddle::Pointers
43
+ # and we can, at a later time, modify these Fiddle::Pointer or call
44
+ # toplevel methods with these registered pointers. This will only
45
+ # work if we have registered these pointers, though, which is why
46
+ # each method that creates a new libui-widget has to make use of
47
+ # this method here.
48
+ #
49
+ # The only exception to the above rule is the main window. The
50
+ # main window is always stored in the @main_window variable instead.
51
+ #
52
+ # Perhaps it should also use the method here, but I found it simpler
53
+ # to just refer to it via @main_window or main_window?. (Note that
54
+ # in future releases of the libui_paradise gem, @main_window will
55
+ # probably be removed and integrated just like any other
56
+ # libui-widget. But this has not been done yet, so it is retained
57
+ # as-is right now.)
58
+ #
59
+ # The mandatory entries given to this method must be of the
60
+ # following format:
61
+ #
62
+ # object_id -> [:the_fiddle_pointer_widget, :the_type]
63
+ #
64
+ # In other words, a key (as an Integer), and an Array as
65
+ # its primary value.
66
+ #
67
+ # The object_id will be determined automatically, so it can
68
+ # be omitted. It is the value that is simply returned by
69
+ # calling the .object_id method, so we do not have to do
70
+ # anything else here.
71
+ #
72
+ # The very last argument of the two-member Array should be a
73
+ # symbol, such as :grid. This is automatically ensured via a
74
+ # call to __method__ which returns a Symbol. That way we can
75
+ # then call the correct method internally, once we know we
76
+ # have a :grid or any other widget.
77
+ # ========================================================================= #
78
+ def self.register_this_fiddle_pointer_widget(
79
+ the_fiddle_pointer_widget,
80
+ the_type_of_the_widget = nil
81
+ )
82
+ # ======================================================================= #
83
+ # Determine the object-id automatically next:
84
+ # ======================================================================= #
85
+ object_id_to_use = the_fiddle_pointer_widget.object_id
86
+ # ======================================================================= #
87
+ # Then, store it on the main Hash.
88
+ # ======================================================================= #
89
+ @hash_fiddle_pointer_widgets[object_id_to_use] =
90
+ [
91
+ the_fiddle_pointer_widget,
92
+ the_type_of_the_widget
93
+ ]
94
+ end; self.instance_eval { alias add_to_the_registered_widgets register_this_fiddle_pointer_widget } # === LibuiParadise::Extensions.add_to_the_registered_widgets
95
+
96
+ # ========================================================================= #
97
+ # === LibuiParadise::Extensions.current_widget_pointer?
98
+ # ========================================================================= #
99
+ def self.current_widget_pointer?
100
+ LibuiParadise::Extensions.hash_fiddle_pointer_widgets?.values.last.first
101
+ end
102
+
103
+ # ========================================================================= #
104
+ # === last_pointer?
105
+ #
106
+ # This used to return the "current" widget pointer, but past September
107
+ # 2021 this is rarely in use anymore. Use current_widget_pointer?
108
+ # instead, based on the main Hash that keeps all widgets registered.
109
+ # ========================================================================= #
110
+ def last_pointer?
111
+ LibuiParadise::Extensions.current_widget_pointer?
112
+ end; alias current_pointer? last_pointer? # === current_pointer?
113
+ alias current_widget_pointer? last_pointer? # === current_widget_pointer?
114
+
115
+ # ========================================================================= #
116
+ # === current_widget_pointer_type?
117
+ # ========================================================================= #
118
+ def current_widget_pointer_type?
119
+ LibuiParadise::Extensions.hash_fiddle_pointer_widgets?.values.last.last
120
+ end
121
+
122
+ # ========================================================================= #
123
+ # === register_this_fiddle_pointer_widget
124
+ # ========================================================================= #
125
+ def register_this_fiddle_pointer_widget(
126
+ the_fiddle_pointer_widget,
127
+ the_type_of_the_widget = nil
128
+ )
129
+ ::LibuiParadise::Extensions.register_this_fiddle_pointer_widget(
130
+ the_fiddle_pointer_widget,
131
+ the_type_of_the_widget
132
+ )
133
+ end; alias add_to_the_registered_widgets register_this_fiddle_pointer_widget # === add_to_the_registered_widgets
134
+
135
+ end
136
+
137
+ # ========================================================================= #
138
+ # === LibuiParadise.register_this_fiddle_pointer_widget
139
+ # ========================================================================= #
140
+ def self.register_this_fiddle_pointer_widget(
141
+ the_fiddle_pointer_widget,
142
+ the_type_of_the_widget = nil
143
+ )
144
+ ::LibuiParadise::Extensions.register_this_fiddle_pointer_widget(
145
+ the_fiddle_pointer_widget,
146
+ the_type_of_the_widget
147
+ )
148
+ end; self.instance_eval { alias add_to_the_registered_widgets register_this_fiddle_pointer_widget } # === LibuiParadise.add_to_the_registered_widgets
149
+
150
+ end