glimmer-dsl-libui 0.0.4 → 0.0.5
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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +446 -15
- data/VERSION +1 -1
- data/examples/control_gallery.rb +184 -0
- 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 +4 -0
- data/lib/glimmer/libui/check_menu_item_proxy.rb +37 -0
- data/lib/glimmer/libui/combobox_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy.rb +54 -18
- data/lib/glimmer/libui/editable_combobox_proxy.rb +42 -0
- data/lib/glimmer/libui/group_proxy.rb +35 -0
- data/lib/glimmer/libui/menu_item_proxy.rb +4 -1
- 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 +42 -0
- data/lib/glimmer/libui/separator_menu_item_proxy.rb +37 -0
- data/lib/glimmer/libui/tab_item_proxy.rb +64 -0
- data/lib/glimmer/libui/window_proxy.rb +1 -1
- metadata +19 -5
@@ -0,0 +1,62 @@
|
|
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 quit menu item object
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class QuitMenuItemProxy < MenuItemProxy
|
30
|
+
def can_handle_listener?(listener_name)
|
31
|
+
listener_name == 'on_clicked' || super
|
32
|
+
end
|
33
|
+
|
34
|
+
def handle_listener(listener_name, &listener)
|
35
|
+
if listener_name == 'on_clicked'
|
36
|
+
default_behavior_listener = Proc.new do
|
37
|
+
return_value = listener.call
|
38
|
+
if return_value.is_a?(Numeric)
|
39
|
+
return_value
|
40
|
+
else
|
41
|
+
destroy
|
42
|
+
::LibUI.quit
|
43
|
+
0
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
::LibUI.on_should_quit(&default_behavior_listener)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def build_control
|
53
|
+
@libui = @parent_proxy.append_quit_item(*@args)
|
54
|
+
handle_listener('on_clicked') do
|
55
|
+
destroy
|
56
|
+
::LibUI.quit
|
57
|
+
0
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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/control_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module LibUI
|
26
|
+
# Proxy for LibUI radio buttons objects
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class RadioButtonsProxy < ControlProxy
|
30
|
+
def items(values = nil)
|
31
|
+
if values.nil?
|
32
|
+
@values
|
33
|
+
else
|
34
|
+
@values = values
|
35
|
+
@values.each { |value| append value }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
alias set_items items
|
39
|
+
alias items= items
|
40
|
+
end
|
41
|
+
end
|
42
|
+
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 separator menu item object
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class SeparatorMenuItemProxy < MenuItemProxy
|
30
|
+
private
|
31
|
+
|
32
|
+
def build_control
|
33
|
+
@libui = @parent_proxy.append_separator(*@args)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,64 @@
|
|
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/control_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module LibUI
|
26
|
+
# Proxy for LibUI tab item objects
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class TabItemProxy < ControlProxy
|
30
|
+
attr_reader :index
|
31
|
+
|
32
|
+
def initialize(keyword, parent, args, &block)
|
33
|
+
@keyword = keyword
|
34
|
+
@parent_proxy = parent
|
35
|
+
@args = args
|
36
|
+
@block = block
|
37
|
+
@enabled = 1
|
38
|
+
@index = @parent_proxy.num_pages
|
39
|
+
@content = @block.call
|
40
|
+
build_control
|
41
|
+
end
|
42
|
+
|
43
|
+
def name
|
44
|
+
@args.first
|
45
|
+
end
|
46
|
+
|
47
|
+
def margined(value = nil)
|
48
|
+
if value.nil?
|
49
|
+
@parent_proxy.margined(@index)
|
50
|
+
else
|
51
|
+
@parent_proxy.margined(@index, value)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
alias set_margined margined
|
55
|
+
alias margined= margined
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def build_control
|
60
|
+
@libui = @parent_proxy.append(name, @content.libui)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -142,9 +142,9 @@ dependencies:
|
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: 0.7.0
|
145
|
-
description:
|
146
|
-
any
|
147
|
-
|
145
|
+
description: Prerequisite-Free Ruby Desktop Development GUI Library (no need to pre-install
|
146
|
+
any prerequisites. Just install the gem and have platform-independent GUI that just
|
147
|
+
works!)
|
148
148
|
email: andy.am@gmail.com
|
149
149
|
executables:
|
150
150
|
- girb
|
@@ -163,19 +163,33 @@ files:
|
|
163
163
|
- examples/basic_button.rb
|
164
164
|
- examples/basic_entry.rb
|
165
165
|
- examples/basic_window.rb
|
166
|
+
- examples/control_gallery.rb
|
166
167
|
- examples/midi_player.rb
|
167
168
|
- examples/simple_notepad.rb
|
168
169
|
- glimmer-dsl-libui.gemspec
|
169
170
|
- lib/glimmer-dsl-libui.rb
|
170
171
|
- lib/glimmer/dsl/libui/control_expression.rb
|
171
172
|
- lib/glimmer/dsl/libui/dsl.rb
|
173
|
+
- lib/glimmer/dsl/libui/file_expression.rb
|
172
174
|
- lib/glimmer/dsl/libui/listener_expression.rb
|
175
|
+
- lib/glimmer/dsl/libui/open_file_expression.rb
|
173
176
|
- lib/glimmer/dsl/libui/property_expression.rb
|
177
|
+
- lib/glimmer/dsl/libui/save_file_expression.rb
|
178
|
+
- lib/glimmer/dsl/libui/tab_item_expression.rb
|
179
|
+
- lib/glimmer/libui/about_menu_item_proxy.rb
|
174
180
|
- lib/glimmer/libui/box.rb
|
181
|
+
- lib/glimmer/libui/check_menu_item_proxy.rb
|
175
182
|
- lib/glimmer/libui/combobox_proxy.rb
|
176
183
|
- lib/glimmer/libui/control_proxy.rb
|
184
|
+
- lib/glimmer/libui/editable_combobox_proxy.rb
|
185
|
+
- lib/glimmer/libui/group_proxy.rb
|
177
186
|
- lib/glimmer/libui/horizontal_box_proxy.rb
|
178
187
|
- lib/glimmer/libui/menu_item_proxy.rb
|
188
|
+
- lib/glimmer/libui/preferences_menu_item_proxy.rb
|
189
|
+
- lib/glimmer/libui/quit_menu_item_proxy.rb
|
190
|
+
- lib/glimmer/libui/radio_buttons_proxy.rb
|
191
|
+
- lib/glimmer/libui/separator_menu_item_proxy.rb
|
192
|
+
- lib/glimmer/libui/tab_item_proxy.rb
|
179
193
|
- lib/glimmer/libui/vertical_box_proxy.rb
|
180
194
|
- lib/glimmer/libui/window_proxy.rb
|
181
195
|
homepage: http://github.com/AndyObtiva/glimmer-dsl-libui
|