libui_paradise 0.2.49 → 0.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +405 -259
- data/bin/libui_message +7 -0
- data/doc/README.gen +356 -131
- data/doc/todo/todo.md +14 -5
- data/lib/libui_paradise/autoinclude.rb +2 -1
- data/lib/libui_paradise/base/base.rb +51 -62
- data/lib/libui_paradise/base_module/base_module.rb +1514 -0
- data/lib/libui_paradise/colours/colours.rb +14 -2
- data/lib/libui_paradise/domain_specific_language/README.md +6 -0
- data/lib/libui_paradise/examples/complex/002_tabs_example.rb +1 -2
- data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +3 -5
- data/lib/libui_paradise/examples/complex/006_coloured_boxes_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/007_slider_example.rb +10 -4
- data/lib/libui_paradise/examples/complex/008_radio_button_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/009_separator_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/010_table_example.rb +139 -49
- data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb +2 -1
- data/lib/libui_paradise/examples/complex/012_password_entry_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/013_form_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/014_text_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/015_text_view_example.rb +4 -4
- data/lib/libui_paradise/examples/complex/016_grid_example.rb +20 -11
- data/lib/libui_paradise/examples/complex/017_unicode_text_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/018_spinbutton_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/019_combo_box_example.rb +1 -1
- data/lib/libui_paradise/examples/complex/020_checkbox_example.rb +5 -5
- data/lib/libui_paradise/examples/complex/021_font_example.rb +4 -3
- data/lib/libui_paradise/examples/complex/022_simple_notepad_example.rb +3 -3
- data/lib/libui_paradise/examples/complex/023_msg_box_error.rb +5 -5
- data/lib/libui_paradise/examples/complex/024_parse_config_file_example.rb +2 -2
- data/lib/libui_paradise/examples/complex/025_colour_button.rb +1 -1
- data/lib/libui_paradise/examples/complex/026_basic_table_image.rb +5 -8
- data/lib/libui_paradise/examples/complex/027_basic_button_example.rb +3 -3
- data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb +4 -5
- data/lib/libui_paradise/examples/complex/029_progressbar_example.rb +4 -5
- data/lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb +5 -6
- data/lib/libui_paradise/examples/complex/031_notification_functionality_example.rb +3 -2
- data/lib/libui_paradise/examples/complex/032_simple_window_example.rb +2 -1
- data/lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb +3 -2
- data/lib/libui_paradise/examples/complex/034_bold_text_example.rb +115 -0
- data/lib/libui_paradise/examples/complex/035_parse_into_table_example.rb +109 -0
- data/lib/libui_paradise/examples/simple/001_open_file_example.rb +1 -1
- data/lib/libui_paradise/examples/simple/002_histogram_example.rb +6 -6
- data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +80 -43
- data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +11 -11
- data/lib/libui_paradise/examples/simple/007_control_gallery.rb +21 -14
- data/lib/libui_paradise/examples/simple/009_spectrum.rb +7 -1
- data/lib/libui_paradise/examples/simple/010_font_button.rb +31 -0
- data/lib/libui_paradise/examples/simple/011_simple_notepad.rb +24 -0
- data/lib/libui_paradise/examples/simple/012_table_example.rb +71 -0
- data/lib/libui_paradise/examples/simple/013_scrolling_pane_example.rb +28 -0
- data/lib/libui_paradise/examples/simple/014_simple_entry_example.rb +30 -0
- data/lib/libui_paradise/examples/simple/015_slider_example.rb +32 -0
- data/lib/libui_paradise/fiddle/{pointer.rb → fiddle.rb} +768 -615
- data/lib/libui_paradise/generic_window/generic_window.rb +1 -1
- data/lib/libui_paradise/images/README.md +5 -2
- data/lib/libui_paradise/libui_classes/button.rb +31 -0
- data/lib/libui_paradise/libui_classes/entry.rb +35 -0
- data/lib/libui_paradise/libui_classes/grid.rb +14 -23
- data/lib/libui_paradise/libui_classes/hbox.rb +39 -0
- data/lib/libui_paradise/libui_classes/libui_classes.rb +9 -1595
- data/lib/libui_paradise/libui_classes/msg_box.rb +121 -0
- data/lib/libui_paradise/libui_classes/msg_box_error.rb +41 -0
- data/lib/libui_paradise/libui_classes/slider.rb +28 -0
- data/lib/libui_paradise/libui_classes/spinbox.rb +48 -0
- data/lib/libui_paradise/libui_classes/vbox.rb +38 -0
- data/lib/libui_paradise/project/project.rb +6 -1
- data/lib/libui_paradise/prototype/prototype.rb +8 -10
- data/lib/libui_paradise/requires/require_the_libui_classes.rb +2 -2
- data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +5 -3
- data/lib/libui_paradise/toplevel_methods/add_to_the_registered_widgets.rb +70 -0
- data/lib/libui_paradise/toplevel_methods/hash_fiddle_pointer_widgets.rb +37 -0
- data/lib/libui_paradise/toplevel_methods/toplevel_counters.rb +83 -0
- data/lib/libui_paradise/toplevel_methods/toplevel_methods.rb +792 -0
- data/lib/libui_paradise/version/version.rb +2 -2
- data/lib/libui_paradise.rb +0 -0
- data/libui_paradise.gemspec +5 -4
- data/test/testing_generic_window.rb +2 -0
- metadata +35 -30
- data/doc/SNIPPETS.md +0 -94
- data/lib/libui_paradise/extensions/counters.rb +0 -58
- data/lib/libui_paradise/extensions/extensions.rb +0 -29
- data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +0 -150
- data/lib/libui_paradise/extensions/misc.rb +0 -754
- data/lib/libui_paradise/libui_classes/box.rb +0 -156
- data/lib/libui_paradise/toplevel_methods/misc.rb +0 -13
@@ -7,11 +7,11 @@ module LibuiParadise
|
|
7
7
|
# ========================================================================= #
|
8
8
|
# === VERSION
|
9
9
|
# ========================================================================= #
|
10
|
-
VERSION = '0.
|
10
|
+
VERSION = '0.4.13'
|
11
11
|
|
12
12
|
# ========================================================================= #
|
13
13
|
# === LAST_UPDATE
|
14
14
|
# ========================================================================= #
|
15
|
-
LAST_UPDATE = '
|
15
|
+
LAST_UPDATE = '28.12.2023'
|
16
16
|
|
17
17
|
end
|
data/lib/libui_paradise.rb
CHANGED
File without changes
|
data/libui_paradise.gemspec
CHANGED
@@ -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
|
-
|
20
|
-
|
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.
|
4
|
+
version: 0.4.13
|
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:
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libui
|
@@ -24,34 +24,26 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
- doc/SNIPPETS.md
|
51
42
|
- doc/todo/todo.md
|
52
43
|
- lib/libui_paradise.rb
|
53
44
|
- lib/libui_paradise/autoinclude.rb
|
54
45
|
- lib/libui_paradise/base/base.rb
|
46
|
+
- lib/libui_paradise/base_module/base_module.rb
|
55
47
|
- lib/libui_paradise/colours/colours.rb
|
56
48
|
- lib/libui_paradise/domain_specific_language/README.md
|
57
49
|
- lib/libui_paradise/domain_specific_language/button.yml
|
@@ -89,6 +81,8 @@ files:
|
|
89
81
|
- lib/libui_paradise/examples/complex/031_notification_functionality_example.rb
|
90
82
|
- lib/libui_paradise/examples/complex/032_simple_window_example.rb
|
91
83
|
- lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb
|
84
|
+
- lib/libui_paradise/examples/complex/034_bold_text_example.rb
|
85
|
+
- lib/libui_paradise/examples/complex/035_parse_into_table_example.rb
|
92
86
|
- lib/libui_paradise/examples/simple/001_open_file_example.rb
|
93
87
|
- lib/libui_paradise/examples/simple/002_histogram_example.rb
|
94
88
|
- lib/libui_paradise/examples/simple/003_fancy_text_example.rb
|
@@ -98,27 +92,39 @@ files:
|
|
98
92
|
- lib/libui_paradise/examples/simple/007_control_gallery.rb
|
99
93
|
- lib/libui_paradise/examples/simple/008_basic_area_example.rb
|
100
94
|
- lib/libui_paradise/examples/simple/009_spectrum.rb
|
95
|
+
- lib/libui_paradise/examples/simple/010_font_button.rb
|
96
|
+
- lib/libui_paradise/examples/simple/011_simple_notepad.rb
|
97
|
+
- lib/libui_paradise/examples/simple/012_table_example.rb
|
98
|
+
- lib/libui_paradise/examples/simple/013_scrolling_pane_example.rb
|
99
|
+
- lib/libui_paradise/examples/simple/014_simple_entry_example.rb
|
100
|
+
- lib/libui_paradise/examples/simple/015_slider_example.rb
|
101
101
|
- lib/libui_paradise/examples/simple/README.md
|
102
102
|
- lib/libui_paradise/experimental/dsl.rb
|
103
|
-
- lib/libui_paradise/
|
104
|
-
- 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
|
103
|
+
- lib/libui_paradise/fiddle/fiddle.rb
|
108
104
|
- lib/libui_paradise/generic_window/README.md
|
109
105
|
- lib/libui_paradise/generic_window/generic_window.rb
|
110
106
|
- lib/libui_paradise/images/LIBUI_PARADISE_LOGO.png
|
111
107
|
- lib/libui_paradise/images/README.md
|
112
108
|
- lib/libui_paradise/images/form_example.png
|
113
|
-
- lib/libui_paradise/libui_classes/
|
109
|
+
- lib/libui_paradise/libui_classes/button.rb
|
110
|
+
- lib/libui_paradise/libui_classes/entry.rb
|
114
111
|
- lib/libui_paradise/libui_classes/grid.rb
|
112
|
+
- lib/libui_paradise/libui_classes/hbox.rb
|
115
113
|
- lib/libui_paradise/libui_classes/libui_classes.rb
|
114
|
+
- lib/libui_paradise/libui_classes/msg_box.rb
|
115
|
+
- lib/libui_paradise/libui_classes/msg_box_error.rb
|
116
|
+
- lib/libui_paradise/libui_classes/slider.rb
|
117
|
+
- lib/libui_paradise/libui_classes/spinbox.rb
|
118
|
+
- lib/libui_paradise/libui_classes/vbox.rb
|
116
119
|
- lib/libui_paradise/project/project.rb
|
117
120
|
- lib/libui_paradise/prototype/README.md
|
118
121
|
- lib/libui_paradise/prototype/prototype.rb
|
119
122
|
- lib/libui_paradise/requires/require_the_libui_classes.rb
|
120
123
|
- lib/libui_paradise/requires/require_the_libui_paradise_project.rb
|
121
|
-
- lib/libui_paradise/toplevel_methods/
|
124
|
+
- lib/libui_paradise/toplevel_methods/add_to_the_registered_widgets.rb
|
125
|
+
- lib/libui_paradise/toplevel_methods/hash_fiddle_pointer_widgets.rb
|
126
|
+
- lib/libui_paradise/toplevel_methods/toplevel_counters.rb
|
127
|
+
- lib/libui_paradise/toplevel_methods/toplevel_methods.rb
|
122
128
|
- lib/libui_paradise/version/version.rb
|
123
129
|
- libui_paradise.gemspec
|
124
130
|
- test/testing_generic_window.rb
|
@@ -139,18 +145,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
145
|
requirements:
|
140
146
|
- - ">="
|
141
147
|
- !ruby/object:Gem::Version
|
142
|
-
version: 3.3
|
148
|
+
version: 3.5.3
|
143
149
|
requirements: []
|
144
|
-
rubygems_version: 3.3
|
150
|
+
rubygems_version: 3.5.3
|
145
151
|
signing_key:
|
146
152
|
specification_version: 4
|
147
153
|
summary: 'This project bundles together some custom bindings and code to the official
|
148
154
|
(upstream) ruby-libui interface. ruby-libui, in turn, makes available code written
|
149
155
|
in the libui project. You can find the libui project here: https://github.com/andlabs/libui
|
150
|
-
and
|
156
|
+
and the ruby-libui bindings maintained by kojix2 here: https://rubygems.org/gems/libui For
|
151
157
|
more documentation about the libui_paradise gem, please have a look at the official
|
152
158
|
homepage of this gem at rubygems.org, at its documentation/ link on the bottom right
|
153
159
|
hand side (or just use this link directly: https://www.rubydoc.info/gems/libui_paradise/
|
154
160
|
)'
|
155
161
|
test_files: []
|
156
|
-
...
|
data/doc/SNIPPETS.md
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
# How to add a new main window:
|
2
|
-
# width, height, hasMenubar
|
3
|
-
main_window = UI.new_window('hello world', 300, 200, 1)
|
4
|
-
|
5
|
-
Source code:
|
6
|
-
|
7
|
-
https://raw.githubusercontent.com/andlabs/libui/master/unix/window.c
|
8
|
-
|
9
|
-
# How to add a libui-widget to the main window / Designate a child widget:
|
10
|
-
|
11
|
-
UI.window_set_child(main_window, button)
|
12
|
-
|
13
|
-
# Act on closing-event (on quit tag):
|
14
|
-
|
15
|
-
UI.window_on_closing(main_window) {
|
16
|
-
puts 'Bye Bye'
|
17
|
-
UI.control_destroy(main_window)
|
18
|
-
UI.quit
|
19
|
-
0
|
20
|
-
}
|
21
|
-
# Or simpler:
|
22
|
-
close_properly(main_window)
|
23
|
-
|
24
|
-
# Add the window to the main UI:
|
25
|
-
|
26
|
-
UI.control_show(main_window)
|
27
|
-
main_window.show_the_controls # Or use this one here.
|
28
|
-
|
29
|
-
|
30
|
-
# Add a checkbox (checkbox tag, checkbutton)
|
31
|
-
|
32
|
-
checkbox = UI.new_checkbox('Checkbox') # or ui_checkbox
|
33
|
-
checkbox_toggle_callback = proc { |pointer|
|
34
|
-
checked = UI.checkbox_checked(pointer) == 1
|
35
|
-
UI.window_set_title(MAIN_WINDOW, "Checkbox is #{checked}")
|
36
|
-
UI.checkbox_set_text(pointer, "I am the checkbox (#{checked})")
|
37
|
-
0
|
38
|
-
}
|
39
|
-
UI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
40
|
-
UI.box_append(inner, checkbox, 0)
|
41
|
-
|
42
|
-
To set it checked:
|
43
|
-
|
44
|
-
checkbox.set_checked(1)
|
45
|
-
|
46
|
-
To query its state:
|
47
|
-
|
48
|
-
checked = UI.checkbox_checked(pointer) == 1
|
49
|
-
|
50
|
-
# And the control:
|
51
|
-
|
52
|
-
UI.control_show(main_window)
|
53
|
-
|
54
|
-
# Using a text-entry (ui entry tag):
|
55
|
-
|
56
|
-
text_entry = UI.new_entry
|
57
|
-
UI.entry_set_text(text_entry, 'Please enter your feelings')
|
58
|
-
UI.entry_on_changed(text_entry, text_changed_callback, nil)
|
59
|
-
|
60
|
-
# To set this on a "multiline entry", aka spanning several
|
61
|
-
# rows, do use:
|
62
|
-
UI.multiline_entry_set_text(entry1, 'Yo there')
|
63
|
-
ui_text_view # an alias used in libui_paradise
|
64
|
-
|
65
|
-
text1 = UI.entry_text(entry1) # Obtain text. You may have to call .to_s on it, to guarantee the String.
|
66
|
-
UI.multiline_entry_text # Obtain the text from a multiline entry.
|
67
|
-
|
68
|
-
# Create a combobox (combo tag, combobox tag):
|
69
|
-
|
70
|
-
combobox_selected_callback = proc { |ptr|
|
71
|
-
puts "New combobox selection: #{UI.combobox_selected(ptr)}"
|
72
|
-
}
|
73
|
-
cbox = UI.new_combobox
|
74
|
-
UI.combobox_append(cbox, 'combobox Item 1')
|
75
|
-
UI.combobox_append(cbox, 'combobox Item 2')
|
76
|
-
UI.combobox_append(cbox, 'combobox Item 3')
|
77
|
-
UI.box_append(inner, cbox, 0)
|
78
|
-
UI.combobox_on_selected(cbox, combobox_selected_callback, nil)
|
79
|
-
|
80
|
-
# Or more concise:
|
81
|
-
combo_box = UI.combobox {
|
82
|
-
['combobox Item 1', 'combobox Item 2', 'combobox Item 3']
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
# Add content to an editable combox:
|
87
|
-
|
88
|
-
UI.append() # .append() adds the named item to the end of the EditableCombobox.
|
89
|
-
|
90
|
-
# How to build a menu-interface (menu tag):
|
91
|
-
|
92
|
-
help_menu = UI.new_menu('Help')
|
93
|
-
version_item = UI.menu_append_item(help_menu, 'Version')
|
94
|
-
|
@@ -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,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# === LibuiParadise::Extensions
|
6
|
-
#
|
7
|
-
# This .rb file is primarly used to "extend" libui in a convenient
|
8
|
-
# way. That way we only have to require this file and the rest will
|
9
|
-
# be set up correctly for us.
|
10
|
-
# =========================================================================== #
|
11
|
-
# require 'libui_paradise/extensions/extensions.rb
|
12
|
-
# include Libuiparadise::Extensions
|
13
|
-
# =========================================================================== #
|
14
|
-
require 'libui' # Mandatory require-call.
|
15
|
-
|
16
|
-
module LibuiParadise
|
17
|
-
|
18
|
-
module Extensions # === LibuiParadise::Extensions
|
19
|
-
|
20
|
-
require 'libui_paradise/fiddle/pointer.rb'
|
21
|
-
require 'libui_paradise/extensions/hash_fiddle_pointer_widgets.rb'
|
22
|
-
require 'libui_paradise/extensions/misc.rb'
|
23
|
-
require 'libui_paradise/libui_classes/libui_classes.rb'
|
24
|
-
|
25
|
-
end; end
|
26
|
-
|
27
|
-
alias e puts
|
28
|
-
|
29
|
-
LibuiParadise::Extensions.initializer # Make UI known here.
|
@@ -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
|