libui_paradise 0.1.49
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.
Potentially problematic release.
This version of libui_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +1505 -0
- data/doc/README.gen +1252 -0
- data/doc/SNIPPETS.md +221 -0
- data/doc/TODO.md +14 -0
- data/lib/libui_paradise/autoinclude.rb +9 -0
- data/lib/libui_paradise/domain_specific_language/README.md +5 -0
- data/lib/libui_paradise/domain_specific_language/button.yml +7 -0
- data/lib/libui_paradise/examples/001_basic_button_example.rb +17 -0
- data/lib/libui_paradise/examples/002_basic_table_image.rb +92 -0
- data/lib/libui_paradise/examples/003_font_button.rb +34 -0
- data/lib/libui_paradise/examples/004_date_time_picker.rb +31 -0
- data/lib/libui_paradise/examples/005_msg_box_error.rb +25 -0
- data/lib/libui_paradise/examples/006_histogram.rb +193 -0
- data/lib/libui_paradise/examples/007_combo_box_example.rb +41 -0
- data/lib/libui_paradise/examples/008_simple_notepad_example.rb +23 -0
- data/lib/libui_paradise/examples/009_checkbox_example.rb +82 -0
- data/lib/libui_paradise/examples/010_grid_example.rb +26 -0
- data/lib/libui_paradise/examples/011_fancy_text_example.rb +21 -0
- data/lib/libui_paradise/examples/012_control_gallery.rb +180 -0
- data/lib/libui_paradise/examples/013_midi_player.rb +91 -0
- data/lib/libui_paradise/examples/014_basic_draw_text.rb +134 -0
- data/lib/libui_paradise/examples/015_font_example.rb +91 -0
- data/lib/libui_paradise/examples/016_search_entry_example.rb +16 -0
- data/lib/libui_paradise/examples/017_tabs_example.rb +22 -0
- data/lib/libui_paradise/examples/018_image_example.rb +82 -0
- data/lib/libui_paradise/examples/019_open_file_button_example.rb +24 -0
- data/lib/libui_paradise/examples/020_unicode_text_example.rb +28 -0
- data/lib/libui_paradise/examples/021_spinbutton_example.rb +25 -0
- data/lib/libui_paradise/examples/022_text_example.rb +16 -0
- data/lib/libui_paradise/examples/023_parse_config_file_example.config +6 -0
- data/lib/libui_paradise/examples/023_parse_config_file_example.rb +13 -0
- data/lib/libui_paradise/examples/024_text_view_example.rb +14 -0
- data/lib/libui_paradise/examples/025_scrolling_area.rb +16 -0
- data/lib/libui_paradise/examples/026_colour_button.rb +51 -0
- data/lib/libui_paradise/examples/027_form_example.rb +37 -0
- data/lib/libui_paradise/examples/028_password_entry_example.rb +17 -0
- data/lib/libui_paradise/examples/029_two_buttons_showing_how_to_enable_and_disable_them.rb +32 -0
- data/lib/libui_paradise/examples/030_table_example.rb +51 -0
- data/lib/libui_paradise/experimental/dsl.rb +17 -0
- data/lib/libui_paradise/extensions/extensions.rb +25 -0
- data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +129 -0
- data/lib/libui_paradise/extensions/misc.rb +309 -0
- data/lib/libui_paradise/fiddle/pointer.rb +841 -0
- data/lib/libui_paradise/images/LIBUI_PARADISE_LOGO.png +0 -0
- data/lib/libui_paradise/images/README.md +2 -0
- data/lib/libui_paradise/images/form_example.png +0 -0
- data/lib/libui_paradise/libui_classes/area_handler.rb +52 -0
- data/lib/libui_paradise/libui_classes/button.rb +82 -0
- data/lib/libui_paradise/libui_classes/checkbox.rb +37 -0
- data/lib/libui_paradise/libui_classes/color_button.rb +44 -0
- data/lib/libui_paradise/libui_classes/combobox.rb +55 -0
- data/lib/libui_paradise/libui_classes/editable_combobox.rb +51 -0
- data/lib/libui_paradise/libui_classes/entry.rb +80 -0
- data/lib/libui_paradise/libui_classes/font.rb +78 -0
- data/lib/libui_paradise/libui_classes/font_button.rb +40 -0
- data/lib/libui_paradise/libui_classes/grid.rb +55 -0
- data/lib/libui_paradise/libui_classes/hbox.rb +98 -0
- data/lib/libui_paradise/libui_classes/horizontal_separator.rb +41 -0
- data/lib/libui_paradise/libui_classes/image.rb +82 -0
- data/lib/libui_paradise/libui_classes/label.rb +83 -0
- data/lib/libui_paradise/libui_classes/menu.rb +36 -0
- data/lib/libui_paradise/libui_classes/msg_box.rb +97 -0
- data/lib/libui_paradise/libui_classes/msg_box_error.rb +49 -0
- data/lib/libui_paradise/libui_classes/multiline_entry.rb +59 -0
- data/lib/libui_paradise/libui_classes/non_wrapping_multiline_entry.rb +41 -0
- data/lib/libui_paradise/libui_classes/open_file.rb +42 -0
- data/lib/libui_paradise/libui_classes/password_entry.rb +49 -0
- data/lib/libui_paradise/libui_classes/progressbar.rb +41 -0
- data/lib/libui_paradise/libui_classes/radio_buttons.rb +36 -0
- data/lib/libui_paradise/libui_classes/scrolling_area.rb +85 -0
- data/lib/libui_paradise/libui_classes/search_entry.rb +36 -0
- data/lib/libui_paradise/libui_classes/spinbox.rb +55 -0
- data/lib/libui_paradise/libui_classes/tab.rb +39 -0
- data/lib/libui_paradise/libui_classes/table.rb +45 -0
- data/lib/libui_paradise/libui_classes/text_layout.rb +42 -0
- data/lib/libui_paradise/libui_classes/vbox.rb +51 -0
- data/lib/libui_paradise/libui_classes/window.rb +167 -0
- data/lib/libui_paradise/project/project.rb +26 -0
- data/lib/libui_paradise/prototype/README.md +3 -0
- data/lib/libui_paradise/prototype/prototype.rb +101 -0
- data/lib/libui_paradise/requires/require_the_libui_classes.rb +26 -0
- data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +11 -0
- data/lib/libui_paradise/version/version.rb +17 -0
- data/lib/libui_paradise.rb +1 -0
- data/libui_paradise.gemspec +49 -0
- metadata +164 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/hbox.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.hbox (hbox tag)
|
|
13
|
+
#
|
|
14
|
+
# This method will create a horizontal box.
|
|
15
|
+
# ========================================================================= #
|
|
16
|
+
def self.hbox(*optional_widgets)
|
|
17
|
+
_ = UI.new_horizontal_box
|
|
18
|
+
add_to_the_registered_widgets(_, __method__)
|
|
19
|
+
if optional_widgets and !optional_widgets.flatten.empty?
|
|
20
|
+
optional_widgets.flatten.each {|this_widget|
|
|
21
|
+
_.add(this_widget)
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
return _
|
|
25
|
+
end; self.instance_eval { alias ui_hbox hbox } # === ui_hbox
|
|
26
|
+
self.instance_eval { alias create_hbox hbox } # === create_hbox
|
|
27
|
+
|
|
28
|
+
# ========================================================================= #
|
|
29
|
+
# === ui_padded_hbox
|
|
30
|
+
# ========================================================================= #
|
|
31
|
+
def ui_padded_hbox(*optional_widgets)
|
|
32
|
+
_ = ui_hbox(optional_widgets)
|
|
33
|
+
_.is_padded
|
|
34
|
+
return _
|
|
35
|
+
end; alias padded_hbox ui_padded_hbox # === padded_hbox
|
|
36
|
+
|
|
37
|
+
# ========================================================================= #
|
|
38
|
+
# === ui_hbox (hbox tag)
|
|
39
|
+
# ========================================================================= #
|
|
40
|
+
def hbox(*optional_widgets)
|
|
41
|
+
::LibuiParadise::Extensions.hbox(optional_widgets)
|
|
42
|
+
end; alias ui_hbox hbox # === ui_hbox
|
|
43
|
+
alias create_hbox hbox # === create_hbox
|
|
44
|
+
|
|
45
|
+
# ========================================================================= #
|
|
46
|
+
# === two_elements_hbox
|
|
47
|
+
#
|
|
48
|
+
# This method will return a horizontal box (hbox) that is accepting
|
|
49
|
+
# two arguments (two widgets) that will be embedded onto that hbox.
|
|
50
|
+
# Then the result is returned.
|
|
51
|
+
# ========================================================================= #
|
|
52
|
+
def two_elements_hbox(
|
|
53
|
+
widget1,
|
|
54
|
+
widget2,
|
|
55
|
+
options = {
|
|
56
|
+
layout_to_use: :maximal # This is the default.
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
_ = ui_padded_hbox
|
|
60
|
+
# ======================================================================= #
|
|
61
|
+
# === Handle :layout_to_use
|
|
62
|
+
#
|
|
63
|
+
# This is mostly done to distinguish between maximal() and minimal()
|
|
64
|
+
# for widgets.
|
|
65
|
+
# ======================================================================= #
|
|
66
|
+
if options.is_a?(Hash) and options.has_key?(:layout_to_use)
|
|
67
|
+
case options[:layout_to_use]
|
|
68
|
+
# ===================================================================== #
|
|
69
|
+
# === :maximal
|
|
70
|
+
# ===================================================================== #
|
|
71
|
+
when :maximal
|
|
72
|
+
_.maximal(widget1)
|
|
73
|
+
_.maximal(widget2)
|
|
74
|
+
# ===================================================================== #
|
|
75
|
+
# === :minimal
|
|
76
|
+
# ===================================================================== #
|
|
77
|
+
when :minimal
|
|
78
|
+
_.minimal(widget1)
|
|
79
|
+
_.minimal(widget2)
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
_.minimal(widget1)
|
|
83
|
+
_.minimal(widget2)
|
|
84
|
+
end
|
|
85
|
+
return _
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# ========================================================================= #
|
|
91
|
+
# === LibuiParadise.hbox
|
|
92
|
+
# ========================================================================= #
|
|
93
|
+
def self.hbox(*optional_widgets)
|
|
94
|
+
::LibuiParadise::Extensions.hbox(optional_widgets)
|
|
95
|
+
end; self.instance_eval { alias ui_hbox hbox } # === LibuiParadise.ui_hbox
|
|
96
|
+
self.instance_eval { alias create_hbox hbox } # === LibuiParadise.create_hbox
|
|
97
|
+
|
|
98
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/horizontal_separator.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.horizontal_separator
|
|
13
|
+
# ========================================================================= #
|
|
14
|
+
def self.horizontal_separator
|
|
15
|
+
UI.new_horizontal_separator
|
|
16
|
+
end; self.instance_eval { alias ui_hseparator horizontal_separator } # === LibuiParadise::Extensions.ui_hseparator
|
|
17
|
+
self.instance_eval { alias ui_hsep horizontal_separator } # === LibuiParadise::Extensions.ui_hsep
|
|
18
|
+
self.instance_eval { alias hspacer horizontal_separator } # === LibuiParadise::Extensions.hspacer
|
|
19
|
+
self.instance_eval { alias horizontal_spacer horizontal_separator } # === LibuiParadise::Extensions.horizontal_spacer
|
|
20
|
+
|
|
21
|
+
# ========================================================================= #
|
|
22
|
+
# === horizontal_separator
|
|
23
|
+
# ========================================================================= #
|
|
24
|
+
def horizontal_separator
|
|
25
|
+
::LibuiParadise::Extensions.horizontal_separator
|
|
26
|
+
end; alias ui_hseparator horizontal_separator # === ui_hseparator
|
|
27
|
+
alias ui_hsep horizontal_separator # === ui_hsep
|
|
28
|
+
alias hspacer horizontal_separator # === hspacer
|
|
29
|
+
alias horizontal_spacer horizontal_separator # === hspacer
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# ========================================================================= #
|
|
34
|
+
# === LibuiParadise.horizontal_separator
|
|
35
|
+
# ========================================================================= #
|
|
36
|
+
def self.horizontal_separator
|
|
37
|
+
::LibuiParadise::Extensions.horizontal_separator
|
|
38
|
+
end; self.instance_eval { alias ui_hseparator horizontal_separator } # === LibuiParadise.ui_hseparator
|
|
39
|
+
self.instance_eval { alias ui_hsep horizontal_separator } # === LibuiParadise.ui_hsep
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/image.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === Libuiparadise::Extensions.image
|
|
13
|
+
#
|
|
14
|
+
# This is currently limited to .png files only, due to ChunkyPng.
|
|
15
|
+
#
|
|
16
|
+
# At some later point in the future this limitation may be lifted. For
|
|
17
|
+
# now it has to remain in place.
|
|
18
|
+
# ========================================================================= #
|
|
19
|
+
def self.image(
|
|
20
|
+
this_file,
|
|
21
|
+
width = :try_to_infer_automatically,
|
|
22
|
+
height = :infer_automatically
|
|
23
|
+
)
|
|
24
|
+
if (width == :infer_automatically) or
|
|
25
|
+
(height == :infer_automatically)
|
|
26
|
+
unless Object.const_defined? :ChunkyPNG
|
|
27
|
+
begin
|
|
28
|
+
require 'chunky_png'
|
|
29
|
+
rescue LoadError; end
|
|
30
|
+
end
|
|
31
|
+
canvas = ChunkyPNG::Canvas.from_file(this_file)
|
|
32
|
+
data = canvas.to_rgba_stream
|
|
33
|
+
width = canvas.width
|
|
34
|
+
height = canvas.height
|
|
35
|
+
_ = UI.new_image(width, height) # Create the image here.
|
|
36
|
+
add_to_the_registered_widgets(_, __method__)
|
|
37
|
+
UI.image_append(
|
|
38
|
+
_,
|
|
39
|
+
data,
|
|
40
|
+
width,
|
|
41
|
+
height,
|
|
42
|
+
width
|
|
43
|
+
)
|
|
44
|
+
return _
|
|
45
|
+
end
|
|
46
|
+
nil
|
|
47
|
+
end; self.instance_eval { alias ui_image image } # === LibuiParadise::Extensions.ui_image
|
|
48
|
+
|
|
49
|
+
# ========================================================================= #
|
|
50
|
+
# === image
|
|
51
|
+
#
|
|
52
|
+
# This is currently limited to .png files only, due to ChunkyPng.
|
|
53
|
+
#
|
|
54
|
+
# At some later point in the future this limitation may be lifted. For
|
|
55
|
+
# now it has to remain in place.
|
|
56
|
+
# ========================================================================= #
|
|
57
|
+
def image(
|
|
58
|
+
this_file,
|
|
59
|
+
width = :try_to_infer_automatically,
|
|
60
|
+
height = :infer_automatically
|
|
61
|
+
)
|
|
62
|
+
Libuiparadise::Extensions.image(
|
|
63
|
+
this_file, width, height
|
|
64
|
+
)
|
|
65
|
+
end; alias ui_image image # === ui_image
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# ========================================================================= #
|
|
70
|
+
# === Libuiparadise.image
|
|
71
|
+
# ========================================================================= #
|
|
72
|
+
def self.image(
|
|
73
|
+
this_file,
|
|
74
|
+
width = :try_to_infer_automatically,
|
|
75
|
+
height = :infer_automatically
|
|
76
|
+
)
|
|
77
|
+
::LibuiParadise::Extensions.image(
|
|
78
|
+
this_file, width, height
|
|
79
|
+
)
|
|
80
|
+
end; self.instance_eval { alias ui_image image } # === LibuiParadise.ui_image
|
|
81
|
+
|
|
82
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/label.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.label (text tag, label tag)
|
|
13
|
+
#
|
|
14
|
+
# Add text to the widget at hand. This is actually called a "label".
|
|
15
|
+
# ========================================================================= #
|
|
16
|
+
def self.label(
|
|
17
|
+
i = ''
|
|
18
|
+
)
|
|
19
|
+
_ = UI.new_label(i.to_s)
|
|
20
|
+
add_to_the_registered_widgets(_, __method__)
|
|
21
|
+
return _
|
|
22
|
+
end; self.instance_eval { alias text label } # === LibuiParadise::Extensions.text
|
|
23
|
+
self.instance_eval { alias ui_text label } # === LibuiParadise::Extensions.ui_text
|
|
24
|
+
self.instance_eval { alias ui_label label } # === LibuiParadise::Extensions.ui_label
|
|
25
|
+
|
|
26
|
+
# ========================================================================= #
|
|
27
|
+
# === label
|
|
28
|
+
# ========================================================================= #
|
|
29
|
+
def label(
|
|
30
|
+
i = ''
|
|
31
|
+
)
|
|
32
|
+
::LibuiParadise::Extensions.label(i)
|
|
33
|
+
end; alias text label # === text
|
|
34
|
+
alias ui_text label # === ui_text
|
|
35
|
+
alias ui_label label # === ui_label
|
|
36
|
+
|
|
37
|
+
# ========================================================================= #
|
|
38
|
+
# === bold_label
|
|
39
|
+
#
|
|
40
|
+
# This currently does not work properly. We may have to re-examine this
|
|
41
|
+
# eventually at a later point.
|
|
42
|
+
# ========================================================================= #
|
|
43
|
+
def bold_label(i = '')
|
|
44
|
+
return label(i)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# ========================================================================= #
|
|
48
|
+
# === bold_text
|
|
49
|
+
#
|
|
50
|
+
# This currently does NOT make the text bold - the method exists solely
|
|
51
|
+
# as a placeholder, until upstream libui supports bold text as such.
|
|
52
|
+
# ========================================================================= #
|
|
53
|
+
def bold_text(i = '')
|
|
54
|
+
return label(i)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# ========================================================================= #
|
|
58
|
+
# === fancy_text
|
|
59
|
+
#
|
|
60
|
+
# This text variant can be styled.
|
|
61
|
+
# ========================================================================= #
|
|
62
|
+
def fancy_text(i = '')
|
|
63
|
+
_ = UI.new_attributed_string(i.to_s)
|
|
64
|
+
add_to_the_registered_widgets(_, __method__)
|
|
65
|
+
return _
|
|
66
|
+
end; alias attributed_string fancy_text # === attributed_string
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# ========================================================================= #
|
|
71
|
+
# === LibuiParadise.label
|
|
72
|
+
#
|
|
73
|
+
# Toplevel method to create a new label, aka new text.
|
|
74
|
+
# ========================================================================= #
|
|
75
|
+
def self.label(
|
|
76
|
+
i = ''
|
|
77
|
+
)
|
|
78
|
+
::LibuiParadise::Extensions.label(i)
|
|
79
|
+
end; self.instance_eval { alias text label } # === LibuiParadise.text
|
|
80
|
+
self.instance_eval { alias ui_text label } # === LibuiParadise.ui_text
|
|
81
|
+
self.instance_eval { alias ui_label label } # === LibuiParadise.ui_label
|
|
82
|
+
|
|
83
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/menu.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.menu (menu tag)
|
|
13
|
+
# ========================================================================= #
|
|
14
|
+
def self.menu(title = '')
|
|
15
|
+
_ = UI.new_menu(title)
|
|
16
|
+
add_to_the_registered_widgets(_, __method__)
|
|
17
|
+
return _
|
|
18
|
+
end; self.instance_eval { alias ui_menu menu } # === ui_menu
|
|
19
|
+
|
|
20
|
+
# ========================================================================= #
|
|
21
|
+
# === menu (menu tag)
|
|
22
|
+
# ========================================================================= #
|
|
23
|
+
def menu(title = '')
|
|
24
|
+
return menu(title)
|
|
25
|
+
end; alias ui_menu menu # === ui_menu
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# =========================================================================== #
|
|
30
|
+
# === LibuiParadise.menu
|
|
31
|
+
# =========================================================================== #
|
|
32
|
+
def self.menu(title = '')
|
|
33
|
+
return LibuiParadise::Extensions.menu(title)
|
|
34
|
+
end; self.instance_eval { alias ui_menu menu } # === LibuiParadise.ui_menu
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# Official API documentation can be found here:
|
|
6
|
+
#
|
|
7
|
+
# https://github.com/andlabs/libui/blob/master/unix/stddialogs.c
|
|
8
|
+
#
|
|
9
|
+
# The API signature of msgbox is:
|
|
10
|
+
#
|
|
11
|
+
# GtkWindow *parent
|
|
12
|
+
# const char *title
|
|
13
|
+
# const char *description
|
|
14
|
+
# GtkMessageType type
|
|
15
|
+
# GtkButtonsType buttons
|
|
16
|
+
#
|
|
17
|
+
# So the first string is the title and the second string is the description.
|
|
18
|
+
# =========================================================================== #
|
|
19
|
+
# require 'libui_paradise/ui_classes/msg_box.rb
|
|
20
|
+
# =========================================================================== #
|
|
21
|
+
module LibuiParadise
|
|
22
|
+
|
|
23
|
+
module Extensions # === LibuiParadise::Extensions
|
|
24
|
+
|
|
25
|
+
# ========================================================================= #
|
|
26
|
+
# === LibuiParadise::Extensions.msg_box
|
|
27
|
+
#
|
|
28
|
+
# This method is a convenience-wrapper over UI.msg_box().
|
|
29
|
+
# ========================================================================= #
|
|
30
|
+
def self.msg_box(
|
|
31
|
+
main_window = :default_window,
|
|
32
|
+
title_to_use = '',
|
|
33
|
+
description_to_use = ''
|
|
34
|
+
)
|
|
35
|
+
case main_window
|
|
36
|
+
# ======================================================================= #
|
|
37
|
+
# === :default_window
|
|
38
|
+
# ======================================================================= #
|
|
39
|
+
when :default_window,
|
|
40
|
+
:default
|
|
41
|
+
require 'libui_paradise/libui_classes/window.rb'
|
|
42
|
+
main_window = ::LibuiParadise.main_window?
|
|
43
|
+
end
|
|
44
|
+
_ = ::LibUI.msg_box(
|
|
45
|
+
main_window,
|
|
46
|
+
title_to_use,
|
|
47
|
+
description_to_use
|
|
48
|
+
)
|
|
49
|
+
add_to_the_registered_widgets(_, __method__)
|
|
50
|
+
return _
|
|
51
|
+
end; self.instance_eval { alias ui_msg_box msg_box } # === LibuiParadise::Extensions.ui_msg_box
|
|
52
|
+
self.instance_eval { alias message_to_the_user msg_box } # === LibuiParadise::Extensions.message_to_the_user
|
|
53
|
+
self.instance_eval { alias message_box msg_box } # === LibuiParadise::Extensions.message_box
|
|
54
|
+
self.instance_eval { alias popup_over_this_widget msg_box } # === LibuiParadise::Extensions.popup_over_this_widget
|
|
55
|
+
|
|
56
|
+
# ========================================================================= #
|
|
57
|
+
# === ui_msg_box
|
|
58
|
+
#
|
|
59
|
+
# This method is a convenience-wrapper over UI.msg_box().
|
|
60
|
+
# ========================================================================= #
|
|
61
|
+
def ui_msg_box(
|
|
62
|
+
main_window = :default_window,
|
|
63
|
+
title_to_use = '',
|
|
64
|
+
whatever = ''
|
|
65
|
+
)
|
|
66
|
+
::LibuiParadise::Extensions.msg_box(
|
|
67
|
+
main_window,
|
|
68
|
+
title_to_use,
|
|
69
|
+
whatever
|
|
70
|
+
)
|
|
71
|
+
end; alias message_to_the_user ui_msg_box # === message_to_the_user
|
|
72
|
+
alias message_box ui_msg_box # === message_box
|
|
73
|
+
alias popup_over_this_widget ui_msg_box # === popup_over_this_widget
|
|
74
|
+
alias popup_message ui_msg_box # === popup_message
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# =========================================================================== #
|
|
79
|
+
# === LibuiParadise.msg_box
|
|
80
|
+
# =========================================================================== #
|
|
81
|
+
def self.msg_box(
|
|
82
|
+
main_window = :default_window,
|
|
83
|
+
title_to_use = '',
|
|
84
|
+
whatever = ''
|
|
85
|
+
)
|
|
86
|
+
::LibuiParadise::Extensions.msg_box(
|
|
87
|
+
main_window,
|
|
88
|
+
title_to_use,
|
|
89
|
+
whatever
|
|
90
|
+
)
|
|
91
|
+
end; self.instance_eval { alias ui_msg_box msg_box } # === LibuiParadise.ui_msg_box
|
|
92
|
+
self.instance_eval { alias message_to_the_user msg_box } # === LibuiParadise.message_to_the_user
|
|
93
|
+
self.instance_eval { alias message_box msg_box } # === LibuiParadise.message_box
|
|
94
|
+
self.instance_eval { alias popup_over_this_widget msg_box } # === LibuiParadise.popup_over_this_widget
|
|
95
|
+
self.instance_eval { alias popup_message msg_box } # === LibuiParadise.popup_message
|
|
96
|
+
|
|
97
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/msg_box_error.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.msg_box_error
|
|
13
|
+
# ========================================================================= #
|
|
14
|
+
def self.msg_box_error(
|
|
15
|
+
main_window = LibuiParadise.main_window?,
|
|
16
|
+
title_to_use = '',
|
|
17
|
+
whatever = ''
|
|
18
|
+
)
|
|
19
|
+
_ = UI.msg_box_error(
|
|
20
|
+
main_window,
|
|
21
|
+
title_to_use,
|
|
22
|
+
whatever
|
|
23
|
+
)
|
|
24
|
+
add_to_the_registered_widgets(_, __method__)
|
|
25
|
+
return _
|
|
26
|
+
end; self.instance_eval { alias ui_msg_box_error msg_box_error } # === LibuiParadise::Extensions.ui_msg_box_error
|
|
27
|
+
self.instance_eval { alias ui_error_msg msg_box_error } # === LibuiParadise::Extensions.ui_error_msg
|
|
28
|
+
self.instance_eval { alias ui_error_message msg_box_error } # === LibuiParadise::Extensions.ui_error_message
|
|
29
|
+
self.instance_eval { alias error_message_to_the_user msg_box_error } # === LibuiParadise::Extensions.error_message_to_the_user
|
|
30
|
+
|
|
31
|
+
# ========================================================================= #
|
|
32
|
+
# === msg_box_error
|
|
33
|
+
# ========================================================================= #
|
|
34
|
+
def msg_box_error(
|
|
35
|
+
main_window = LibuiParadise.main_window?,
|
|
36
|
+
title_to_use = '',
|
|
37
|
+
whatever = ''
|
|
38
|
+
)
|
|
39
|
+
return ::LibuiParadise::Extensions.msg_box_error(
|
|
40
|
+
main_window,
|
|
41
|
+
title_to_use,
|
|
42
|
+
whatever
|
|
43
|
+
)
|
|
44
|
+
end; alias ui_msg_box_error msg_box_error # === ui_msg_box_error
|
|
45
|
+
alias ui_error_msg msg_box_error # === ui_error_msg
|
|
46
|
+
alias ui_error_message msg_box_error # === ui_error_message
|
|
47
|
+
alias error_message_to_the_user msg_box_error # === error_message_to_the_user
|
|
48
|
+
|
|
49
|
+
end; end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/libui_classes/multiline_entry.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.multiline_entry (multiline_entry tag)
|
|
13
|
+
#
|
|
14
|
+
# A textview is a widget that allows the user to input text and modify
|
|
15
|
+
# that text as well.
|
|
16
|
+
# ========================================================================= #
|
|
17
|
+
def self.multiline_entry(optional_content = nil)
|
|
18
|
+
_ = UI.new_multiline_entry
|
|
19
|
+
add_to_the_registered_widgets(_, __method__)
|
|
20
|
+
if optional_content and optional_content.is_a?(String) and !optional_content.empty?
|
|
21
|
+
_.set_text(optional_content)
|
|
22
|
+
end
|
|
23
|
+
return _
|
|
24
|
+
end; self.instance_eval { alias ui_multiline_entry multiline_entry } # === LibuiParadise::Extensions.ui_multiline_entry
|
|
25
|
+
self.instance_eval { alias textview multiline_entry } # === LibuiParadise::Extensions.textview
|
|
26
|
+
self.instance_eval { alias text_view multiline_entry } # === LibuiParadise::Extensions.text_view
|
|
27
|
+
self.instance_eval { alias ui_text_view multiline_entry } # === LibuiParadise::Extensions.ui_text_view
|
|
28
|
+
self.instance_eval { alias ui_textview multiline_entry } # === LibuiParadise::Extensions.ui_textview
|
|
29
|
+
self.instance_eval { alias ui_text_buffer multiline_entry } # === LibuiParadise::Extensions.ui_text_buffer
|
|
30
|
+
self.instance_eval { alias input_field multiline_entry } # === LibuiParadise::Extensions.input_field
|
|
31
|
+
|
|
32
|
+
# ========================================================================= #
|
|
33
|
+
# === multiline_entry
|
|
34
|
+
# ========================================================================= #
|
|
35
|
+
def multiline_entry(optional_content = nil)
|
|
36
|
+
::LibuiParadise::Extensions.multiline_entry(optional_content)
|
|
37
|
+
end; alias ui_multiline_entry multiline_entry # === ui_multiline_entry
|
|
38
|
+
alias textview multiline_entry # === textview
|
|
39
|
+
alias text_view multiline_entry # === text_view
|
|
40
|
+
alias ui_text_view multiline_entry # === ui_text_view
|
|
41
|
+
alias ui_textview multiline_entry # === ui_textview
|
|
42
|
+
alias ui_text_buffer multiline_entry # === ui_text_buffer
|
|
43
|
+
alias input_field multiline_entry # === input_field
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# =========================================================================== #
|
|
48
|
+
# === LibuiParadise.multiline_entry
|
|
49
|
+
# =========================================================================== #
|
|
50
|
+
def self.multiline_entry(optional_content = nil)
|
|
51
|
+
::LibuiParadise::Extensions.multiline_entry(optional_content)
|
|
52
|
+
end; self.instance_eval { alias textview multiline_entry } # === LibuiParadise.textview
|
|
53
|
+
self.instance_eval { alias text_view multiline_entry } # === LibuiParadise.text_view
|
|
54
|
+
self.instance_eval { alias ui_text_view multiline_entry } # === LibuiParadise.ui_text_view
|
|
55
|
+
self.instance_eval { alias ui_textview multiline_entry } # === LibuiParadise.ui_textview
|
|
56
|
+
self.instance_eval { alias ui_text_buffer multiline_entry } # === LibuiParadise.ui_text_buffer
|
|
57
|
+
self.instance_eval { alias input_field multiline_entry } # === LibuiParadise.input_field
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# The upstream C API can be found here:
|
|
6
|
+
#
|
|
7
|
+
# https://raw.githubusercontent.com/andlabs/libui/master/unix/multilineentry.c
|
|
8
|
+
#
|
|
9
|
+
# =========================================================================== #
|
|
10
|
+
# require 'libui_paradise/ui_classes/new_non_wrapping_multiline_entry.rb
|
|
11
|
+
# =========================================================================== #
|
|
12
|
+
module LibuiParadise
|
|
13
|
+
|
|
14
|
+
module Extensions # === LibuiParadise::Extensions
|
|
15
|
+
|
|
16
|
+
# ========================================================================= #
|
|
17
|
+
# === LibuiParadise::Extensions.non_wrapping_multiline_entry
|
|
18
|
+
# ========================================================================= #
|
|
19
|
+
def self.non_wrapping_multiline_entry
|
|
20
|
+
_ = UI.new_non_wrapping_multiline_entry
|
|
21
|
+
add_to_the_registered_widgets(_, __method__)
|
|
22
|
+
return _
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# ========================================================================= #
|
|
26
|
+
# === LibuiParadise::Extensions.non_wrapping_multiline_entry
|
|
27
|
+
# ========================================================================= #
|
|
28
|
+
def non_wrapping_multiline_entry
|
|
29
|
+
return ::LibuiParadise::Extensions.non_wrapping_multiline_entry
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# =========================================================================== #
|
|
35
|
+
# === LibuiParadise.non_wrapping_multiline_entry
|
|
36
|
+
# =========================================================================== #
|
|
37
|
+
def self.non_wrapping_multiline_entry
|
|
38
|
+
return ::LibuiParadise::Extensions.non_wrapping_multiline_entry
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/open_file.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.open_file
|
|
13
|
+
# ========================================================================= #
|
|
14
|
+
def self.open_file(
|
|
15
|
+
main_window = LibuiParadise::Extensions.main_window?
|
|
16
|
+
)
|
|
17
|
+
_ = UI.open_file(main_window)
|
|
18
|
+
add_to_the_registered_widgets(_, __method__)
|
|
19
|
+
return _
|
|
20
|
+
end; self.instance_eval { alias ui_open_file open_file } # === LibuiParadise::Extensions.ui_open_file
|
|
21
|
+
|
|
22
|
+
# ========================================================================= #
|
|
23
|
+
# === open_file
|
|
24
|
+
# ========================================================================= #
|
|
25
|
+
def open_file(
|
|
26
|
+
main_window = LibuiParadise::Extensions.main_window?
|
|
27
|
+
)
|
|
28
|
+
return ::LibuiParadise::Extensions.open_file(main_window)
|
|
29
|
+
end; alias ui_open_file open_file # === ui_open_file
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# =========================================================================== #
|
|
34
|
+
# === LibuiParadise.open_file
|
|
35
|
+
# =========================================================================== #
|
|
36
|
+
def self.open_file(
|
|
37
|
+
main_window = LibuiParadise::Extensions.main_window?
|
|
38
|
+
)
|
|
39
|
+
return ::LibuiParadise::Extensions.open_file(main_window)
|
|
40
|
+
end; self.instance_eval { alias ui_open_file open_file } # === LibuiParadise.ui_open_file
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'libui_paradise/ui_classes/password_entry.rb
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module LibuiParadise
|
|
8
|
+
|
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === LibuiParadise::Extensions.password_entry
|
|
13
|
+
#
|
|
14
|
+
# This method will create and returns a new password entry widget. This
|
|
15
|
+
# means that input will be "disguised" via the '*' character.
|
|
16
|
+
#
|
|
17
|
+
# Usage example:
|
|
18
|
+
#
|
|
19
|
+
# entry = LibuiParadise::Extensions.password_entry
|
|
20
|
+
#
|
|
21
|
+
# ========================================================================= #
|
|
22
|
+
def self.password_entry
|
|
23
|
+
entry = UI.new_password_entry
|
|
24
|
+
add_to_the_registered_widgets(entry, __method__)
|
|
25
|
+
return entry
|
|
26
|
+
end; self.instance_eval { alias ui_password_entry password_entry } # === LibuiParadise::Extensions.ui_password_entry
|
|
27
|
+
|
|
28
|
+
# ========================================================================= #
|
|
29
|
+
# === password_entry
|
|
30
|
+
#
|
|
31
|
+
# Usage example:
|
|
32
|
+
#
|
|
33
|
+
# entry = ui_password_entry
|
|
34
|
+
#
|
|
35
|
+
# ========================================================================= #
|
|
36
|
+
def password_entry
|
|
37
|
+
::LibuiParadise::Extensions.password_entry
|
|
38
|
+
end; alias ui_password_entry password_entry # === ui_password_entry
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# =========================================================================== #
|
|
43
|
+
# === LibuiParadise.password_entry
|
|
44
|
+
# =========================================================================== #
|
|
45
|
+
def self.password_entry
|
|
46
|
+
::LibuiParadise::Extensions.password_entry
|
|
47
|
+
end; self.instance_eval { alias ui_password_entry password_entry } # === LibuiParadise.ui_password_entry
|
|
48
|
+
|
|
49
|
+
end
|