libui_paradise 0.2.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.
- checksums.yaml +7 -0
- data/README.md +2072 -0
- data/doc/README.gen +1931 -0
- data/doc/SNIPPETS.md +94 -0
- data/doc/todo/todo.md +16 -0
- data/lib/libui_paradise/autoinclude.rb +9 -0
- data/lib/libui_paradise/base/base.rb +154 -0
- data/lib/libui_paradise/colours/colours.rb +14 -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/complex/001_hbox_example.rb +17 -0
- data/lib/libui_paradise/examples/complex/002_tabs_example.rb +25 -0
- data/lib/libui_paradise/examples/complex/003_open_file_button_example.rb +38 -0
- data/lib/libui_paradise/examples/complex/004_font_button.rb +41 -0
- data/lib/libui_paradise/examples/complex/005_search_entry_example.rb +18 -0
- data/lib/libui_paradise/examples/complex/006_coloured_boxes_example.rb +22 -0
- data/lib/libui_paradise/examples/complex/007_slider_example.rb +31 -0
- data/lib/libui_paradise/examples/complex/008_radio_button_example.rb +23 -0
- data/lib/libui_paradise/examples/complex/009_separator_example.rb +25 -0
- data/lib/libui_paradise/examples/complex/010_table_example.rb +55 -0
- data/lib/libui_paradise/examples/complex/011_two_buttons_showing_how_to_enable_and_disable_them.rb +32 -0
- data/lib/libui_paradise/examples/complex/012_password_entry_example.rb +29 -0
- data/lib/libui_paradise/examples/complex/013_form_example.rb +38 -0
- data/lib/libui_paradise/examples/complex/014_text_example.rb +18 -0
- data/lib/libui_paradise/examples/complex/015_text_view_example.rb +16 -0
- data/lib/libui_paradise/examples/complex/016_grid_example.rb +31 -0
- data/lib/libui_paradise/examples/complex/017_unicode_text_example.rb +30 -0
- data/lib/libui_paradise/examples/complex/018_spinbutton_example.rb +33 -0
- data/lib/libui_paradise/examples/complex/019_combo_box_example.rb +50 -0
- data/lib/libui_paradise/examples/complex/020_checkbox_example.rb +81 -0
- data/lib/libui_paradise/examples/complex/021_font_example.rb +115 -0
- data/lib/libui_paradise/examples/complex/022_simple_notepad_example.rb +25 -0
- data/lib/libui_paradise/examples/complex/023_msg_box_error.rb +27 -0
- data/lib/libui_paradise/examples/complex/024_parse_config_file_example.config +6 -0
- data/lib/libui_paradise/examples/complex/024_parse_config_file_example.rb +15 -0
- data/lib/libui_paradise/examples/complex/025_colour_button.rb +53 -0
- data/lib/libui_paradise/examples/complex/026_basic_table_image.rb +96 -0
- data/lib/libui_paradise/examples/complex/027_basic_button_example.rb +19 -0
- data/lib/libui_paradise/examples/complex/028_try_for_automatic_button_press_event_after_a_delay.rb +47 -0
- data/lib/libui_paradise/examples/complex/029_progressbar_example.rb +116 -0
- data/lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb +140 -0
- data/lib/libui_paradise/examples/complex/031_notification_functionality_example.rb +96 -0
- data/lib/libui_paradise/examples/complex/032_simple_window_example.rb +69 -0
- data/lib/libui_paradise/examples/complex/033_daemonize_and_exit_after_delay_example.rb +91 -0
- data/lib/libui_paradise/examples/simple/001_open_file_example.rb +35 -0
- data/lib/libui_paradise/examples/simple/002_histogram_example.rb +213 -0
- data/lib/libui_paradise/examples/simple/003_fancy_text_example.rb +220 -0
- data/lib/libui_paradise/examples/simple/004_date_time_picker.rb +52 -0
- data/lib/libui_paradise/examples/simple/005_text_drawing_example.rb +185 -0
- data/lib/libui_paradise/examples/simple/006_midi_player.rb +96 -0
- data/lib/libui_paradise/examples/simple/007_control_gallery.rb +191 -0
- data/lib/libui_paradise/examples/simple/008_basic_area_example.rb +56 -0
- data/lib/libui_paradise/examples/simple/009_spectrum.rb +107 -0
- data/lib/libui_paradise/examples/simple/README.md +7 -0
- data/lib/libui_paradise/experimental/dsl.rb +17 -0
- data/lib/libui_paradise/extensions/counters.rb +58 -0
- data/lib/libui_paradise/extensions/extensions.rb +29 -0
- data/lib/libui_paradise/extensions/hash_fiddle_pointer_widgets.rb +150 -0
- data/lib/libui_paradise/extensions/misc.rb +754 -0
- data/lib/libui_paradise/fiddle/pointer.rb +1158 -0
- data/lib/libui_paradise/generic_window/README.md +9 -0
- data/lib/libui_paradise/generic_window/generic_window.rb +79 -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/box.rb +156 -0
- data/lib/libui_paradise/libui_classes/grid.rb +55 -0
- data/lib/libui_paradise/libui_classes/libui_classes.rb +1611 -0
- data/lib/libui_paradise/project/project.rb +28 -0
- data/lib/libui_paradise/prototype/README.md +3 -0
- data/lib/libui_paradise/prototype/prototype.rb +107 -0
- data/lib/libui_paradise/requires/require_the_libui_classes.rb +29 -0
- data/lib/libui_paradise/requires/require_the_libui_paradise_project.rb +12 -0
- data/lib/libui_paradise/toplevel_methods/misc.rb +13 -0
- data/lib/libui_paradise/version/version.rb +17 -0
- data/lib/libui_paradise.rb +1 -0
- data/libui_paradise.gemspec +49 -0
- data/test/testing_generic_window.rb +20 -0
- metadata +156 -0
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# === Fiddle::Pointer
|
|
6
|
+
#
|
|
7
|
+
# Modify Fiddle::Pointer - but this is super-specific to Libui, so it is
|
|
8
|
+
# really not recommended to do this.
|
|
9
|
+
#
|
|
10
|
+
# A cleaner solution would be to modify just in-place, such as via
|
|
11
|
+
# refinements, but I don't quite like the syntax of refinements,
|
|
12
|
+
# so I opted for the simpler toplevel modification instead.
|
|
13
|
+
# =========================================================================== #
|
|
14
|
+
# require 'libui_paradise/fiddle/pointer.rb'
|
|
15
|
+
# =========================================================================== #
|
|
16
|
+
module Fiddle
|
|
17
|
+
|
|
18
|
+
class Pointer # === Fiddle::Pointer
|
|
19
|
+
|
|
20
|
+
require 'libui_paradise/extensions/counters.rb'
|
|
21
|
+
|
|
22
|
+
# ========================================================================= #
|
|
23
|
+
# === on_changed
|
|
24
|
+
#
|
|
25
|
+
# The idea for this method is to respond to on-changed events, in
|
|
26
|
+
# particular on a spinbox. Currently it is enabled for a few
|
|
27
|
+
# widgets, including :entry. This may be expanded at a later time
|
|
28
|
+
# to add on-changed support for more widgets.
|
|
29
|
+
#
|
|
30
|
+
# For a combobox we may have to use this code:
|
|
31
|
+
#
|
|
32
|
+
# LibUI.combobox_on_selected
|
|
33
|
+
# UI.spinbox_on_changed(self, spinbox_changed_callback, nil)
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
# Be sure to pass the proc object into the method, in a block.
|
|
37
|
+
#
|
|
38
|
+
# Usage examples:
|
|
39
|
+
#
|
|
40
|
+
# text_entry.on_changed { text_changed_callback }
|
|
41
|
+
# slider.on_changed { slider_changed_callback }
|
|
42
|
+
#
|
|
43
|
+
# ========================================================================= #
|
|
44
|
+
def on_changed(&block)
|
|
45
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
46
|
+
_pointer = current_widget.first # Not used currently in this method.
|
|
47
|
+
type = current_widget.last
|
|
48
|
+
case type
|
|
49
|
+
# ======================================================================= #
|
|
50
|
+
# === :entry
|
|
51
|
+
# ======================================================================= #
|
|
52
|
+
when :entry
|
|
53
|
+
LibUI.entry_on_changed(self, block.call, nil)
|
|
54
|
+
# ======================================================================= #
|
|
55
|
+
# === :multiline_entry
|
|
56
|
+
# ======================================================================= #
|
|
57
|
+
when :multiline_entry
|
|
58
|
+
LibUI.multiline_entry_on_changed(self, block.call, nil)
|
|
59
|
+
# ======================================================================= #
|
|
60
|
+
# === :spinbox
|
|
61
|
+
# ======================================================================= #
|
|
62
|
+
when :spinbox
|
|
63
|
+
LibUI.spinbox_on_changed(self, block.call, nil)
|
|
64
|
+
# ======================================================================= #
|
|
65
|
+
# === :slider
|
|
66
|
+
#
|
|
67
|
+
# This is for a slider bar.
|
|
68
|
+
# ======================================================================= #
|
|
69
|
+
when :slider
|
|
70
|
+
LibUI.slider_on_changed(self, block.call, nil)
|
|
71
|
+
# ======================================================================= #
|
|
72
|
+
# === :colour_button
|
|
73
|
+
# ======================================================================= #
|
|
74
|
+
when :colour_button
|
|
75
|
+
LibUI.color_button_on_changed(self, block.call, nil)
|
|
76
|
+
# ======================================================================= #
|
|
77
|
+
# === :combobox
|
|
78
|
+
# ======================================================================= #
|
|
79
|
+
when :combobox
|
|
80
|
+
LibUI.combobox_on_selected(self, block.call, nil)
|
|
81
|
+
else
|
|
82
|
+
e 'Not registered type in .on_changed(): '+type.to_s
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# ========================================================================= #
|
|
87
|
+
# === fraction=
|
|
88
|
+
#
|
|
89
|
+
# This is mostly a wrapper to reach ruby-gtk3 compatibility.
|
|
90
|
+
# ========================================================================= #
|
|
91
|
+
def fraction=(i = '')
|
|
92
|
+
i = i * 100
|
|
93
|
+
set_value(i)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# ========================================================================= #
|
|
97
|
+
# === set_text
|
|
98
|
+
#
|
|
99
|
+
# This method can be used to set the text of a particular libui-widget,
|
|
100
|
+
# in particular entries.
|
|
101
|
+
# ========================================================================= #
|
|
102
|
+
def set_text(
|
|
103
|
+
display_this_text = '', # This is the text that will be used.
|
|
104
|
+
type = nil
|
|
105
|
+
)
|
|
106
|
+
object_id = self.object_id
|
|
107
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
108
|
+
this_widget = hash[object_id].first
|
|
109
|
+
if type.nil?
|
|
110
|
+
type = hash[object_id].last # This should be :grid. But it is not used here.
|
|
111
|
+
end
|
|
112
|
+
case type
|
|
113
|
+
# ======================================================================= #
|
|
114
|
+
# === :new_progress_bar
|
|
115
|
+
# ======================================================================= #
|
|
116
|
+
when :new_progress_bar
|
|
117
|
+
# This currently does nothing.
|
|
118
|
+
# ======================================================================= #
|
|
119
|
+
# === :multiline_entry
|
|
120
|
+
#
|
|
121
|
+
# This is a text-view widget actually.
|
|
122
|
+
# ======================================================================= #
|
|
123
|
+
when :multiline_entry
|
|
124
|
+
LibUI.multiline_entry_set_text(
|
|
125
|
+
this_widget,
|
|
126
|
+
display_this_text.to_s
|
|
127
|
+
)
|
|
128
|
+
# ======================================================================= #
|
|
129
|
+
# === :text
|
|
130
|
+
# ======================================================================= #
|
|
131
|
+
when :text,
|
|
132
|
+
:label
|
|
133
|
+
LibUI.label_set_text(
|
|
134
|
+
this_widget,
|
|
135
|
+
display_this_text.to_s
|
|
136
|
+
)
|
|
137
|
+
# ======================================================================= #
|
|
138
|
+
# === :textview
|
|
139
|
+
# ======================================================================= #
|
|
140
|
+
when :textview
|
|
141
|
+
LibUI.multiline_entry_set_text(
|
|
142
|
+
this_widget,
|
|
143
|
+
display_this_text.to_s
|
|
144
|
+
)
|
|
145
|
+
# ======================================================================= #
|
|
146
|
+
# === :entry
|
|
147
|
+
# ======================================================================= #
|
|
148
|
+
when :entry
|
|
149
|
+
LibUI.entry_set_text(
|
|
150
|
+
this_widget,
|
|
151
|
+
display_this_text.to_s
|
|
152
|
+
)
|
|
153
|
+
# ======================================================================= #
|
|
154
|
+
# === :search_entry
|
|
155
|
+
#
|
|
156
|
+
# This is specifically for a search-entry.
|
|
157
|
+
# ======================================================================= #
|
|
158
|
+
when :search_entry
|
|
159
|
+
LibUI.entry_set_text(
|
|
160
|
+
this_widget,
|
|
161
|
+
display_this_text.to_s
|
|
162
|
+
)
|
|
163
|
+
else
|
|
164
|
+
puts 'Unhandled case in set_text(): '+
|
|
165
|
+
type.to_s
|
|
166
|
+
end
|
|
167
|
+
end; alias set_content set_text # === set_content
|
|
168
|
+
|
|
169
|
+
# ========================================================================= #
|
|
170
|
+
# === text?
|
|
171
|
+
#
|
|
172
|
+
# This method queries the content of any widget that may contain text, in
|
|
173
|
+
# particular entries such as a gtk-entry.
|
|
174
|
+
# ========================================================================= #
|
|
175
|
+
def text?(
|
|
176
|
+
type = nil
|
|
177
|
+
)
|
|
178
|
+
object_id = self.object_id
|
|
179
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
180
|
+
if type.nil?
|
|
181
|
+
# ===================================================================== #
|
|
182
|
+
# In this case we must determine the type in use.
|
|
183
|
+
# ===================================================================== #
|
|
184
|
+
if hash.has_key? object_id
|
|
185
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
case type
|
|
189
|
+
# ======================================================================= #
|
|
190
|
+
# === :new_progress_bar
|
|
191
|
+
#
|
|
192
|
+
# This is actually a progress-bar.
|
|
193
|
+
# ======================================================================= #
|
|
194
|
+
when :new_progress_bar,
|
|
195
|
+
:progress_bar
|
|
196
|
+
return LibUI.progress_bar_value(self).to_s
|
|
197
|
+
# ======================================================================= #
|
|
198
|
+
# === :multiline_entry
|
|
199
|
+
#
|
|
200
|
+
# This is, I believe, synonymous to :textview.
|
|
201
|
+
# ======================================================================= #
|
|
202
|
+
when :multiline_entry,
|
|
203
|
+
:textview
|
|
204
|
+
return LibUI.multiline_entry_text(self).to_s
|
|
205
|
+
# ======================================================================= #
|
|
206
|
+
# === :combobox
|
|
207
|
+
# ======================================================================= #
|
|
208
|
+
when :combobox
|
|
209
|
+
return LibUI.combobox_selected(self).to_s
|
|
210
|
+
else # This is the "historic" default. May have to be removed one day.
|
|
211
|
+
return LibUI.entry_text(self).to_s
|
|
212
|
+
end
|
|
213
|
+
end; alias buffer? text? # === buffer?
|
|
214
|
+
alias selected? text? # === selected?
|
|
215
|
+
alias value? text? # === value?
|
|
216
|
+
|
|
217
|
+
# ========================================================================= #
|
|
218
|
+
# === set_value
|
|
219
|
+
#
|
|
220
|
+
# This method has initially been created to assign a value to a
|
|
221
|
+
# spinbutton. That way the following API is made possible:
|
|
222
|
+
#
|
|
223
|
+
# spinbutton.set_value(42)
|
|
224
|
+
#
|
|
225
|
+
# ========================================================================= #
|
|
226
|
+
def set_value(
|
|
227
|
+
new_value
|
|
228
|
+
)
|
|
229
|
+
object_id = self.object_id
|
|
230
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
231
|
+
this_widget = hash[object_id].first
|
|
232
|
+
type = hash[object_id].last
|
|
233
|
+
case type
|
|
234
|
+
# ======================================================================= #
|
|
235
|
+
# === :new_progress_bar
|
|
236
|
+
#
|
|
237
|
+
# This is actually a progress-bar.
|
|
238
|
+
# ======================================================================= #
|
|
239
|
+
when :new_progress_bar,
|
|
240
|
+
:progress_bar
|
|
241
|
+
LibUI.progress_bar_set_value(this_widget, new_value.to_i)
|
|
242
|
+
# ======================================================================= #
|
|
243
|
+
# === :spinbox
|
|
244
|
+
# ======================================================================= #
|
|
245
|
+
when :spinbox
|
|
246
|
+
LibUI.spinbox_set_value(
|
|
247
|
+
this_widget,
|
|
248
|
+
new_value.to_i # Must be an Integer.
|
|
249
|
+
)
|
|
250
|
+
else
|
|
251
|
+
e 'Not registered type: '+type.to_s
|
|
252
|
+
end
|
|
253
|
+
end; alias value= set_value # === value=
|
|
254
|
+
alias start_position= set_value # === start_position=
|
|
255
|
+
|
|
256
|
+
# ========================================================================= #
|
|
257
|
+
# === right (right tag)
|
|
258
|
+
# ========================================================================= #
|
|
259
|
+
def right(
|
|
260
|
+
widget,
|
|
261
|
+
left = LibuiParadise.counter_left?,
|
|
262
|
+
top = LibuiParadise.counter_top?,
|
|
263
|
+
xspan = 1,
|
|
264
|
+
yspan = 1
|
|
265
|
+
)
|
|
266
|
+
object_id = self.object_id
|
|
267
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
268
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
269
|
+
case left
|
|
270
|
+
# ======================================================================= #
|
|
271
|
+
# === :default
|
|
272
|
+
# ======================================================================= #
|
|
273
|
+
when :default
|
|
274
|
+
left = LibuiParadise.counter_left?
|
|
275
|
+
end
|
|
276
|
+
case top
|
|
277
|
+
# ======================================================================= #
|
|
278
|
+
# === :default
|
|
279
|
+
# ======================================================================= #
|
|
280
|
+
when :default
|
|
281
|
+
top = LibuiParadise.counter_top?
|
|
282
|
+
end
|
|
283
|
+
case type
|
|
284
|
+
# ======================================================================= #
|
|
285
|
+
# === :vbox
|
|
286
|
+
# ======================================================================= #
|
|
287
|
+
when :vbox
|
|
288
|
+
add(widget)
|
|
289
|
+
# ======================================================================= #
|
|
290
|
+
# === :grid
|
|
291
|
+
# ======================================================================= #
|
|
292
|
+
when :grid
|
|
293
|
+
hash_grid(
|
|
294
|
+
widget,
|
|
295
|
+
{
|
|
296
|
+
left: left,
|
|
297
|
+
top: top,
|
|
298
|
+
xspan: xspan,
|
|
299
|
+
yspan: yspan,
|
|
300
|
+
hexpand: 0,
|
|
301
|
+
halign: 0,
|
|
302
|
+
vexpand: 0,
|
|
303
|
+
valign: 0
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
LibuiParadise.counter_left += 1
|
|
307
|
+
else
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# ========================================================================= #
|
|
312
|
+
# === left (left tag)
|
|
313
|
+
# ========================================================================= #
|
|
314
|
+
def left(
|
|
315
|
+
widget,
|
|
316
|
+
left = LibuiParadise.counter_left?,
|
|
317
|
+
top = LibuiParadise.counter_top?,
|
|
318
|
+
xspan = 1,
|
|
319
|
+
yspan = 1
|
|
320
|
+
)
|
|
321
|
+
object_id = self.object_id
|
|
322
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
323
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
324
|
+
case left
|
|
325
|
+
# ======================================================================= #
|
|
326
|
+
# === :default
|
|
327
|
+
# ======================================================================= #
|
|
328
|
+
when :default
|
|
329
|
+
left = LibuiParadise.counter_left?
|
|
330
|
+
end
|
|
331
|
+
case top
|
|
332
|
+
# ======================================================================= #
|
|
333
|
+
# === :default
|
|
334
|
+
# ======================================================================= #
|
|
335
|
+
when :default
|
|
336
|
+
top = LibuiParadise.counter_top?
|
|
337
|
+
end
|
|
338
|
+
case type
|
|
339
|
+
# ======================================================================= #
|
|
340
|
+
# === :vbox
|
|
341
|
+
# ======================================================================= #
|
|
342
|
+
when :vbox
|
|
343
|
+
add(widget)
|
|
344
|
+
# ======================================================================= #
|
|
345
|
+
# === :grid
|
|
346
|
+
# ======================================================================= #
|
|
347
|
+
when :grid
|
|
348
|
+
hash_grid(
|
|
349
|
+
widget,
|
|
350
|
+
{
|
|
351
|
+
left: left,
|
|
352
|
+
top: top,
|
|
353
|
+
xspan: xspan,
|
|
354
|
+
yspan: yspan,
|
|
355
|
+
hexpand: 0,
|
|
356
|
+
halign: 0,
|
|
357
|
+
vexpand: 0,
|
|
358
|
+
valign: 0
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
LibuiParadise.counter_left += 1
|
|
362
|
+
else
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
# ========================================================================= #
|
|
367
|
+
# === new_row
|
|
368
|
+
# ========================================================================= #
|
|
369
|
+
def new_row
|
|
370
|
+
LibuiParadise.counter_left = 0
|
|
371
|
+
LibuiParadise.counter_top += 1
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# ========================================================================= #
|
|
375
|
+
# === hash_grid
|
|
376
|
+
#
|
|
377
|
+
# Usage example:
|
|
378
|
+
#
|
|
379
|
+
# hash_grid(text('Yo6'), { left: 0, top: 3, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 })
|
|
380
|
+
#
|
|
381
|
+
# ========================================================================= #
|
|
382
|
+
def hash_grid(
|
|
383
|
+
pass_this_widget,
|
|
384
|
+
hash = {}
|
|
385
|
+
)
|
|
386
|
+
array_to_be_passed = []
|
|
387
|
+
# ======================================================================= #
|
|
388
|
+
# === :left
|
|
389
|
+
# ======================================================================= #
|
|
390
|
+
if hash.has_key? :left
|
|
391
|
+
array_to_be_passed << hash[:left]
|
|
392
|
+
else
|
|
393
|
+
array_to_be_passed << 0
|
|
394
|
+
end
|
|
395
|
+
# ======================================================================= #
|
|
396
|
+
# === :top
|
|
397
|
+
# ======================================================================= #
|
|
398
|
+
if hash.has_key? :top
|
|
399
|
+
array_to_be_passed << hash[:top]
|
|
400
|
+
else
|
|
401
|
+
array_to_be_passed << 0
|
|
402
|
+
end
|
|
403
|
+
# ======================================================================= #
|
|
404
|
+
# === :xspan
|
|
405
|
+
# ======================================================================= #
|
|
406
|
+
if hash.has_key? :xspan
|
|
407
|
+
array_to_be_passed << hash[:xspan]
|
|
408
|
+
else
|
|
409
|
+
array_to_be_passed << 0
|
|
410
|
+
end
|
|
411
|
+
# ======================================================================= #
|
|
412
|
+
# === :yspan
|
|
413
|
+
# ======================================================================= #
|
|
414
|
+
if hash.has_key? :yspan
|
|
415
|
+
array_to_be_passed << hash[:yspan]
|
|
416
|
+
else
|
|
417
|
+
array_to_be_passed << 0
|
|
418
|
+
end
|
|
419
|
+
# ======================================================================= #
|
|
420
|
+
# === :hexpand
|
|
421
|
+
# ======================================================================= #
|
|
422
|
+
if hash.has_key? :hexpand
|
|
423
|
+
array_to_be_passed << hash[:hexpand]
|
|
424
|
+
else
|
|
425
|
+
array_to_be_passed << 0
|
|
426
|
+
end
|
|
427
|
+
# ======================================================================= #
|
|
428
|
+
# === :halign
|
|
429
|
+
# ======================================================================= #
|
|
430
|
+
if hash.has_key? :halign
|
|
431
|
+
array_to_be_passed << hash[:halign]
|
|
432
|
+
else
|
|
433
|
+
array_to_be_passed << 0
|
|
434
|
+
end
|
|
435
|
+
# ======================================================================= #
|
|
436
|
+
# === :vexpand
|
|
437
|
+
# ======================================================================= #
|
|
438
|
+
if hash.has_key? :vexpand
|
|
439
|
+
array_to_be_passed << hash[:vexpand]
|
|
440
|
+
else
|
|
441
|
+
array_to_be_passed << 0
|
|
442
|
+
end
|
|
443
|
+
# ======================================================================= #
|
|
444
|
+
# === :valign
|
|
445
|
+
# ======================================================================= #
|
|
446
|
+
if hash.has_key? :valign
|
|
447
|
+
array_to_be_passed << hash[:valign]
|
|
448
|
+
else
|
|
449
|
+
array_to_be_passed << 0
|
|
450
|
+
end
|
|
451
|
+
ui_grid_append(pass_this_widget, *array_to_be_passed)
|
|
452
|
+
end; alias hash hash_grid # === hash
|
|
453
|
+
|
|
454
|
+
# ========================================================================= #
|
|
455
|
+
# === ui_grid_append
|
|
456
|
+
#
|
|
457
|
+
# This method can be used to append onto a grid in LibUI.
|
|
458
|
+
#
|
|
459
|
+
# Usage example:
|
|
460
|
+
#
|
|
461
|
+
# grid.grid_append(text('Right'), 1, 0, 1, 1, 0, 0.5, 1, 0)
|
|
462
|
+
#
|
|
463
|
+
# ========================================================================= #
|
|
464
|
+
def ui_grid_append(
|
|
465
|
+
widget_to_append,
|
|
466
|
+
left = 0,
|
|
467
|
+
top = 0,
|
|
468
|
+
xspan = 1,
|
|
469
|
+
yspan = 1, #
|
|
470
|
+
hexpand = 0, # A "boolean". 0 means false here.
|
|
471
|
+
halign = 0,
|
|
472
|
+
vexpand = 0, # A "boolean". 0 means false here.
|
|
473
|
+
valign = 0
|
|
474
|
+
)
|
|
475
|
+
# ======================================================================= #
|
|
476
|
+
# The signature in Go is:
|
|
477
|
+
#
|
|
478
|
+
# Append(child Control, left, top int, xspan, yspan int, hexpand bool, halign Align, vexpand bool, valign Align)
|
|
479
|
+
#
|
|
480
|
+
# ======================================================================= #
|
|
481
|
+
object_id = self.object_id
|
|
482
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
483
|
+
this_widget = hash[object_id].first
|
|
484
|
+
_type = hash[object_id].last # This should be :grid. But it is not used here.
|
|
485
|
+
# ======================================================================= #
|
|
486
|
+
# left, top, xspan, yspan, hexpand, halign, vexpand, valign
|
|
487
|
+
# 0, 0, 2, 1, 0, 0, 1, 0
|
|
488
|
+
# ======================================================================= #
|
|
489
|
+
LibUI.grid_append(
|
|
490
|
+
this_widget,
|
|
491
|
+
widget_to_append,
|
|
492
|
+
left,
|
|
493
|
+
top,
|
|
494
|
+
xspan,
|
|
495
|
+
yspan,
|
|
496
|
+
hexpand,
|
|
497
|
+
halign,
|
|
498
|
+
vexpand,
|
|
499
|
+
valign
|
|
500
|
+
)
|
|
501
|
+
end; alias grid_append ui_grid_append # === grid_append
|
|
502
|
+
|
|
503
|
+
# ========================================================================= #
|
|
504
|
+
# === append (append tag, add tag)
|
|
505
|
+
#
|
|
506
|
+
# This is simply a wrapper over LibUI.box_append().
|
|
507
|
+
# ========================================================================= #
|
|
508
|
+
def append(
|
|
509
|
+
this_widget,
|
|
510
|
+
padding_to_use = 1,
|
|
511
|
+
*remaining_arguments
|
|
512
|
+
)
|
|
513
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
514
|
+
_pointer = current_widget.first # Not used currently in this method.
|
|
515
|
+
type = current_widget.last
|
|
516
|
+
case type
|
|
517
|
+
# ======================================================================= #
|
|
518
|
+
# === :grid
|
|
519
|
+
#
|
|
520
|
+
# This entry-point is specifically for a ui-grid element.
|
|
521
|
+
# ======================================================================= #
|
|
522
|
+
when :grid
|
|
523
|
+
LibUI.grid_append(
|
|
524
|
+
self,
|
|
525
|
+
this_widget.to_s,
|
|
526
|
+
padding_to_use,
|
|
527
|
+
remaining_arguments[0],
|
|
528
|
+
remaining_arguments[1],
|
|
529
|
+
remaining_arguments[2],
|
|
530
|
+
remaining_arguments[3],
|
|
531
|
+
remaining_arguments[4],
|
|
532
|
+
remaining_arguments[5],
|
|
533
|
+
remaining_arguments[6]
|
|
534
|
+
)
|
|
535
|
+
# ======================================================================= #
|
|
536
|
+
# === :tab
|
|
537
|
+
#
|
|
538
|
+
# This is specifically for the notebook-tab. In this case the argument
|
|
539
|
+
# names do not make a lot of sense. For instance, this_widget is
|
|
540
|
+
# actually the text-title for the tab, and padding_to_use is the
|
|
541
|
+
# actual widget that will be embedded. Because this is, however had,
|
|
542
|
+
# the "minor use case", compared to the subsequent "else" clause, I
|
|
543
|
+
# will keep the name as-is. The comment here should be kept, in order
|
|
544
|
+
# to explain this peculiar oddity though.
|
|
545
|
+
# ======================================================================= #
|
|
546
|
+
when :tab
|
|
547
|
+
LibUI.tab_append(self, this_widget.to_s, padding_to_use)
|
|
548
|
+
# ======================================================================= #
|
|
549
|
+
# === :window
|
|
550
|
+
#
|
|
551
|
+
# Add support for the toplevel window here, as of September 2021.
|
|
552
|
+
# ======================================================================= #
|
|
553
|
+
when :window
|
|
554
|
+
LibUI.window_set_child(self, this_widget)
|
|
555
|
+
else # This is the default.
|
|
556
|
+
LibUI.box_append(
|
|
557
|
+
self, this_widget, padding_to_use
|
|
558
|
+
)
|
|
559
|
+
end
|
|
560
|
+
end; alias add append # === add
|
|
561
|
+
alias << append # === <<
|
|
562
|
+
|
|
563
|
+
# ========================================================================= #
|
|
564
|
+
# === clear
|
|
565
|
+
# ========================================================================= #
|
|
566
|
+
def clear(
|
|
567
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
568
|
+
)
|
|
569
|
+
_pointer = current_widget.first # Not used currently in this method.
|
|
570
|
+
type = current_widget.last
|
|
571
|
+
|
|
572
|
+
object_id = self.object_id
|
|
573
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
574
|
+
if type.nil?
|
|
575
|
+
type = hash[object_id].last # This should be :grid. But it is not used here.
|
|
576
|
+
end
|
|
577
|
+
case type
|
|
578
|
+
# ======================================================================= #
|
|
579
|
+
# === :combobox
|
|
580
|
+
#
|
|
581
|
+
# This currently does not work; it depends on libui-ng, which has not
|
|
582
|
+
# yet been added completely.
|
|
583
|
+
# ======================================================================= #
|
|
584
|
+
when :combobox
|
|
585
|
+
# LibUI.multiline_entry_set_text(
|
|
586
|
+
# this_widget,
|
|
587
|
+
# display_this_text.to_s
|
|
588
|
+
# )
|
|
589
|
+
else
|
|
590
|
+
puts 'Unhandled case in clear(): '+
|
|
591
|
+
type.to_s
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
# ========================================================================= #
|
|
596
|
+
# === empty?
|
|
597
|
+
# ========================================================================= #
|
|
598
|
+
def empty?(
|
|
599
|
+
type = nil
|
|
600
|
+
)
|
|
601
|
+
object_id = self.object_id
|
|
602
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
603
|
+
if type.nil?
|
|
604
|
+
# ===================================================================== #
|
|
605
|
+
# In this case we must determine the type in use.
|
|
606
|
+
# ===================================================================== #
|
|
607
|
+
if hash.has_key? object_id
|
|
608
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
609
|
+
end
|
|
610
|
+
end
|
|
611
|
+
case type
|
|
612
|
+
# ======================================================================= #
|
|
613
|
+
# === :entry
|
|
614
|
+
# ======================================================================= #
|
|
615
|
+
when :entry
|
|
616
|
+
self.text?.empty?
|
|
617
|
+
else
|
|
618
|
+
return true
|
|
619
|
+
end
|
|
620
|
+
end
|
|
621
|
+
|
|
622
|
+
# ========================================================================= #
|
|
623
|
+
# === is_read_only
|
|
624
|
+
# ========================================================================= #
|
|
625
|
+
def is_read_only(
|
|
626
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
627
|
+
)
|
|
628
|
+
_pointer = current_widget.first # Not used currently in this method.
|
|
629
|
+
type = current_widget.last
|
|
630
|
+
case type
|
|
631
|
+
# ======================================================================= #
|
|
632
|
+
# === :multiline_entry
|
|
633
|
+
# ======================================================================= #
|
|
634
|
+
when :multiline_entry
|
|
635
|
+
LibUI.multiline_entry_set_read_only(self, 1)
|
|
636
|
+
else
|
|
637
|
+
pp caller()
|
|
638
|
+
puts "#{type} (class #{type.class}) is not yet implemented in .padded=."
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
# ========================================================================= #
|
|
643
|
+
# === append_this_string
|
|
644
|
+
#
|
|
645
|
+
# This method can be used to append a String to an existing String.
|
|
646
|
+
# ========================================================================= #
|
|
647
|
+
def append_this_string(i)
|
|
648
|
+
::LibUI.attributed_string_append_unattributed(self, i)
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
# ========================================================================= #
|
|
652
|
+
# === append_text_column
|
|
653
|
+
#
|
|
654
|
+
# This method is specifically used for libui-tables.
|
|
655
|
+
# ========================================================================= #
|
|
656
|
+
def append_text_column(text, a, b)
|
|
657
|
+
object_id = self.object_id
|
|
658
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
659
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
660
|
+
case type
|
|
661
|
+
# ======================================================================= #
|
|
662
|
+
# === :button
|
|
663
|
+
# ======================================================================= #
|
|
664
|
+
when :table
|
|
665
|
+
LibUI.table_append_text_column(self, text, a, b)
|
|
666
|
+
else
|
|
667
|
+
e 'Not registered type in .append_text_column(): '+type.to_s
|
|
668
|
+
end
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
# ========================================================================= #
|
|
672
|
+
# === padded=
|
|
673
|
+
#
|
|
674
|
+
# Set a uniform padding via this method.
|
|
675
|
+
# ========================================================================= #
|
|
676
|
+
def padded=(
|
|
677
|
+
pad_n_px = 25,
|
|
678
|
+
type = nil
|
|
679
|
+
)
|
|
680
|
+
object_id = self.object_id
|
|
681
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
682
|
+
if type.nil?
|
|
683
|
+
# ===================================================================== #
|
|
684
|
+
# In this case we must determine the type in use.
|
|
685
|
+
# ===================================================================== #
|
|
686
|
+
if hash.has_key? object_id
|
|
687
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
688
|
+
end
|
|
689
|
+
end
|
|
690
|
+
case type
|
|
691
|
+
# ======================================================================= #
|
|
692
|
+
# === :grid
|
|
693
|
+
# ======================================================================= #
|
|
694
|
+
when :grid
|
|
695
|
+
LibUI.grid_set_padded(self, pad_n_px) # This line should be changed at a later time.
|
|
696
|
+
# ======================================================================= #
|
|
697
|
+
# === :button
|
|
698
|
+
#
|
|
699
|
+
# This entry point probably does not work, so don't use it.
|
|
700
|
+
# ======================================================================= #
|
|
701
|
+
when :button
|
|
702
|
+
LibUI.box_set_padded(self, pad_n_px)
|
|
703
|
+
# ======================================================================= #
|
|
704
|
+
# === :vbox
|
|
705
|
+
# ======================================================================= #
|
|
706
|
+
when :vbox,
|
|
707
|
+
:hbox
|
|
708
|
+
LibUI.box_set_padded(self, pad_n_px)
|
|
709
|
+
# ======================================================================= #
|
|
710
|
+
# === :entry
|
|
711
|
+
# ======================================================================= #
|
|
712
|
+
when :entry
|
|
713
|
+
# ===================================================================== #
|
|
714
|
+
# This method does not seem to exist. We'll leave this here for the
|
|
715
|
+
# time being.
|
|
716
|
+
# ===================================================================== #
|
|
717
|
+
# LibUI.entry_set_padded(self, pad_n_px) # This line should be changed at a later time.
|
|
718
|
+
else
|
|
719
|
+
pp caller()
|
|
720
|
+
puts "#{type} (class #{type.class}) is not yet implemented in .padded=."
|
|
721
|
+
end
|
|
722
|
+
end; alias set_padded padded= # === set_padded
|
|
723
|
+
|
|
724
|
+
# ========================================================================= #
|
|
725
|
+
# === disable (disable tag)
|
|
726
|
+
# ========================================================================= #
|
|
727
|
+
def disable(&block)
|
|
728
|
+
object_id = self.object_id
|
|
729
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
730
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
731
|
+
case type
|
|
732
|
+
# ======================================================================= #
|
|
733
|
+
# === :button
|
|
734
|
+
# ======================================================================= #
|
|
735
|
+
when :button
|
|
736
|
+
LibUI.control_disable(self)
|
|
737
|
+
else
|
|
738
|
+
e 'Not registered type in .disable(): '+type.to_s
|
|
739
|
+
end
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
# ========================================================================= #
|
|
743
|
+
# === enable (enable tag)
|
|
744
|
+
# ========================================================================= #
|
|
745
|
+
def enable(&block)
|
|
746
|
+
object_id = self.object_id
|
|
747
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
748
|
+
type = hash[object_id].last # The last entry contains the type.
|
|
749
|
+
case type
|
|
750
|
+
# ======================================================================= #
|
|
751
|
+
# === :button
|
|
752
|
+
# ======================================================================= #
|
|
753
|
+
when :button
|
|
754
|
+
LibUI.control_enable(self)
|
|
755
|
+
else
|
|
756
|
+
e 'Not registered type in .enable(): '+type.to_s
|
|
757
|
+
end
|
|
758
|
+
end
|
|
759
|
+
|
|
760
|
+
# ========================================================================= #
|
|
761
|
+
# === populate
|
|
762
|
+
# ========================================================================= #
|
|
763
|
+
def populate(dataset)
|
|
764
|
+
object_id = self.object_id
|
|
765
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
766
|
+
type = hash[object_id].last
|
|
767
|
+
case type
|
|
768
|
+
# ======================================================================= #
|
|
769
|
+
# === :combobox
|
|
770
|
+
# ======================================================================= #
|
|
771
|
+
when :combobox
|
|
772
|
+
self.append_this_array(dataset)
|
|
773
|
+
end
|
|
774
|
+
end
|
|
775
|
+
|
|
776
|
+
# ========================================================================= #
|
|
777
|
+
# === is_padded
|
|
778
|
+
# ========================================================================= #
|
|
779
|
+
def is_padded
|
|
780
|
+
set_padded(1)
|
|
781
|
+
end
|
|
782
|
+
|
|
783
|
+
# ========================================================================= #
|
|
784
|
+
# === show_then_main_then_quit
|
|
785
|
+
#
|
|
786
|
+
# This method ultimately combines three other method calls.
|
|
787
|
+
# ========================================================================= #
|
|
788
|
+
def show_then_main_then_quit
|
|
789
|
+
LibUI.control_show(self)
|
|
790
|
+
main_then_quit
|
|
791
|
+
end; alias elegant_exit show_then_main_then_quit # === elegant_exit
|
|
792
|
+
alias complex_finalizer show_then_main_then_quit # === complex_finalizer
|
|
793
|
+
alias intelligent_close_down show_then_main_then_quit # === intelligent_close_down
|
|
794
|
+
alias intelligent_quit show_then_main_then_quit # === intelligent_quit
|
|
795
|
+
alias intelligent_exit show_then_main_then_quit # === intelligent_exit
|
|
796
|
+
|
|
797
|
+
# ========================================================================= #
|
|
798
|
+
# === on_clicked
|
|
799
|
+
#
|
|
800
|
+
# This method is in general called on a button-widget.
|
|
801
|
+
# ========================================================================= #
|
|
802
|
+
def on_clicked(&block)
|
|
803
|
+
LibUI.button_on_clicked(self, &block)
|
|
804
|
+
end; alias on_click_event on_clicked # === on_click_event
|
|
805
|
+
|
|
806
|
+
# ========================================================================= #
|
|
807
|
+
# === available_pointers?
|
|
808
|
+
# ========================================================================= #
|
|
809
|
+
def available_pointers?
|
|
810
|
+
LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
811
|
+
end; alias main_hash? available_pointers? # === main_hash?
|
|
812
|
+
|
|
813
|
+
# ========================================================================= #
|
|
814
|
+
# === append_this_array
|
|
815
|
+
# ========================================================================= #
|
|
816
|
+
def append_this_array(array)
|
|
817
|
+
object_id = self.object_id
|
|
818
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
819
|
+
_this_widget = hash[object_id].first # This variable is currently not in use.
|
|
820
|
+
type = hash[object_id].last
|
|
821
|
+
case type
|
|
822
|
+
# ======================================================================= #
|
|
823
|
+
# === :combobox
|
|
824
|
+
# ======================================================================= #
|
|
825
|
+
when :combobox
|
|
826
|
+
array.each {|this_entry|
|
|
827
|
+
LibUI.combobox_append(self, this_entry)
|
|
828
|
+
}
|
|
829
|
+
LibUI.combobox_set_selected(self, 0) # The first one will be active too.
|
|
830
|
+
end
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
# ========================================================================= #
|
|
834
|
+
# === maximal
|
|
835
|
+
# ========================================================================= #
|
|
836
|
+
def maximal(this_widget, optional_padding = 1)
|
|
837
|
+
add(this_widget, optional_padding)
|
|
838
|
+
end
|
|
839
|
+
|
|
840
|
+
# ========================================================================= #
|
|
841
|
+
# === group_maximal
|
|
842
|
+
# ========================================================================= #
|
|
843
|
+
def group_maximal(*i)
|
|
844
|
+
i.flatten.each {|entry|
|
|
845
|
+
maximal(entry)
|
|
846
|
+
}
|
|
847
|
+
end
|
|
848
|
+
|
|
849
|
+
# ========================================================================= #
|
|
850
|
+
# === minimal
|
|
851
|
+
# ========================================================================= #
|
|
852
|
+
def minimal(this_widget, optional_padding = 0)
|
|
853
|
+
add(this_widget, optional_padding)
|
|
854
|
+
end
|
|
855
|
+
|
|
856
|
+
# ========================================================================= #
|
|
857
|
+
# === text
|
|
858
|
+
#
|
|
859
|
+
# This ad-hoc method can be used to write text onto a widget.
|
|
860
|
+
#
|
|
861
|
+
# Usage example:
|
|
862
|
+
#
|
|
863
|
+
# outer_vbox.text(
|
|
864
|
+
# 'This widget can be used to modify the ID3 tags '\
|
|
865
|
+
# 'of .mp3 files. The taglib-ruby gem is required for this functionality.'
|
|
866
|
+
# )
|
|
867
|
+
#
|
|
868
|
+
# ========================================================================= #
|
|
869
|
+
def text(
|
|
870
|
+
i = '',
|
|
871
|
+
padding_to_use = 0
|
|
872
|
+
)
|
|
873
|
+
i = i.to_s # Let's ensure we have a String past this point.
|
|
874
|
+
object_id = self.object_id
|
|
875
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
876
|
+
_this_widget = hash[object_id].first # This variable is currently not in use.
|
|
877
|
+
type = hash[object_id].last
|
|
878
|
+
case type
|
|
879
|
+
# ======================================================================= #
|
|
880
|
+
# === :vbox
|
|
881
|
+
# ======================================================================= #
|
|
882
|
+
when :vbox,
|
|
883
|
+
:hbox
|
|
884
|
+
_ = ui_text(i)
|
|
885
|
+
self.add(_, padding_to_use)
|
|
886
|
+
end
|
|
887
|
+
end; alias add_text text # === text
|
|
888
|
+
|
|
889
|
+
# ========================================================================= #
|
|
890
|
+
# === add_hsep
|
|
891
|
+
#
|
|
892
|
+
# This method adds a horizontal separator.
|
|
893
|
+
# ========================================================================= #
|
|
894
|
+
def add_hsep
|
|
895
|
+
object_id = self.object_id
|
|
896
|
+
hash = LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
|
|
897
|
+
this_widget = hash[object_id].first
|
|
898
|
+
this_widget.add(::LibuiParadise::Extensions.horizontal_separator, 0)
|
|
899
|
+
end; alias add_horizontal_separator add_hsep # === add_horizontal_separator
|
|
900
|
+
|
|
901
|
+
# ========================================================================= #
|
|
902
|
+
# === active?
|
|
903
|
+
# ========================================================================= #
|
|
904
|
+
def active?
|
|
905
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
906
|
+
pointer = current_widget.first
|
|
907
|
+
type = current_widget.last
|
|
908
|
+
case type
|
|
909
|
+
# ======================================================================= #
|
|
910
|
+
# === :checkbox
|
|
911
|
+
# ======================================================================= #
|
|
912
|
+
when :checkbox
|
|
913
|
+
checked = (UI.checkbox_checked(pointer) == 1)
|
|
914
|
+
return (checked == true)
|
|
915
|
+
# ======================================================================= #
|
|
916
|
+
# === :entry
|
|
917
|
+
#
|
|
918
|
+
# This is unhandled.
|
|
919
|
+
# ======================================================================= #
|
|
920
|
+
when :entry
|
|
921
|
+
e 'An entry can not be "active". Check the code - there may '\
|
|
922
|
+
'an erroneous assumption if the method .active? is called.'
|
|
923
|
+
end
|
|
924
|
+
end; alias is_active? active? # === is_active?
|
|
925
|
+
|
|
926
|
+
# ========================================================================= #
|
|
927
|
+
# === set_active
|
|
928
|
+
# ========================================================================= #
|
|
929
|
+
def set_active
|
|
930
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
931
|
+
pointer = current_widget.first
|
|
932
|
+
type = current_widget.last
|
|
933
|
+
case type
|
|
934
|
+
# ======================================================================= #
|
|
935
|
+
# === :checkbox
|
|
936
|
+
# ======================================================================= #
|
|
937
|
+
when :checkbox
|
|
938
|
+
LibUI.checkbox_set_checked(pointer, 1)
|
|
939
|
+
end
|
|
940
|
+
end; alias is_active set_active # === is_active
|
|
941
|
+
alias is_now_active set_active # === is_now_active
|
|
942
|
+
|
|
943
|
+
# ========================================================================= #
|
|
944
|
+
# === set_inactive
|
|
945
|
+
# ========================================================================= #
|
|
946
|
+
def set_inactive
|
|
947
|
+
current_widget = available_pointers?[self.object_id] # This will be an Array.
|
|
948
|
+
pointer = current_widget.first
|
|
949
|
+
type = current_widget.last
|
|
950
|
+
case type
|
|
951
|
+
# ======================================================================= #
|
|
952
|
+
# === :checkbox
|
|
953
|
+
# ======================================================================= #
|
|
954
|
+
when :checkbox
|
|
955
|
+
LibUI.checkbox_set_checked(pointer, 0)
|
|
956
|
+
end
|
|
957
|
+
end; alias is_inactive set_inactive # === is_inactive
|
|
958
|
+
alias is_now_inactive set_inactive # === is_now_inactive
|
|
959
|
+
|
|
960
|
+
# ========================================================================= #
|
|
961
|
+
# === child
|
|
962
|
+
#
|
|
963
|
+
# This method should only be called on a LibUI-Window.
|
|
964
|
+
# ========================================================================= #
|
|
965
|
+
def child(child_widget)
|
|
966
|
+
LibUI.window_set_child(self, child_widget)
|
|
967
|
+
end; alias children= child # === children=
|
|
968
|
+
alias child= child # === child=
|
|
969
|
+
|
|
970
|
+
# ========================================================================= #
|
|
971
|
+
# === show_the_controls
|
|
972
|
+
# ========================================================================= #
|
|
973
|
+
def show_the_controls
|
|
974
|
+
LibUI.control_show(self)
|
|
975
|
+
end; alias control_show show_the_controls # === control_show
|
|
976
|
+
|
|
977
|
+
# ========================================================================= #
|
|
978
|
+
# === is_margined (margin tag, margined tag)
|
|
979
|
+
#
|
|
980
|
+
# For now this only works on @main_window.
|
|
981
|
+
# ========================================================================= #
|
|
982
|
+
def is_margined(
|
|
983
|
+
i = LibuiParadise::Extensions.main_window?
|
|
984
|
+
)
|
|
985
|
+
id = self.object_id
|
|
986
|
+
hash = main_hash?
|
|
987
|
+
if hash.has_key? id
|
|
988
|
+
_ = hash[id]
|
|
989
|
+
type = _.last
|
|
990
|
+
case type
|
|
991
|
+
# ===================================================================== #
|
|
992
|
+
# === :window
|
|
993
|
+
# ===================================================================== #
|
|
994
|
+
when :window
|
|
995
|
+
LibUI.window_set_margined(_.first, 1)
|
|
996
|
+
else
|
|
997
|
+
e 'The type '+type.to_s+' in is_margined() is currently not supported.'
|
|
998
|
+
end
|
|
999
|
+
else
|
|
1000
|
+
e
|
|
1001
|
+
e '-'*80
|
|
1002
|
+
e 'An unhandled situation has been created:'
|
|
1003
|
+
e
|
|
1004
|
+
e ' No available key in is_margined() for id: '+id.to_s
|
|
1005
|
+
e
|
|
1006
|
+
e '-'*80
|
|
1007
|
+
e
|
|
1008
|
+
end
|
|
1009
|
+
end; alias uses_a_margin is_margined # === uses_a_margin
|
|
1010
|
+
alias has_margin is_margined # === has_margin
|
|
1011
|
+
|
|
1012
|
+
# ========================================================================= #
|
|
1013
|
+
# === main_then_quit
|
|
1014
|
+
#
|
|
1015
|
+
# We use ::LibUI just in case to avoid any possible name-collisions.
|
|
1016
|
+
# ========================================================================= #
|
|
1017
|
+
def main_then_quit
|
|
1018
|
+
::LibUI.main
|
|
1019
|
+
::LibUI.quit
|
|
1020
|
+
end
|
|
1021
|
+
|
|
1022
|
+
# ========================================================================= #
|
|
1023
|
+
# === close_properly
|
|
1024
|
+
#
|
|
1025
|
+
# This can be invoked via, for instance:
|
|
1026
|
+
#
|
|
1027
|
+
# main_window.simple_exit
|
|
1028
|
+
#
|
|
1029
|
+
# ========================================================================= #
|
|
1030
|
+
def close_properly
|
|
1031
|
+
LibUI.window_on_closing(self) {
|
|
1032
|
+
LibUI.exit_from(self)
|
|
1033
|
+
}
|
|
1034
|
+
end; alias simple_exit close_properly # === simple_exit
|
|
1035
|
+
alias sane_exit close_properly # === sane_exit
|
|
1036
|
+
alias should_quit close_properly # === should_quit
|
|
1037
|
+
alias do_quit close_properly # === should_quit
|
|
1038
|
+
|
|
1039
|
+
# ========================================================================= #
|
|
1040
|
+
# === Skeleton methods:
|
|
1041
|
+
#
|
|
1042
|
+
# A "skeleton" method is one that doesn't do anything right now. These
|
|
1043
|
+
# were added to increase compatibility with the gtk_paradise gem in
|
|
1044
|
+
# particular.
|
|
1045
|
+
#
|
|
1046
|
+
# Some of these skeleton methods may become real methods one day,
|
|
1047
|
+
# depending on how sophisticated the libui code will be - but
|
|
1048
|
+
# until then we will simply use different options on different
|
|
1049
|
+
# toolkits.
|
|
1050
|
+
# ========================================================================= #
|
|
1051
|
+
def bblack1; end
|
|
1052
|
+
def bblack2; end
|
|
1053
|
+
def bblack3; end
|
|
1054
|
+
def pad1px; end
|
|
1055
|
+
def pad2px; end
|
|
1056
|
+
def pad3px; end
|
|
1057
|
+
def pad4px; end
|
|
1058
|
+
def pad5px; end
|
|
1059
|
+
def pad6px; end
|
|
1060
|
+
def pad7px; end
|
|
1061
|
+
def pad8px; end
|
|
1062
|
+
def pad9px; end
|
|
1063
|
+
def pad10px; end
|
|
1064
|
+
def yellow_background; end
|
|
1065
|
+
def hint=(i = nil); end
|
|
1066
|
+
alias popup_hint hint= # === popup_hint
|
|
1067
|
+
def modify_background(a = :active, b = :coral); end
|
|
1068
|
+
def set_focus(true_or_false = true); end
|
|
1069
|
+
def clear_background; end
|
|
1070
|
+
def position=(i = 10); end
|
|
1071
|
+
def reset_the_internal_variables; end
|
|
1072
|
+
def editable=(true_or_false = false); end
|
|
1073
|
+
def set_max_length(n = 100); end
|
|
1074
|
+
def use_gtk_paradise_project_css_file; end
|
|
1075
|
+
def append_project_CSS_file; end
|
|
1076
|
+
def infer_the_size_automatically; end
|
|
1077
|
+
def set_column_spacing(i = 1); end
|
|
1078
|
+
def set_row_spacing(i = 1); end
|
|
1079
|
+
def css_class(i = ''); end
|
|
1080
|
+
def set_border_width(i = 2); end
|
|
1081
|
+
def set_colour(i = 'blue'); end
|
|
1082
|
+
def make_bold; end
|
|
1083
|
+
def set_name(i = ''); end
|
|
1084
|
+
def do_use_underline; end
|
|
1085
|
+
def lightblue; end
|
|
1086
|
+
def set_font(i = ''); end
|
|
1087
|
+
def do_markify; end
|
|
1088
|
+
def default=(i = ''); end
|
|
1089
|
+
def on_click_select_all; end
|
|
1090
|
+
def do_center; end
|
|
1091
|
+
def on_hover(i = ''); end
|
|
1092
|
+
def lightgreen; end
|
|
1093
|
+
def set_background_colour(i = ''); end
|
|
1094
|
+
def set_size_request(a = 42, b = 42); end
|
|
1095
|
+
def the_first_entry_is_active; end
|
|
1096
|
+
def clear_old_datapoints; end
|
|
1097
|
+
def width_height(a = 500, b = 500); end
|
|
1098
|
+
def row_spacing=(i = 10); end
|
|
1099
|
+
def line_spacing=(i = 10); end
|
|
1100
|
+
def to_the_left; end
|
|
1101
|
+
def set_editable(i = true); end
|
|
1102
|
+
def try_to_add_default_CSS_rules; end
|
|
1103
|
+
def enable_free_form_css; end
|
|
1104
|
+
def show_all; end # This one here may become a real method one day, but right now I don't know how to enable that.
|
|
1105
|
+
def align_to_the_left; end
|
|
1106
|
+
def yellowish_background; end
|
|
1107
|
+
def on_enter; end
|
|
1108
|
+
def on_value_changed; end
|
|
1109
|
+
def try_to_use_this_font(i = nil); end
|
|
1110
|
+
alias use_this_font= try_to_use_this_font
|
|
1111
|
+
alias set_use_this_font try_to_use_this_font
|
|
1112
|
+
def horizontal_center; end
|
|
1113
|
+
def light_green_background; end
|
|
1114
|
+
def center; end
|
|
1115
|
+
def align_to_center; end
|
|
1116
|
+
def make_selectable; end
|
|
1117
|
+
def very_light_yellow_background; end
|
|
1118
|
+
def very_light_yellowish_background; end
|
|
1119
|
+
def remove_background; end
|
|
1120
|
+
def rounded_border(a = '', b = '', c = ''); end
|
|
1121
|
+
def bblack4; end
|
|
1122
|
+
def on_mouse_click_select_everything; end
|
|
1123
|
+
def font=(i = ''); end
|
|
1124
|
+
def set_activates_default(i = true); end
|
|
1125
|
+
def enable_events; end
|
|
1126
|
+
def do_focus; end
|
|
1127
|
+
def border(i = '', *a); end
|
|
1128
|
+
def fancy_hint(i = ''); end
|
|
1129
|
+
def fancy_hints(i = ''); end
|
|
1130
|
+
def fancy_hint=(i = ''); end
|
|
1131
|
+
def fancy_hints=(i = ''); end
|
|
1132
|
+
def shadow_hint=(i = ''); end
|
|
1133
|
+
def on_enter_key(i = ''); end
|
|
1134
|
+
def signal_connect(i = ''); end
|
|
1135
|
+
def spacing1=(i = 2); end
|
|
1136
|
+
def spacing2=(i = 2); end
|
|
1137
|
+
def spacing=(i = 0); end
|
|
1138
|
+
def deselect; end
|
|
1139
|
+
# def fraction=(i = ''); end
|
|
1140
|
+
def return_all_entries
|
|
1141
|
+
[]
|
|
1142
|
+
end
|
|
1143
|
+
|
|
1144
|
+
# ========================================================================= #
|
|
1145
|
+
# === on_key_press_event
|
|
1146
|
+
# ========================================================================= #
|
|
1147
|
+
def on_key_press_event(&block)
|
|
1148
|
+
# e 'NOT YET IMPLEMENTED.'
|
|
1149
|
+
end
|
|
1150
|
+
|
|
1151
|
+
# ========================================================================= #
|
|
1152
|
+
# === on_button_press_event
|
|
1153
|
+
# ========================================================================= #
|
|
1154
|
+
def on_button_press_event(&block)
|
|
1155
|
+
# e 'NOT YET IMPLEMENTED'
|
|
1156
|
+
end
|
|
1157
|
+
|
|
1158
|
+
end; end
|