libui_paradise 0.1.49
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of libui_paradise might be problematic. Click here for more details.
- 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,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://github.com/andlabs/libui/blob/master/unix/progressbar.c
|
8
|
+
#
|
9
|
+
# =========================================================================== #
|
10
|
+
# require 'libui_paradise/ui_classes/progressbar.rb
|
11
|
+
# =========================================================================== #
|
12
|
+
module LibuiParadise
|
13
|
+
|
14
|
+
module Extensions # === LibuiParadise::Extensions
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === LibuiParadise::Extensions.new_progress_bar
|
18
|
+
# ========================================================================= #
|
19
|
+
def self.new_progress_bar
|
20
|
+
_ = LibUI.new_progress_bar
|
21
|
+
add_to_the_registered_widgets(_, __method__)
|
22
|
+
return _
|
23
|
+
end
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === new_progress_bar
|
27
|
+
# ========================================================================= #
|
28
|
+
def new_progress_bar
|
29
|
+
return ::LibuiParadise::Extensions.new_progress_bar
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
# =========================================================================== #
|
35
|
+
# === LibuiParadise.new_progress_bar
|
36
|
+
# =========================================================================== #
|
37
|
+
def self.new_progress_bar
|
38
|
+
return ::LibuiParadise::Extensions.new_progress_bar
|
39
|
+
end
|
40
|
+
|
41
|
+
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/radio_buttons.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.radio_buttons
|
13
|
+
# ========================================================================= #
|
14
|
+
def self.radio_buttons
|
15
|
+
_ = UI.new_radio_buttons
|
16
|
+
add_to_the_registered_widgets(_, __method__)
|
17
|
+
return _
|
18
|
+
end; self.instance_eval { alias ui_radio_buttons radio_buttons } # === LibuiParadise::Extensionsui_radio_buttons
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === radio_buttons
|
22
|
+
# ========================================================================= #
|
23
|
+
def radio_buttons
|
24
|
+
return ::LibuiParadise::Extensions.radio_buttons
|
25
|
+
end; alias ui_radio_buttons radio_buttons # === ui_radio_buttons
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
# =========================================================================== #
|
30
|
+
# === LibuiParadise.radio_buttons
|
31
|
+
# =========================================================================== #
|
32
|
+
def self.radio_buttons
|
33
|
+
return ::LibuiParadise::Extensions.radio_buttons
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/ui_classes/scrolling_area.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.scrolling_area
|
13
|
+
#
|
14
|
+
# It seems as if scrolling is not yet easily available in libui.
|
15
|
+
#
|
16
|
+
# The upstream API is like this:
|
17
|
+
#
|
18
|
+
# uiArea *area = uiNewScrollingArea(&handler, 400, 400);
|
19
|
+
#
|
20
|
+
# The two numbers are width and height, as integers, respectively.
|
21
|
+
# In total three arguments are required. The first argument is
|
22
|
+
# a so-called "AreaHandler".
|
23
|
+
#
|
24
|
+
# The code may be found here:
|
25
|
+
#
|
26
|
+
# https://github.com/andlabs/libui/blob/master/windows/areascroll.cpp
|
27
|
+
#
|
28
|
+
# ========================================================================= #
|
29
|
+
def self.scrolling_area(
|
30
|
+
widget,
|
31
|
+
width = 400,
|
32
|
+
height = 400
|
33
|
+
)
|
34
|
+
case width
|
35
|
+
when :default, nil
|
36
|
+
width = 400
|
37
|
+
end
|
38
|
+
case height
|
39
|
+
when :default, nil
|
40
|
+
height = 400
|
41
|
+
end
|
42
|
+
_ = LibUI.new_scrolling_area(widget, width, height)
|
43
|
+
# ======================================================================= #
|
44
|
+
# The next part does not yet work - is it even possible to add widgets
|
45
|
+
# to a scrolling area in libui?
|
46
|
+
# if optional_widget
|
47
|
+
# _.add(optional_widget)
|
48
|
+
# end
|
49
|
+
# ======================================================================= #
|
50
|
+
add_to_the_registered_widgets(_, __method__)
|
51
|
+
return _
|
52
|
+
end; self.instance_eval { alias ui_scrolling_area scrolling_area } # === LibuiParadise::Extensions.ui_scrolling_area
|
53
|
+
self.instance_eval { alias ui_scrolled_window scrolling_area } # === LibuiParadise::Extensions.ui_scrolling_window
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === scrolling_area
|
57
|
+
#
|
58
|
+
# It seems as if scrolling is not yet easily available in libui.
|
59
|
+
#
|
60
|
+
# The upstream API is like this:
|
61
|
+
#
|
62
|
+
# uiArea *area = uiNewScrollingArea(&handler, 400, 400);
|
63
|
+
#
|
64
|
+
# ========================================================================= #
|
65
|
+
def scrolling_area(
|
66
|
+
optional_widget = nil
|
67
|
+
)
|
68
|
+
LibuiParadise::Extensions.scrolling_area(optional_widget)
|
69
|
+
end; alias ui_scrolling_area scrolling_area # === ui_scrolling_area
|
70
|
+
alias ui_scrolled_window scrolling_area # === ui_scrolling_window
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
# =========================================================================== #
|
75
|
+
# === LibuiParadise.scrolling_area
|
76
|
+
# =========================================================================== #
|
77
|
+
def self.scrolling_area(
|
78
|
+
widget,
|
79
|
+
width = :default,
|
80
|
+
height = :default
|
81
|
+
)
|
82
|
+
::LibuiParadise::Extensions.scrolling_area(widget, width, height)
|
83
|
+
end
|
84
|
+
|
85
|
+
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/search_entry.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.search_entry
|
13
|
+
# ========================================================================= #
|
14
|
+
def self.search_entry
|
15
|
+
_ = UI.new_search_entry
|
16
|
+
add_to_the_registered_widgets(_, __method__)
|
17
|
+
return _
|
18
|
+
end; self.instance_eval { alias ui_search_entry search_entry } # === LibuiParadise::Extensions.ui_search_entry
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === search_entry
|
22
|
+
# ========================================================================= #
|
23
|
+
def search_entry
|
24
|
+
::LibuiParadise::Extensions.search_entry
|
25
|
+
end; alias ui_search_entry search_entry # === ui_search_entry
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
# =========================================================================== #
|
30
|
+
# === LibuiParadise.search_entry
|
31
|
+
# =========================================================================== #
|
32
|
+
def self.search_entry
|
33
|
+
::LibuiParadise::Extensions.search_entry
|
34
|
+
end; self.instance_eval { alias ui_search_entry search_entry } # === LibuiParadise.ui_search_entry
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/ui_classes/spinbox.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.spinbox
|
13
|
+
#
|
14
|
+
# This method will return a spin-button, also called a spin-box.
|
15
|
+
# ========================================================================= #
|
16
|
+
def self.spinbox(
|
17
|
+
start_point = 0,
|
18
|
+
end_point = 100
|
19
|
+
)
|
20
|
+
_ = UI.new_spinbox(start_point.to_i, end_point.to_i)
|
21
|
+
add_to_the_registered_widgets(_, __method__)
|
22
|
+
return _
|
23
|
+
end; self.instance_eval { alias ui_spinbox spinbox } # === LibuiParadise::Extensions.ui_spinbox
|
24
|
+
self.instance_eval { alias ui_spinbutton spinbox } # === LibuiParadise::Extensions.ui_spinbutton
|
25
|
+
self.instance_eval { alias spinbutton spinbox } # === LibuiParadise::Extensions.spinbutton
|
26
|
+
|
27
|
+
# ========================================================================= #
|
28
|
+
# === spinbox
|
29
|
+
#
|
30
|
+
# This method will return a spin-button, also called a spin-box.
|
31
|
+
# ========================================================================= #
|
32
|
+
def spinbox(
|
33
|
+
start_point = 0,
|
34
|
+
end_point = 100
|
35
|
+
)
|
36
|
+
::LibuiParadise::Extensions.spinbox(start_point, end_point)
|
37
|
+
end; alias ui_spinbox spinbox # === ui_spinbox
|
38
|
+
alias ui_spinbutton spinbox # === ui_spinbutton
|
39
|
+
alias spinbutton spinbox # === spinbutton
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
# =========================================================================== #
|
44
|
+
# === LibuiParadise.spinbox
|
45
|
+
# =========================================================================== #
|
46
|
+
def self.spinbox(
|
47
|
+
start_point = 0,
|
48
|
+
end_point = 100
|
49
|
+
)
|
50
|
+
::LibuiParadise::Extensions.spinbox(start_point, end_point)
|
51
|
+
end; self.instance_eval { alias ui_spinbox spinbox } # === LibuiParadise.ui_spinbox
|
52
|
+
self.instance_eval { alias ui_spinbutton spinbox } # === LibuiParadise.ui_spinbutton
|
53
|
+
self.instance_eval { alias spinbutton spinbox } # === LibuiParadise.spinbutton
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/ui_classes/tab.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.tab
|
13
|
+
#
|
14
|
+
# This could be also called "notebook_tab".
|
15
|
+
# ========================================================================= #
|
16
|
+
def self.tab
|
17
|
+
_ = UI.new_tab
|
18
|
+
add_to_the_registered_widgets(_, __method__)
|
19
|
+
return _
|
20
|
+
end; self.instance_eval { alias ui_tab tab } # === LibuiParadise::Extensions.ui_tab
|
21
|
+
self.instance_eval { alias ui_tabs tab } # === LibuiParadise::Extensions.ui_tabs
|
22
|
+
self.instance_eval { alias notebook tab } # === LibuiParadise::Extensions.notebook
|
23
|
+
self.instance_eval { alias ui_notebook tab } # === LibuiParadise::Extensions.ui_notebook
|
24
|
+
self.instance_eval { alias notebook_tab tab } # === LibuiParadise::Extensions.notebook_tab
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === tab
|
28
|
+
#
|
29
|
+
# This could be also called "notebook_tab".
|
30
|
+
# ========================================================================= #
|
31
|
+
def tab
|
32
|
+
::LibuiParadise::Extensions.tab
|
33
|
+
end; alias ui_tab tab # === ui_tab
|
34
|
+
alias ui_tabs tab # === ui_tabs
|
35
|
+
alias notebook tab # === notebook
|
36
|
+
alias ui_notebook tab # === ui_notebook
|
37
|
+
alias notebook_tab tab # === notebook_tab
|
38
|
+
|
39
|
+
end; end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/ui_classes/table.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.table
|
13
|
+
#
|
14
|
+
# The argument should be of type table_params.
|
15
|
+
#
|
16
|
+
# Example for this:
|
17
|
+
#
|
18
|
+
# table_params = LibUI::FFI::TableParams.malloc
|
19
|
+
# table_params.Model = model
|
20
|
+
# table_params.RowBackgroundColorModelColumn = -1
|
21
|
+
#
|
22
|
+
# ========================================================================= #
|
23
|
+
def self.table(i)
|
24
|
+
_ = LibUI.new_table(i)
|
25
|
+
LibuiParadise::Extensions.register_this_fiddle_pointer_widget(_, __method__)
|
26
|
+
return _
|
27
|
+
end; self.instance_eval { alias ui_table table } # === LibuiParadise::Extensions.ui_table
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === table
|
31
|
+
# ========================================================================= #
|
32
|
+
def table(i)
|
33
|
+
::LibuiParadise::Extensions.table(i)
|
34
|
+
end; alias ui_table table # === ui_table
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
# =========================================================================== #
|
39
|
+
# === LibuiParadise.table
|
40
|
+
# =========================================================================== #
|
41
|
+
def self.table(i)
|
42
|
+
::LibuiParadise::Extensions.table(i)
|
43
|
+
end; self.instance_eval { alias ui_table table } # === LibuiParadise.ui_table
|
44
|
+
|
45
|
+
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/text_layout.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.text_layout
|
13
|
+
# ========================================================================= #
|
14
|
+
def self.text_layout(
|
15
|
+
i = ''
|
16
|
+
)
|
17
|
+
_ = UI.draw_new_text_layout(i.to_s)
|
18
|
+
add_to_the_registered_widgets(_, __method__)
|
19
|
+
return _
|
20
|
+
end
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === text_layout
|
24
|
+
# ========================================================================= #
|
25
|
+
def text_layout(
|
26
|
+
i = ''
|
27
|
+
)
|
28
|
+
::LibuiParadise::Extensions.text_layout(i)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
# =========================================================================== #
|
34
|
+
# === LibuiParadise.text_layout
|
35
|
+
# =========================================================================== #
|
36
|
+
def self.text_layout(
|
37
|
+
i = ''
|
38
|
+
)
|
39
|
+
::LibuiParadise::Extensions.text_layout(i)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/libui_classes/vbox.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === LibuiParadise::Extensions.vbox (vbox tag)
|
13
|
+
#
|
14
|
+
# This method will create a vertical box.
|
15
|
+
# ========================================================================= #
|
16
|
+
def self.vbox
|
17
|
+
_ = UI.new_vertical_box
|
18
|
+
add_to_the_registered_widgets(_, __method__)
|
19
|
+
return _
|
20
|
+
end; self.instance_eval { alias ui_vbox vbox } # === ui_vbox
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === vbox
|
24
|
+
# ========================================================================= #
|
25
|
+
def vbox
|
26
|
+
::LibuiParadise::Extensions.vbox
|
27
|
+
end; alias ui_vbox vbox # === ui_vbox
|
28
|
+
alias gtk_box vbox # === gtk_box
|
29
|
+
|
30
|
+
# ========================================================================= #
|
31
|
+
# === ui_padded_vbox
|
32
|
+
#
|
33
|
+
# This method will call .is_padded on the vbox after it has been
|
34
|
+
# initialized.
|
35
|
+
# ========================================================================= #
|
36
|
+
def ui_padded_vbox
|
37
|
+
_ = ui_vbox
|
38
|
+
_.is_padded
|
39
|
+
return _
|
40
|
+
end; alias padded_vbox ui_padded_vbox # === padded_vbox
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
# =========================================================================== #
|
45
|
+
# === LibuiParadise.vbox
|
46
|
+
# =========================================================================== #
|
47
|
+
def self.vbox
|
48
|
+
::LibuiParadise::Extensions.vbox
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/ui_classes/window.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
module LibuiParadise
|
8
|
+
|
9
|
+
module Extensions # === LibuiParadise::Extensions
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === @main_window
|
13
|
+
#
|
14
|
+
# This variable can be used to keep track of the main window in use.
|
15
|
+
# ========================================================================= #
|
16
|
+
@main_window = nil
|
17
|
+
|
18
|
+
# ========================================================================= #
|
19
|
+
# === LibuiParadise::Extensions.main_window?
|
20
|
+
# ========================================================================= #
|
21
|
+
def self.main_window?
|
22
|
+
@main_window
|
23
|
+
end
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === main_window?
|
27
|
+
# ========================================================================= #
|
28
|
+
def main_window?
|
29
|
+
::LibuiParadise::Extensions.main_window?
|
30
|
+
end
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === LibuiParadise::Extensions.set_main_window
|
34
|
+
# ========================================================================= #
|
35
|
+
def self.set_main_window(i)
|
36
|
+
@main_window = i
|
37
|
+
end
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === LibuiParadise::Extensions.window (window tag)
|
41
|
+
#
|
42
|
+
# This method will create a new main-window.
|
43
|
+
#
|
44
|
+
# It will also call UI.simple_exit(). This is done mostly so that we
|
45
|
+
# can omit that line whenever we use e. g. ui_main_window().
|
46
|
+
# ========================================================================= #
|
47
|
+
def self.window(
|
48
|
+
the_title = '', # Pick a title for the window here.
|
49
|
+
width = 500, # width in n pixels.
|
50
|
+
height = 300, # height in n pixels.
|
51
|
+
has_menubar = 1, # hasMenubar or has not.
|
52
|
+
&block
|
53
|
+
)
|
54
|
+
raw_has_menubar = 0
|
55
|
+
if has_menubar.is_a? Numeric
|
56
|
+
raw_has_menubar = has_menubar
|
57
|
+
end
|
58
|
+
# ======================================================================= #
|
59
|
+
# Instantiate a new main-window next:
|
60
|
+
# ======================================================================= #
|
61
|
+
main_window = LibUI.new_window(
|
62
|
+
the_title,
|
63
|
+
width,
|
64
|
+
height,
|
65
|
+
raw_has_menubar
|
66
|
+
)
|
67
|
+
set_main_window(main_window) # Keep a reference stored here.
|
68
|
+
# ======================================================================= #
|
69
|
+
# Since as of 30.08.2021 we will also register the main-window.
|
70
|
+
#
|
71
|
+
# In the long run we may obsolete and deprecate @main_window, since
|
72
|
+
# it is no longer needed - but for now we will retain that variable.
|
73
|
+
# ======================================================================= #
|
74
|
+
add_to_the_registered_widgets(main_window, __method__)
|
75
|
+
if has_menubar and has_menubar.is_a?(Hash)
|
76
|
+
if has_menubar.has_key? :margin
|
77
|
+
if has_menubar[:margin] == true
|
78
|
+
main_window.has_margin
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
UI.simple_exit(main_window)
|
83
|
+
if block_given?
|
84
|
+
yield
|
85
|
+
end
|
86
|
+
return main_window # Always return it here.
|
87
|
+
end; self.instance_eval { alias main_window window } # === LibuiParadise::Extensions.main_window
|
88
|
+
self.instance_eval { alias ui_main_window window } # === LibuiParadise::Extensions.ui_main_window
|
89
|
+
self.instance_eval { alias margined_window window } # === LibuiParadise::Extensions.margined_window
|
90
|
+
self.instance_eval { alias ui_window window } # === LibuiParadise::Extensions.ui_window
|
91
|
+
|
92
|
+
# ========================================================================= #
|
93
|
+
# === window
|
94
|
+
# ========================================================================= #
|
95
|
+
def window(
|
96
|
+
the_title = '', # Pick a title for the window here.
|
97
|
+
width = 500, # width in n pixels.
|
98
|
+
height = 300, # height in n pixels.
|
99
|
+
has_menubar = 1 # hasMenubar or has not.
|
100
|
+
)
|
101
|
+
LibuiParadise::Extensions.window(
|
102
|
+
the_title, width, height, has_menubar
|
103
|
+
)
|
104
|
+
end; alias main_window window # === main_window
|
105
|
+
|
106
|
+
# ========================================================================= #
|
107
|
+
# === ui_margined_main_window
|
108
|
+
#
|
109
|
+
# This variant is like ui_main_window() but it will automatically
|
110
|
+
# put a margin on the window, via .is_margined().
|
111
|
+
#
|
112
|
+
# Note that the variant name "ui_padded_main_window" is a misnomer,
|
113
|
+
# since it is a margin rather than padding - but I found that it
|
114
|
+
# is easier to not care about this, so for the time being (September
|
115
|
+
# 2021) this is how it is. It may be subject to change in the future,
|
116
|
+
# though.
|
117
|
+
# ========================================================================= #
|
118
|
+
def ui_margined_main_window(
|
119
|
+
the_title = '', # Pick a title for the window here.
|
120
|
+
width = 500, # width in n pixels.
|
121
|
+
height = 300, # height in n pixels.
|
122
|
+
has_menubar = 1 # hasMenubar or has not.
|
123
|
+
)
|
124
|
+
_ = LibuiParadise.window(the_title, width, height, has_menubar)
|
125
|
+
_.is_margined
|
126
|
+
return _
|
127
|
+
end; alias ui_margined_window ui_margined_main_window # === ui_margined_window
|
128
|
+
alias ui_padded_main_window ui_margined_main_window # === ui_padded_main_window
|
129
|
+
alias margined_window ui_margined_main_window # === margined_window
|
130
|
+
alias padded_window ui_margined_main_window # === padded_window
|
131
|
+
alias padded_main_window ui_margined_main_window # === padded_main_window
|
132
|
+
alias ui_main_window ui_margined_main_window # === ui_main_window
|
133
|
+
alias ui_window ui_margined_main_window # === ui_window
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
# =========================================================================== #
|
138
|
+
# === LibuiParadise.window
|
139
|
+
# =========================================================================== #
|
140
|
+
def self.window(
|
141
|
+
the_title = '', # Pick a title for the window here.
|
142
|
+
width = 500, # width in n pixels.
|
143
|
+
height = 300, # height in n pixels.
|
144
|
+
has_menubar = 1 # hasMenubar or has not.
|
145
|
+
)
|
146
|
+
::LibuiParadise::Extensions.window(
|
147
|
+
the_title,
|
148
|
+
width,
|
149
|
+
height,
|
150
|
+
has_menubar
|
151
|
+
)
|
152
|
+
end; self.instance_eval { alias main_window window } # === LibuiParadise.main_window
|
153
|
+
self.instance_eval { alias margined_window window } # === LibuiParadise.margined_window
|
154
|
+
self.instance_eval { alias ui_window window } # === LibuiParadise.ui_window
|
155
|
+
self.instance_eval { alias ui_main_window window } # === LibuiParadise.ui_main_window
|
156
|
+
self.instance_eval { alias ui_padded_main_window window } # === LibuiParadise.margined_window
|
157
|
+
self.instance_eval { alias padded_window window } # === LibuiParadise.padded_window
|
158
|
+
self.instance_eval { alias padded_main_window window } # === LibuiParadise.padded_main_window
|
159
|
+
|
160
|
+
# =========================================================================== #
|
161
|
+
# === LibuiParadise.main_window?
|
162
|
+
# =========================================================================== #
|
163
|
+
def self.main_window?
|
164
|
+
LibuiParadise::Extensions.main_window?
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'libui_paradise/project/project.rb'
|
6
|
+
# LibuiParadise.project_base_dir?
|
7
|
+
# =========================================================================== #
|
8
|
+
module LibuiParadise
|
9
|
+
|
10
|
+
# ========================================================================= #
|
11
|
+
# === PROJECT_BASE_DIRECTORY
|
12
|
+
# ========================================================================= #
|
13
|
+
PROJECT_BASE_DIRECTORY =
|
14
|
+
File.absolute_path("#{__dir__}/..")+'/'
|
15
|
+
BASE_DIR = PROJECT_BASE_DIRECTORY
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === LibuiParadise.project_base_dir?
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.project_base_dir?
|
21
|
+
PROJECT_BASE_DIRECTORY
|
22
|
+
end; self.instance_eval { alias project_base_dir project_base_dir? } # === LibuiParadise.project_base_dir
|
23
|
+
self.instance_eval { alias project_base_dir? project_base_dir? } # === LibuiParadise.project_base_dir?
|
24
|
+
self.instance_eval { alias project_base_directory? project_base_dir? } # === LibuiParadise.project_base_directory?
|
25
|
+
|
26
|
+
end
|