glimmer-dsl-wx 0.0.6 → 0.1.0
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 +20 -1
- data/LICENSE.txt +1 -1
- data/README.md +482 -101
- data/VERSION +1 -1
- data/bin/girb +1 -1
- data/bin/girb_runner.rb +1 -1
- data/glimmer-dsl-wx.gemspec +0 -0
- data/lib/glimmer/dsl/wx/about_box_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/bind_expression.rb +16 -16
- data/lib/glimmer/dsl/wx/control_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/data_binding_expression.rb +25 -25
- data/lib/glimmer/dsl/wx/dsl.rb +5 -7
- data/lib/glimmer/dsl/wx/listener_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/observe_expression.rb +1 -1
- data/lib/glimmer/dsl/wx/operation_expression.rb +23 -27
- data/lib/glimmer/dsl/wx/property_expression.rb +10 -3
- data/lib/glimmer/dsl/wx/shine_data_binding_expression.rb +23 -22
- data/lib/glimmer/dsl/wx/sizer_addable_expression.rb +42 -0
- data/lib/glimmer/dsl/wx/sizer_args_expression.rb +5 -2
- data/lib/glimmer/dsl/wx/sizer_expression.rb +1 -1
- data/lib/glimmer/wx/control_proxy/frame_proxy.rb +1 -1
- data/lib/glimmer/wx/control_proxy/slider_proxy.rb +55 -0
- data/lib/glimmer/wx/control_proxy/spin_ctrl_double_proxy.rb +41 -0
- data/lib/glimmer/wx/control_proxy/spin_ctrl_proxy.rb +41 -0
- data/lib/glimmer/wx/control_proxy/text_ctrl_proxy.rb +39 -0
- data/lib/glimmer/wx/control_proxy.rb +3 -3
- data/lib/glimmer/wx/data_bindable.rb +1 -1
- data/lib/glimmer/wx/parent.rb +1 -1
- data/lib/glimmer/wx/sizer_proxy.rb +17 -1
- data/lib/glimmer-dsl-wx.rb +1 -1
- data/samples/hello/hello_button.rb +1 -1
- data/samples/hello/hello_button2.rb +1 -1
- data/samples/hello/hello_data_binding.rb +126 -0
- data/samples/hello/hello_sizer.rb +89 -34
- data/samples/hello/hello_world.rb +1 -1
- data/samples/hello/hello_world2.rb +1 -1
- data/samples/minimal/nothing.rb +1 -1
- metadata +20 -10
@@ -0,0 +1,126 @@
|
|
1
|
+
# Copyright (c) 2023-2024 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
|
+
class Donor
|
25
|
+
DONATION_AMOUNT_MIN = 0
|
26
|
+
DONATION_AMOUNT_MAX = 100
|
27
|
+
DONATION_AMOUNT_DEFAULT = 50
|
28
|
+
|
29
|
+
attr_accessor :first_name, :last_name, :donation_amount
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
@last_name = @first_name = ''
|
33
|
+
@donation_amount = DONATION_AMOUNT_DEFAULT
|
34
|
+
end
|
35
|
+
|
36
|
+
def full_name
|
37
|
+
full_name_parts = [first_name, last_name]
|
38
|
+
full_name_string = full_name_parts.join(' ').strip
|
39
|
+
if full_name_string.empty?
|
40
|
+
'Anonymous'
|
41
|
+
else
|
42
|
+
full_name_string
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def summary
|
47
|
+
"#{full_name} donated $#{donation_amount}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
donor = Donor.new
|
52
|
+
|
53
|
+
include Glimmer
|
54
|
+
|
55
|
+
frame(title: 'Hello, Data-Binding!') { |window|
|
56
|
+
panel {
|
57
|
+
v_box_sizer {
|
58
|
+
h_box_sizer {
|
59
|
+
sizer_args 0, Wx::DOWN, 10
|
60
|
+
|
61
|
+
static_text(label: 'First Name:') {
|
62
|
+
sizer_args 0, Wx::RIGHT, 10
|
63
|
+
}
|
64
|
+
text_ctrl {
|
65
|
+
sizer_args 0, Wx::RIGHT, 10
|
66
|
+
# data-bind donor.first_name to text_ctrl.value bidirectionally,
|
67
|
+
# ensuring changes to either attribute update the other attribute
|
68
|
+
value <=> [donor, :first_name]
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
h_box_sizer {
|
73
|
+
sizer_args 0, Wx::DOWN, 10
|
74
|
+
|
75
|
+
static_text(label: 'Last Name:') {
|
76
|
+
sizer_args 0, Wx::RIGHT, 10
|
77
|
+
}
|
78
|
+
text_ctrl {
|
79
|
+
sizer_args 0, Wx::RIGHT, 10
|
80
|
+
# data-bind donor.last_name to text_ctrl.value bidirectionally,
|
81
|
+
# ensuring changes to either attribute update the other attribute
|
82
|
+
value <=> [donor, :last_name]
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
h_box_sizer {
|
87
|
+
sizer_args 0, Wx::DOWN, 10
|
88
|
+
|
89
|
+
static_text(label: 'Donation Amount: $') {
|
90
|
+
sizer_args 0, Wx::RIGHT, 1
|
91
|
+
}
|
92
|
+
spin_ctrl {
|
93
|
+
sizer_args 0, Wx::RIGHT, 10
|
94
|
+
range Donor::DONATION_AMOUNT_MIN, Donor::DONATION_AMOUNT_MAX
|
95
|
+
# data-bind donor.donation_amount to spin_ctrl.value bidirectionally,
|
96
|
+
# ensuring changes to either attribute update the other attribute
|
97
|
+
value <=> [donor, :donation_amount]
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
h_box_sizer {
|
102
|
+
sizer_args 0, Wx::DOWN, 10
|
103
|
+
|
104
|
+
slider {
|
105
|
+
sizer_args 0, Wx::RIGHT, 10
|
106
|
+
range Donor::DONATION_AMOUNT_MIN, Donor::DONATION_AMOUNT_MAX
|
107
|
+
# data-bind donor.first_name to spinner.value bidirectionally,
|
108
|
+
# ensuring changes to either attribute update the other attribute
|
109
|
+
value <=> [donor, :donation_amount]
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
h_box_sizer {
|
114
|
+
sizer_args 0, Wx::DOWN, 10
|
115
|
+
|
116
|
+
static_text(label: '') {
|
117
|
+
sizer_args 0, Wx::RIGHT, 10
|
118
|
+
# data-bind donor.summary to static_text.label unidirectionally,
|
119
|
+
# with computed data-binding from donor summary dependencies: first_name, last_name, and donation_amount
|
120
|
+
# ensuring changes to donor.summary or any of its dependencies update static_text.label
|
121
|
+
label <= [donor, :summary, computed_by: [:first_name, :last_name, :donation_amount]]
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2023 Andy Maleh
|
1
|
+
# Copyright (c) 2023-2024 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
|
@@ -26,44 +26,99 @@ include Glimmer
|
|
26
26
|
frame { |main_frame|
|
27
27
|
title 'Hello, Sizer!'
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
sizer_args 0, Wx::
|
32
|
-
label 'Greeting 1'
|
29
|
+
h_box_sizer {
|
30
|
+
v_box_sizer {
|
31
|
+
sizer_args 0, Wx::RIGHT, 10
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
33
|
+
button {
|
34
|
+
sizer_args 0, Wx::DOWN, 10
|
35
|
+
label 'Greeting 1'
|
36
|
+
|
37
|
+
on_button do
|
38
|
+
message_dialog(
|
39
|
+
"Hello",
|
40
|
+
"Greeting 1",
|
41
|
+
Wx::OK | Wx::ICON_INFORMATION
|
42
|
+
).show_modal
|
43
|
+
end
|
44
|
+
}
|
45
|
+
|
46
|
+
spacer(10)
|
47
|
+
|
48
|
+
button {
|
49
|
+
sizer_args 0, Wx::DOWN, 10
|
50
|
+
label 'Greeting 2'
|
51
|
+
|
52
|
+
on_button do
|
53
|
+
message_dialog(
|
54
|
+
"Howdy",
|
55
|
+
"Greeting 2",
|
56
|
+
Wx::OK | Wx::ICON_INFORMATION
|
57
|
+
).show_modal
|
58
|
+
end
|
59
|
+
}
|
60
|
+
|
61
|
+
spacer(10)
|
46
62
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
63
|
+
button {
|
64
|
+
sizer_args 0, Wx::DOWN, 10
|
65
|
+
label 'Greeting 3'
|
66
|
+
|
67
|
+
on_button do
|
68
|
+
message_dialog(
|
69
|
+
"Hi",
|
70
|
+
"Greeting 3",
|
71
|
+
Wx::OK | Wx::ICON_INFORMATION
|
72
|
+
).show_modal
|
73
|
+
end
|
74
|
+
}
|
54
75
|
}
|
55
76
|
|
56
|
-
|
57
|
-
sizer_args 0, Wx::
|
58
|
-
|
77
|
+
v_box_sizer {
|
78
|
+
sizer_args 0, Wx::RIGHT, 10
|
79
|
+
|
80
|
+
button {
|
81
|
+
sizer_args 0, Wx::DOWN, 10
|
82
|
+
label 'Greeting 4'
|
83
|
+
|
84
|
+
on_button do
|
85
|
+
message_dialog(
|
86
|
+
"Ciao",
|
87
|
+
"Greeting 4",
|
88
|
+
Wx::OK | Wx::ICON_INFORMATION
|
89
|
+
).show_modal
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
spacer(10)
|
94
|
+
|
95
|
+
button {
|
96
|
+
sizer_args 0, Wx::DOWN, 10
|
97
|
+
label 'Greeting 5'
|
98
|
+
|
99
|
+
on_button do
|
100
|
+
message_dialog(
|
101
|
+
"Aloha",
|
102
|
+
"Greeting 5",
|
103
|
+
Wx::OK | Wx::ICON_INFORMATION
|
104
|
+
).show_modal
|
105
|
+
end
|
106
|
+
}
|
107
|
+
|
108
|
+
spacer(10)
|
59
109
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
110
|
+
button {
|
111
|
+
sizer_args 0, Wx::DOWN, 10
|
112
|
+
label 'Greeting 6'
|
113
|
+
|
114
|
+
on_button do
|
115
|
+
message_dialog(
|
116
|
+
"Salut",
|
117
|
+
"Greeting 6",
|
118
|
+
Wx::OK | Wx::ICON_INFORMATION
|
119
|
+
).show_modal
|
120
|
+
end
|
121
|
+
}
|
67
122
|
}
|
68
123
|
}
|
69
124
|
}
|
data/samples/minimal/nothing.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.7.
|
19
|
+
version: 2.7.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.7.
|
26
|
+
version: 2.7.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: os
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 1.0.0
|
54
54
|
- - "<="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 2.0.0
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 1.0.0
|
64
64
|
- - "<="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 2.0.0
|
@@ -211,12 +211,16 @@ dependencies:
|
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: 0.7.0
|
213
213
|
description: Glimmer DSL for WX (wxWidgets Ruby Desktop Development GUI Library).
|
214
|
-
This is a Glimmer GUI DSL for the WxWidgets GUI toolkit using the
|
214
|
+
This is a Glimmer GUI DSL for the WxWidgets GUI toolkit using the latest wxruby
|
215
|
+
binding, wxruby3. It supports a declarative hierarchical minimalistic Ruby DSL with
|
216
|
+
Unidirectional/Bidirectional Data-Binding support to enable building desktop applications
|
217
|
+
the Ruby way.
|
215
218
|
email: andy.am@gmail.com
|
216
219
|
executables:
|
217
220
|
- girb
|
218
221
|
extensions: []
|
219
222
|
extra_rdoc_files:
|
223
|
+
- CHANGELOG.md
|
220
224
|
- LICENSE.txt
|
221
225
|
- README.md
|
222
226
|
files:
|
@@ -240,11 +244,16 @@ files:
|
|
240
244
|
- lib/glimmer/dsl/wx/operation_expression.rb
|
241
245
|
- lib/glimmer/dsl/wx/property_expression.rb
|
242
246
|
- lib/glimmer/dsl/wx/shine_data_binding_expression.rb
|
247
|
+
- lib/glimmer/dsl/wx/sizer_addable_expression.rb
|
243
248
|
- lib/glimmer/dsl/wx/sizer_args_expression.rb
|
244
249
|
- lib/glimmer/dsl/wx/sizer_expression.rb
|
245
250
|
- lib/glimmer/proc_tracker.rb
|
246
251
|
- lib/glimmer/wx/control_proxy.rb
|
247
252
|
- lib/glimmer/wx/control_proxy/frame_proxy.rb
|
253
|
+
- lib/glimmer/wx/control_proxy/slider_proxy.rb
|
254
|
+
- lib/glimmer/wx/control_proxy/spin_ctrl_double_proxy.rb
|
255
|
+
- lib/glimmer/wx/control_proxy/spin_ctrl_proxy.rb
|
256
|
+
- lib/glimmer/wx/control_proxy/text_ctrl_proxy.rb
|
248
257
|
- lib/glimmer/wx/data_bindable.rb
|
249
258
|
- lib/glimmer/wx/parent.rb
|
250
259
|
- lib/glimmer/wx/sizer_proxy.rb
|
@@ -255,6 +264,7 @@ files:
|
|
255
264
|
- samples/art/wxruby.png
|
256
265
|
- samples/hello/hello_button.rb
|
257
266
|
- samples/hello/hello_button2.rb
|
267
|
+
- samples/hello/hello_data_binding.rb
|
258
268
|
- samples/hello/hello_sizer.rb
|
259
269
|
- samples/hello/hello_world.rb
|
260
270
|
- samples/hello/hello_world2.rb
|
@@ -267,7 +277,7 @@ homepage: http://github.com/AndyObtiva/glimmer-dsl-wx
|
|
267
277
|
licenses:
|
268
278
|
- MIT
|
269
279
|
metadata: {}
|
270
|
-
post_install_message:
|
280
|
+
post_install_message:
|
271
281
|
rdoc_options: []
|
272
282
|
require_paths:
|
273
283
|
- lib
|
@@ -284,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
294
|
version: '0'
|
285
295
|
requirements: []
|
286
296
|
rubygems_version: 3.3.3
|
287
|
-
signing_key:
|
297
|
+
signing_key:
|
288
298
|
specification_version: 4
|
289
299
|
summary: Glimmer DSL for WX
|
290
300
|
test_files: []
|