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
@@ -0,0 +1,67 @@
|
|
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
|
+
require 'glimmer/libui/horizontal_box_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module LibUI
|
27
|
+
# Proxy for LibUI tab item objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class TabItemProxy < ControlProxy
|
31
|
+
attr_reader :index
|
32
|
+
|
33
|
+
def initialize(keyword, parent, args, &block)
|
34
|
+
@keyword = keyword
|
35
|
+
@parent_proxy = parent
|
36
|
+
@args = args
|
37
|
+
@block = block
|
38
|
+
@enabled = 1
|
39
|
+
@index = @parent_proxy.num_pages
|
40
|
+
@content = @block&.call
|
41
|
+
build_control
|
42
|
+
end
|
43
|
+
|
44
|
+
def name
|
45
|
+
@args.first
|
46
|
+
end
|
47
|
+
|
48
|
+
def margined(value = nil)
|
49
|
+
if value.nil?
|
50
|
+
@parent_proxy.margined(@index)
|
51
|
+
else
|
52
|
+
@parent_proxy.margined(@index, value)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
alias set_margined margined
|
56
|
+
alias margined= margined
|
57
|
+
alias margined? margined
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def build_control
|
62
|
+
@content = HorizontalBoxProxy.new('horizontal_box', @libui, []) if @content.nil?
|
63
|
+
@libui = @parent_proxy.append(name, @content.libui)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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/date_time_picker_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module LibUI
|
26
|
+
# Proxy for LibUI time picker objects
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class TimePickerProxy < DateTimePickerProxy
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -23,10 +23,15 @@ require 'glimmer/libui/control_proxy'
|
|
23
23
|
|
24
24
|
module Glimmer
|
25
25
|
module LibUI
|
26
|
-
# Proxy for LibUI
|
26
|
+
# Proxy for LibUI window objects
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class WindowProxy < ControlProxy
|
30
|
+
DEFAULT_TITLE = 'Glimmer'
|
31
|
+
DEFAULT_WIDTH = 150
|
32
|
+
DEFAULT_HEIGHT = 150
|
33
|
+
DEFAULT_HAS_MENUBAR = 1
|
34
|
+
|
30
35
|
def post_initialize_child(child)
|
31
36
|
::LibUI.window_set_child(@libui, child.libui)
|
32
37
|
end
|
@@ -43,7 +48,7 @@ module Glimmer
|
|
43
48
|
def handle_listener(listener_name, &listener)
|
44
49
|
if listener_name == 'on_closing'
|
45
50
|
default_behavior_listener = Proc.new do
|
46
|
-
return_value = listener.call
|
51
|
+
return_value = listener.call(self)
|
47
52
|
if return_value.is_a?(Numeric)
|
48
53
|
return_value
|
49
54
|
else
|
@@ -59,7 +64,14 @@ module Glimmer
|
|
59
64
|
private
|
60
65
|
|
61
66
|
def build_control
|
62
|
-
|
67
|
+
construction_args = @args.dup
|
68
|
+
construction_args[0] = DEFAULT_TITLE if construction_args.size == 0
|
69
|
+
construction_args[1] = DEFAULT_WIDTH if construction_args.size == 1
|
70
|
+
construction_args[2] = DEFAULT_HEIGHT if construction_args.size == 2
|
71
|
+
construction_args[3] = DEFAULT_HAS_MENUBAR if construction_args.size == 3
|
72
|
+
construction_args[3] = ControlProxy.boolean_to_integer(construction_args[3]) if construction_args.size == 4 && (construction_args[3].is_a?(TrueClass) || construction_args[3].is_a?(FalseClass))
|
73
|
+
@libui = ::LibUI.send("new_window", *construction_args)
|
74
|
+
@libui.tap do
|
63
75
|
handle_listener('on_closing') do
|
64
76
|
destroy
|
65
77
|
::LibUI.quit
|
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.8
|
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-19 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
|
-
|
147
|
-
just works)
|
145
|
+
description: Glimmer DSL for LibUI - Prerequisite-Free Ruby Desktop Development GUI
|
146
|
+
Library (no need to pre-install any prerequisites. Just install the gem and have
|
147
|
+
platform-independent native GUI that just works!)
|
148
148
|
email: andy.am@gmail.com
|
149
149
|
executables:
|
150
150
|
- girb
|
@@ -163,19 +163,39 @@ files:
|
|
163
163
|
- examples/basic_button.rb
|
164
164
|
- examples/basic_entry.rb
|
165
165
|
- examples/basic_window.rb
|
166
|
+
- examples/basic_window2.rb
|
167
|
+
- examples/control_gallery.rb
|
166
168
|
- examples/midi_player.rb
|
167
169
|
- examples/simple_notepad.rb
|
168
170
|
- glimmer-dsl-libui.gemspec
|
169
171
|
- lib/glimmer-dsl-libui.rb
|
170
172
|
- lib/glimmer/dsl/libui/control_expression.rb
|
171
173
|
- lib/glimmer/dsl/libui/dsl.rb
|
174
|
+
- lib/glimmer/dsl/libui/file_expression.rb
|
172
175
|
- lib/glimmer/dsl/libui/listener_expression.rb
|
176
|
+
- lib/glimmer/dsl/libui/open_file_expression.rb
|
173
177
|
- lib/glimmer/dsl/libui/property_expression.rb
|
178
|
+
- lib/glimmer/dsl/libui/save_file_expression.rb
|
179
|
+
- lib/glimmer/dsl/libui/tab_item_expression.rb
|
180
|
+
- lib/glimmer/libui/about_menu_item_proxy.rb
|
174
181
|
- lib/glimmer/libui/box.rb
|
182
|
+
- lib/glimmer/libui/check_menu_item_proxy.rb
|
175
183
|
- lib/glimmer/libui/combobox_proxy.rb
|
176
184
|
- lib/glimmer/libui/control_proxy.rb
|
185
|
+
- lib/glimmer/libui/date_picker_proxy.rb
|
186
|
+
- lib/glimmer/libui/date_time_picker_proxy.rb
|
187
|
+
- lib/glimmer/libui/editable_combobox_proxy.rb
|
188
|
+
- lib/glimmer/libui/group_proxy.rb
|
177
189
|
- lib/glimmer/libui/horizontal_box_proxy.rb
|
178
190
|
- lib/glimmer/libui/menu_item_proxy.rb
|
191
|
+
- lib/glimmer/libui/multiline_entry_proxy.rb
|
192
|
+
- lib/glimmer/libui/non_wrapping_multiline_entry_proxy.rb
|
193
|
+
- lib/glimmer/libui/preferences_menu_item_proxy.rb
|
194
|
+
- lib/glimmer/libui/quit_menu_item_proxy.rb
|
195
|
+
- lib/glimmer/libui/radio_buttons_proxy.rb
|
196
|
+
- lib/glimmer/libui/separator_menu_item_proxy.rb
|
197
|
+
- lib/glimmer/libui/tab_item_proxy.rb
|
198
|
+
- lib/glimmer/libui/time_picker_proxy.rb
|
179
199
|
- lib/glimmer/libui/vertical_box_proxy.rb
|
180
200
|
- lib/glimmer/libui/window_proxy.rb
|
181
201
|
homepage: http://github.com/AndyObtiva/glimmer-dsl-libui
|