glimmer-dsl-wx 0.0.2
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 +7 -0
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +20 -0
- data/README.md +120 -0
- data/VERSION +1 -0
- data/bin/girb +30 -0
- data/bin/girb_runner.rb +47 -0
- data/glimmer-dsl-wx.gemspec +0 -0
- data/icons/glimmer.png +0 -0
- data/lib/glimmer/dsl/wx/bind_expression.rb +36 -0
- data/lib/glimmer/dsl/wx/control_expression.rb +63 -0
- data/lib/glimmer/dsl/wx/data_binding_expression.rb +45 -0
- data/lib/glimmer/dsl/wx/dsl.rb +50 -0
- data/lib/glimmer/dsl/wx/listener_expression.rb +41 -0
- data/lib/glimmer/dsl/wx/observe_expression.rb +35 -0
- data/lib/glimmer/dsl/wx/operation_expression.rb +47 -0
- data/lib/glimmer/dsl/wx/property_expression.rb +48 -0
- data/lib/glimmer/dsl/wx/shine_data_binding_expression.rb +42 -0
- data/lib/glimmer/proc_tracker.rb +39 -0
- data/lib/glimmer/wx/control_proxy.rb +409 -0
- data/lib/glimmer/wx/data_bindable.rb +69 -0
- data/lib/glimmer/wx/parent.rb +36 -0
- data/lib/glimmer-dsl-wx/ext/glimmer.rb +7 -0
- data/lib/glimmer-dsl-wx.rb +53 -0
- data/samples/art/wxruby-128x128.png +0 -0
- data/samples/art/wxruby-256x256.png +0 -0
- data/samples/art/wxruby-64x64.png +0 -0
- data/samples/art/wxruby.ico +0 -0
- data/samples/art/wxruby.png +0 -0
- data/samples/minimal/mondrian.ico +0 -0
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +24 -0
- data/samples/minimal/tn_minimal.png +0 -0
- data/samples/minimal/tn_nothing.png +0 -0
- metadata +280 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a58eca665a94827505984c32aca6e70f41b74227adefc3847d6c36272ccd0125
|
4
|
+
data.tar.gz: c92afe6e99a78d32b07df6f6e30a70cbd73a65f136dc4f20cdac02a591bc099c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4720d808e123c3a67baf8e0fc99b4a5c12c5d1929ba1279cc4ac47fdc24d7fffb61c1aa11d9d303bbbfcd2ad71cf5742b5073e36717ea31bda97b54776ef9b10
|
7
|
+
data.tar.gz: eed7d3e70d290ac90fe36a2a8502c516febccc4a09f8fc9667cd15886d250a3b3683c245cc72930fe99fe578e48588b7612bdb86a026e38226d3b61fd6667e79
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,120 @@
|
|
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.2
|
2
|
+
## wxWidgets Ruby Desktop Development GUI Library
|
3
|
+
[](http://badge.fury.io/rb/glimmer-dsl-wx)
|
4
|
+
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
|
+
|
6
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [WX](https://www.wxwidgets.org/) is an [MRI Ruby](https://www.ruby-lang.org) desktop development GUI (Graphical User Interface) library for the cross-platform native widget [wxWidgets](https://www.wxwidgets.org/) GUI toolkit. It provides a Glimmer GUI DSL on top of the [wxruby3](https://github.com/mcorino/wxRuby3) binding.
|
7
|
+
|
8
|
+
[Glimmer DSL for WX](https://rubygems.org/gems/glimmer-dsl-wx) 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:
|
9
|
+
- [Declarative DSL syntax](#glimmer-gui-dsl-concepts) that visually maps to the GUI control hierarchy
|
10
|
+
- [Convention over configuration](#smart-defaults-and-conventions) via smart defaults and automation of low-level details
|
11
|
+
- Requiring the [least amount of syntax](#glimmer-gui-dsl-concepts) possible to build GUI
|
12
|
+
- [Custom Control](#custom-keywords) support
|
13
|
+
- [Bidirectional/Unidirectional Data-Binding](#data-binding) to declaratively wire and automatically synchronize GUI Views with Models
|
14
|
+
- Scaffolding for new custom controls, apps, and gems
|
15
|
+
- Native-Executable packaging on Mac, Windows, and Linux.
|
16
|
+
|
17
|
+
Nothing Sample:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require 'glimmer-dsl-wx'
|
21
|
+
|
22
|
+
include Glimmer
|
23
|
+
|
24
|
+
frame
|
25
|
+
```
|
26
|
+
|
27
|
+
**[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
|
28
|
+
DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
29
|
+
----|-----------|---------|------------------|------|------|--------
|
30
|
+
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
31
|
+
[Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
|
32
|
+
[Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
|
33
|
+
[Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Complicated Setup / Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
|
34
|
+
[Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
|
35
|
+
[Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
|
36
|
+
[Glimmer DSL for WX (wxWidgets Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-wx) | Mac / Windows / Linux | Yes | Yes | Fast Startup Time / Light Memory Footprint | wxruby3 is still beta and does not support Mac yet | wxWidgets library, Doxygen, and other prereqs
|
37
|
+
[Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
|
38
|
+
[Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-swing) | Mac / Windows / Linux | No | Yes (Java2D) | Very Mature | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby
|
39
|
+
[Glimmer DSL for XML (& HTML)](https://github.com/AndyObtiva/glimmer-dsl-xml) | All Web Browsers | No | Yes (SVG) | Programmable / Lighter-weight Than Actual XML | XML Elements Are Sometimes Not Well-Named (Many Types of Input) | None
|
40
|
+
[Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) | All Web Browsers | No | Yes | Programmable | CSS Is Over-Engineered / Too Many Features To Learn | None
|
41
|
+
|
42
|
+
## Table of Contents
|
43
|
+
|
44
|
+
- [Glimmer DSL for WX](#)
|
45
|
+
- [Process](#process)
|
46
|
+
- [Resources](#resources)
|
47
|
+
- [Help](#help)
|
48
|
+
- [Issues](#issues)
|
49
|
+
- [Chat](#chat)
|
50
|
+
- [Planned Features and Feature Suggestions](#planned-features-and-feature-suggestions)
|
51
|
+
- [Change Log](#change-log)
|
52
|
+
- [Contributing](#contributing)
|
53
|
+
- [Contributors](#contributors)
|
54
|
+
- [License](#license)
|
55
|
+
|
56
|
+
## Process
|
57
|
+
|
58
|
+
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
59
|
+
|
60
|
+
## Resources
|
61
|
+
|
62
|
+
- [Code Master Blog](https://andymaleh.blogspot.com)
|
63
|
+
- [wxruby3 Bindings](https://github.com/mcorino/wxRuby3)
|
64
|
+
- [wxWidgets GUI Toolkit](https://www.wxwidgets.org/)
|
65
|
+
|
66
|
+
## Help
|
67
|
+
|
68
|
+
### Issues
|
69
|
+
|
70
|
+
If you encounter [issues](https://github.com/AndyObtiva/glimmer-dsl-wx/issues) that are not reported, discover missing features that are not mentioned in [TODO.md](TODO.md), or think up better ways to use [wxWidgets](https://www.wxwidgets.org/) than what is possible with [Glimmer DSL for WX](https://rubygems.org/gems/glimmer-dsl-wx), you may submit an [issue](https://github.com/AndyObtiva/glimmer-dsl-wx/issues/new) or [pull request](https://github.com/AndyObtiva/glimmer-dsl-wx/compare) on [GitHub](https://github.com). In the meantime, you may try older gem versions of [Glimmer DSL for WX](https://rubygems.org/gems/glimmer-dsl-wx) till you find one that works.
|
71
|
+
|
72
|
+
### Chat
|
73
|
+
|
74
|
+
If you need live help, try to [](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
75
|
+
|
76
|
+
## Planned Features and Feature Suggestions
|
77
|
+
|
78
|
+
These features have been planned or suggested. You might see them in a future version of [Glimmer DSL for WX](https://rubygems.org/gems/glimmer-dsl-wx). You are welcome to contribute more feature suggestions.
|
79
|
+
|
80
|
+
[TODO.md](TODO.md)
|
81
|
+
|
82
|
+
## Change Log
|
83
|
+
|
84
|
+
[CHANGELOG.md](CHANGELOG.md)
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
|
88
|
+
If you would like to contribute to the project, please adhere to the [Open-Source Etiquette](https://github.com/AndyObtiva/open-source-etiquette) to ensure the best results.
|
89
|
+
|
90
|
+
- Check out the latest master to make sure the feature hasn't been
|
91
|
+
implemented or the bug hasn't been fixed yet.
|
92
|
+
- Check out the issue tracker to make sure someone already hasn't
|
93
|
+
requested it and/or contributed it.
|
94
|
+
- Fork the project.
|
95
|
+
- Start a feature/bugfix branch.
|
96
|
+
- Commit and push until you are happy with your contribution.
|
97
|
+
- Make sure to add tests for it. This is important so I don't break it
|
98
|
+
in a future version unintentionally.
|
99
|
+
- Please try not to mess with the Rakefile, version, or history. If
|
100
|
+
you want to have your own version, or is otherwise necessary, that
|
101
|
+
is fine, but please isolate to its own commit so I can cherry-pick
|
102
|
+
around it.
|
103
|
+
|
104
|
+
Note that the latest development sometimes takes place in the [development](https://github.com/AndyObtiva/glimmer-dsl-wx/tree/development) branch (usually deleted once merged back to [master](https://github.com/AndyObtiva/glimmer-dsl-wx)).
|
105
|
+
|
106
|
+
## Contributors
|
107
|
+
|
108
|
+
* [Andy Maleh](https://github.com/AndyObtiva) (Founder)
|
109
|
+
|
110
|
+
[Click here to view contributor commits.](https://github.com/AndyObtiva/glimmer-dsl-wx/graphs/contributors)
|
111
|
+
|
112
|
+
## License
|
113
|
+
|
114
|
+
[MIT](LICENSE.txt)
|
115
|
+
|
116
|
+
Copyright (c) 2023 Andy Maleh
|
117
|
+
|
118
|
+
--
|
119
|
+
|
120
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (DSL Framework).
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
data/bin/girb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
# This script was written for Windows and Linux only
|
25
|
+
|
26
|
+
require_relative 'girb_runner'
|
27
|
+
|
28
|
+
require 'irb'
|
29
|
+
|
30
|
+
IRB.start('.')
|
data/bin/girb_runner.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (c) 2021-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 'puts_debuggerer'
|
23
|
+
require 'fileutils'
|
24
|
+
require 'etc'
|
25
|
+
|
26
|
+
require_relative '../lib/glimmer-dsl-libui'
|
27
|
+
|
28
|
+
include Glimmer
|
29
|
+
|
30
|
+
GIRB_RUNNER_EXIT_FILE = "#{Dir.home}/.girb_runner_exit"
|
31
|
+
FileUtils.rm_rf GIRB_RUNNER_EXIT_FILE
|
32
|
+
|
33
|
+
@exit_method = method(:exit)
|
34
|
+
|
35
|
+
@exit_girb_block = lambda do
|
36
|
+
FileUtils.touch GIRB_RUNNER_EXIT_FILE
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.exit(*args)
|
40
|
+
@exit_girb_block.call
|
41
|
+
@exit_method.call(*args)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.quit(*args)
|
45
|
+
@exit_girb_block.call
|
46
|
+
@exit_method.call(*args)
|
47
|
+
end
|
Binary file
|
data/icons/glimmer.png
ADDED
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Copyright (c) 2021-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
|
+
# require 'glimmer/dsl/bind_expression'
|
24
|
+
#
|
25
|
+
# module Glimmer
|
26
|
+
# module DSL
|
27
|
+
# module Libui
|
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
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Copyright (c) 2021-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/expression'
|
23
|
+
require 'glimmer/dsl/parent_expression'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Wx
|
28
|
+
class ControlExpression < Expression
|
29
|
+
include ParentExpression
|
30
|
+
|
31
|
+
def can_interpret?(parent, keyword, *args, &block)
|
32
|
+
# Glimmer::Wx::ControlProxy.exists?(keyword)
|
33
|
+
::Wx.constants.include?(keyword.capitalize.to_sym)
|
34
|
+
end
|
35
|
+
|
36
|
+
def interpret(parent, keyword, *args, &block)
|
37
|
+
# Glimmer::Wx::ControlProxy.create(keyword, parent, args, &block)
|
38
|
+
control = ::Wx.const_get(keyword.capitalize.to_sym).new(nil)
|
39
|
+
control.show if keyword == 'frame'
|
40
|
+
control
|
41
|
+
end
|
42
|
+
|
43
|
+
def around(parent, keyword, args, block, &interpret_and_add_content)
|
44
|
+
if keyword == 'frame'
|
45
|
+
::Wx::App.run do
|
46
|
+
interpret_and_add_content.call
|
47
|
+
end
|
48
|
+
else
|
49
|
+
interpret_and_add_content.call
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# def add_content(parent, keyword, *args, &block)
|
54
|
+
# options = args.last.is_a?(Hash) ? args.last : {post_add_content: true}
|
55
|
+
# super
|
56
|
+
# parent&.post_add_content if options[:post_add_content]
|
57
|
+
# end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# require 'glimmer/wx/control_proxy'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Copyright (c) 2021-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/expression'
|
23
|
+
# require 'glimmer/data_binding/model_binding'
|
24
|
+
#
|
25
|
+
# module Glimmer
|
26
|
+
# module DSL
|
27
|
+
# module Libui
|
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
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Copyright (c) 2021-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/engine'
|
23
|
+
# Dir[File.expand_path('*_expression.rb', __dir__)].each {|f| require f}
|
24
|
+
require 'glimmer/dsl/wx/control_expression'
|
25
|
+
|
26
|
+
# Glimmer DSL expression configuration module
|
27
|
+
#
|
28
|
+
# When DSL engine interprets an expression, it attempts to handle
|
29
|
+
# with expressions listed here in the order specified.
|
30
|
+
|
31
|
+
# Every expression has a corresponding Expression subclass
|
32
|
+
# in glimmer/dsl
|
33
|
+
|
34
|
+
module Glimmer
|
35
|
+
module DSL
|
36
|
+
module Wx
|
37
|
+
Engine.add_dynamic_expressions(
|
38
|
+
Wx,
|
39
|
+
# listener
|
40
|
+
# data_binding
|
41
|
+
# shine_data_binding
|
42
|
+
# property
|
43
|
+
# operation
|
44
|
+
%w[
|
45
|
+
control
|
46
|
+
]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2021-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/expression'
|
23
|
+
# require 'glimmer/libui/control_proxy'
|
24
|
+
#
|
25
|
+
# module Glimmer
|
26
|
+
# module DSL
|
27
|
+
# module Libui
|
28
|
+
# class ListenerExpression < Expression
|
29
|
+
# def can_interpret?(parent, keyword, *args, &block)
|
30
|
+
# (parent.is_a?(Glimmer::LibUI::ControlProxy) or parent.is_a?(Glimmer::LibUI::Shape)) 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
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (c) 2021-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
|
+
# require 'glimmer/dsl/top_level_expression'
|
24
|
+
# require 'glimmer/dsl/observe_expression'
|
25
|
+
#
|
26
|
+
# module Glimmer
|
27
|
+
# module DSL
|
28
|
+
# module Libui
|
29
|
+
# class ObserveExpression < StaticExpression
|
30
|
+
# include TopLevelExpression
|
31
|
+
# include Glimmer::DSL::ObserveExpression
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
# end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (c) 2021-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/expression'
|
23
|
+
# require 'glimmer/libui/control_proxy'
|
24
|
+
# require 'glimmer/libui/shape'
|
25
|
+
# require 'glimmer/libui/attributed_string'
|
26
|
+
#
|
27
|
+
# module Glimmer
|
28
|
+
# module DSL
|
29
|
+
# module Libui
|
30
|
+
# class OperationExpression < Expression
|
31
|
+
# def can_interpret?(parent, keyword, *args, &block)
|
32
|
+
# (
|
33
|
+
# parent.is_a?(Glimmer::LibUI::ControlProxy) or
|
34
|
+
# parent.is_a?(Glimmer::LibUI::Shape) or
|
35
|
+
# parent.is_a?(Glimmer::LibUI::AttributedString)
|
36
|
+
# ) and
|
37
|
+
# block.nil? and
|
38
|
+
# parent.respond_to?(keyword, *args)
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# def interpret(parent, keyword, *args, &block)
|
42
|
+
# parent.send(keyword, *args)
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
# end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright (c) 2021-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/expression'
|
23
|
+
# require 'glimmer/libui/control_proxy'
|
24
|
+
# require 'glimmer/libui/shape'
|
25
|
+
# require 'glimmer/libui/attributed_string'
|
26
|
+
#
|
27
|
+
# module Glimmer
|
28
|
+
# module DSL
|
29
|
+
# module Libui
|
30
|
+
# class PropertyExpression < Expression
|
31
|
+
# def can_interpret?(parent, keyword, *args, &block)
|
32
|
+
# (
|
33
|
+
# parent.is_a?(Glimmer::LibUI::ControlProxy) or
|
34
|
+
# parent.is_a?(Glimmer::LibUI::Shape) or
|
35
|
+
# parent.is_a?(Glimmer::LibUI::AttributedString) or
|
36
|
+
# parent.is_a?(Glimmer::LibUI::CustomControl)
|
37
|
+
# ) and
|
38
|
+
# block.nil? and
|
39
|
+
# parent.respond_to?("#{keyword}=", *args)
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# def interpret(parent, keyword, *args, &block)
|
43
|
+
# parent.send("#{keyword}=", *args)
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
# end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright (c) 2021-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/expression'
|
23
|
+
# require 'glimmer/data_binding/model_binding'
|
24
|
+
# require 'glimmer/data_binding/shine'
|
25
|
+
#
|
26
|
+
# module Glimmer
|
27
|
+
# module DSL
|
28
|
+
# module Libui
|
29
|
+
# class ShineDataBindingExpression < Expression
|
30
|
+
# def can_interpret?(parent, keyword, *args, &block)
|
31
|
+
# args.size == 0 and
|
32
|
+
# block.nil? and
|
33
|
+
# parent.respond_to?(keyword, *args, &block)
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# def interpret(parent, keyword, *args, &block)
|
37
|
+
# Glimmer::DataBinding::Shine.new(parent, keyword)
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
# end
|