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
@@ -2,13 +2,25 @@
|
|
2
2
|
# Encoding: UTF-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
|
-
# require 'libui_paradise/colours/colours.rb
|
5
|
+
# require 'libui_paradise/colours/colours.rb'
|
6
6
|
# =========================================================================== #
|
7
7
|
module LibuiParadise
|
8
8
|
|
9
9
|
# ========================================================================= #
|
10
|
-
# === COLOR_BLUE
|
10
|
+
# === LibuiParadise::COLOR_BLUE
|
11
|
+
#
|
12
|
+
# This is actually dodgerblue.
|
11
13
|
# ========================================================================= #
|
12
14
|
COLOR_BLUE = 0x1E90FF
|
13
15
|
|
16
|
+
# ========================================================================= #
|
17
|
+
# === LibuiParadise::COLOR_MIDNIGHTBLUE
|
18
|
+
# ========================================================================= #
|
19
|
+
COLOR_MIDNIGHTBLUE = 0x191970
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === LibuiParadise::COLOR_LIGHTSEAGREEN
|
23
|
+
# ========================================================================= #
|
24
|
+
COLOR_LIGHTSEAGREEN = 0x20b2aa
|
25
|
+
|
14
26
|
end
|
@@ -3,3 +3,9 @@ libui_paradise even more.
|
|
3
3
|
|
4
4
|
For instance, the user should be able to parse widgets that
|
5
5
|
are described in pure yaml.
|
6
|
+
|
7
|
+
As of December 2023 this is probably no longer as important,
|
8
|
+
as the gem called universal_widgets uses a simplified YAML
|
9
|
+
format that is more terse. But, in the event that we may
|
10
|
+
wish to revisit this idea, the directory here will be
|
11
|
+
retained.
|
@@ -5,9 +5,8 @@
|
|
5
5
|
# require '002_tabs_example.rb'
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
|
-
#require 'libui_paradise/requires/require_the_libui_paradise_project.rb'
|
9
8
|
|
10
|
-
window =
|
9
|
+
window = main_window('A notebook with tabs example', 1200, 200, 15)
|
11
10
|
|
12
11
|
tab = ui_tabs
|
13
12
|
tab.add('Page 1', hbox(text('One! 😎️')))
|
@@ -8,14 +8,14 @@
|
|
8
8
|
# =========================================================================== #
|
9
9
|
require 'libui_paradise/autoinclude'
|
10
10
|
|
11
|
-
window =
|
11
|
+
window = padded_main_window('An open-file button-example', 1200, 200, 15)
|
12
12
|
|
13
13
|
outer_vbox = ui_padded_vbox
|
14
14
|
button_open_file = ui_button('Open file')
|
15
15
|
button_open_file.on_clicked {
|
16
16
|
begin
|
17
|
-
#filename = ui_open_file(window).to_s
|
18
|
-
filename =
|
17
|
+
# filename = ui_open_file(window).to_s
|
18
|
+
filename = LibUI.open_file(main_window).to_s
|
19
19
|
e "The filename was: #{filename}"
|
20
20
|
rescue ArgumentError => error # Rescue from "NULL pointer given"
|
21
21
|
pp error
|
@@ -26,7 +26,6 @@ outer_vbox << button_open_file
|
|
26
26
|
window.child = outer_vbox
|
27
27
|
window.intelligent_quit
|
28
28
|
|
29
|
-
|
30
29
|
if false
|
31
30
|
LibUI.button_on_clicked(button) {
|
32
31
|
result = ::LibUI.open_file(main_window).to_s
|
@@ -34,5 +33,4 @@ LibUI.button_on_clicked(button) {
|
|
34
33
|
e 'The file exists. \o/'
|
35
34
|
end
|
36
35
|
}
|
37
|
-
|
38
36
|
end
|
@@ -8,9 +8,9 @@ require 'libui_paradise/autoinclude'
|
|
8
8
|
|
9
9
|
require 'colours' # Needs the colours gem.
|
10
10
|
|
11
|
-
window =
|
11
|
+
window = padded_main_window('Coloured boxes example', :default, 200, 1)
|
12
12
|
|
13
|
-
outer_hbox =
|
13
|
+
outer_hbox = create_hbox
|
14
14
|
outer_hbox.maximal LibuiParadise.draw_rectangle(:default, :default, Colours.random_html_colour)
|
15
15
|
outer_hbox.maximal LibuiParadise.draw_rectangle(:default, :default, :seagreen)
|
16
16
|
outer_hbox.maximal LibuiParadise.draw_rectangle(:default, :default, :springgreen)
|
@@ -6,16 +6,21 @@
|
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
9
|
-
|
9
|
+
# =========================================================================== #
|
10
|
+
# === UPPER_RANGE
|
11
|
+
# =========================================================================== #
|
12
|
+
UPPER_RANGE = 20
|
10
13
|
|
11
|
-
|
14
|
+
window = padded_main_window('Slider Example', :default, 70, 1)
|
15
|
+
|
16
|
+
slider = create_slider(0, UPPER_RANGE)
|
12
17
|
|
13
18
|
# =========================================================================== #
|
14
19
|
# === callback_for_the_slider
|
15
20
|
# =========================================================================== #
|
16
21
|
def callback_for_the_slider
|
17
22
|
proc { |pointer|
|
18
|
-
puts "New Slider value: #{
|
23
|
+
puts "New Slider value: #{LibUI.slider_value(pointer)}"
|
19
24
|
}
|
20
25
|
end
|
21
26
|
slider.on_changed { callback_for_the_slider }
|
@@ -27,5 +32,6 @@ slider.on_changed { callback_for_the_slider }
|
|
27
32
|
#
|
28
33
|
# =========================================================================== #
|
29
34
|
outer_vbox = ui_padded_vbox(slider)
|
30
|
-
|
35
|
+
|
36
|
+
window << outer_vbox
|
31
37
|
window.intelligent_quit
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
9
|
-
window = margined_window(:filename,
|
9
|
+
window = margined_window(:filename, :default, 200, 0)
|
10
10
|
|
11
11
|
outer_vbox = padded_vbox
|
12
12
|
array_to_use = ['Radio Button 1', 'Radio Button 2', 'Radio Button 3']
|
@@ -19,5 +19,5 @@ rb = ui_radio_buttons(array_to_use)
|
|
19
19
|
outer_vbox.minimal(rb)
|
20
20
|
outer_vbox.minimal(hsep, 0)
|
21
21
|
|
22
|
-
window
|
22
|
+
window << outer_vbox
|
23
23
|
window.intelligent_quit
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
9
|
-
window = margined_window(:filename,
|
9
|
+
window = margined_window(:filename, :default, 150, 0)
|
10
10
|
|
11
11
|
outer_vbox = padded_vbox
|
12
12
|
|
@@ -21,5 +21,5 @@ outer_vbox.minimal(button_hello_world, 1)
|
|
21
21
|
outer_vbox.minimal(hsep, 0)
|
22
22
|
outer_vbox.minimal(hsep, 1)
|
23
23
|
|
24
|
-
window
|
24
|
+
window << outer_vbox
|
25
25
|
window.intelligent_quit
|
@@ -2,54 +2,144 @@
|
|
2
2
|
# Encoding: UTF-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
|
-
# Todo:
|
6
|
-
#
|
7
|
-
# - Add editable entry to the table
|
8
|
-
#
|
9
|
-
# =========================================================================== #
|
10
5
|
# require 'libui_paradise/010_table_example.rb'
|
11
6
|
# =========================================================================== #
|
12
|
-
require 'libui_paradise/
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
LibUI
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
7
|
+
require 'libui_paradise/base/base.rb'
|
8
|
+
|
9
|
+
module LibuiParadise
|
10
|
+
|
11
|
+
module GUI
|
12
|
+
|
13
|
+
module LibUI
|
14
|
+
|
15
|
+
class TableExample < ::LibuiParadise::Base # === LibuiParadise::GUI::LibUI::TableExample
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === DATA
|
19
|
+
# ========================================================================= #
|
20
|
+
DATA = [
|
21
|
+
%w( cat calm meow ),
|
22
|
+
%w( dog loyal woof ),
|
23
|
+
%w( chicken bird cock-a-doodle-doo ),
|
24
|
+
%w( horse fast neigh ),
|
25
|
+
%w( cow slow moo ),
|
26
|
+
%w( one two three ),
|
27
|
+
%w( 1 2 3 ),
|
28
|
+
%w( 4 5 6 ),
|
29
|
+
%w( 7 8 9 )
|
30
|
+
]
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === TITLE
|
34
|
+
# ========================================================================= #
|
35
|
+
TITLE = 'A TableExample for LibUI'
|
36
|
+
|
37
|
+
# ========================================================================= #
|
38
|
+
# === WIDTH
|
39
|
+
# ========================================================================= #
|
40
|
+
WIDTH = 800
|
41
|
+
|
42
|
+
# ========================================================================= #
|
43
|
+
# === HEIGHT
|
44
|
+
# ========================================================================= #
|
45
|
+
HEIGHT = 520
|
46
|
+
|
47
|
+
# ========================================================================= #
|
48
|
+
# === initialize
|
49
|
+
# ========================================================================= #
|
50
|
+
def initialize(
|
51
|
+
run_already = true
|
52
|
+
)
|
53
|
+
reset
|
54
|
+
run if run_already
|
55
|
+
end
|
56
|
+
|
57
|
+
# ========================================================================= #
|
58
|
+
# === reset (reset tag)
|
59
|
+
# ========================================================================= #
|
60
|
+
def reset
|
61
|
+
reset_the_internal_hash
|
62
|
+
title_width_height(TITLE, WIDTH, HEIGHT)
|
63
|
+
end
|
64
|
+
|
65
|
+
# ========================================================================= #
|
66
|
+
# === create_skeleton (create tag, skeleton tag)
|
67
|
+
# ========================================================================= #
|
68
|
+
def create_skeleton
|
69
|
+
# ======================================================================= #
|
70
|
+
# === @window
|
71
|
+
# ======================================================================= #
|
72
|
+
set_window(return_default_window)
|
73
|
+
# ======================================================================= #
|
74
|
+
# Protects BlockCaller objects from garbage collection.
|
75
|
+
# ======================================================================= #
|
76
|
+
@block_callers = []
|
77
|
+
end
|
78
|
+
|
79
|
+
# ========================================================================= #
|
80
|
+
# === rbcallback
|
81
|
+
# ========================================================================= #
|
82
|
+
def rbcallback(*args, &block)
|
83
|
+
args << [0] if args.size == 1 # Argument types are omitted
|
84
|
+
block_caller = Fiddle::Closure::BlockCaller.new(*args, &block)
|
85
|
+
@block_callers << block_caller
|
86
|
+
block_caller
|
87
|
+
end
|
88
|
+
|
89
|
+
# ========================================================================= #
|
90
|
+
# === run
|
91
|
+
# ========================================================================= #
|
92
|
+
def run
|
93
|
+
super()
|
94
|
+
outer_vbox = padded_vbox
|
95
|
+
# ======================================================================= #
|
96
|
+
# First add the two buttons on top:
|
97
|
+
# ======================================================================= #
|
98
|
+
outer_vbox.add_hsep
|
99
|
+
|
100
|
+
grid = padded_grid
|
101
|
+
# widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
|
102
|
+
grid.ui_grid_append(text('Testing tables'), 0, 0, 1, 1, 0, 0.5, 1, 0)
|
103
|
+
outer_vbox.minimal(grid)
|
104
|
+
|
105
|
+
model_handler = ::LibUI::FFI::TableModelHandler.malloc
|
106
|
+
model_handler.to_ptr.free = Fiddle::RUBY_FREE
|
107
|
+
model_handler.NumColumns = rbcallback(4) { 2 }
|
108
|
+
model_handler.ColumnType = rbcallback(4) { 0 }
|
109
|
+
model_handler.NumRows = rbcallback(4) { 5 }
|
110
|
+
model_handler.CellValue = rbcallback(1, [1, 1, 4, 4]) do |_, _, row, column|
|
111
|
+
::LibUI.new_table_value_string(
|
112
|
+
DATA[row][column] # Pass the data here.
|
113
|
+
)
|
114
|
+
end
|
115
|
+
model_handler.SetCellValue = rbcallback(0, [0]) {}
|
116
|
+
|
117
|
+
model = ::LibUI.new_table_model(model_handler)
|
118
|
+
table_params = ui_table_params_malloc(model)
|
119
|
+
|
120
|
+
table = create_table(table_params)
|
121
|
+
table.append_text_column('Animal', 0)
|
122
|
+
table.append_text_column('Description', 1)
|
123
|
+
table.append_text_column('TEST', 2)
|
124
|
+
# table.append_text_column('TEST', 3, -1) # This would crash it.
|
125
|
+
# ::LibUI.table_append_text_column(table, 'Animal', 0, -1)
|
126
|
+
|
127
|
+
outer_vbox.maximal(table)
|
128
|
+
button1 = button('Show the current selection in the table')
|
129
|
+
button1.on_clicked {
|
130
|
+
e 'This is currently not implemented.'
|
131
|
+
}
|
132
|
+
outer_vbox.minimal(
|
133
|
+
button1
|
134
|
+
)
|
135
|
+
outer_vbox.minimal(quit_button)
|
136
|
+
main_window? << outer_vbox
|
137
|
+
main_window?.intelligent_exit
|
138
|
+
free_table_model(model)
|
139
|
+
end
|
140
|
+
|
141
|
+
end; end; end; end
|
142
|
+
|
143
|
+
if __FILE__ == $PROGRAM_NAME
|
144
|
+
LibuiParadise::GUI::LibUI::TableExample.new
|
145
|
+
end
|
data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb
CHANGED
@@ -19,6 +19,7 @@ button2.disable # Start-state for this button.
|
|
19
19
|
outer_hbox << button1
|
20
20
|
outer_hbox << button2
|
21
21
|
|
22
|
+
# The two buttons will toggle one another.
|
22
23
|
button1.on_clicked {|widget|
|
23
24
|
button2.enable
|
24
25
|
button1.disable
|
@@ -28,5 +29,5 @@ button2.on_clicked {|widget|
|
|
28
29
|
button2.disable
|
29
30
|
}
|
30
31
|
|
31
|
-
main_window
|
32
|
+
main_window << outer_hbox
|
32
33
|
main_window.intelligent_exit
|
@@ -2,15 +2,15 @@
|
|
2
2
|
# Encoding: UTF-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
|
-
#
|
5
|
+
# 015_text_view_example.rb
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
9
|
-
window = padded_main_window('Text View Example',
|
9
|
+
window = padded_main_window('Text View Example', :default, 300, 0)
|
10
10
|
|
11
11
|
outer_vbox = padded_vbox
|
12
12
|
text = multiline_entry('Hello world! This can be set to read only via .is_read_only().')
|
13
|
-
# text.is_read_only
|
13
|
+
# text.is_read_only # This can be used to set it to read-only.
|
14
14
|
outer_vbox.minimal(text, 1)
|
15
|
-
window
|
15
|
+
window << outer_vbox
|
16
16
|
window.intelligent_quit
|
@@ -10,22 +10,31 @@ require 'libui_paradise/autoinclude'
|
|
10
10
|
|
11
11
|
window = padded_main_window('A simple grid-example', 1200, 200, 15)
|
12
12
|
|
13
|
-
grid =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
grid = padded_grid
|
14
|
+
grid.grid_append(text('Yo1'))
|
15
|
+
grid.grid_append(text('Yo2'))
|
16
|
+
grid.grid_append(text('Yo3'))
|
17
|
+
LibuiParadise.new_row
|
18
|
+
# ======================================================================= #
|
19
|
+
# left, top, xspan, yspan, hexpand, halign, vexpand, valign
|
20
|
+
# 0, 0, 1, 1, 0, 0, 1, 0
|
21
|
+
# ======================================================================= #
|
22
|
+
grid.grid_append(text('Yo4'))
|
23
|
+
grid.grid_append(text('Yo5'))
|
24
|
+
grid.grid_append(text('Yo6'))
|
25
|
+
LibuiParadise.new_row
|
21
26
|
|
27
|
+
# ========================================================================= #
|
28
|
+
# This one will add at a specific position - it's a little more complicated
|
29
|
+
# than the prior methods, but this shows how it can be done.
|
30
|
+
# ========================================================================= #
|
22
31
|
grid.hash_grid(
|
23
32
|
text('Yo7'),
|
24
|
-
{ left:
|
33
|
+
{ left: 3, top: 3, xspan: 3, yspan: 3, hexpand: 1, halign: 0, vexpand: 1, valign: 0 }
|
25
34
|
)
|
26
35
|
|
27
36
|
vbox = padded_vbox
|
28
37
|
vbox << grid
|
29
38
|
|
30
|
-
window
|
31
|
-
window.intelligent_exit
|
39
|
+
#window << vbox
|
40
|
+
window.intelligent_exit(vbox)
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# =========================================================================== #
|
9
9
|
require 'libui_paradise/autoinclude'
|
10
10
|
|
11
|
-
window =
|
11
|
+
window = margined_main_window('Unicode Text Example', 1200, 200, 15)
|
12
12
|
|
13
13
|
outer_vbox = padded_vbox
|
14
14
|
text = text(
|
@@ -26,5 +26,5 @@ Let's test this next with some unicode:
|
|
26
26
|
|
27
27
|
outer_vbox << text
|
28
28
|
|
29
|
-
window
|
29
|
+
window << outer_vbox
|
30
30
|
window.intelligent_quit
|
@@ -71,11 +71,11 @@ checkbox_toggle_callback = proc { |ptr|
|
|
71
71
|
UI.checkbox_on_toggled(checkbox, checkbox_toggle_callback, nil)
|
72
72
|
inner.add(checkbox, 0)
|
73
73
|
|
74
|
-
MAIN_WINDOW = UI.window('hello world',
|
74
|
+
MAIN_WINDOW = UI.window('hello world', :default, HEIGHT, 1)
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
LibUI.window_set_margined(MAIN_WINDOW, 1)
|
77
|
+
MAIN_WINDOW << vbox
|
78
78
|
|
79
|
-
|
79
|
+
LibUI.window_on_closing(MAIN_WINDOW, should_quit_callback, nil)
|
80
80
|
MAIN_WINDOW.control_show
|
81
|
-
|
81
|
+
LibUI.main_then_quit
|
@@ -15,7 +15,7 @@
|
|
15
15
|
class FontExample
|
16
16
|
|
17
17
|
require 'libui_paradise'
|
18
|
-
include LibuiParadise::
|
18
|
+
include LibuiParadise::BaseModule
|
19
19
|
|
20
20
|
# ========================================================================= #
|
21
21
|
# === USE_THIS_FONT
|
@@ -45,6 +45,7 @@ class FontExample
|
|
45
45
|
def initialize(
|
46
46
|
run_already = true
|
47
47
|
)
|
48
|
+
reset
|
48
49
|
run if run_already
|
49
50
|
end
|
50
51
|
|
@@ -67,7 +68,7 @@ class FontExample
|
|
67
68
|
handler_draw_event = Fiddle::Closure::BlockCaller.new(0, [1, 1, 1]) { |_, _, adp|
|
68
69
|
area_draw_params = LibUI::FFI::AreaDrawParams.new(adp)
|
69
70
|
default_font = font {{
|
70
|
-
font_size: USE_THIS_FONT_SIZE,
|
71
|
+
font_size: USE_THIS_FONT_SIZE, # Pass in the font-size here.
|
71
72
|
font_family: USE_THIS_FONT,
|
72
73
|
italic: false,
|
73
74
|
stretch: 2,
|
@@ -102,7 +103,7 @@ class FontExample
|
|
102
103
|
|
103
104
|
main_window = ui_main_window(TITLE, WIDTH, 400, 1)
|
104
105
|
LibUI.window_set_margined(main_window, 1)
|
105
|
-
main_window
|
106
|
+
main_window << box
|
106
107
|
main_window.simple_exit
|
107
108
|
main_window.control_show
|
108
109
|
main_window.intelligent_exit
|
@@ -6,9 +6,9 @@
|
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
9
|
-
window = padded_window('Notepad',
|
9
|
+
window = padded_window('Notepad', :default, 300, 1)
|
10
10
|
|
11
|
-
vbox =
|
11
|
+
vbox = create_vbox
|
12
12
|
|
13
13
|
text_view = ui_text_view
|
14
14
|
text_view.set_text(
|
@@ -21,5 +21,5 @@ button_show_content.on_clicked {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
vbox << button_show_content
|
24
|
-
window
|
24
|
+
window << vbox
|
25
25
|
window.intelligent_exit
|
@@ -7,11 +7,11 @@
|
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
9
9
|
TITLE = 'msg box error'
|
10
|
-
main_window = ui_padded_window(TITLE,
|
10
|
+
main_window = ui_padded_window(TITLE, 320, 240, 1)
|
11
11
|
|
12
|
-
button1 =
|
12
|
+
button1 = create_button('Text (click me)')
|
13
13
|
button1.on_clicked {
|
14
|
-
LibuiParadise
|
14
|
+
LibuiParadise.message_box_error(
|
15
15
|
main_window,
|
16
16
|
'Error',
|
17
17
|
"You clicked \nthe button"
|
@@ -22,6 +22,6 @@ button1.on_clicked {
|
|
22
22
|
hbox = padded_hbox
|
23
23
|
hbox << button1
|
24
24
|
main_window.close_properly
|
25
|
-
main_window
|
25
|
+
main_window << hbox
|
26
26
|
main_window.control_show
|
27
|
-
|
27
|
+
LibUI.main_then_quit
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Encoding: UTF-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
|
-
# require '
|
5
|
+
# require '024_parse'
|
6
6
|
# =========================================================================== #
|
7
7
|
require 'libui_paradise/autoinclude'
|
8
8
|
|
@@ -11,5 +11,5 @@ window = LibuiParadise.parse_this_config_file(use_this_config_file)
|
|
11
11
|
outer_vbox = padded_vbox
|
12
12
|
text = text('The config file was '+use_this_config_file)
|
13
13
|
outer_vbox << text
|
14
|
-
window
|
14
|
+
window << outer_vbox
|
15
15
|
window.intelligent_quit
|
@@ -17,11 +17,11 @@ N_TIMES = 10
|
|
17
17
|
# =========================================================================== #
|
18
18
|
REMOTE_URL = 'https://www.ghibli.jp/gallery/thumb-redturtle%03d.png'
|
19
19
|
|
20
|
-
main_window =
|
20
|
+
main_window = padded_main_window('The Red Turtle', 310, 350, 0)
|
21
21
|
|
22
22
|
hbox = ui_padded_hbox
|
23
23
|
main_window.simple_exit
|
24
|
-
main_window
|
24
|
+
main_window << hbox
|
25
25
|
|
26
26
|
# =========================================================================== #
|
27
27
|
# === IMAGES
|
@@ -43,10 +43,8 @@ N_TIMES.times { |i|
|
|
43
43
|
# Add a new image next:
|
44
44
|
# ========================================================================= #
|
45
45
|
image = UI.new_image(width, height)
|
46
|
-
|
46
|
+
LibUI.image_append(image, data, width, height, width * 4)
|
47
47
|
IMAGES << image # Store all images in the following area.
|
48
|
-
rescue StandardError => error
|
49
|
-
warn url, error.message
|
50
48
|
}
|
51
49
|
|
52
50
|
# =========================================================================== #
|
@@ -84,8 +82,7 @@ hbox.maximal(table)
|
|
84
82
|
|
85
83
|
main_window.show_the_controls
|
86
84
|
|
87
|
-
|
88
|
-
e 'Bye Bye'
|
85
|
+
LibUI.window_on_closing(main_window) {
|
89
86
|
UI.control_destroy(main_window)
|
90
87
|
UI.free_table_model(model)
|
91
88
|
IMAGES.each { |i| UI.free_image(i) }
|
@@ -93,4 +90,4 @@ UI.window_on_closing(main_window) {
|
|
93
90
|
0
|
94
91
|
}
|
95
92
|
|
96
|
-
|
93
|
+
LibUI.main_then_quit
|