libui_paradise 0.2.49 → 0.3.9

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +241 -116
  3. data/bin/libui_message +7 -0
  4. data/doc/README.gen +191 -56
  5. data/doc/SNIPPETS.md +1 -30
  6. data/doc/todo/todo.md +13 -8
  7. data/lib/libui_paradise/base/base.rb +64 -25
  8. data/lib/libui_paradise/colours/colours.rb +12 -0
  9. data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +2 -4
  10. data/lib/libui_paradise/examples/complex/010_table_example.rb +143 -49
  11. data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +18 -9
  12. data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +8 -8
  13. data/lib/libui_paradise/examples/simple/007_control_gallery.rb +19 -13
  14. data/lib/libui_paradise/examples/simple/010_font_button.rb +31 -0
  15. data/lib/libui_paradise/examples/simple/011_simple_notepad.rb +24 -0
  16. data/lib/libui_paradise/examples/simple/012_table_example.rb +71 -0
  17. data/lib/libui_paradise/extensions/extensions.rb +961 -11
  18. data/lib/libui_paradise/extensions/toplevel_counters.rb +58 -0
  19. data/lib/libui_paradise/fiddle/{pointer.rb → fiddle.rb} +162 -144
  20. data/lib/libui_paradise/generic_window/generic_window.rb +1 -1
  21. data/lib/libui_paradise/images/README.md +5 -2
  22. data/lib/libui_paradise/libui_classes/box.rb +3 -2
  23. data/lib/libui_paradise/libui_classes/grid.rb +4 -1
  24. data/lib/libui_paradise/libui_classes/libui_classes.rb +113 -78
  25. data/lib/libui_paradise/project/project.rb +5 -1
  26. data/lib/libui_paradise/prototype/prototype.rb +1 -3
  27. data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +1 -1
  28. data/lib/libui_paradise/version/version.rb +2 -2
  29. data/lib/libui_paradise.rb +0 -0
  30. data/libui_paradise.gemspec +5 -4
  31. metadata +18 -27
  32. data/lib/libui_paradise/extensions/counters.rb +0 -58
  33. data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +0 -150
  34. data/lib/libui_paradise/extensions/misc.rb +0 -754
  35. data/lib/libui_paradise/toplevel_methods/misc.rb +0 -13
@@ -11,6 +11,13 @@ module Extensions # === LibuiParadise::Extensions
11
11
  require 'libui_paradise/libui_classes/box.rb'
12
12
  require 'libui_paradise/libui_classes/grid.rb'
13
13
 
14
+ # ========================================================================= #
15
+ # === grid
16
+ # ========================================================================= #
17
+ def grid
18
+ ::LibUI.new_grid
19
+ end
20
+
14
21
  # ========================================================================= #
15
22
  # === button (button tag)
16
23
  #
@@ -23,8 +30,38 @@ module Extensions # === LibuiParadise::Extensions
23
30
  if text.start_with? '_'
24
31
  text[0,1] = '' # Right now we do not support accelerators.
25
32
  end
26
- ::LibuiParadise::Extensions.button(text)
27
- end; alias ui_button button # === ui_button
33
+ return ::LibuiParadise::Extensions.button(text)
34
+ end; alias ui_button button # === ui_button
35
+ alias create_button button # === create_button
36
+
37
+ # ========================================================================= #
38
+ # === LibuiParadise::Extensions.tab
39
+ #
40
+ # This could be also called "notebook_tab" - see the alias on the
41
+ # bottom.
42
+ # ========================================================================= #
43
+ def self.tab
44
+ _ = ::LibUI.new_tab # Create a new notebook-tab here.
45
+ add_to_the_registered_widgets(_, __method__)
46
+ return _
47
+ end; self.instance_eval { alias ui_tab tab } # === LibuiParadise::Extensions.ui_tab
48
+ self.instance_eval { alias ui_tabs tab } # === LibuiParadise::Extensions.ui_tabs
49
+ self.instance_eval { alias notebook tab } # === LibuiParadise::Extensions.notebook
50
+ self.instance_eval { alias ui_notebook tab } # === LibuiParadise::Extensions.ui_notebook
51
+ self.instance_eval { alias notebook_tab tab } # === LibuiParadise::Extensions.notebook_tab
52
+
53
+ # ========================================================================= #
54
+ # === tab
55
+ #
56
+ # This could be also called "notebook_tab".
57
+ # ========================================================================= #
58
+ def tab
59
+ ::LibuiParadise::Extensions.tab
60
+ end; alias ui_tab tab # === ui_tab
61
+ alias ui_tabs tab # === ui_tabs
62
+ alias notebook tab # === notebook
63
+ alias ui_notebook tab # === ui_notebook
64
+ alias notebook_tab tab # === notebook_tab
28
65
 
