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
@@ -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
|
@@ -19,18 +19,18 @@
|
|
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
|
-
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/dsl/bind_expression'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Wx
|
28
|
+
# Responsible for setting up the return value of the bind keyword (command symbol)
|
29
|
+
# as a ModelBinding. It is then used by another command handler like
|
30
|
+
# DataBindingExpression
|
31
|
+
class BindExpression < StaticExpression
|
32
|
+
include Glimmer::DSL::BindExpression
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -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
|
@@ -19,27 +19,27 @@
|
|
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
22
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/data_binding/model_binding'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Wx
|
28
|
+
# Responsible for wiring data-binding
|
29
|
+
# Depends on BindExpression
|
30
|
+
class DataBindingExpression < Expression
|
31
|
+
def can_interpret?(parent, keyword, *args, &block)
|
32
|
+
args.size == 1 and
|
33
|
+
args[0].is_a?(DataBinding::ModelBinding) and
|
34
|
+
parent.respond_to?(:data_bind)
|
35
|
+
end
|
36
|
+
|
37
|
+
def interpret(parent, keyword, *args, &block)
|
38
|
+
property = keyword
|
39
|
+
model_binding = args[0]
|
40
|
+
parent.data_bind(property, model_binding)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/glimmer/dsl/wx/dsl.rb
CHANGED
@@ -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
|
@@ -35,17 +35,15 @@ module Glimmer
|
|
35
35
|
module Wx
|
36
36
|
Engine.add_dynamic_expressions(
|
37
37
|
Wx,
|
38
|
-
# listener
|
39
|
-
# data_binding
|
40
|
-
# shine_data_binding
|
41
|
-
# property
|
42
|
-
# operation
|
43
|
-
# control
|
44
38
|
%w[
|
45
39
|
listener
|
40
|
+
data_binding
|
41
|
+
shine_data_binding
|
46
42
|
sizer_args
|
43
|
+
sizer_addable
|
47
44
|
sizer
|
48
45
|
property
|
46
|
+
operation
|
49
47
|
control
|
50
48
|
]
|
51
49
|
)
|
@@ -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
|
@@ -19,29 +19,25 @@
|
|
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
|
-
|
43
|
-
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
# end
|
47
|
-
# end
|
22
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/wx/control_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Wx
|
28
|
+
class OperationExpression < Expression
|
29
|
+
def can_interpret?(parent, keyword, *args, &block)
|
30
|
+
(
|
31
|
+
parent.is_a?(Glimmer::Wx::ControlProxy)
|
32
|
+
) and
|
33
|
+
block.nil? and
|
34
|
+
parent.respond_to?(keyword, *args)
|
35
|
+
end
|
36
|
+
|
37
|
+
def interpret(parent, keyword, *args, &block)
|
38
|
+
parent.send(keyword, *args)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -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
|
@@ -29,11 +29,18 @@ module Glimmer
|
|
29
29
|
def can_interpret?(parent, keyword, *args, &block)
|
30
30
|
parent.is_a?(Glimmer::Wx::ControlProxy) and
|
31
31
|
block.nil? and
|
32
|
-
|
32
|
+
(
|
33
|
+
parent.respond_to?("#{keyword}=", *args) or
|
34
|
+
parent.respond_to?("set_#{keyword}", *args)
|
35
|
+
)
|
33
36
|
end
|
34
37
|
|
35
38
|
def interpret(parent, keyword, *args, &block)
|
36
|
-
parent.
|
39
|
+
if parent.respond_to?("#{keyword}=", *args)
|
40
|
+
parent.send("#{keyword}=", *args)
|
41
|
+
else
|
42
|
+
parent.send("set_#{keyword}", *args)
|
43
|
+
end
|
37
44
|
end
|
38
45
|
end
|
39
46
|
end
|
@@ -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
|
@@ -19,24 +19,25 @@
|
|
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
|
-
|
22
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/data_binding/model_binding'
|
24
|
+
require 'glimmer/data_binding/shine'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module Wx
|
29
|
+
class ShineDataBindingExpression < Expression
|
30
|
+
def can_interpret?(parent, keyword, *args, &block)
|
31
|
+
keyword != 'content' and
|
32
|
+
args.size == 0 and
|
33
|
+
block.nil? and
|
34
|
+
parent.respond_to?(keyword, *args, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
def interpret(parent, keyword, *args, &block)
|
38
|
+
Glimmer::DataBinding::Shine.new(parent, keyword)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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/expression'
|
23
|
+
require 'glimmer/wx/control_proxy'
|
24
|
+
require 'glimmer/wx/sizer_proxy'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module Wx
|
29
|
+
class SizerAddableExpression < Expression
|
30
|
+
def can_interpret?(parent, keyword, *args, &block)
|
31
|
+
parent.is_a?(Glimmer::Wx::SizerProxy) and
|
32
|
+
block.nil? and
|
33
|
+
parent.can_add_sizer_addable?(keyword)
|
34
|
+
end
|
35
|
+
|
36
|
+
def interpret(parent, keyword, *args, &block)
|
37
|
+
parent.add_sizer_addable(keyword, *args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -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
|
@@ -29,7 +29,10 @@ module Glimmer
|
|
29
29
|
class SizerArgsExpression < StaticExpression
|
30
30
|
def can_interpret?(parent, keyword, *args, &block)
|
31
31
|
keyword == 'sizer_args' and
|
32
|
-
|
32
|
+
(
|
33
|
+
parent.is_a?(Glimmer::Wx::ControlProxy) or
|
34
|
+
parent.is_a?(Glimmer::Wx::SizerProxy)
|
35
|
+
) and
|
33
36
|
parent&.parent_proxy&.is_a?(Glimmer::Wx::SizerProxy)
|
34
37
|
end
|
35
38
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright (c) 2021-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/wx/control_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Wx
|
26
|
+
class ControlProxy
|
27
|
+
# Proxy for Wx slider double objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class SliderProxy < ControlProxy
|
31
|
+
include ::Wx::IDHelper
|
32
|
+
|
33
|
+
class << self
|
34
|
+
def new_control(keyword, parent, args)
|
35
|
+
args = args.clone || []
|
36
|
+
if args.last.is_a?(Hash)
|
37
|
+
args[-1] = args[-1].clone
|
38
|
+
end
|
39
|
+
value = 0
|
40
|
+
min = 0
|
41
|
+
max = 100
|
42
|
+
style = 0
|
43
|
+
::Wx.const_get(wx_constant_symbol(keyword)).new(parent, next_id, value, min, max, style: style)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def data_bind_write(property, model_binding)
|
48
|
+
handle_listener('on_slider') { model_binding.call(value) } if property == 'value'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2021-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/wx/control_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Wx
|
26
|
+
class ControlProxy
|
27
|
+
# Proxy for Wx spin ctrl double objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class SpinCtrlDoubleProxy < ControlProxy
|
31
|
+
def data_bind_write(property, model_binding)
|
32
|
+
if property == 'value'
|
33
|
+
handle_listener('on_spinctrldouble') { model_binding.call(value) }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2021-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/wx/control_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Wx
|
26
|
+
class ControlProxy
|
27
|
+
# Proxy for Wx spin ctrl objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class SpinCtrlProxy < ControlProxy
|
31
|
+
def data_bind_write(property, model_binding)
|
32
|
+
if property == 'value'
|
33
|
+
handle_listener('on_spinctrl') { model_binding.call(value) }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2021-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/wx/control_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Wx
|
26
|
+
class ControlProxy
|
27
|
+
# Proxy for Wx text ctrl objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class TextCtrlProxy < ControlProxy
|
31
|
+
def data_bind_write(property, model_binding)
|
32
|
+
handle_listener('on_text') { model_binding.call(value) } if property == 'value'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
|
@@ -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
|
@@ -214,14 +214,14 @@ module Glimmer
|
|
214
214
|
end
|
215
215
|
|
216
216
|
def content(&block)
|
217
|
-
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::
|
217
|
+
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Wx::ControlExpression.new, @keyword, {post_add_content: @content_added}, &block)
|
218
218
|
end
|
219
219
|
|
220
220
|
private
|
221
221
|
|
222
222
|
def build_control
|
223
223
|
# must pass control_proxy.wx as parent because the direct parent might be a sizer
|
224
|
-
@wx =
|
224
|
+
@wx = self.class.control_proxy_class(keyword).new_control(@keyword, control_proxy&.wx, @args)
|
225
225
|
end
|
226
226
|
end
|
227
227
|
end
|
data/lib/glimmer/wx/parent.rb
CHANGED
@@ -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
|
@@ -61,6 +61,10 @@ module Glimmer
|
|
61
61
|
"#{keyword.to_s.camelcase(:upper)}Proxy".to_sym
|
62
62
|
end
|
63
63
|
|
64
|
+
def sizer_addable_method(keyword)
|
65
|
+
"add_#{keyword}"
|
66
|
+
end
|
67
|
+
|
64
68
|
def keyword(constant_symbol)
|
65
69
|
constant_symbol.to_s.underscore.sub(/_proxy$/, '')
|
66
70
|
end
|
@@ -136,6 +140,18 @@ module Glimmer
|
|
136
140
|
@wx.add(control_proxy.wx, *args)
|
137
141
|
end
|
138
142
|
|
143
|
+
# Checks if it can add a sizer addable (visual things other than controls)
|
144
|
+
# Example: for keyword `growable_col`, sizer addable method is `add_growable_col`
|
145
|
+
def can_add_sizer_addable?(keyword)
|
146
|
+
@wx.respond_to?(SizerProxy.sizer_addable_method(keyword))
|
147
|
+
end
|
148
|
+
|
149
|
+
# Adds a sizer addable (visual things other than controls)
|
150
|
+
# Example: for keyword `growable_col`, sizer addable method is `add_growable_col`
|
151
|
+
def add_sizer_addable(keyword, *args)
|
152
|
+
@wx.send(SizerProxy.sizer_addable_method(keyword), *args)
|
153
|
+
end
|
154
|
+
|
139
155
|
private
|
140
156
|
|
141
157
|
def build_sizer
|
data/lib/glimmer-dsl-wx.rb
CHANGED