glimmer-dsl-libui 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/README.md +540 -41
- data/VERSION +1 -1
- data/examples/basic_button.rb +1 -1
- data/examples/basic_entry.rb +3 -3
- data/examples/basic_window.rb +1 -1
- data/examples/basic_window2.rb +14 -0
- data/examples/control_gallery.rb +168 -0
- data/examples/midi_player.rb +2 -2
- data/examples/simple_notepad.rb +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/dsl.rb +1 -1
- data/lib/glimmer/dsl/libui/file_expression.rb +33 -0
- data/lib/glimmer/dsl/libui/open_file_expression.rb +33 -0
- data/lib/glimmer/dsl/libui/save_file_expression.rb +33 -0
- data/lib/glimmer/dsl/libui/tab_item_expression.rb +35 -0
- data/lib/glimmer/libui/about_menu_item_proxy.rb +37 -0
- data/lib/glimmer/libui/box.rb +16 -2
- data/lib/glimmer/libui/check_menu_item_proxy.rb +37 -0
- data/lib/glimmer/libui/combobox_proxy.rb +4 -3
- data/lib/glimmer/libui/control_proxy.rb +135 -29
- data/lib/glimmer/libui/date_picker_proxy.rb +32 -0
- data/lib/glimmer/libui/date_time_picker_proxy.rb +35 -0
- data/lib/glimmer/libui/editable_combobox_proxy.rb +43 -0
- data/lib/glimmer/libui/group_proxy.rb +43 -0
- data/lib/glimmer/libui/menu_item_proxy.rb +4 -1
- data/lib/glimmer/libui/multiline_entry_proxy.rb +35 -0
- data/lib/glimmer/libui/non_wrapping_multiline_entry_proxy.rb +32 -0
- data/lib/glimmer/libui/preferences_menu_item_proxy.rb +37 -0
- data/lib/glimmer/libui/quit_menu_item_proxy.rb +62 -0
- data/lib/glimmer/libui/radio_buttons_proxy.rb +43 -0
- data/lib/glimmer/libui/separator_menu_item_proxy.rb +37 -0
- data/lib/glimmer/libui/tab_item_proxy.rb +67 -0
- data/lib/glimmer/libui/time_picker_proxy.rb +32 -0
- data/lib/glimmer/libui/window_proxy.rb +15 -3
- metadata +25 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/examples/basic_button.rb
CHANGED
data/examples/basic_entry.rb
CHANGED
@@ -4,10 +4,10 @@ require 'glimmer-dsl-libui'
|
|
4
4
|
|
5
5
|
include Glimmer
|
6
6
|
|
7
|
-
window('Basic Entry', 300, 50
|
7
|
+
window('Basic Entry', 300, 50) { |w|
|
8
8
|
horizontal_box {
|
9
9
|
e = entry {
|
10
|
-
# stretchy
|
10
|
+
# stretchy true # Smart default option for appending to horizontal_box
|
11
11
|
|
12
12
|
on_changed do
|
13
13
|
puts e.text
|
@@ -16,7 +16,7 @@ window('Basic Entry', 300, 50, 1) { |w|
|
|
16
16
|
}
|
17
17
|
|
18
18
|
button('Button') {
|
19
|
-
stretchy
|
19
|
+
stretchy false
|
20
20
|
|
21
21
|
on_clicked do
|
22
22
|
text = e.text
|
data/examples/basic_window.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'glimmer-dsl-libui'
|
4
|
+
|
5
|
+
include Glimmer
|
6
|
+
|
7
|
+
window { # args can alternatively be set via properties with 4th arg has_menubar=true by default
|
8
|
+
title 'hello world'
|
9
|
+
content_size 300, 200
|
10
|
+
|
11
|
+
on_closing do
|
12
|
+
puts 'Bye Bye'
|
13
|
+
end
|
14
|
+
}.show
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'glimmer-dsl-libui'
|
4
|
+
|
5
|
+
include Glimmer
|
6
|
+
|
7
|
+
menu('File') {
|
8
|
+
menu_item('Open') {
|
9
|
+
on_clicked do
|
10
|
+
file = open_file(MAIN_WINDOW)
|
11
|
+
puts file unless file.nil?
|
12
|
+
end
|
13
|
+
}
|
14
|
+
|
15
|
+
menu_item('Save') {
|
16
|
+
on_clicked do
|
17
|
+
file = save_file(MAIN_WINDOW)
|
18
|
+
puts file unless file.nil?
|
19
|
+
end
|
20
|
+
}
|
21
|
+
|
22
|
+
quit_menu_item {
|
23
|
+
on_clicked do
|
24
|
+
puts 'Bye Bye'
|
25
|
+
end
|
26
|
+
}
|
27
|
+
|
28
|
+
preferences_menu_item # Can optionally contain an on_clicked listener
|
29
|
+
}
|
30
|
+
|
31
|
+
menu('Edit') {
|
32
|
+
check_menu_item('Checkable Item_')
|
33
|
+
separator_menu_item
|
34
|
+
menu_item('Disabled Item_') {
|
35
|
+
enabled false
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
menu('Help') {
|
40
|
+
menu_item('Help')
|
41
|
+
|
42
|
+
about_menu_item # Can optionally contain an on_clicked listener
|
43
|
+
}
|
44
|
+
|
45
|
+
MAIN_WINDOW = window('Control Gallery', 600, 500) {
|
46
|
+
margined true
|
47
|
+
|
48
|
+
on_closing do
|
49
|
+
puts 'Bye Bye'
|
50
|
+
end
|
51
|
+
|
52
|
+
vertical_box {
|
53
|
+
horizontal_box {
|
54
|
+
group('Basic Controls') {
|
55
|
+
vertical_box {
|
56
|
+
button('Button') {
|
57
|
+
stretchy false
|
58
|
+
|
59
|
+
on_clicked do
|
60
|
+
msg_box(MAIN_WINDOW, 'Information', 'You clicked the button')
|
61
|
+
end
|
62
|
+
}
|
63
|
+
|
64
|
+
checkbox('Checkbox') {
|
65
|
+
stretchy false
|
66
|
+
|
67
|
+
on_toggled do |c|
|
68
|
+
checked = c.checked?
|
69
|
+
MAIN_WINDOW.title = "Checkbox is #{checked}"
|
70
|
+
c.text = "I am the checkbox (#{checked})"
|
71
|
+
end
|
72
|
+
}
|
73
|
+
|
74
|
+
label('Label') { stretchy false }
|
75
|
+
|
76
|
+
horizontal_separator { stretchy false }
|
77
|
+
|
78
|
+
date_picker { stretchy false }
|
79
|
+
|
80
|
+
time_picker { stretchy false }
|
81
|
+
|
82
|
+
date_time_picker { stretchy false }
|
83
|
+
|
84
|
+
font_button { stretchy false }
|
85
|
+
|
86
|
+
color_button { stretchy false }
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
vertical_box {
|
91
|
+
group('Numbers') {
|
92
|
+
stretchy false
|
93
|
+
|
94
|
+
vertical_box {
|
95
|
+
spinbox(0, 100) {
|
96
|
+
stretchy false
|
97
|
+
value 42
|
98
|
+
|
99
|
+
on_changed do |s|
|
100
|
+
puts "New Spinbox value: #{s.value}"
|
101
|
+
end
|
102
|
+
}
|
103
|
+
|
104
|
+
slider(0, 100) {
|
105
|
+
stretchy false
|
106
|
+
|
107
|
+
on_changed do |s|
|
108
|
+
v = s.value
|
109
|
+
puts "New Slider value: #{v}"
|
110
|
+
@progress_bar.value = v
|
111
|
+
end
|
112
|
+
}
|
113
|
+
|
114
|
+
@progress_bar = progress_bar { stretchy false }
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
group('Lists') {
|
119
|
+
stretchy false
|
120
|
+
|
121
|
+
vertical_box {
|
122
|
+
combobox {
|
123
|
+
stretchy false
|
124
|
+
items 'combobox Item 1', 'combobox Item 2', 'combobox Item 3' # also accepts a single array argument
|
125
|
+
|
126
|
+
on_selected do |c|
|
127
|
+
puts "New combobox selection: #{c.selected}"
|
128
|
+
end
|
129
|
+
}
|
130
|
+
|
131
|
+
editable_combobox {
|
132
|
+
stretchy false
|
133
|
+
items 'Editable Item 1', 'Editable Item 2', 'Editable Item 3' # also accepts a single array argument
|
134
|
+
}
|
135
|
+
|
136
|
+
radio_buttons {
|
137
|
+
items 'Radio Button 1', 'Radio Button 2', 'Radio Button 3' # also accepts a single array argument
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
tab {
|
143
|
+
tab_item('Page 1') {
|
144
|
+
horizontal_box {
|
145
|
+
entry {
|
146
|
+
text 'Please enter your feelings'
|
147
|
+
|
148
|
+
on_changed do |e|
|
149
|
+
puts "Current textbox data: '#{e.text}'"
|
150
|
+
end
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
tab_item('Page 2') {
|
156
|
+
horizontal_box
|
157
|
+
}
|
158
|
+
|
159
|
+
tab_item('Page 3') {
|
160
|
+
horizontal_box
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
MAIN_WINDOW.show
|
data/examples/midi_player.rb
CHANGED
@@ -56,10 +56,10 @@ class TinyMidiPlayer
|
|
56
56
|
end
|
57
57
|
}
|
58
58
|
}
|
59
|
-
@main_window = window('Tiny Midi Player', 200, 50
|
59
|
+
@main_window = window('Tiny Midi Player', 200, 50) {
|
60
60
|
horizontal_box {
|
61
61
|
vertical_box {
|
62
|
-
stretchy
|
62
|
+
stretchy false
|
63
63
|
|
64
64
|
button('▶') {
|
65
65
|
on_clicked do
|
data/examples/simple_notepad.rb
CHANGED
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/dsl/engine'
|
23
|
-
Dir[File.expand_path('
|
23
|
+
Dir[File.expand_path('*_expression.rb', __dir__)].each {|f| require f}
|
24
24
|
|
25
25
|
# Glimmer DSL expression configuration module
|
26
26
|
#
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Glimmer
|
23
|
+
module DSL
|
24
|
+
module Libui
|
25
|
+
module FileExpression
|
26
|
+
def interpret(parent, keyword, *args, &block)
|
27
|
+
file_pointer = ::LibUI.send(self.class.name.underscore.split('::').last.sub(/_expression$/, ''), args.first.libui)
|
28
|
+
file_pointer.to_s unless file_pointer.null?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/dsl/libui/file_expression'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Libui
|
28
|
+
class OpenFileExpression < StaticExpression
|
29
|
+
include FileExpression
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/dsl/libui/file_expression'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Libui
|
28
|
+
class SaveFileExpression < StaticExpression
|
29
|
+
include FileExpression
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/libui/tab_item_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Libui
|
28
|
+
class TabItemExpression < StaticExpression
|
29
|
+
def interpret(parent, keyword, *args, &block)
|
30
|
+
Glimmer::LibUI::TabItemProxy.create(keyword, parent, args, &block)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/libui/menu_item_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module LibUI
|
26
|
+
# Proxy for LibUI about menu item object
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class AboutMenuItemProxy < MenuItemProxy
|
30
|
+
private
|
31
|
+
|
32
|
+
def build_control
|
33
|
+
@libui = @parent_proxy.append_about_item(*@args)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/glimmer/libui/box.rb
CHANGED
@@ -19,14 +19,28 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
require 'glimmer/libui/control_proxy'
|
23
|
+
|
22
24
|
module Glimmer
|
23
25
|
module LibUI
|
24
26
|
module Box
|
25
27
|
APPEND_PROPERTIES = %w[stretchy]
|
26
28
|
|
27
29
|
def post_initialize_child(child)
|
28
|
-
child.stretchy =
|
29
|
-
::LibUI.box_append(@libui, child.libui, child.stretchy)
|
30
|
+
child.stretchy = true if child.stretchy.nil?
|
31
|
+
::LibUI.box_append(@libui, child.libui, ControlProxy.boolean_to_integer(child.stretchy))
|
32
|
+
end
|
33
|
+
|
34
|
+
def libui_api_keyword
|
35
|
+
'box'
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def build_control
|
41
|
+
super.tap do
|
42
|
+
self.padded = true
|
43
|
+
end
|
30
44
|
end
|
31
45
|
end
|
32
46
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright (c) 2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/libui/menu_item_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module LibUI
|
26
|
+
# Proxy for LibUI check menu item object
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class CheckMenuItemProxy < MenuItemProxy
|
30
|
+
private
|
31
|
+
|
32
|
+
def build_control
|
33
|
+
@libui = @parent_proxy.append_check_item(*@args)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -23,12 +23,13 @@ require 'glimmer/libui/control_proxy'
|
|
23
23
|
|
24
24
|
module Glimmer
|
25
25
|
module LibUI
|
26
|
-
# Proxy for LibUI
|
26
|
+
# Proxy for LibUI combobox objects
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class ComboboxProxy < ControlProxy
|
30
|
-
def items(values
|
31
|
-
if values.
|
30
|
+
def items(*values)
|
31
|
+
values = values.first if values.first.is_a?(Array)
|
32
|
+
if values.empty?
|
32
33
|
@values
|
33
34
|
else
|
34
35
|
@values = values
|