29
66
  # ========================================================================= #
30
67
  # === LibuiParadise::Extensions.msg_box
@@ -91,11 +128,16 @@ module Extensions # === LibuiParadise::Extensions
91
128
  case main_window
92
129
  # ======================================================================= #
93
130
  # === :default_window
131
+ #
132
+ # Note that LibuiParadise.main_window? may be nil.
94
133
  # ======================================================================= #
95
134
  when :default_window,
96
135
  :default
97
136
  main_window = ::LibuiParadise.main_window?
98
137
  end
138
+ if description_to_use.is_a? Array
139
+ description_to_use = description_to_use.join(' ').strip
140
+ end
99
141
  _ = ::LibUI.msg_box(
100
142
  main_window,
101
143
  title_to_use,
@@ -228,27 +270,6 @@ module Extensions # === LibuiParadise::Extensions
228
270
  end
229
271
  end; self.instance_eval { alias ui_open_file open_file } # === LibuiParadise::Extensions.ui_open_file
230
272
 
231
- # ========================================================================= #
232
- # === ui_open_file
233
- # ========================================================================= #
234
- def ui_open_file(
235
- main_window = ::LibuiParadise::Extensions.main_window?
236
- )
237
- return ::LibuiParadise::Extensions.open_file(main_window)
238
- end
239
-
240
- # ========================================================================= #
241
- # === open_file
242
- #
243
- # This here creates a problem, because ::Libui.open_file is already
244
- # defined. We'd have to use an alias to make this work.
245
- # ========================================================================= #
246
- # def open_file(
247
- # main_window = LibuiParadise::Extensions.main_window?
248
- # )
249
- # return ::LibuiParadise::Extensions.open_file(main_window)
250
- # end; alias ui_open_file open_file # === ui_open_file
251
-
252
273
  # ========================================================================= #
253
274
  # === @main_window
254
275
  #
@@ -378,6 +399,7 @@ module Extensions # === LibuiParadise::Extensions
378
399
  )
379
400
  _ = LibuiParadise.window(the_title, width, height, has_menubar)
380
401
  _.is_margined
402
+ #_.intelligent_exit # This does not work right now.
381
403
  return _
382
404
  end; alias ui_margined_window ui_margined_main_window # === ui_margined_window
383
405
  alias ui_padded_main_window ui_margined_main_window # === ui_padded_main_window
@@ -738,24 +760,6 @@ module Extensions # === LibuiParadise::Extensions
738
760
  alias spinbutton spinbox # === spinbutton
739
761
  alias centered_spin_button spinbox # === centered_spin_button
740
762
 
741
- # ========================================================================= #
742
- # === LibuiParadise::Extensions.table
743
- #
744
- # The argument should be of type table_params.
745
- #
746
- # Example for this:
747
- #
748
- # table_params = LibUI::FFI::TableParams.malloc
749
- # table_params.Model = model
750
- # table_params.RowBackgroundColorModelColumn = -1
751
- #
752
- # ========================================================================= #
753
- def self.table(i)
754
- _ = ::LibUI.new_table(i)
755
- LibuiParadise::Extensions.register_this_fiddle_pointer_widget(_, __method__)
756
- return _
757
- end; self.instance_eval { alias ui_table table } # === LibuiParadise::Extensions.ui_table
758
-
759
763
  # ========================================================================= #
760
764
  # === LibuiParadise::Extensions.checkbox (checkbox tag)
761
765
  # ========================================================================= #
@@ -1031,6 +1035,24 @@ module Extensions # === LibuiParadise::Extensions
1031
1035
  end; alias ui_scrolling_area scrolling_area # === ui_scrolling_area
1032
1036
  alias ui_scrolled_window scrolling_area # === ui_scrolling_window
1033
1037
 
