glimmer-dsl-opal 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +50 -43
- data/VERSION +1 -1
- data/lib/display.rb +1 -1
- data/lib/glimmer-dsl-opal.rb +2 -1
- data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
- data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +3 -2
- data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +4 -4
- data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed/contact.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +78 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
- data/lib/glimmer-dsl-swt.rb +1 -1
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dialog_expression.rb +20 -0
- data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dsl.rb +1 -1
- data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/menu_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/swt_expression.rb +4 -4
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
- data/lib/glimmer/swt.rb +1 -1
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/control_editor.rb +1 -1
- data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
- data/lib/glimmer/swt/custom/radio_group.rb +1 -1
- data/lib/glimmer/swt/dialog_proxy.rb +173 -0
- data/lib/glimmer/swt/display_proxy.rb +4 -0
- data/lib/glimmer/swt/font_proxy.rb +1 -1
- data/lib/glimmer/swt/label_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_dialog_proxy.rb +42 -0
- data/lib/glimmer/swt/latest_message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_shell_proxy.rb +1 -1
- data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_item_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_proxy.rb +1 -1
- data/lib/glimmer/swt/message_box_proxy.rb +3 -7
- data/lib/glimmer/swt/row_layout_proxy.rb +22 -2
- data/lib/glimmer/swt/shell_proxy.rb +13 -1
- data/lib/glimmer/swt/style_constantizable.rb +1 -1
- data/lib/glimmer/swt/swt_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
- data/lib/glimmer/swt/table_editor.rb +1 -1
- data/lib/glimmer/swt/table_item_proxy.rb +1 -1
- data/lib/glimmer/swt/table_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +3 -2
- data/lib/glimmer/ui/custom_shell.rb +1 -1
- data/lib/glimmer/ui/custom_widget.rb +1 -1
- data/lib/glimmer/util/proc_tracker.rb +1 -1
- data/lib/net/http.rb +1 -1
- data/lib/os.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cf10a8e6a840bef3b7a757f55dec62651a334bce49f52d2ebac77ef6d68d0a3
|
4
|
+
data.tar.gz: 02c7196499a96d53a3cc00d761af4cda2c6baa90a7d3587faee4d67b6d0e2615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dab1f9539fa2be9a6ae67e485011ebb3ab2f3322a35f3d266e2a1bb1b64bc408ffb47f4e3ddd3f67b103b21c2ce68de154b4bfd77736f8bf12a18b0dc611161
|
7
|
+
data.tar.gz: 9651ec109a222fd805ef90e82c1898329648399a92c1008ac884b69b3e39bca3d119769169f52ae913fe8e523c72fcafdf0c82f6f066e80255e208414f11f5e6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.10.0
|
4
|
+
|
5
|
+
- Hello, Dialog! Sample
|
6
|
+
- Support `dialog` widget
|
7
|
+
- Support `width` and `height` on `layout_data` for `row_layout`
|
8
|
+
- Support `center` for `row_layout`
|
9
|
+
|
3
10
|
## 0.9.3
|
4
11
|
|
5
12
|
- Extracted pure Ruby Struct to pure-struct gem (since it's also used by YASL)
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 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 Opal 0.10.0 (Pure Ruby Web GUI)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
|
3
3
|
[![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)
|
4
4
|
|
@@ -141,50 +141,17 @@ Hello, Table! Game Booked
|
|
141
141
|
|
142
142
|
NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
|
143
143
|
|
144
|
-
**Alpha Version** 0.
|
145
|
-
|
146
|
-
[Hello samples](#hello-samples):
|
147
|
-
|
148
|
-
- [Hello, World!](#hello-world)
|
149
|
-
- [Hello, Combo!](#hello-combo)
|
150
|
-
- [Hello, Computed!](#hello-computed)
|
151
|
-
- [Hello, List Single Selection!](#hello-list-single-selection)
|
152
|
-
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
153
|
-
- [Hello, Browser!](#hello-browser)
|
154
|
-
- [Hello, Tab!](#hello-tab)
|
155
|
-
- [Hello, Custom Widget!](#hello-custom-widget)
|
156
|
-
- [Hello, Custom Shell!](#hello-custom-shell)
|
157
|
-
- [Hello, Radio!](#hello-radio)
|
158
|
-
- [Hello, Radio Group!](#hello-radio-group)
|
159
|
-
- [Hello, Group!](#hello-group)
|
160
|
-
- [Hello, Checkbox!](#hello-checkbox)
|
161
|
-
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
162
|
-
- [Hello, Date Time!](#hello-date-time)
|
163
|
-
- [Hello, Table!](#hello-table)
|
164
|
-
- [Hello, Button!](#hello-button)
|
165
|
-
- [Hello, Message Box!](#hello-message-box)
|
166
|
-
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
167
|
-
- [Hello, Menu Bar!](#hello-menu-bar)
|
168
|
-
|
169
|
-
[Elaborate samples](#elaborate-samples):
|
170
|
-
|
171
|
-
- [Login](#login)
|
172
|
-
- [Tic Tac Toe](#tic-tac-toe)
|
173
|
-
- [Contact Manager](#contact-manager)
|
174
|
-
|
175
|
-
[External samples](#external-samples):
|
176
|
-
|
177
|
-
- [Glimmer Calculator](#glimmer-calculator)
|
144
|
+
**Alpha Version** 0.10.0 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
|
178
145
|
|
179
146
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
180
|
-
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI
|
181
|
-
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
147
|
+
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
182
148
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
183
149
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
150
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
184
151
|
|
185
152
|
## Table of Contents
|
186
153
|
|
187
|
-
- [Glimmer DSL for Opal 0.
|
154
|
+
- [Glimmer DSL for Opal 0.10.0 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0100-pure-ruby-web-gui)
|
188
155
|
- [Principles](#principles)
|
189
156
|
- [Background](#background)
|
190
157
|
- [Pre-requisites](#pre-requisites)
|
@@ -212,6 +179,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
212
179
|
- [Hello, Message Box!](#hello-message-box)
|
213
180
|
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
214
181
|
- [Hello, Menu Bar!](#hello-menu-bar)
|
182
|
+
- [Hello, Dialog!](#hello-dialog)
|
215
183
|
- [Elaborate Samples](#elaborate-samples)
|
216
184
|
- [Login](#login)
|
217
185
|
- [Tic Tac Toe](#tic-tac-toe)
|
@@ -231,7 +199,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
231
199
|
|
232
200
|
## Principles
|
233
201
|
|
234
|
-
- **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to web browser technologies.
|
202
|
+
- **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to web browser technologies, thanks to [Opal](https://opalrb.com/).
|
235
203
|
- **Forget Routers!** Glimmer DSL for Opal supports auto-routing of custom shells (windows), which are opened as separate tabs in a web browser with automatically generated routes and bookmarkable URLs.
|
236
204
|
- **HTML is strictly made for creating documents not interactive applications**. As such, software engineers can avoid it and focus on creating web applications more productively with Glimmer DSL for Opal in pure Ruby instead (just like they do in desktop development) while content creators and web designers can be the ones responsible for creating HTML documents for web content purposes only as HTML was originally intended. That way, Glimmer web GUI is used and embedded in web pages when providing users with applications while the rest of the web pages are maintained by non-engineers as pure HTML. This achieves a correct separation of responsibilities and better productivity and maintainability.
|
237
205
|
- **Approximate styles by developers via the Glimmer GUI DSL. Perfect styles by designers via pure CSS**. Developers can simply build GUI with approximate styling similar to desktop GUI and mockups without worrying about pixel-perfect aesthetics. Web designers can take styling further with pure CSS since every HTML element auto-generated by Glimmer DSL for Opal has a predictable ID and CSS class. This achieves a proper separation of responsibilities between developers and designers.
|
@@ -239,7 +207,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
239
207
|
|
240
208
|
## Background
|
241
209
|
|
242
|
-
The original idea behind Glimmer DSL for Opal was that you start by having a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app that communicates with a Rails API for any web/cloud concerns. The pure Ruby [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is very simple, so it is more productive to build GUI in it since it does not go through a server/client request/response cycle and can be iterated on locally with a much shorter feedback cycle. Once the GUI and the rest of the app is built. You simply embed it in a Rails app as a one line require statement, and BOOM, it just works on the web inside a web browser with the same server/client communication you had in the desktop app (I am working on adding minimal support for net/http in Opal so that desktop apps that use it continue to work in a web browser. Until then, just use [Opal-jQuery](https://github.com/opal/opal-jquery) http support). That way, you get two apps for one: desktop and web.
|
210
|
+
The original idea behind Glimmer DSL for Opal (which later evolved) was that you start by having a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app that communicates with a Rails API for any web/cloud concerns. The pure Ruby [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is very simple, so it is more productive to build GUI in it since it does not go through a server/client request/response cycle and can be iterated on locally with a much shorter feedback cycle. Once the GUI and the rest of the app is built. You simply embed it in a Rails app as a one line require statement, and BOOM, it just works on the web inside a web browser with the same server/client communication you had in the desktop app (I am working on adding minimal support for net/http in Opal so that desktop apps that use it continue to work in a web browser. Until then, just use [Opal-jQuery](https://github.com/opal/opal-jquery) http support). That way, you get two apps for one: desktop and web.
|
243
211
|
|
244
212
|
Part of the idea is that web browsers just render GUI widgets similar to those of a desktop app (after all a web browser is a desktop app), so whether you run your GUI on the desktop or on the web should just be a low-level concern, hopefully automated completely with Glimmer DSL for Opal.
|
245
213
|
|
@@ -281,7 +249,7 @@ Add the following to `Gemfile`:
|
|
281
249
|
gem 'opal-rails', '~> 1.1.2'
|
282
250
|
gem 'opal-async', '~> 1.2.0'
|
283
251
|
gem 'opal-jquery', '~> 0.4.4'
|
284
|
-
gem 'glimmer-dsl-opal', '~> 0.
|
252
|
+
gem 'glimmer-dsl-opal', '~> 0.10.0'
|
285
253
|
gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
|
286
254
|
gem 'glimmer-dsl-css', '~> 1.1.0', require: false
|
287
255
|
|
@@ -354,6 +322,7 @@ Widgets:
|
|
354
322
|
- `composite`: featured in [Hello, Radio!](#hello-radio) / [Hello, Computed!](#hello-computed) / [Hello, Checkbox!](#hello-checkbox) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login) / [Contact Manager](#contact-manager)
|
355
323
|
- `date`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Tic Tac Toe](#tic-tac-toe)
|
356
324
|
- `date_drop_down`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
|
325
|
+
- `dialog`: featured in [Hello, Dialog!](#hello-dialog)
|
357
326
|
- `group`: featured in [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager)
|
358
327
|
- `label`: featured in [Hello, Computed!](#hello-computed) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, World!](#hello-world) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Login](#login)
|
359
328
|
- `list` (w/ optional `:multi` SWT style): featured in [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager)
|
@@ -2565,6 +2534,44 @@ You should see "Hello, Menu Bar!"
|
|
2565
2534
|
|
2566
2535
|
![Hello Menu Bar Help Menu](images/glimmer-dsl-opal-hello-menu-bar-help-menu.png)
|
2567
2536
|
|
2537
|
+
#### Hello, Dialog!
|
2538
|
+
|
2539
|
+
This sample demonstrates a modal dialog similar to message_box, but allows adding arbitrary widgets, not just a message.
|
2540
|
+
|
2541
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
2542
|
+
|
2543
|
+
```ruby
|
2544
|
+
require 'glimmer-dsl-opal/samples/hello/hello_dialog'
|
2545
|
+
```
|
2546
|
+
|
2547
|
+
Or add the Glimmer code directly if you prefer to play around with it:
|
2548
|
+
|
2549
|
+
```ruby
|
2550
|
+
|
2551
|
+
|
2552
|
+
```
|
2553
|
+
|
2554
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
2555
|
+
|
2556
|
+
![Hello Dialog](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-dialog.png)
|
2557
|
+
|
2558
|
+
![Hello Dialog Open Dialog](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-dialog-open-dialog.png)
|
2559
|
+
|
2560
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
2561
|
+
|
2562
|
+
Start the Rails server:
|
2563
|
+
```
|
2564
|
+
rails s
|
2565
|
+
```
|
2566
|
+
|
2567
|
+
Visit `http://localhost:3000`
|
2568
|
+
|
2569
|
+
You should see "Hello, Dialog!"
|
2570
|
+
|
2571
|
+
![Hello Dialog](images/glimmer-dsl-opal-hello-dialog.png)
|
2572
|
+
|
2573
|
+
![Hello Dialog Open Dialog](images/glimmer-dsl-opal-hello-dialog-open-dialog.png)
|
2574
|
+
|
2568
2575
|
### Elaborate Samples
|
2569
2576
|
|
2570
2577
|
#### Login
|
@@ -3409,9 +3416,9 @@ These features have been suggested. You might see them in a future version of Gl
|
|
3409
3416
|
|
3410
3417
|
[MIT](https://opensource.org/licenses/MIT)
|
3411
3418
|
|
3412
|
-
Copyright (c) 2020 - Andy Maleh.
|
3419
|
+
Copyright (c) 2020-2021 - Andy Maleh.
|
3413
3420
|
See [LICENSE.txt](LICENSE.txt) for further details.
|
3414
3421
|
|
3415
3422
|
--
|
3416
3423
|
|
3417
|
-
[<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) (
|
3424
|
+
[<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
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
data/lib/display.rb
CHANGED
data/lib/glimmer-dsl-opal.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
1
|
+
# Copyright (c) 2020-2021 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
|
@@ -82,6 +82,7 @@ if RUBY_ENGINE == 'opal'
|
|
82
82
|
require 'glimmer-dsl-css'
|
83
83
|
Element.alias_native :replace_with, :replaceWith
|
84
84
|
Element.alias_native :select
|
85
|
+
Element.alias_native :dialog
|
85
86
|
|
86
87
|
# Glimmer::Config.loop_max_count = 20 # TODO disable
|
87
88
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
1
|
+
# Copyright (c) 2020-2021 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
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
require 'glimmer/swt/latest_shell_proxy'
|
23
23
|
require 'glimmer/swt/latest_message_box_proxy'
|
24
|
+
require 'glimmer/swt/latest_dialog_proxy'
|
24
25
|
|
25
26
|
module Glimmer
|
26
27
|
module DSL
|
@@ -33,7 +34,7 @@ module Glimmer
|
|
33
34
|
dsl_stack.pop
|
34
35
|
end
|
35
36
|
end
|
36
|
-
if ['shell', 'message_box'].include?(keyword) && Glimmer::SWT::DisplayProxy.instance.shells.empty?
|
37
|
+
if ['shell', 'message_box', 'dialog'].include?(keyword) && Glimmer::SWT::DisplayProxy.instance.shells.empty?
|
37
38
|
Document.ready?(&work)
|
38
39
|
Glimmer::SWT.const_get("Latest#{keyword.camelcase(:upper)}Proxy").new
|
39
40
|
else
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c)
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
include Glimmer
|
23
|
+
|
24
|
+
shell {
|
25
|
+
row_layout :vertical
|
26
|
+
|
27
|
+
text 'Hello, Dialog!'
|
28
|
+
|
29
|
+
7.times { |n|
|
30
|
+
dialog_number = n + 1
|
31
|
+
|
32
|
+
button {
|
33
|
+
layout_data {
|
34
|
+
width 200
|
35
|
+
height 50
|
36
|
+
}
|
37
|
+
text "Dialog #{dialog_number}"
|
38
|
+
|
39
|
+
on_widget_selected {
|
40
|
+
dialog { |dialog_proxy|
|
41
|
+
row_layout(:vertical) {
|
42
|
+
center true
|
43
|
+
}
|
44
|
+
|
45
|
+
text "Dialog #{dialog_number}"
|
46
|
+
|
47
|
+
label {
|
48
|
+
text "Given `dialog` is modal, you cannot interact with the main window till the dialog is closed."
|
49
|
+
}
|
50
|
+
composite {
|
51
|
+
row_layout {
|
52
|
+
margin_height 0
|
53
|
+
margin_top 0
|
54
|
+
margin_bottom 0
|
55
|
+
}
|
56
|
+
|
57
|
+
label {
|
58
|
+
text "Unlike `message_box`, `dialog` can contain arbitrary widgets:"
|
59
|
+
}
|
60
|
+
radio {
|
61
|
+
text 'Radio'
|
62
|
+
}
|
63
|
+
checkbox {
|
64
|
+
text 'Checkbox'
|
65
|
+
}
|
66
|
+
}
|
67
|
+
button {
|
68
|
+
text 'Close'
|
69
|
+
|
70
|
+
on_widget_selected {
|
71
|
+
dialog_proxy.close
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}.open
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}.open
|