glimmer-dsl-wx 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +99 -3
- data/VERSION +1 -1
- data/bin/girb +1 -1
- data/bin/girb_runner.rb +2 -2
- data/glimmer-dsl-wx.gemspec +0 -0
- data/lib/glimmer/dsl/wx/about_box_expression.rb +34 -0
- data/lib/glimmer/dsl/wx/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/control_expression.rb +13 -14
- data/lib/glimmer/dsl/wx/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/dsl.rb +5 -3
- data/lib/glimmer/dsl/wx/listener_expression.rb +21 -21
- data/lib/glimmer/dsl/wx/observe_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/operation_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/property_expression.rb +21 -28
- data/lib/glimmer/dsl/wx/shine_data_binding_expression.rb +1 -1
- data/lib/glimmer/wx/control_proxy/frame_proxy.rb +52 -0
- data/lib/glimmer/wx/control_proxy.rb +44 -226
- data/lib/glimmer/wx/data_bindable.rb +2 -2
- data/lib/glimmer/wx/parent.rb +2 -2
- data/lib/glimmer-dsl-wx.rb +1 -1
- data/samples/glimmer_new/hello_button.rb +37 -0
- data/samples/glimmer_new/hello_button2.rb +41 -0
- data/samples/glimmer_new/hello_world.rb +26 -0
- data/samples/glimmer_new/hello_world2.rb +28 -0
- data/samples/minimal/nothing.rb +25 -20
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d5a658d9129e3c8ebf9c27f75d090d8d3f987a56866d1072d8ee17c757a7845
|
4
|
+
data.tar.gz: 31fc334221373c19a3461742fac4c201caf513b79413fa3738e09b4aa7a7b752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1516d96c79fdcd492d647092af6eed155b36091b7c2499c60384c24666a16e2cb5d2f397d92dd4c5f408d5d9cb947d24b50f7797ca70c644831ceafd89b6225a
|
7
|
+
data.tar.gz: e55a50420ee69b41e8406367151320aa29dd9d1d4ba57481475877e6e1624b2fcd1e157c00705ae9f43fb0b417ec4214079a8fa0377f32095c75c06300995368
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.5
|
4
|
+
|
5
|
+
- Nested child control support
|
6
|
+
- Listener support
|
7
|
+
- `about_box` keyword for displaying an about dialog box
|
8
|
+
- samples/glimmer_new/hello_button.rb
|
9
|
+
- samples/glimmer_new/hello_button2.rb
|
10
|
+
- Fix again the issue with complaining about not finding `frame` `app_name` when not specified despite it being optional
|
11
|
+
|
12
|
+
## 0.0.4
|
13
|
+
|
14
|
+
- Fix issue with complaining about not finding `frame` `app_name` when not specified despite it being optional
|
15
|
+
|
16
|
+
## 0.0.3
|
17
|
+
|
18
|
+
- Support control arguments and properties
|
19
|
+
- girb (Glimmer IRB)
|
20
|
+
- Use frame title argument in samples/minimal/nothing.rb
|
21
|
+
- Support `app_name` argument/property on `frame`
|
22
|
+
- Automatically set `app_name` to `frame` `title` if `frame` `app_name` is not specified
|
23
|
+
- samples/glimmer_new/hello_world.rb
|
24
|
+
- samples/glimmer_new/hello_world2.rb
|
25
|
+
|
3
26
|
## 0.0.2
|
4
27
|
|
5
28
|
- Remove forgotten occurrences of pd (puts_debuggerer) from code
|
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 WX 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 WX 0.0.5
|
2
2
|
## wxWidgets Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-wx.svg)](http://badge.fury.io/rb/glimmer-dsl-wx)
|
4
4
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -14,14 +14,80 @@
|
|
14
14
|
- Scaffolding for new custom controls, apps, and gems
|
15
15
|
- Native-Executable packaging on Mac, Windows, and Linux.
|
16
16
|
|
17
|
-
|
17
|
+
**Hello, World!**
|
18
|
+
|
19
|
+
![Hello, World!](https://github.com/AndyObtiva/glimmer-dsl-wx/blob/master/screenshots/glimmer-dsl-wx-sample-hello-world.png?raw=true)
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'glimmer-dsl-wx'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
frame(title: 'Hello, World!')
|
27
|
+
```
|
28
|
+
|
29
|
+
Alternate Syntax:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'glimmer-dsl-wx'
|
33
|
+
|
34
|
+
include Glimmer
|
35
|
+
|
36
|
+
frame {
|
37
|
+
title 'Hello, World!'
|
38
|
+
}
|
39
|
+
```
|
40
|
+
|
41
|
+
**Hello Button!**
|
42
|
+
|
43
|
+
|
44
|
+
![Hello, Button!](https://github.com/AndyObtiva/glimmer-dsl-wx/blob/master/screenshots/glimmer-dsl-wx-sample-hello-button.png?raw=true)
|
45
|
+
|
46
|
+
![Hello, Button! Clicked](https://github.com/AndyObtiva/glimmer-dsl-wx/blob/master/screenshots/glimmer-dsl-wx-sample-hello-button-clicked.png?raw=true)
|
47
|
+
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
require 'glimmer-dsl-wx'
|
51
|
+
|
52
|
+
include Glimmer
|
53
|
+
|
54
|
+
frame(title: 'Hello, Button!') { |f|
|
55
|
+
button(label: 'Click To Find Who Built This!') {
|
56
|
+
on_button do
|
57
|
+
about_box(
|
58
|
+
name: f.title,
|
59
|
+
version: Wx::WXRUBY_VERSION,
|
60
|
+
description: "This is the Hello, Button! sample",
|
61
|
+
developers: ['The Glimmer DSL for WX Development Team']
|
62
|
+
)
|
63
|
+
end
|
64
|
+
}
|
65
|
+
}
|
66
|
+
```
|
67
|
+
|
68
|
+
Alternate Syntax:
|
18
69
|
|
19
70
|
```ruby
|
20
71
|
require 'glimmer-dsl-wx'
|
21
72
|
|
22
73
|
include Glimmer
|
23
74
|
|
24
|
-
frame
|
75
|
+
frame { |f|
|
76
|
+
title 'Hello, Button!'
|
77
|
+
|
78
|
+
button {
|
79
|
+
label 'Click To Find Who Built This!'
|
80
|
+
|
81
|
+
on_button do
|
82
|
+
about_box(
|
83
|
+
name: f.title,
|
84
|
+
version: Wx::WXRUBY_VERSION,
|
85
|
+
description: "This is the Hello, Button! sample",
|
86
|
+
developers: ['The Glimmer DSL for WX Development Team']
|
87
|
+
)
|
88
|
+
end
|
89
|
+
}
|
90
|
+
}
|
25
91
|
```
|
26
92
|
|
27
93
|
**[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
|
@@ -42,6 +108,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
42
108
|
## Table of Contents
|
43
109
|
|
44
110
|
- [Glimmer DSL for WX](#)
|
111
|
+
- [Usage](#usage)
|
45
112
|
- [Process](#process)
|
46
113
|
- [Resources](#resources)
|
47
114
|
- [Help](#help)
|
@@ -53,6 +120,35 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
53
120
|
- [Contributors](#contributors)
|
54
121
|
- [License](#license)
|
55
122
|
|
123
|
+
## Usage
|
124
|
+
|
125
|
+
Follow instructions for installing [wxruby3](https://github.com/mcorino/wxRuby3) on a supported platform (Linux or Windows):
|
126
|
+
https://github.com/mcorino/wxRuby3/blob/master/INSTALL.md
|
127
|
+
|
128
|
+
Install [glimmer-dsl-wx](https://rubygems.org/gems/glimmer-dsl-wx) gem directly into a [maintained Ruby version](https://www.ruby-lang.org/en/downloads/):
|
129
|
+
|
130
|
+
```
|
131
|
+
gem install glimmer-dsl-wx
|
132
|
+
```
|
133
|
+
|
134
|
+
Or install via Bundler `Gemfile`:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
gem 'glimmer-dsl-wx', '~> 0.0.5'
|
138
|
+
```
|
139
|
+
|
140
|
+
Test that installation worked by running a sample:
|
141
|
+
|
142
|
+
```
|
143
|
+
ruby -r glimmer-dsl-wx -e "require 'samples/glimmer_new/hello_world'"
|
144
|
+
```
|
145
|
+
|
146
|
+
If you cloned project, test by running a sample locally:
|
147
|
+
|
148
|
+
```
|
149
|
+
ruby -r ./lib/glimmer-dsl-wx.rb samples/glimmer_new/hello_world.rb
|
150
|
+
```
|
151
|
+
|
56
152
|
## Process
|
57
153
|
|
58
154
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/bin/girb
CHANGED
data/bin/girb_runner.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -23,7 +23,7 @@
|
|
23
23
|
require 'fileutils'
|
24
24
|
require 'etc'
|
25
25
|
|
26
|
-
require_relative '../lib/glimmer-dsl-
|
26
|
+
require_relative '../lib/glimmer-dsl-wx'
|
27
27
|
|
28
28
|
include Glimmer
|
29
29
|
|
data/glimmer-dsl-wx.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (c) 2023 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
|
+
|
24
|
+
module Glimmer
|
25
|
+
module DSL
|
26
|
+
module Wx
|
27
|
+
class AboutBoxExpression < StaticExpression
|
28
|
+
def interpret(parent, keyword, *args, &block)
|
29
|
+
::Wx.about_box(*args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -29,35 +29,34 @@ module Glimmer
|
|
29
29
|
include ParentExpression
|
30
30
|
|
31
31
|
def can_interpret?(parent, keyword, *args, &block)
|
32
|
-
|
33
|
-
::Wx.constants.include?(keyword.capitalize.to_sym)
|
32
|
+
Glimmer::Wx::ControlProxy.exists?(keyword)
|
34
33
|
end
|
35
34
|
|
36
35
|
def interpret(parent, keyword, *args, &block)
|
37
|
-
|
38
|
-
control = ::Wx.const_get(keyword.capitalize.to_sym).new(nil)
|
39
|
-
control.show if keyword == 'frame'
|
40
|
-
control
|
36
|
+
Glimmer::Wx::ControlProxy.create(keyword, parent, args, &block)
|
41
37
|
end
|
42
38
|
|
43
39
|
def around(parent, keyword, args, block, &interpret_and_add_content)
|
44
40
|
if keyword == 'frame'
|
45
41
|
::Wx::App.run do
|
46
|
-
interpret_and_add_content.call
|
42
|
+
frame_proxy = interpret_and_add_content.call
|
43
|
+
app_name = frame_proxy.app_name || frame_proxy.title
|
44
|
+
self.app_name = app_name unless app_name.nil?
|
47
45
|
end
|
48
46
|
else
|
49
47
|
interpret_and_add_content.call
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
def add_content(parent, keyword, *args, &block)
|
52
|
+
options = args.last.is_a?(Hash) ? args.last : {post_add_content: true}
|
53
|
+
options[:post_add_content] = true if options[:post_add_content].nil?
|
54
|
+
super
|
55
|
+
parent&.post_add_content if options[:post_add_content]
|
56
|
+
end
|
58
57
|
end
|
59
58
|
end
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
|
-
|
62
|
+
require 'glimmer/wx/control_proxy'
|
data/lib/glimmer/dsl/wx/dsl.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -20,8 +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
|
-
|
24
|
-
require 'glimmer/dsl/wx/control_expression'
|
23
|
+
Dir[File.expand_path('*_expression.rb', __dir__)].each {|f| require f}
|
25
24
|
|
26
25
|
# Glimmer DSL expression configuration module
|
27
26
|
#
|
@@ -41,7 +40,10 @@ module Glimmer
|
|
41
40
|
# shine_data_binding
|
42
41
|
# property
|
43
42
|
# operation
|
43
|
+
# control
|
44
44
|
%w[
|
45
|
+
listener
|
46
|
+
property
|
45
47
|
control
|
46
48
|
]
|
47
49
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -19,23 +19,23 @@
|
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/wx/control_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Wx
|
28
|
+
class ListenerExpression < Expression
|
29
|
+
def can_interpret?(parent, keyword, *args, &block)
|
30
|
+
parent.is_a?(Glimmer::Wx::ControlProxy) and
|
31
|
+
block_given? and
|
32
|
+
parent&.can_handle_listener?(keyword)
|
33
|
+
end
|
34
|
+
|
35
|
+
def interpret(parent, keyword, *args, &block)
|
36
|
+
parent.handle_listener(keyword, &block)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -19,30 +19,23 @@
|
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# def interpret(parent, keyword, *args, &block)
|
43
|
-
# parent.send("#{keyword}=", *args)
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
# end
|
47
|
-
# end
|
48
|
-
# end
|
22
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/wx/control_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Wx
|
28
|
+
class PropertyExpression < Expression
|
29
|
+
def can_interpret?(parent, keyword, *args, &block)
|
30
|
+
parent.is_a?(Glimmer::Wx::ControlProxy) and
|
31
|
+
block.nil? and
|
32
|
+
parent.respond_to?("#{keyword}=", *args)
|
33
|
+
end
|
34
|
+
|
35
|
+
def interpret(parent, keyword, *args, &block)
|
36
|
+
parent.send("#{keyword}=", *args)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Copyright (c) 2023 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/wx/parent'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Wx
|
26
|
+
class ControlProxy
|
27
|
+
# Proxy for Wx frame objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class FrameProxy < ControlProxy
|
31
|
+
include Parent
|
32
|
+
|
33
|
+
attr_accessor :app_name
|
34
|
+
|
35
|
+
def initialize(keyword, parent, args, &block)
|
36
|
+
self.app_name = options.delete(:app_name)
|
37
|
+
super(keyword, parent, args, &block)
|
38
|
+
end
|
39
|
+
|
40
|
+
def title=(value)
|
41
|
+
# wxWidgets does not allow setting a frame title if set already
|
42
|
+
super if (options[:title] || options['title']).nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
def post_add_content
|
46
|
+
super
|
47
|
+
show
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -19,53 +19,43 @@
|
|
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/
|
22
|
+
require 'glimmer/wx/data_bindable'
|
23
|
+
require 'glimmer/wx/parent'
|
23
24
|
|
24
25
|
module Glimmer
|
25
|
-
module
|
26
|
-
# Proxy for
|
26
|
+
module Wx
|
27
|
+
# Proxy for Wx control objects
|
27
28
|
#
|
28
29
|
# Follows the Proxy Design Pattern
|
29
30
|
class ControlProxy
|
30
31
|
class << self
|
31
32
|
def exists?(keyword)
|
32
|
-
::
|
33
|
-
::LibUI.respond_to?(keyword) or
|
33
|
+
::Wx.constants.include?(wx_constant_symbol(keyword)) or
|
34
34
|
descendant_keyword_constant_map.keys.include?(keyword)
|
35
35
|
end
|
36
36
|
|
37
37
|
def create(keyword, parent, args, &block)
|
38
|
-
|
38
|
+
control_proxy_class(keyword).new(keyword, parent, args, &block)
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def control_proxy_class(keyword)
|
42
42
|
descendant_keyword_constant_map[keyword] || ControlProxy
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
def main_window_proxy
|
52
|
-
control_proxies.find {|c| c.is_a?(WindowProxy)}
|
53
|
-
end
|
54
|
-
|
55
|
-
def menu_proxies
|
56
|
-
control_proxies.select {|c| c.keyword == 'menu' }
|
57
|
-
end
|
58
|
-
|
59
|
-
def image_proxies
|
60
|
-
control_proxies.select {|c| c.keyword == 'image' }
|
45
|
+
def new_control(keyword, parent, args)
|
46
|
+
args = args.clone || []
|
47
|
+
if args.last.is_a?(Hash)
|
48
|
+
args[-1] = args[-1].clone
|
49
|
+
end
|
50
|
+
::Wx.const_get(wx_constant_symbol(keyword)).new(parent, *args)
|
61
51
|
end
|
62
52
|
|
63
|
-
def
|
64
|
-
|
53
|
+
def wx_constant_symbol(keyword)
|
54
|
+
keyword.to_s.camelcase(:upper).to_sym
|
65
55
|
end
|
66
56
|
|
67
57
|
def constant_symbol(keyword)
|
68
|
-
"#{keyword.camelcase(:upper)}Proxy".to_sym
|
58
|
+
"#{keyword.to_s.camelcase(:upper)}Proxy".to_sym
|
69
59
|
end
|
70
60
|
|
71
61
|
def keyword(constant_symbol)
|
@@ -73,7 +63,7 @@ module Glimmer
|
|
73
63
|
end
|
74
64
|
|
75
65
|
def descendant_keyword_constant_map
|
76
|
-
@descendant_keyword_constant_map ||=
|
66
|
+
@descendant_keyword_constant_map ||= map_descendant_keyword_constants_for(self)
|
77
67
|
end
|
78
68
|
|
79
69
|
def reset_descendant_keyword_constant_map
|
@@ -92,41 +82,12 @@ module Glimmer
|
|
92
82
|
end
|
93
83
|
accumulator
|
94
84
|
end
|
95
|
-
|
96
|
-
private
|
97
|
-
|
98
|
-
def add_aliases_to_keyword_constant_map(keyword_constant_map)
|
99
|
-
KEYWORD_ALIASES.each do |keyword, alias_keyword|
|
100
|
-
keyword_constant_map[alias_keyword] = keyword_constant_map[keyword]
|
101
|
-
end
|
102
|
-
keyword_constant_map
|
103
|
-
end
|
104
85
|
end
|
105
86
|
|
106
87
|
include DataBindable
|
107
88
|
|
108
|
-
|
109
|
-
|
110
|
-
'msg_box_error' => 'message_box_error',
|
111
|
-
}
|
112
|
-
|
113
|
-
BOOLEAN_PROPERTIES = %w[
|
114
|
-
padded
|
115
|
-
checked
|
116
|
-
enabled toplevel visible
|
117
|
-
read_only
|
118
|
-
margined
|
119
|
-
borderless fullscreen
|
120
|
-
stretchy
|
121
|
-
]
|
122
|
-
|
123
|
-
STRING_PROPERTIES = %w[
|
124
|
-
text
|
125
|
-
title
|
126
|
-
]
|
127
|
-
|
128
|
-
# libui returns the contained LibUI object
|
129
|
-
attr_reader :parent_proxy, :libui, :args, :keyword, :block, :content_added
|
89
|
+
# wx returns the contained LibUI object
|
90
|
+
attr_reader :parent_proxy, :wx, :args, :keyword, :block, :content_added
|
130
91
|
alias content_added? content_added
|
131
92
|
|
132
93
|
def initialize(keyword, parent, args, &block)
|
@@ -134,11 +95,14 @@ module Glimmer
|
|
134
95
|
@parent_proxy = parent
|
135
96
|
@args = args
|
136
97
|
@block = block
|
137
|
-
@enabled = true
|
138
98
|
build_control
|
139
99
|
post_add_content if @block.nil?
|
140
100
|
end
|
141
101
|
|
102
|
+
def options
|
103
|
+
@args&.last&.is_a?(Hash) ? @args.last : {}
|
104
|
+
end
|
105
|
+
|
142
106
|
# Subclasses may override to perform post add_content work (normally must call super)
|
143
107
|
def post_add_content
|
144
108
|
unless @content_added
|
@@ -152,7 +116,7 @@ module Glimmer
|
|
152
116
|
# No Op by default
|
153
117
|
end
|
154
118
|
|
155
|
-
def
|
119
|
+
def frame_proxy
|
156
120
|
found_proxy = self
|
157
121
|
until found_proxy.nil? || found_proxy.is_a?(WindowProxy)
|
158
122
|
found_proxy = found_proxy.parent_proxy
|
@@ -161,31 +125,17 @@ module Glimmer
|
|
161
125
|
end
|
162
126
|
|
163
127
|
def can_handle_listener?(listener_name)
|
164
|
-
|
165
|
-
|
166
|
-
|
128
|
+
listener_name.to_s.start_with?('on_')
|
129
|
+
# TODO figure out if there is a way to check this in Wx or not.
|
130
|
+
# has_custom_listener?(listener_name)
|
167
131
|
end
|
168
132
|
|
169
133
|
def handle_listener(listener_name, &listener)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
listeners_for(listener_name).map { |listener| listener.call(*args) }.last
|
176
|
-
end
|
177
|
-
end
|
178
|
-
listeners_for(listener_name) << safe_listener
|
179
|
-
elsif ::LibUI.respond_to?("control_#{listener_name}")
|
180
|
-
if listeners[listener_name].nil?
|
181
|
-
::LibUI.send("control_#{listener_name}", libui) do |*args|
|
182
|
-
listeners_for(listener_name).map { |listener| listener.call(*args) }.last
|
183
|
-
end
|
184
|
-
end
|
185
|
-
listeners_for(listener_name) << safe_listener
|
186
|
-
elsif has_custom_listener?(listener_name)
|
187
|
-
handle_custom_listener(listener_name, &listener)
|
188
|
-
end
|
134
|
+
event = listener_name.to_s.sub('on_', '')
|
135
|
+
@parent_proxy.wx.send("evt_#{event}", @wx, &listener)
|
136
|
+
# elsif has_custom_listener?(listener_name)
|
137
|
+
# handle_custom_listener(listener_name, &listener)
|
138
|
+
# end
|
189
139
|
end
|
190
140
|
|
191
141
|
def listeners
|
@@ -238,31 +188,14 @@ module Glimmer
|
|
238
188
|
end
|
239
189
|
|
240
190
|
def respond_to?(method_name, *args, &block)
|
241
|
-
|
242
|
-
(
|
243
|
-
append_properties.include?(method_name.to_s) ||
|
244
|
-
(append_properties.include?(method_name.to_s.sub(/\?$/, '')) && BOOLEAN_PROPERTIES.include?(method_name.to_s.sub(/\?$/, ''))) ||
|
245
|
-
append_properties.include?(method_name.to_s.sub(/=$/, ''))
|
246
|
-
) ||
|
191
|
+
@wx.respond_to?(method_name, true) ||
|
247
192
|
can_handle_listener?(method_name.to_s) ||
|
248
193
|
super(method_name, true)
|
249
194
|
end
|
250
195
|
|
251
|
-
def respond_to_libui?(method_name, *args, &block)
|
252
|
-
::LibUI.respond_to?("control_#{method_name}") or
|
253
|
-
(::LibUI.respond_to?("control_#{method_name.to_s.sub(/\?$/, '')}") && BOOLEAN_PROPERTIES.include?(method_name.to_s.sub(/\?$/, '')) ) or
|
254
|
-
::LibUI.respond_to?("control_set_#{method_name.to_s.sub(/=$/, '')}") or
|
255
|
-
::LibUI.respond_to?("#{libui_api_keyword}_#{method_name}") or
|
256
|
-
(::LibUI.respond_to?("#{libui_api_keyword}_#{method_name.to_s.sub(/\?$/, '')}") && BOOLEAN_PROPERTIES.include?(method_name.to_s.sub(/\?$/, '')) ) or
|
257
|
-
::LibUI.respond_to?("#{libui_api_keyword}_set_#{method_name.to_s.sub(/=$/, '')}")
|
258
|
-
end
|
259
|
-
|
260
196
|
def method_missing(method_name, *args, &block)
|
261
|
-
if
|
262
|
-
|
263
|
-
elsif append_properties.include?(method_name.to_s) ||
|
264
|
-
append_properties.include?(method_name.to_s.sub(/(=|\?)$/, ''))
|
265
|
-
append_property(method_name, *args)
|
197
|
+
if @wx.respond_to?(method_name, true)
|
198
|
+
@wx.send(method_name, *args, &block)
|
266
199
|
elsif can_handle_listener?(method_name.to_s)
|
267
200
|
handle_listener(method_name.to_s, &block)
|
268
201
|
else
|
@@ -270,116 +203,6 @@ module Glimmer
|
|
270
203
|
end
|
271
204
|
end
|
272
205
|
|
273
|
-
def send_to_libui(method_name, *args, &block)
|
274
|
-
if ::LibUI.respond_to?("#{libui_api_keyword}_#{method_name.to_s.sub(/\?$/, '')}") && args.empty?
|
275
|
-
property = method_name.to_s.sub(/\?$/, '')
|
276
|
-
value = ::LibUI.send("#{libui_api_keyword}_#{property}", libui, *args)
|
277
|
-
handle_string_property(property, handle_boolean_property(property, value))
|
278
|
-
elsif ::LibUI.respond_to?("#{libui_api_keyword}_get_#{method_name.to_s.sub(/\?$/, '')}") && args.empty?
|
279
|
-
property = method_name.to_s.sub(/\?$/, '')
|
280
|
-
value = ::LibUI.send("#{libui_api_keyword}_get_#{property}", libui, *args)
|
281
|
-
handle_string_property(property, handle_boolean_property(property, value))
|
282
|
-
elsif ::LibUI.respond_to?("#{libui_api_keyword}_set_#{method_name.to_s.sub(/=$/, '')}") && !args.empty?
|
283
|
-
property = method_name.to_s.sub(/=$/, '')
|
284
|
-
args[0] = Glimmer::LibUI.boolean_to_integer(args.first) if BOOLEAN_PROPERTIES.include?(property) && (args.first.is_a?(TrueClass) || args.first.is_a?(FalseClass))
|
285
|
-
args[0] = '' if STRING_PROPERTIES.include?(property) && args.first == nil
|
286
|
-
if property.to_s == 'checked'
|
287
|
-
current_value = Glimmer::LibUI.integer_to_boolean(::LibUI.send("#{libui_api_keyword}_checked", libui), allow_nil: false)
|
288
|
-
new_value = Glimmer::LibUI.integer_to_boolean(args[0], allow_nil: false)
|
289
|
-
::LibUI.send("#{libui_api_keyword}_set_#{property}", libui, *args) if new_value != current_value
|
290
|
-
else
|
291
|
-
::LibUI.send("#{libui_api_keyword}_set_#{property}", libui, *args)
|
292
|
-
end
|
293
|
-
elsif ::LibUI.respond_to?("#{libui_api_keyword}_#{method_name}") && !args.empty?
|
294
|
-
::LibUI.send("#{libui_api_keyword}_#{method_name}", libui, *args)
|
295
|
-
elsif ::LibUI.respond_to?("control_#{method_name.to_s.sub(/\?$/, '')}") && args.empty?
|
296
|
-
property = method_name.to_s.sub(/\?$/, '')
|
297
|
-
value = ::LibUI.send("control_#{property}", libui, *args)
|
298
|
-
handle_string_property(property, handle_boolean_property(property, value))
|
299
|
-
elsif ::LibUI.respond_to?("control_set_#{method_name.to_s.sub(/=$/, '')}")
|
300
|
-
property = method_name.to_s.sub(/=$/, '')
|
301
|
-
args[0] = Glimmer::LibUI.boolean_to_integer(args.first) if BOOLEAN_PROPERTIES.include?(property) && (args.first.is_a?(TrueClass) || args.first.is_a?(FalseClass))
|
302
|
-
args[0] = '' if STRING_PROPERTIES.include?(property) && args.first == nil
|
303
|
-
::LibUI.send("control_set_#{method_name.to_s.sub(/=$/, '')}", libui, *args)
|
304
|
-
elsif ::LibUI.respond_to?("control_#{method_name}") && !args.empty?
|
305
|
-
::LibUI.send("control_#{method_name}", libui, *args)
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
|
-
def append_properties
|
310
|
-
@parent_proxy&.class&.constants&.include?(:APPEND_PROPERTIES) ? @parent_proxy.class::APPEND_PROPERTIES : []
|
311
|
-
end
|
312
|
-
|
313
|
-
def append_property(property, value = nil)
|
314
|
-
property = property.to_s.sub(/(=|\?)$/, '')
|
315
|
-
@append_property_hash ||= {}
|
316
|
-
if value.nil?
|
317
|
-
value = @append_property_hash[property]
|
318
|
-
handle_string_property(property, handle_boolean_property(property, value))
|
319
|
-
else
|
320
|
-
value = Glimmer::LibUI.boolean_to_integer(value) if BOOLEAN_PROPERTIES.include?(property) && (value.is_a?(TrueClass) || value.is_a?(FalseClass))
|
321
|
-
@append_property_hash[property] = value
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
def libui_api_keyword
|
326
|
-
@keyword
|
327
|
-
end
|
328
|
-
|
329
|
-
def destroy
|
330
|
-
# TODO exclude menus from this initial return
|
331
|
-
return if !is_a?(ControlProxy::WindowProxy) && ControlProxy.main_window_proxy&.destroying?
|
332
|
-
data_binding_model_attribute_observer_registrations.each(&:deregister)
|
333
|
-
if parent_proxy.nil?
|
334
|
-
default_destroy
|
335
|
-
else
|
336
|
-
parent_proxy.destroy_child(self)
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
def destroy_child(child)
|
341
|
-
child.default_destroy
|
342
|
-
children.delete(child)
|
343
|
-
end
|
344
|
-
|
345
|
-
def default_destroy
|
346
|
-
deregister_all_custom_listeners
|
347
|
-
send_to_libui('destroy')
|
348
|
-
ControlProxy.control_proxies.delete(self)
|
349
|
-
end
|
350
|
-
|
351
|
-
def enabled(value = nil)
|
352
|
-
if value.nil?
|
353
|
-
@enabled
|
354
|
-
elsif value != @enabled
|
355
|
-
@enabled = value == 1 || value
|
356
|
-
if value == 1 || value
|
357
|
-
send_to_libui('enable')
|
358
|
-
else
|
359
|
-
send_to_libui('disable')
|
360
|
-
end
|
361
|
-
end
|
362
|
-
end
|
363
|
-
alias enabled? enabled
|
364
|
-
alias set_enabled enabled
|
365
|
-
alias enabled= enabled
|
366
|
-
|
367
|
-
def visible(value = nil)
|
368
|
-
current_value = send_to_libui('visible')
|
369
|
-
if value.nil?
|
370
|
-
current_value
|
371
|
-
elsif value != current_value
|
372
|
-
if value == 1 || value
|
373
|
-
send_to_libui('show')
|
374
|
-
else
|
375
|
-
send_to_libui('hide')
|
376
|
-
end
|
377
|
-
end
|
378
|
-
end
|
379
|
-
alias visible? visible
|
380
|
-
alias set_visible visible
|
381
|
-
alias visible= visible
|
382
|
-
|
383
206
|
def content(&block)
|
384
207
|
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Libui::ControlExpression.new, @keyword, {post_add_content: @content_added}, &block)
|
385
208
|
end
|
@@ -387,20 +210,15 @@ module Glimmer
|
|
387
210
|
private
|
388
211
|
|
389
212
|
def build_control
|
390
|
-
|
391
|
-
ControlProxy.new_control(@keyword, @args)
|
392
|
-
|
393
|
-
|
394
|
-
|
213
|
+
if is_a?(Parent)
|
214
|
+
@wx = ControlProxy.new_control(@keyword, @parent_proxy&.wx, @args)
|
215
|
+
else
|
216
|
+
sizer = ::Wx::HBoxSizer.new
|
217
|
+
@parent_proxy.sizer = sizer
|
218
|
+
@wx = ControlProxy.new_control(@keyword, @parent_proxy&.wx, @args)
|
219
|
+
sizer.add @wx, 0, ::Wx::RIGHT, 8
|
395
220
|
end
|
396
|
-
|
397
|
-
|
398
|
-
def handle_boolean_property(property, value)
|
399
|
-
BOOLEAN_PROPERTIES.include?(property) ? Glimmer::LibUI.integer_to_boolean(value) : value
|
400
|
-
end
|
401
|
-
|
402
|
-
def handle_string_property(property, value)
|
403
|
-
STRING_PROPERTIES.include?(property) ? value.to_s : value
|
221
|
+
@wx
|
404
222
|
end
|
405
223
|
end
|
406
224
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
module Glimmer
|
23
|
-
module
|
23
|
+
module Wx
|
24
24
|
# Parent controls and shapes who have children and add child post_initialize_child
|
25
25
|
module DataBindable
|
26
26
|
# Sets up read/write (bidirectional) data-binding
|
data/lib/glimmer/wx/parent.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
module Glimmer
|
23
|
-
module
|
23
|
+
module Wx
|
24
24
|
# Parent controls and shapes who have children and add child post_initialize_child
|
25
25
|
module Parent
|
26
26
|
# Subclasses can override and must call super (passing add_child: false to cancel adding child to children)
|
data/lib/glimmer-dsl-wx.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright (c) 2023 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-wx'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
frame(title: 'Hello, Button!') { |f|
|
27
|
+
button(label: 'Click To Find Who Built This!') {
|
28
|
+
on_button do
|
29
|
+
about_box(
|
30
|
+
name: f.title,
|
31
|
+
version: Wx::WXRUBY_VERSION,
|
32
|
+
description: "This is the Hello, Button! sample",
|
33
|
+
developers: ['The Glimmer DSL for WX Development Team']
|
34
|
+
)
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2023 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-wx'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
frame { |f|
|
27
|
+
title 'Hello, Button!'
|
28
|
+
|
29
|
+
button {
|
30
|
+
label 'Click To Find Who Built This!'
|
31
|
+
|
32
|
+
on_button do
|
33
|
+
about_box(
|
34
|
+
name: f.title,
|
35
|
+
version: Wx::WXRUBY_VERSION,
|
36
|
+
description: "This is the Hello, Button! sample",
|
37
|
+
developers: ['The Glimmer DSL for WX Development Team']
|
38
|
+
)
|
39
|
+
end
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2023 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-wx'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
frame(title: 'Hello, World!')
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (c) 2023 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-wx'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
frame {
|
27
|
+
title 'Hello, World!'
|
28
|
+
}
|
data/samples/minimal/nothing.rb
CHANGED
@@ -1,24 +1,29 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
#
|
1
|
+
# Copyright (c) 2023 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.
|
8
21
|
|
9
|
-
|
10
|
-
# show it.
|
11
|
-
# Wx::App.run do
|
12
|
-
### self.app_name = 'Nothing'
|
13
|
-
### frame = Wx::Frame.new(nil, title: "Empty wxRuby App")
|
14
|
-
# frame = Wx::Frame.new(nil)
|
15
|
-
# frame.title = "Empty wxRuby App"
|
16
|
-
# frame.show
|
17
|
-
# frame
|
18
|
-
# end
|
19
|
-
|
20
|
-
require './lib/glimmer-dsl-wx'
|
22
|
+
require 'glimmer-dsl-wx'
|
21
23
|
|
22
24
|
include Glimmer
|
23
25
|
|
24
|
-
frame
|
26
|
+
frame {
|
27
|
+
app_name 'Nothing'
|
28
|
+
title 'Empty wxRuby App'
|
29
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-wx
|
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
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- icons/glimmer.png
|
231
231
|
- lib/glimmer-dsl-wx.rb
|
232
232
|
- lib/glimmer-dsl-wx/ext/glimmer.rb
|
233
|
+
- lib/glimmer/dsl/wx/about_box_expression.rb
|
233
234
|
- lib/glimmer/dsl/wx/bind_expression.rb
|
234
235
|
- lib/glimmer/dsl/wx/control_expression.rb
|
235
236
|
- lib/glimmer/dsl/wx/data_binding_expression.rb
|
@@ -241,6 +242,7 @@ files:
|
|
241
242
|
- lib/glimmer/dsl/wx/shine_data_binding_expression.rb
|
242
243
|
- lib/glimmer/proc_tracker.rb
|
243
244
|
- lib/glimmer/wx/control_proxy.rb
|
245
|
+
- lib/glimmer/wx/control_proxy/frame_proxy.rb
|
244
246
|
- lib/glimmer/wx/data_bindable.rb
|
245
247
|
- lib/glimmer/wx/parent.rb
|
246
248
|
- samples/art/wxruby-128x128.png
|
@@ -248,6 +250,10 @@ files:
|
|
248
250
|
- samples/art/wxruby-64x64.png
|
249
251
|
- samples/art/wxruby.ico
|
250
252
|
- samples/art/wxruby.png
|
253
|
+
- samples/glimmer_new/hello_button.rb
|
254
|
+
- samples/glimmer_new/hello_button2.rb
|
255
|
+
- samples/glimmer_new/hello_world.rb
|
256
|
+
- samples/glimmer_new/hello_world2.rb
|
251
257
|
- samples/minimal/mondrian.ico
|
252
258
|
- samples/minimal/mondrian.png
|
253
259
|
- samples/minimal/nothing.rb
|