1038
+ # ========================================================================= #
1039
+ # === LibuiParadise::Extensions.table
1040
+ #
1041
+ # The argument to this method should be of type table_params.
1042
+ #
1043
+ # Example for this:
1044
+ #
1045
+ # table_params = LibUI::FFI::TableParams.malloc
1046
+ # table_params.Model = model
1047
+ # table_params.RowBackgroundColorModelColumn = -1
1048
+ #
1049
+ # ========================================================================= #
1050
+ def self.table(i)
1051
+ _ = ::LibUI.new_table(i)
1052
+ LibuiParadise::Extensions.register_this_fiddle_pointer_widget(_, __method__)
1053
+ return _
1054
+ end; self.instance_eval { alias ui_table table } # === LibuiParadise::Extensions.ui_table
1055
+
1034
1056
  # ========================================================================= #
1035
1057
  # === bold_button
1036
1058
  #
@@ -1242,34 +1264,6 @@ module Extensions # === LibuiParadise::Extensions
1242
1264
  return _
1243
1265
  end; alias attributed_string fancy_text # === attributed_string
1244
1266
 
1245
- # ========================================================================= #
1246
- # === LibuiParadise::Extensions.tab
1247
- #
1248
- # This could be also called "notebook_tab".
1249
- # ========================================================================= #
1250
- def self.tab
1251
- _ = ::LibUI.new_tab
1252
- add_to_the_registered_widgets(_, __method__)
1253
- return _
1254
- end; self.instance_eval { alias ui_tab tab } # === LibuiParadise::Extensions.ui_tab
1255
- self.instance_eval { alias ui_tabs tab } # === LibuiParadise::Extensions.ui_tabs
1256
- self.instance_eval { alias notebook tab } # === LibuiParadise::Extensions.notebook
1257
- self.instance_eval { alias ui_notebook tab } # === LibuiParadise::Extensions.ui_notebook
1258
- self.instance_eval { alias notebook_tab tab } # === LibuiParadise::Extensions.notebook_tab
1259
-
1260
- # ========================================================================= #
1261
- # === tab
1262
- #
1263
- # This could be also called "notebook_tab".
1264
- # ========================================================================= #
1265
- def tab
1266
- ::LibuiParadise::Extensions.tab
1267
- end; alias ui_tab tab # === ui_tab
1268
- alias ui_tabs tab # === ui_tabs
1269
- alias notebook tab # === notebook
1270
- alias ui_notebook tab # === ui_notebook
1271
- alias notebook_tab tab # === notebook_tab
1272
-
1273
1267
  # ========================================================================= #
1274
1268
  # === LibuiParadise::Extensions.area
1275
1269
  #
@@ -1325,6 +1319,30 @@ module Extensions # === LibuiParadise::Extensions
1325
1319
  Gem.win_platform?
1326
1320
  end
1327
1321
 
1322
+ # ========================================================================= #
1323
+ # === ui_open_file
1324
+ #
1325
+ # This method can be used as a wrapper towards an "open local file"
1326
+ # functionality.
1327
+ # ========================================================================= #
1328
+ def ui_open_file(
1329
+ main_window = ::LibuiParadise::Extensions.main_window?
1330
+ )
1331
+ return ::LibuiParadise::Extensions.open_file(main_window)
1332
+ end
1333
+
1334
+ # ========================================================================= #
1335
+ # === open_file
1336
+ #
1337
+ # This here creates a problem, because ::Libui.open_file is already
1338
+ # defined. We'd have to use an alias to make this work.
1339
+ # ========================================================================= #
1340
+ # def open_file(
1341
+ # main_window = LibuiParadise::Extensions.main_window?
1342
+ # )
1343
+ # return ::LibuiParadise::Extensions.open_file(main_window)
1344
+ # end; alias ui_open_file open_file # === ui_open_file
1345
+
1328
1346
  end
1329
1347
 
1330
1348
  # =========================================================================== #
@@ -1400,7 +1418,8 @@ end; self.instance_eval { alias ui_table table } # === LibuiParadise.ui_table
1400
1418
  # =========================================================================== #
1401
1419
  def self.spinbox(
1402
1420
  start_point = 0,
1403
- end_point = 100
1421
+ end_point = 100,
1422
+ increment = 1 # This is currently ignored.
1404
1423
  )
