glimmer-dsl-libui 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +163 -6
- data/VERSION +1 -1
- data/examples/basic_entry.rb +31 -0
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/control_expression.rb +3 -0
- data/lib/glimmer/libui/box.rb +33 -0
- data/lib/glimmer/libui/control_proxy.rb +32 -6
- data/lib/glimmer/libui/horizontal_box_proxy.rb +34 -0
- data/lib/glimmer/libui/vertical_box_proxy.rb +34 -0
- data/lib/glimmer/libui/window_proxy.rb +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 686f778cb2f5ec48ff536ba285ea078eaca725dbc9f244630c277de89698909c
|
4
|
+
data.tar.gz: 232094e072370a3d9aa10902659a78ceb61195ad20c897894fc22dc9bdbbcb0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb9a14df6b910961466bcc4ee970f186e13113991534853d7fdcad8bc4524d61cd0166016ff91f00a9e02d0bcd18708af719f6e3621db9c46d7a55e8867bda6d
|
7
|
+
data.tar.gz: 9d38221eb5e1fe6446febb706b07fb3800e739fc4cf28f6580cb90163256710d78d235669d24c71551f5dc21cf2fa23a6eab556dbbcb11d75bc52cab48f9adab
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.0.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.0.2
|
2
2
|
## Dependency-Free Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-libui/maintainability)
|
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
[Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is a dependency-free Ruby desktop development GUI library. No need to pre-install any pre-requisites. Just install the gem and have platform-independent GUI that just works!
|
8
8
|
|
9
|
+
The main trade-off against [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) and [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) is the fact that [SWT](https://www.eclipse.org/swt/) and [Tk](https://www.tcl.tk/) are more mature than [LibUI](https://github.com/kojix2/LibUI) as GUI toolkits. Still, if there is only a need to build a small simple application, [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) could be a pretty good choice due to having zero external dependencies beyond what is included in the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui).
|
10
|
+
|
9
11
|
[Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
|
10
12
|
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
11
13
|
- Convention over configuration via smart defaults and automation of low-level details
|
@@ -15,6 +17,28 @@
|
|
15
17
|
- Scaffolding for new custom widgets, apps, and gems
|
16
18
|
- Native-Executable packaging on Mac, Windows, and Linux
|
17
19
|
|
20
|
+
Example:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require 'glimmer-dsl-libui'
|
24
|
+
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
window('hello world', 300, 200, 1).show
|
28
|
+
```
|
29
|
+
|
30
|
+
![glimmer-dsl-libui-basic-window-mac.png](images/glimmer-dsl-libui-basic-window-mac.png)
|
31
|
+
![glimmer-dsl-libui-basic-window-linux.png](images/glimmer-dsl-libui-basic-window-linux.png)
|
32
|
+
|
33
|
+
NOTE: [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is in early alpha mode. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
|
34
|
+
|
35
|
+
Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interested in:
|
36
|
+
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
37
|
+
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
38
|
+
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
39
|
+
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
40
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
41
|
+
|
18
42
|
## Glimmer GUI DSL Concepts
|
19
43
|
|
20
44
|
The Glimmer GUI DSL provides a declarative syntax for [LibUI](https://github.com/kojix2/LibUI) that:
|
@@ -70,6 +94,18 @@ window('hello world', 300, 200, 1) {
|
|
70
94
|
|
71
95
|
## Usage
|
72
96
|
|
97
|
+
Install [glimmer-dsl-libui](https://rubygems.org/gems/glimmer-dsl-libui) gem directly:
|
98
|
+
|
99
|
+
```
|
100
|
+
gem install glimmer-dsl-libui
|
101
|
+
```
|
102
|
+
|
103
|
+
Or install via Bundler `Gemfile`:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
gem 'glimmer-dsl-libui', '~> 0.0.2'
|
107
|
+
```
|
108
|
+
|
73
109
|
Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
|
74
110
|
|
75
111
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
@@ -87,10 +123,6 @@ class Application
|
|
87
123
|
puts 'Button Clicked'
|
88
124
|
end
|
89
125
|
}
|
90
|
-
|
91
|
-
on_closing do
|
92
|
-
puts 'Bye Bye'
|
93
|
-
end
|
94
126
|
}.show
|
95
127
|
end
|
96
128
|
end
|
@@ -127,12 +159,24 @@ Gotcha: On the Mac, when you close a window opened in `girb`, it remains open un
|
|
127
159
|
|
128
160
|
## Examples
|
129
161
|
|
130
|
-
These examples reimplement the ones in the [LibUI](https://github.com/kojix2/LibUI) project utilizing the
|
162
|
+
These examples reimplement the ones in the [LibUI](https://github.com/kojix2/LibUI) project utilizing the Glimmer GUI DSL.
|
131
163
|
|
132
164
|
### Basic Window
|
133
165
|
|
134
166
|
[examples/basic_window.rb](examples/basic_window.rb)
|
135
167
|
|
168
|
+
Run with this command from the root of the project if you cloned the project:
|
169
|
+
|
170
|
+
```
|
171
|
+
ruby -r './lib/glimmer-dsl-libui' examples/basic_window.rb
|
172
|
+
```
|
173
|
+
|
174
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
175
|
+
|
176
|
+
```
|
177
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/basic_window'"
|
178
|
+
```
|
179
|
+
|
136
180
|
Mac
|
137
181
|
|
138
182
|
![glimmer-dsl-libui-basic-window-mac.png](images/glimmer-dsl-libui-basic-window-mac.png)
|
@@ -183,6 +227,18 @@ window('hello world', 300, 200, 1) {
|
|
183
227
|
|
184
228
|
[examples/basic_button.rb](examples/basic_button.rb)
|
185
229
|
|
230
|
+
Run with this command from the root of the project if you cloned the project:
|
231
|
+
|
232
|
+
```
|
233
|
+
ruby -r './lib/glimmer-dsl-libui' examples/basic_button.rb
|
234
|
+
```
|
235
|
+
|
236
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
237
|
+
|
238
|
+
```
|
239
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/basic_button'"
|
240
|
+
```
|
241
|
+
|
186
242
|
Mac
|
187
243
|
|
188
244
|
![glimmer-dsl-libui-basic-button-mac.png](images/glimmer-dsl-libui-basic-button-mac.png)
|
@@ -244,6 +300,107 @@ window('hello world', 300, 200, 1) { |w|
|
|
244
300
|
}.show
|
245
301
|
```
|
246
302
|
|
303
|
+
### Basic Entry
|
304
|
+
|
305
|
+
[examples/basic_entry.rb](examples/basic_entry.rb)
|
306
|
+
|
307
|
+
Run with this command from the root of the project if you cloned the project:
|
308
|
+
|
309
|
+
```
|
310
|
+
ruby -r './lib/glimmer-dsl-libui' examples/basic_entry.rb
|
311
|
+
```
|
312
|
+
|
313
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
314
|
+
|
315
|
+
```
|
316
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/basic_entry'"
|
317
|
+
```
|
318
|
+
|
319
|
+
Mac
|
320
|
+
|
321
|
+
![glimmer-dsl-libui-basic-entry-mac.png](images/glimmer-dsl-libui-basic-entry-mac.png)
|
322
|
+
![glimmer-dsl-libui-basic-entry-msg-box-mac.png](images/glimmer-dsl-libui-basic-entry-msg-box-mac.png)
|
323
|
+
|
324
|
+
Linux
|
325
|
+
|
326
|
+
![glimmer-dsl-libui-basic-entry-linux.png](images/glimmer-dsl-libui-basic-entry-linux.png)
|
327
|
+
![glimmer-dsl-libui-basic-entry-msg-box-linux.png](images/glimmer-dsl-libui-basic-entry-msg-box-linux.png)
|
328
|
+
|
329
|
+
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
330
|
+
|
331
|
+
```ruby
|
332
|
+
require 'libui'
|
333
|
+
|
334
|
+
UI = LibUI
|
335
|
+
|
336
|
+
UI.init
|
337
|
+
|
338
|
+
main_window = UI.new_window('Basic Entry', 300, 50, 1)
|
339
|
+
UI.window_on_closing(main_window) do
|
340
|
+
puts 'Bye Bye'
|
341
|
+
UI.control_destroy(main_window)
|
342
|
+
UI.quit
|
343
|
+
0
|
344
|
+
end
|
345
|
+
|
346
|
+
hbox = UI.new_horizontal_box
|
347
|
+
UI.window_set_child(main_window, hbox)
|
348
|
+
|
349
|
+
entry = UI.new_entry
|
350
|
+
UI.entry_on_changed(entry) do
|
351
|
+
puts UI.entry_text(entry).to_s
|
352
|
+
$stdout.flush # For Windows
|
353
|
+
end
|
354
|
+
UI.box_append(hbox, entry, 1)
|
355
|
+
|
356
|
+
button = UI.new_button('Button')
|
357
|
+
UI.button_on_clicked(button) do
|
358
|
+
text = UI.entry_text(entry).to_s
|
359
|
+
UI.msg_box(main_window, 'You entered', text)
|
360
|
+
0
|
361
|
+
end
|
362
|
+
|
363
|
+
UI.box_append(hbox, button, 0)
|
364
|
+
|
365
|
+
UI.control_show(main_window)
|
366
|
+
UI.main
|
367
|
+
UI.quit
|
368
|
+
```
|
369
|
+
|
370
|
+
[Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
371
|
+
|
372
|
+
```ruby
|
373
|
+
require 'glimmer-dsl-libui'
|
374
|
+
|
375
|
+
include Glimmer
|
376
|
+
|
377
|
+
window('Basic Entry', 300, 50, 1) { |w|
|
378
|
+
horizontal_box {
|
379
|
+
e = entry {
|
380
|
+
stretchy 1
|
381
|
+
|
382
|
+
on_changed do
|
383
|
+
puts e.text
|
384
|
+
$stdout.flush # For Windows
|
385
|
+
end
|
386
|
+
}
|
387
|
+
|
388
|
+
button('Button') {
|
389
|
+
stretchy 0
|
390
|
+
|
391
|
+
on_clicked do
|
392
|
+
text = e.text
|
393
|
+
msg_box(w, 'You entered', text)
|
394
|
+
end
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
on_closing do
|
399
|
+
puts 'Bye Bye'
|
400
|
+
end
|
401
|
+
}.show
|
402
|
+
```
|
403
|
+
|
247
404
|
## Contributing to glimmer-dsl-libui
|
248
405
|
|
249
406
|
- Check out the latest master to make sure the feature hasn't been
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'glimmer-dsl-libui'
|
4
|
+
|
5
|
+
include Glimmer
|
6
|
+
|
7
|
+
window('Basic Entry', 300, 50, 1) { |w|
|
8
|
+
horizontal_box {
|
9
|
+
e = entry {
|
10
|
+
stretchy 1
|
11
|
+
|
12
|
+
on_changed do
|
13
|
+
puts e.text
|
14
|
+
$stdout.flush # For Windows
|
15
|
+
end
|
16
|
+
}
|
17
|
+
|
18
|
+
button('Button') {
|
19
|
+
stretchy 0
|
20
|
+
|
21
|
+
on_clicked do
|
22
|
+
text = e.text
|
23
|
+
msg_box(w, 'You entered', text)
|
24
|
+
end
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
on_closing do
|
29
|
+
puts 'Bye Bye'
|
30
|
+
end
|
31
|
+
}.show
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -46,5 +46,8 @@ module Glimmer
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# TODO Consider moving all controls underneath Control namespace
|
49
50
|
require 'glimmer/libui/control_proxy'
|
50
51
|
require 'glimmer/libui/window_proxy'
|
52
|
+
require 'glimmer/libui/horizontal_box_proxy'
|
53
|
+
require 'glimmer/libui/vertical_box_proxy'
|
@@ -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 LibUI
|
24
|
+
module Box
|
25
|
+
APPEND_PROPERTIES = %w[stretchy]
|
26
|
+
|
27
|
+
def post_initialize_child(child)
|
28
|
+
child.stretchy = 1 if child.stretchy.nil?
|
29
|
+
::LibUI.box_append(@libui, child.libui, child.stretchy)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -30,8 +30,8 @@ module Glimmer
|
|
30
30
|
::LibUI.respond_to?("new_#{keyword}") || ::LibUI.respond_to?(keyword)
|
31
31
|
end
|
32
32
|
|
33
|
-
def create(keyword, parent, args)
|
34
|
-
widget_proxy_class(keyword).new(keyword, parent, args)
|
33
|
+
def create(keyword, parent, args, &block)
|
34
|
+
widget_proxy_class(keyword).new(keyword, parent, args, &block)
|
35
35
|
end
|
36
36
|
|
37
37
|
def widget_proxy_class(keyword)
|
@@ -51,16 +51,24 @@ module Glimmer
|
|
51
51
|
@keyword = keyword
|
52
52
|
@parent_proxy = parent
|
53
53
|
@args = args
|
54
|
+
@block = block
|
54
55
|
build_control
|
55
|
-
if @parent_proxy.
|
56
|
-
|
56
|
+
if @parent_proxy.class.constants.include?(:APPEND_PROPERTIES)
|
57
|
+
@parent_proxy.class::APPEND_PROPERTIES
|
57
58
|
end
|
59
|
+
post_add_content if @block.nil?
|
58
60
|
end
|
59
61
|
|
62
|
+
# Subclasses may override to perform post add_content work (normally must call super)
|
60
63
|
def post_add_content
|
61
|
-
|
64
|
+
@parent_proxy&.post_initialize_child(self)
|
62
65
|
end
|
63
66
|
|
67
|
+
# Subclasses may override to perform post initialization work on an added child
|
68
|
+
def post_initialize_child(child)
|
69
|
+
# No Op by default
|
70
|
+
end
|
71
|
+
|
64
72
|
def can_handle_listener?(listener_name)
|
65
73
|
::LibUI.respond_to?("control_#{listener_name}") || ::LibUI.respond_to?("#{@keyword}_#{listener_name}")
|
66
74
|
end
|
@@ -74,7 +82,9 @@ module Glimmer
|
|
74
82
|
end
|
75
83
|
|
76
84
|
def respond_to?(method_name, *args, &block)
|
77
|
-
respond_to_libui?(method_name, *args, &block) ||
|
85
|
+
respond_to_libui?(method_name, *args, &block) ||
|
86
|
+
(append_properties.include?(method_name.to_s) || append_properties.include?(method_name.to_s.sub(/=$/, ''))) ||
|
87
|
+
super
|
78
88
|
end
|
79
89
|
|
80
90
|
def respond_to_libui?(method_name, *args, &block)
|
@@ -87,6 +97,8 @@ module Glimmer
|
|
87
97
|
def method_missing(method_name, *args, &block)
|
88
98
|
if respond_to_libui?(method_name, *args, &block)
|
89
99
|
send_to_libui(method_name, *args, &block)
|
100
|
+
elsif (append_properties.include?(method_name.to_s) || append_properties.include?(method_name.to_s.sub(/=$/, '')))
|
101
|
+
append_property(method_name, *args)
|
90
102
|
else
|
91
103
|
super
|
92
104
|
end
|
@@ -106,6 +118,20 @@ module Glimmer
|
|
106
118
|
end
|
107
119
|
end
|
108
120
|
|
121
|
+
def append_properties
|
122
|
+
@parent_proxy&.class&.constants&.include?(:APPEND_PROPERTIES) ? @parent_proxy.class::APPEND_PROPERTIES : []
|
123
|
+
end
|
124
|
+
|
125
|
+
def append_property(property, value = nil)
|
126
|
+
property = property.to_s.sub(/=$/, '')
|
127
|
+
@append_property_hash ||= {}
|
128
|
+
if value.nil?
|
129
|
+
@append_property_hash[property]
|
130
|
+
else
|
131
|
+
@append_property_hash[property] = value
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
109
135
|
private
|
110
136
|
|
111
137
|
def build_control
|
@@ -0,0 +1,34 @@
|
|
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/box'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module LibUI
|
27
|
+
# Proxy for LibUI Window objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class HorizontalBoxProxy < ControlProxy
|
31
|
+
include Box
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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/box'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module LibUI
|
27
|
+
# Proxy for LibUI Window objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class VerticalBoxProxy < ControlProxy
|
31
|
+
include Box
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -27,6 +27,10 @@ module Glimmer
|
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class WindowProxy < ControlProxy
|
30
|
+
def post_initialize_child(child)
|
31
|
+
::LibUI.window_set_child(@libui, child.libui)
|
32
|
+
end
|
33
|
+
|
30
34
|
def show
|
31
35
|
send_to_libui('show')
|
32
36
|
unless @shown_at_least_once
|
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.2
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- bin/girb
|
162
162
|
- bin/girb_runner.rb
|
163
163
|
- examples/basic_button.rb
|
164
|
+
- examples/basic_entry.rb
|
164
165
|
- examples/basic_window.rb
|
165
166
|
- glimmer-dsl-libui.gemspec
|
166
167
|
- lib/glimmer-dsl-libui.rb
|
@@ -168,7 +169,10 @@ files:
|
|
168
169
|
- lib/glimmer/dsl/libui/dsl.rb
|
169
170
|
- lib/glimmer/dsl/libui/listener_expression.rb
|
170
171
|
- lib/glimmer/dsl/libui/property_expression.rb
|
172
|
+
- lib/glimmer/libui/box.rb
|
171
173
|
- lib/glimmer/libui/control_proxy.rb
|
174
|
+
- lib/glimmer/libui/horizontal_box_proxy.rb
|
175
|
+
- lib/glimmer/libui/vertical_box_proxy.rb
|
172
176
|
- lib/glimmer/libui/window_proxy.rb
|
173
177
|
homepage: http://github.com/AndyObtiva/glimmer-dsl-libui
|
174
178
|
licenses:
|