1405
1424
  ::LibuiParadise::Extensions.spinbox(start_point, end_point)
1406
1425
  end; self.instance_eval { alias ui_spinbox spinbox } # === LibuiParadise.ui_spinbox
@@ -1590,10 +1609,33 @@ def self.entry(
1590
1609
  ::LibuiParadise::Extensions.entry(optional_text)
1591
1610
  end; self.instance_eval { alias ui_entry entry } # === LibuiParadise.ui_entry
1592
1611
 
1612
+ # =========================================================================== #
1613
+ # === LibuiParadise.set_main_window
1614
+ # =========================================================================== #
1615
+ def self.set_main_window(i)
1616
+ ::LibuiParadise::Extensions.set_main_window(i)
1617
+ end
1618
+
1619
+ # =========================================================================== #
1620
+ # === LibuiParadise.create_tab
1621
+ # =========================================================================== #
1622
+ def self.create_tab
1623
+ LibuiParadise::Extensions.tab
1624
+ end; self.instance_eval { alias tab create_tab } # === LibuiParadise.tab
1625
+
1626
+ # =========================================================================== #
1627
+ # === LibuiParadise.create_grid
1628
+ # =========================================================================== #
1629
+ def self.create_grid
1630
+ ::LibUI.new_grid
1631
+ end; self.instance_eval { alias grid create_grid } # === LibuiParadise.grid
1632
+
1593
1633
  # =========================================================================== #
1594
1634
  # === LibuiParadise.open_file
1595
1635
  #
1596
- # Simple delegator towards LibuiParadise::Extensions.open_file().
1636
+ # This method is a simple delegator towards
1637
+ # the LibuiParadise::Extensions.open_file()
1638
+ # functionality.
1597
1639
  # =========================================================================== #
1598
1640
  def self.open_file(
1599
1641
  main_window = LibuiParadise::Extensions.main_window?
@@ -1601,11 +1643,4 @@ def self.open_file(
1601
1643
  return ::LibuiParadise::Extensions.open_file(main_window)
1602
1644
  end; self.instance_eval { alias ui_open_file open_file } # === LibuiParadise.ui_open_file
1603
1645
 
1604
- # =========================================================================== #
1605
- # === LibuiParadise.set_main_window
1606
- # =========================================================================== #
1607
- def self.set_main_window(i)
1608
- ::LibuiParadise::Extensions.set_main_window(i)
1609
- end
1610
-
1611
1646
  end
@@ -8,7 +8,7 @@
8
8
  module LibuiParadise
9
9
 
10
10
  # ========================================================================= #
11
- # === PROJECT_BASE_DIRECTORY
11
+ # === LibuiParadise::PROJECT_BASE_DIRECTORY
12
12
  # ========================================================================= #
13
13
  PROJECT_BASE_DIRECTORY =
14
14
  File.absolute_path("#{__dir__}/..")+'/'
@@ -25,4 +25,8 @@ module LibuiParadise
25
25
  self.instance_eval { alias project_base_dir? project_base_dir? } # === LibuiParadise.project_base_dir?
26
26
  self.instance_eval { alias project_base_directory? project_base_dir? } # === LibuiParadise.project_base_directory?
27
27
 
28
+ end
29
+
30
+ if __FILE__ == $PROGRAM_NAME
31
+ puts LibuiParadise.project_base_dir?
28
32
  end
@@ -12,9 +12,7 @@ module LibUI
12
12
 
13
13
  class Prototype # === LibuiParadise::GUI::LibUI::Prototype
14
14
 
15
- alias e puts
16
-
17
- require 'libui_paradise'
15
+ require 'libui_paradise/extensions/extensions.rb'
18
16
  include LibuiParadise::Extensions
19
17
 
20
18
  # require 'bioroebe/gui/shared_code/levensthein_distance/levensthein_distance_module.rb'
@@ -6,7 +6,7 @@
6
6
  # =========================================================================== #
7
7
  require 'libui_paradise/extensions/extensions.rb' # This also pulls in another file, called pointer.rb.
8
8
  require 'libui_paradise/project/project.rb'
9
- require 'libui_paradise/toplevel_methods/misc.rb'
10
9
  require 'libui_paradise/requires/require_the_libui_classes.rb'
10
+ require 'libui_paradise/colours/colours.rb'
11
11
 
12
12
  LibuiParadise.do_require_the_libui_classes
@@ -7,11 +7,11 @@ module LibuiParadise
7
7
  # ========================================================================= #
8
8
  # === VERSION
9
9
  # ========================================================================= #
10
- VERSION = '0.2.49'
10
+ VERSION = '0.3.9'
11
11
 
12
12
  # ========================================================================= #
13
13
  # === LAST_UPDATE
14
14
  # ========================================================================= #
15
- LAST_UPDATE = '09.10.2022'
15
+ LAST_UPDATE = '12.12.2023'
16
16
 
17
17
  end
File without changes
@@ -15,15 +15,16 @@ Gem::Specification.new { |s|
15
15
  This project bundles together some custom bindings and code to the
16
16
  official (upstream) ruby-libui interface. ruby-libui, in turn,
17
17
  makes available code written in the libui project. You can find
18
- the libui project here: https://github.com/andlabs/libui
19
- and the ruby-libui bindings maintained by kojix2 here:
20
- https://rubygems.org/gems/libui
18
+ the libui project here: https://github.com/andlabs/libui and
19
+ the ruby-libui bindings maintained by kojix2 here:
20
+
21
+ https://rubygems.org/gems/libui
21
22
 
22
23
  For more documentation about the libui_paradise gem, please have a look
23
24
  at the official homepage of this gem at rubygems.org, at its
24
25
  documentation/ link on the bottom right hand side (or just use
25
26
  this link directly:
26
- https://www.rubydoc.info/gems/libui_paradise/
27
+ https://www.rubydoc.info/gems/libui_paradise/
27
28
  )
28
29
 
29
30
  EOF
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui_paradise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.49
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert A. Heiler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-09 00:00:00.000000000 Z
11
+ date: 2023-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libui
@@ -24,28 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: |2+
28
-
29
- This project bundles together some custom bindings and code to the
30
- official (upstream) ruby-libui interface. ruby-libui, in turn,
31
- makes available code written in the libui project. You can find
32
- the libui project here: https://github.com/andlabs/libui
33
- and the ruby-libui bindings maintained by kojix2 here:
34
- https://rubygems.org/gems/libui
35
-
36
- For more documentation about the libui_paradise gem, please have a look
37
- at the official homepage of this gem at rubygems.org, at its
38
- documentation/ link on the bottom right hand side (or just use
39
- this link directly:
40
- https://www.rubydoc.info/gems/libui_paradise/
41
- )
42
-
27
+ description: "\nThis project bundles together some custom bindings and code to the\nofficial
28
+ (upstream) ruby-libui interface. ruby-libui, in turn,\nmakes available code written
29
+ in the libui project. You can find\nthe libui project here: https://github.com/andlabs/libui
30
+ and \nthe ruby-libui bindings maintained by kojix2 here:\n\n https://rubygems.org/gems/libui\n\nFor
31
+ more documentation about the libui_paradise gem, please have a look\nat the official
32
+ homepage of this gem at rubygems.org, at its\ndocumentation/ link on the bottom
33
+ right hand side (or just use\nthis link directly:\n https://www.rubydoc.info/gems/libui_paradise/\n)\n\n"
43
34
  email: shevy@inbox.lt
44
35
  executables: []
45
36
  extensions: []
46
37
  extra_rdoc_files: []
47
38
  files:
48
39
  - README.md
40
+ - bin/libui_message
49
41
  - doc/README.gen
50
42
  - doc/SNIPPETS.md
51
43
  - doc/todo/todo.md
@@ -98,13 +90,14 @@ files:
98
90
  - lib/libui_paradise/examples/simple/007_control_gallery.rb
99
91
  - lib/libui_paradise/examples/simple/008_basic_area_example.rb
100
92
  - lib/libui_paradise/examples/simple/009_spectrum.rb
93
+ - lib/libui_paradise/examples/simple/010_font_button.rb
94
+ - lib/libui_paradise/examples/simple/011_simple_notepad.rb
95
+ - lib/libui_paradise/examples/simple/012_table_example.rb
101
96
  - lib/libui_paradise/examples/simple/README.md
102
97
  - lib/libui_paradise/experimental/dsl.rb
103
- - lib/libui_paradise/extensions/counters.rb
104
98
  - lib/libui_paradise/extensions/extensions.rb
105
- - lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb
106
- - lib/libui_paradise/extensions/misc.rb
107
- - lib/libui_paradise/fiddle/pointer.rb
99
+ - lib/libui_paradise/extensions/toplevel_counters.rb
100
+ - lib/libui_paradise/fiddle/fiddle.rb
108
101
  - lib/libui_paradise/generic_window/README.md
109
102
  - lib/libui_paradise/generic_window/generic_window.rb
110
103
  - lib/libui_paradise/images/LIBUI_PARADISE_LOGO.png
@@ -118,7 +111,6 @@ files:
118
111
  - lib/libui_paradise/prototype/prototype.rb
119
112
  - lib/libui_paradise/requires/require_the_libui_classes.rb
120
113
  - lib/libui_paradise/requires/require_the_libui_paradise_project.rb
121
- - lib/libui_paradise/toplevel_methods/misc.rb
122
114
  - lib/libui_paradise/version/version.rb
123
115
  - libui_paradise.gemspec
124
116
  - test/testing_generic_window.rb
@@ -139,18 +131,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
131
  requirements:
140
132
  - - ">="
141
133
  - !ruby/object:Gem::Version
142
- version: 3.3.7
134
+ version: 3.4.22
143
135
  requirements: []
144
- rubygems_version: 3.3.7
136
+ rubygems_version: 3.4.22
145
137
  signing_key:
146
138
  specification_version: 4
147
139
  summary: 'This project bundles together some custom bindings and code to the official
148
140
  (upstream) ruby-libui interface. ruby-libui, in turn, makes available code written
149
141
  in the libui project. You can find the libui project here: https://github.com/andlabs/libui
150
- and the ruby-libui bindings maintained by kojix2 here: https://rubygems.org/gems/libui For
142
+ and the ruby-libui bindings maintained by kojix2 here: https://rubygems.org/gems/libui For
151
143
  more documentation about the libui_paradise gem, please have a look at the official
152
144
  homepage of this gem at rubygems.org, at its documentation/ link on the bottom right
153
145
  hand side (or just use this link directly: https://www.rubydoc.info/gems/libui_paradise/
154
146
  )'
155
147
  test_files: []
156
- ...
@@ -1,58 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'libui_paradise/extensions/counters.rb
6
- # =========================================================================== #
7
- module LibuiParadise
8
-
9
- # =========================================================================== #
10
- # === @counter_left
11
- # =========================================================================== #
12
- @counter_left = 0
13
-
14
- # =========================================================================== #
15
- # === LibuiParadise.counter_left?
16
- # =========================================================================== #
17
- def self.counter_left?
18
- @counter_left
19
- end; self.instance_eval { alias counter_left counter_left? } # === LibuiParadise.counter_left
20
- self.instance_eval { alias left_counter counter_left? } # === LibuiParadise.left_counter
21
- self.instance_eval { alias left_counter? counter_left? } # === LibuiParadise.left_counter?
22
-
23
- # =========================================================================== #
24
- # === LibuiParadise.counter_left=
25
- # =========================================================================== #
26
- def self.counter_left=(i = 1)
27
- @counter_left = i
28
- end
29
-
30
- # =========================================================================== #
31
- # === @counter_top
32
- # =========================================================================== #
33
- @counter_top = 0
34
-
35
- # =========================================================================== #
36
- # === LibuiParadise.counter_top?
37
- # =========================================================================== #
38
- def self.counter_top?
39
- @counter_top
40
- end; self.instance_eval { alias counter_top counter_top? } # === LibuiParadise.counter_top
41
- self.instance_eval { alias top_counter counter_top? } # === LibuiParadise.top_counter
42
- self.instance_eval { alias top_counter? counter_top? } # === LibuiParadise.top_counter?
43
-
44
- # =========================================================================== #
45
- # === LibuiParadise.counter_top=
46
- # =========================================================================== #
47
- def self.counter_top=(i = 1)
48
- @counter_top = i
49
- end
50
-
51
- # =========================================================================== #
52
- # === LibuiParadise.counters?
53
- # =========================================================================== #
54
- def self.counters?
55
- return [@counter_left, @counter_top]
56
- end
57
-
58
- end
@@ -1,150 +0,0 @@
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