glimmer-dsl-libui 0.0.12 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8be478e9d224fabeac6b2d42b7ccae6f7063491c88b1ea14e90cf1665e379bdf
4
- data.tar.gz: b8b9b58fe072ec1973263ae20dbbe5407d7dceb30290420dd6734397cd850918
3
+ metadata.gz: 2ab738eba1965fffc98860a23a44f2e1ed15c0c426ba4d21bcbb3fc4812ecde5
4
+ data.tar.gz: 2d5c195882767b63d941d9b8bad8338bc5d5ce160e97f34a9f57f5631c833fac
5
5
  SHA512:
6
- metadata.gz: 534bf3ffa94019746c5a1291af5d8a676766221ea299e627cbb38dd1e3814f941688b8cf0182f243b942e73180f2f642c93598ca4d03a3a2df36cc249459316a
7
- data.tar.gz: 3d6a77dcaffdedc6149d2efdb05df1e01f6499114054d5d43f83d576abeed0791d7cc6138335087fbfbd4d29bd481b1c016e71fe4c40af963218fd6e5227b3be
6
+ metadata.gz: 23e1de3b8f30f90abb605a351e6cd9302dd778da2e711f7c72c4ad39b267090bab324bd056ca3855c343781c53757af320ca67c0d4aacac4c6351f7cf4a646e8
7
+ data.tar.gz: 18f3d9b8d48bc15a342efeb38f6979e1b2516b5144a790876d931c28a2803da840f980d0d9b9cd4c96484817d4cf241d19b7b64c751229fa1ae6a236029545ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.16
4
+
5
+ - Support ability to instantiate without args and set args as properties afterwards inside block (e.g. `window { title 'Greeter'; content_size 300, 400; button {text 'Greet'; on_clicked {puts 'Hi'}} }`)
6
+ - window (was supported before, but changed default title to empty string)
7
+ - button
8
+ - checkbox
9
+ - group
10
+ - label
11
+
12
+ ## 0.0.15
13
+
14
+ - New examples/form.rb
15
+ - Support `form` control and child attributes of `stretchy` and `label`
16
+ - Smart defaults for `form` child attributes `stretchy` (`true`) and `label` (`''`)
17
+
18
+ ## 0.0.14
19
+
20
+ - New examples/grid.rb
21
+ - Support `grid` control and child attributes of `left`, `top`, `xspan`, `yspan`, `hexpand`, `halign`, `vexpand`, and `valign`
22
+ - Smart defaults for `grid` child attributes `left` (`0`), `top` (`0`), `xspan` (`1`), `yspan` (`1`), `hexpand` (`false`), `halign` (`0`), `vexpand` (`false`), and `valign` (`0`)
23
+
24
+ ## 0.0.13
25
+
26
+ - Support examples/date_time_picker.rb
27
+ - Support `date_time_picker`, `date_picker`, and `time_picker` controls having `time`/`time=`/`set_time` property
28
+
3
29
  ## 0.0.12
4
30
 
5
31
  - Have examples/meta_example.rb allow code editing to enable experimentation and learning
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 LibUI 0.0.12
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 LibUI 0.0.16
2
2
  ## Prerequisite-Free Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-libui/maintainability)
@@ -43,7 +43,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
43
43
 
44
44
  ## Table of Contents
45
45
 
46
- - [Glimmer DSL for LibUI 0.0.12](#-glimmer-dsl-for-libui-0012)
46
+ - [Glimmer DSL for LibUI 0.0.16](#-glimmer-dsl-for-libui-0016)
47
47
  - [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
48
48
  - [Usage](#usage)
49
49
  - [API](#api)
@@ -53,6 +53,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
53
53
  - [Extra Dialogs](#extra-dialogs)
54
54
  - [Extra Operations](#extra-operations)
55
55
  - [Smart Defaults and Conventions](#smart-defaults-and-conventions)
56
+ - [API Gotchas](#api-gotchas)
56
57
  - [Original API](#original-api)
57
58
  - [Glimmer Style Guide](#glimmer-style-guide)
58
59
  - [Girb (Glimmer IRB)](#girb-glimmer-irb)
@@ -65,6 +66,9 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
65
66
  - [Control Gallery](#control-gallery)
66
67
  - [Font Button](#font-button)
67
68
  - [Color Button](#color-button)
69
+ - [Date Time Picker](#date-time-picker)
70
+ - [Grid](#grid)
71
+ - [Form](#form)
68
72
  - [Contributing to glimmer-dsl-libui](#contributing-to-glimmer-dsl-libui)
69
73
  - [Help](#help)
70
74
  - [Issues](#issues)
@@ -152,7 +156,7 @@ gem install glimmer-dsl-libui
152
156
  Or install via Bundler `Gemfile`:
153
157
 
154
158
  ```ruby
155
- gem 'glimmer-dsl-libui', '~> 0.0.12'
159
+ gem 'glimmer-dsl-libui', '~> 0.0.16'
156
160
  ```
157
161
 
158
162
  Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
@@ -186,7 +190,7 @@ Any control returned by a [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) keyword d
186
190
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
187
191
 
188
192
  ```ruby
189
- w = window('hello world', 300, 200, 1)
193
+ w = window('hello world')
190
194
  puts w.title # => hello world
191
195
  w.title = 'howdy'
192
196
  puts w.title # => howdy
@@ -199,7 +203,7 @@ Controls are wrapped as Ruby proxy objects, having a `#libui` method to obtain t
199
203
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
200
204
 
201
205
  ```ruby
202
- w = window('hello world', 300, 200, 1) # => #<Glimmer::LibUI::WindowProxy:0x00007fde4ea39fb0
206
+ w = window('hello world') # => #<Glimmer::LibUI::WindowProxy:0x00007fde4ea39fb0
203
207
  w.libui # => #<Fiddle::Pointer:0x00007fde53997980 ptr=0x00007fde51352a60 size=0 free=0x0000000000000000>
204
208
  ```
205
209
 
@@ -212,11 +216,13 @@ Control(Args) | Properties | Listeners
212
216
  `checkbox(text as String)` | `checked` (Boolean), `text` (`String`) | `on_toggled`
213
217
  `combobox` | `items` (`Array` of `String`), `selected` (`Integer`) | `on_selected`
214
218
  `color_button` | `color` (Array of `red` as `Float`, `green` as `Float`, `blue` as `Float`, `alpha` as `Float`), `red` as `Float`, `green` as `Float`, `blue` as `Float`, `alpha` as `Float` | `on_changed`
215
- `date_picker` | `time` (`LibUI::FFI::TM`) | `on_changed`
216
- `date_time_picker` | `time` (`LibUI::FFI::TM`) | `on_changed`
219
+ `date_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`, `mday` as `Integer`, `mon` as `Integer`, `year` as `Integer`, `wday` as `Integer`, `yday` as `Integer`, `dst` as Boolean) | `on_changed`
220
+ `date_time_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`, `mday` as `Integer`, `mon` as `Integer`, `year` as `Integer`, `wday` as `Integer`, `yday` as `Integer`, `dst` as Boolean) | `on_changed`
217
221
  `editable_combobox` | `items` (`Array` of `String`), `text` (`String`) | `on_changed`
218
222
  `entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
219
223
  `font_button` | `font` [read-only] (`Hash` of keys: `:family`, `:size`, `:weight`, `:italic`, `:stretch`), `family` as `String`, `size` as `Float`, `weight` as `Integer`, `italic` as `Integer`, `stretch` as `Integer` | `on_changed`
224
+ `form` | `padded` (Boolean) | None
225
+ `grid` | `padded` (Boolean) | None
220
226
  `group(text as String)` | `margined` (Boolean), `title` (`String`) | None
221
227
  `horizontal_box` | `padded` (Boolean) | None
222
228
  `horizontal_separator` | None | None
@@ -235,7 +241,7 @@ Control(Args) | Properties | Listeners
235
241
  `spinbox(min as Numeric, max as Numeric)` | `value` (`Numeric`) | `on_changed`
236
242
  `tab` | `margined` (Boolean), `num_pages` (`Integer`) | None
237
243
  `tab_item(name as String)` | `index` [read-only] (`Integer`), `margined` (Boolean), `name` [read-only] (`String`) | None
238
- `time_picker` | `time` (`LibUI::FFI::TM`) | `on_changed`
244
+ `time_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`, `mday` as `Integer`, `mon` as `Integer`, `year` as `Integer`, `wday` as `Integer`, `yday` as `Integer`, `dst` as Boolean) | `on_changed`
239
245
  `vertical_box` | `padded` (Boolean) | None
240
246
  `window(title as String, width as Integer, height as Integer, has_menubar as Boolean)` | `borderless` (Boolean), `content_size` (width `Numeric`, height `Numeric`), `fullscreen` (Boolean), `margined` (Boolean), `title` (`String`) | `on_closing`, `on_content_size_changed`
241
247
 
@@ -246,7 +252,15 @@ Control(Args) | Properties | Listeners
246
252
  - `parent` (`Fiddle::Pointer`)
247
253
  - `toplevel` [read-only] (Boolean)
248
254
  - `visible` (Boolean)
249
- - `stretchy` [dsl-only] (Boolean): available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `horizontal_box` or `vertical_box`
255
+ - `stretchy` [dsl-only] (Boolean) [default=`true`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `horizontal_box`, `vertical_box`, or `form`
256
+ - `left` [dsl-only] (`Integer`) [default=`0`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
257
+ - `top` [dsl-only] (`Integer`) [default=`0`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
258
+ - `xspan` [dsl-only] (`Integer`) [default=`1`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
259
+ - `yspan` [dsl-only] (`Integer`) [default=`1`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
260
+ - `hexpand` [dsl-only] (Boolean) [default=`false`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
261
+ - `halign` [dsl-only] (`Integer`) [default=`0`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
262
+ - `vexpand` [dsl-only] (Boolean) [default=`false`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
263
+ - `valign` [dsl-only] (`Integer`) [default=`0`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
250
264
 
251
265
  ### Common Control Operations
252
266
  - `destroy`
@@ -268,11 +282,13 @@ Control(Args) | Properties | Listeners
268
282
 
269
283
  ### Smart Defaults and Conventions
270
284
 
271
- - `horizontal_box` and `vertical_box` controls have `padded` as `true` upon instantiation to ensure more user-friendly GUI by default
285
+ - `horizontal_box`, `vertical_box`, `grid`, and `form` controls have `padded` as `true` upon instantiation to ensure more user-friendly GUI by default
272
286
  - `group` controls have `margined` as `true` upon instantiation to ensure more user-friendly GUI by default
273
- - All controls nested under a `horizontal_box` or `vertical_box` have `stretchy` property (passed to `box_append` method) as `true` by default (filling maximum space)
274
- - `window` constructor args can be left off and have the following defaults when unspecified: `title` as `'Glimmer'`, `width` as `150`, `height` as `150`, and `has_menubar` as `true`)
287
+ - All controls nested under a `horizontal_box`, `vertical_box`, and `form` have `stretchy` property (fill maximum space) as `true` by default (passed to `box_append`/`form_append` method)
288
+ - `window` instatiation args can be left off, having the following defaults when unspecified: `title` as `''`, `width` as `150`, `height` as `150`, and `has_menubar` as `true`)
275
289
  - `window` has an `on_closing` listener by default that quits application upon hitting the close button (can be overridden with a manual `on_closing` implementation that returns integer `0` for success)
290
+ - `group` has `title` property default to `''` if not specified in instantiation args, so it can be instantiated without args with `title` property specified in nested block (e.g. `group {title 'Address'; ...}`)
291
+ - `button`, `checkbox`, and `label` have `text` default to `''` if not specified in instantiation args, so they can be instantiated without args with `text` property specified in nested block (e.g. `button {text 'Greet'; on_clicked {puts 'Hello'}}`)
276
292
  - `quit_menu_item` has an `on_clicked` listener by default that quits application upon selecting the quit menu item (can be overridden with a manual `on_clicked` implementation that returns integer `0` for success)
277
293
  - If an `on_closing` listener was defined on `window` and it does not return an integer, default exit behavior is assumed (`window.destroy` is called followed by `LibUI.quit`, returning `0`).
278
294
  - If an `on_clicked` listener was defined on `quit_menu_item` and it does not return an integer, default exit behavior is assumed (`main_window.destroy` is called followed by `LibUI.quit`, returning `0`).
@@ -283,7 +299,14 @@ Control(Args) | Properties | Listeners
283
299
  - Automatically allocate color value pointers upon instantiating `color_button` controls and free them when destorying `color_button` controls
284
300
  - On the Mac, if no `menu` items were added, an automatic `quit_menu_item` is added to enable quitting with CTRL+Q
285
301
  - When destroying a control nested under a `horizontal_box` or `vertical_box`, it is automatically deleted from the box's children
302
+ - When destroying a control nested under a `form`, it is automatically deleted from the form's children
286
303
  - When destroying a control nested under a `window` or `group`, it is automatically unset as their child to allow successful destruction
304
+ - For `date_time_picker`, `date_picker`, and `time_picker`, make sure `time` hash values for `mon`, `wday`, and `yday` are 1-based instead of [libui](https://github.com/andlabs/libui) original 0-based values, and return `dst` as Boolean instead of `isdst` as `1`/`0`
305
+ - Smart defaults for `grid` child attributes are `left` (`0`), `top` (`0`), `xspan` (`1`), `yspan` (`1`), `hexpand` (`false`), `halign` (`0`), `vexpand` (`false`), and `valign` (`0`)
306
+
307
+ ### API Gotchas
308
+
309
+ There is no proper way to destroy `grid` children due to [libui](https://github.com/andlabs/libui) not offering any API for deleting them from `grid` (no `grid_delete` similar to `box_delete` for `horizontal_box` and `vertical_box`)
287
310
 
288
311
  ### Original API
289
312
 
@@ -653,7 +676,7 @@ window('Basic Entry', 300, 50) { |w|
653
676
  }
654
677
 
655
678
  button('Button') {
656
- stretchy false
679
+ stretchy false # stretchy property is available when control is nested under horizontal_box
657
680
 
658
681
  on_clicked do
659
682
  text = e.text
@@ -1465,8 +1488,6 @@ Linux
1465
1488
  New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
1466
1489
 
1467
1490
  ```ruby
1468
- # frozen_string_literal: true
1469
-
1470
1491
  require 'glimmer-dsl-libui'
1471
1492
 
1472
1493
  include Glimmer
@@ -1481,6 +1502,253 @@ window('color button', 230) {
1481
1502
  }.show
1482
1503
  ```
1483
1504
 
1505
+ ### Date Time Picker
1506
+
1507
+ [examples/date_time_picker.rb](examples/date_time_picker.rb)
1508
+
1509
+ Run with this command from the root of the project if you cloned the project:
1510
+
1511
+ ```
1512
+ ruby -r './lib/glimmer-dsl-libui' examples/date_time_picker.rb
1513
+ ```
1514
+
1515
+ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
1516
+
1517
+ ```
1518
+ ruby -r glimmer-dsl-libui -e "require 'examples/date_time_picker'"
1519
+ ```
1520
+
1521
+ Mac
1522
+
1523
+ ![glimmer-dsl-libui-mac-date-time-picker.png](images/glimmer-dsl-libui-mac-date-time-picker.png)
1524
+
1525
+ Linux
1526
+
1527
+ ![glimmer-dsl-libui-linux-date-time-picker.png](images/glimmer-dsl-libui-linux-date-time-picker.png)
1528
+
1529
+ [LibUI](https://github.com/kojix2/LibUI) Original Version:
1530
+
1531
+ ```ruby
1532
+ require 'libui'
1533
+
1534
+ UI = LibUI
1535
+
1536
+ UI.init
1537
+
1538
+ vbox = UI.new_vertical_box
1539
+
1540
+ date_time_picker = UI.new_date_time_picker
1541
+
1542
+ time = UI::FFI::TM.malloc
1543
+
1544
+ UI.date_time_picker_on_changed(date_time_picker) do
1545
+ UI.date_time_picker_time(date_time_picker, time)
1546
+ p sec: time.tm_sec,
1547
+ min: time.tm_min,
1548
+ hour: time.tm_hour,
1549
+ mday: time.tm_mday,
1550
+ mon: time.tm_mon,
1551
+ year: time.tm_year,
1552
+ wday: time.tm_wday,
1553
+ yday: time.tm_yday,
1554
+ isdst: time.tm_isdst
1555
+ end
1556
+ UI.box_append(vbox, date_time_picker, 1)
1557
+
1558
+ main_window = UI.new_window('Date Time Pickers', 300, 200, 1)
1559
+ UI.window_on_closing(main_window) do
1560
+ puts 'Bye Bye'
1561
+ UI.control_destroy(main_window)
1562
+ UI.quit
1563
+ 0
1564
+ end
1565
+ UI.window_set_child(main_window, vbox)
1566
+ UI.control_show(main_window)
1567
+
1568
+ UI.main
1569
+ UI.quit
1570
+ ```
1571
+
1572
+ [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
1573
+
1574
+ ```ruby
1575
+ require 'glimmer-dsl-libui'
1576
+
1577
+ include Glimmer
1578
+
1579
+ window('Date Time Pickers', 300, 200) {
1580
+ vertical_box {
1581
+ date_time_picker { |dtp|
1582
+ on_changed do
1583
+ time = dtp.time
1584
+ p time
1585
+ end
1586
+ }
1587
+ }
1588
+
1589
+ on_closing do
1590
+ puts 'Bye Bye'
1591
+ end
1592
+ }.show
1593
+ ```
1594
+
1595
+ ### Grid
1596
+
1597
+ [examples/grid.rb](examples/grid.rb)
1598
+
1599
+ Run with this command from the root of the project if you cloned the project:
1600
+
1601
+ ```
1602
+ ruby -r './lib/glimmer-dsl-libui' examples/grid.rb
1603
+ ```
1604
+
1605
+ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
1606
+
1607
+ ```
1608
+ ruby -r glimmer-dsl-libui -e "require 'examples/grid'"
1609
+ ```
1610
+
1611
+ Mac
1612
+
1613
+ ![glimmer-dsl-libui-mac-grid-spanning.png](images/glimmer-dsl-libui-mac-grid-spanning.png)
1614
+ ![glimmer-dsl-libui-mac-grid-expanding.png](images/glimmer-dsl-libui-mac-grid-expanding.png)
1615
+
1616
+ Linux
1617
+
1618
+ ![glimmer-dsl-libui-linux-grid-spanning.png](images/glimmer-dsl-libui-linux-grid-spanning.png)
1619
+ ![glimmer-dsl-libui-linux-grid-expanding.png](images/glimmer-dsl-libui-linux-grid-expanding.png)
1620
+
1621
+ New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
1622
+
1623
+ ```ruby
1624
+ require 'glimmer-dsl-libui'
1625
+
1626
+ include Glimmer
1627
+
1628
+ window('Grid') {
1629
+ tab {
1630
+ tab_item('Spanning') {
1631
+ grid {
1632
+ 4.times { |left_value|
1633
+ 4.times { |top_value|
1634
+ label("(#{left_value}, #{top_value}) xspan1\nyspan1") {
1635
+ left left_value
1636
+ top top_value
1637
+ hexpand true
1638
+ vexpand true
1639
+ }
1640
+ }
1641
+ }
1642
+ label("(0, 4) xspan2\nyspan1 more text fits horizontally") {
1643
+ left 0
1644
+ top 4
1645
+ xspan 2
1646
+ }
1647
+ label("(2, 4) xspan2\nyspan1 more text fits horizontally") {
1648
+ left 2
1649
+ top 4
1650
+ xspan 2
1651
+ }
1652
+ label("(0, 5) xspan1\nyspan2\nmore text\nfits vertically") {
1653
+ left 0
1654
+ top 5
1655
+ yspan 2
1656
+ }
1657
+ label("(0, 7) xspan1\nyspan2\nmore text\nfits vertically") {
1658
+ left 0
1659
+ top 7
1660
+ yspan 2
1661
+ }
1662
+ label("(1, 5) xspan3\nyspan4 a lot more text fits horizontally than before\nand\neven\na lot\nmore text\nfits vertically\nthan\nbefore") {
1663
+ left 1
1664
+ top 5
1665
+ xspan 3
1666
+ yspan 4
1667
+ }
1668
+ }
1669
+ }
1670
+ tab_item('Expanding') {
1671
+ grid {
1672
+ label("(0, 0) hexpand/vexpand\nall available horizontal space is taken\nand\nall\navailable\nvertical\nspace\nis\ntaken") {
1673
+ left 0
1674
+ top 0
1675
+ hexpand true
1676
+ vexpand true
1677
+ }
1678
+ label("(1, 0)") {
1679
+ left 1
1680
+ top 0
1681
+ }
1682
+ label("(0, 1)") {
1683
+ left 0
1684
+ top 1
1685
+ }
1686
+ label("(1, 1)") {
1687
+ left 1
1688
+ top 1
1689
+ }
1690
+ }
1691
+ }
1692
+ }
1693
+ }.show
1694
+ ```
1695
+
1696
+ ### Form
1697
+
1698
+ [examples/form.rb](examples/form.rb)
1699
+
1700
+ Run with this command from the root of the project if you cloned the project:
1701
+
1702
+ ```
1703
+ ruby -r './lib/glimmer-dsl-libui' examples/form.rb
1704
+ ```
1705
+
1706
+ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
1707
+
1708
+ ```
1709
+ ruby -r glimmer-dsl-libui -e "require 'examples/form'"
1710
+ ```
1711
+
1712
+ Mac
1713
+
1714
+ ![glimmer-dsl-libui-mac-form.png](images/glimmer-dsl-libui-mac-form.png)
1715
+ ![glimmer-dsl-libui-mac-form-msg-box.png](images/glimmer-dsl-libui-mac-form-msg-box.png)
1716
+
1717
+ Linux
1718
+
1719
+ ![glimmer-dsl-libui-linux-form.png](images/glimmer-dsl-libui-linux-form.png)
1720
+ ![glimmer-dsl-libui-linux-form-msg-box.png](images/glimmer-dsl-libui-linux-form-msg-box.png)
1721
+
1722
+ New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
1723
+
1724
+ ```ruby
1725
+ require 'glimmer-dsl-libui'
1726
+
1727
+ include Glimmer
1728
+
1729
+ window('Form') { |w|
1730
+ margined true
1731
+
1732
+ vertical_box {
1733
+ form {
1734
+ @first_name_entry = entry {
1735
+ label 'First Name' # label property is available when control is nested under form
1736
+ }
1737
+
1738
+ @last_name_entry = entry {
1739
+ label 'Last Name' # label property is available when control is nested under form
1740
+ }
1741
+ }
1742
+
1743
+ button('Display Name') {
1744
+ on_clicked do
1745
+ msg_box(w, 'Name', "#{@first_name_entry.text} #{@last_name_entry.text}")
1746
+ end
1747
+ }
1748
+ }
1749
+ }.show
1750
+ ```
1751
+
1484
1752
  ## Contributing to glimmer-dsl-libui
1485
1753
 
1486
1754
  - Check out the latest master to make sure the feature hasn't been
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.16
@@ -16,7 +16,7 @@ window('Basic Entry', 300, 50) { |w|
16
16
  }
17
17
 
18
18
  button('Button') {
19
- stretchy false
19
+ stretchy false # stretchy property is available when control is nested under horizontal_box
20
20
 
21
21
  on_clicked do
22
22
  text = e.text
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'glimmer-dsl-libui'
4
+
5
+ include Glimmer
6
+
7
+ window('Date Time Pickers', 300, 200) {
8
+ vertical_box {
9
+ date_time_picker { |dtp|
10
+ on_changed do
11
+ time = dtp.time
12
+ p time
13
+ end
14
+ }
15
+ }
16
+
17
+ on_closing do
18
+ puts 'Bye Bye'
19
+ end
20
+ }.show
data/examples/form.rb ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'glimmer-dsl-libui'
4
+
5
+ include Glimmer
6
+
7
+ window('Form') { |w|
8
+ margined true
9
+
10
+ vertical_box {
11
+ form {
12
+ @first_name_entry = entry {
13
+ label 'First Name' # label property is available when control is nested under form
14
+ }
15
+
16
+ @last_name_entry = entry {
17
+ label 'Last Name' # label property is available when control is nested under form
18
+ }
19
+ }
20
+
21
+ button('Display Name') {
22
+ on_clicked do
23
+ msg_box(w, 'Name', "#{@first_name_entry.text} #{@last_name_entry.text}")
24
+ end
25
+ }
26
+ }
27
+ }.show
data/examples/grid.rb ADDED
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'glimmer-dsl-libui'
4
+
5
+ include Glimmer
6
+
7
+ window('Grid') {
8
+ tab {
9
+ tab_item('Spanning') {
10
+ grid {
11
+ 4.times { |left_value|
12
+ 4.times { |top_value|
13
+ label("(#{left_value}, #{top_value}) xspan1\nyspan1") {
14
+ left left_value
15
+ top top_value
16
+ hexpand true
17
+ vexpand true
18
+ }
19
+ }
20
+ }
21
+ label("(0, 4) xspan2\nyspan1 more text fits horizontally") {
22
+ left 0
23
+ top 4
24
+ xspan 2
25
+ }
26
+ label("(2, 4) xspan2\nyspan1 more text fits horizontally") {
27
+ left 2
28
+ top 4
29
+ xspan 2
30
+ }
31
+ label("(0, 5) xspan1\nyspan2\nmore text\nfits vertically") {
32
+ left 0
33
+ top 5
34
+ yspan 2
35
+ }
36
+ label("(0, 7) xspan1\nyspan2\nmore text\nfits vertically") {
37
+ left 0
38
+ top 7
39
+ yspan 2
40
+ }
41
+ label("(1, 5) xspan3\nyspan4 a lot more text fits horizontally than before\nand\neven\na lot\nmore text\nfits vertically\nthan\nbefore") {
42
+ left 1
43
+ top 5
44
+ xspan 3
45
+ yspan 4
46
+ }
47
+ }
48
+ }
49
+ tab_item('Expanding') {
50
+ grid {
51
+ label("(0, 0) hexpand/vexpand\nall available horizontal space is taken\nand\nall\navailable\nvertical\nspace\nis\ntaken") {
52
+ left 0
53
+ top 0
54
+ hexpand true
55
+ vexpand true
56
+ }
57
+ label("(1, 0)") {
58
+ left 1
59
+ top 0
60
+ }
61
+ label("(0, 1)") {
62
+ left 0
63
+ top 1
64
+ }
65
+ label("(1, 1)") {
66
+ left 1
67
+ top 1
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }.show
Binary file
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 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
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ # Proxy for LibUI button objects
27
+ #
28
+ # Follows the Proxy Design Pattern
29
+ class ButtonProxy < ControlProxy
30
+ DEFAULT_TEXT = ''
31
+
32
+ private
33
+
34
+ def build_control
35
+ construction_args = @args.dup
36
+ construction_args[0] = DEFAULT_TEXT if construction_args.size == 0
37
+ @libui = ControlProxy.new_control(@keyword, construction_args)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 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
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ # Proxy for LibUI checkbox objects
27
+ #
28
+ # Follows the Proxy Design Pattern
29
+ class CheckboxProxy < ControlProxy
30
+ DEFAULT_TEXT = ''
31
+
32
+ private
33
+
34
+ def build_control
35
+ construction_args = @args.dup
36
+ construction_args[0] = DEFAULT_TEXT if construction_args.size == 0
37
+ @libui = ControlProxy.new_control(@keyword, construction_args)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -66,6 +66,10 @@ module Glimmer
66
66
  def menu_proxies
67
67
  all_control_proxies.select {|c| c.keyword == 'menu' }
68
68
  end
69
+
70
+ def new_control(keyword, args)
71
+ ::LibUI.send("new_#{keyword}", *args)
72
+ end
69
73
  end
70
74
 
71
75
  BOOLEAN_PROPERTIES = %w[
@@ -254,7 +258,7 @@ module Glimmer
254
258
 
255
259
  def build_control
256
260
  @libui = if ::LibUI.respond_to?("new_#{keyword}")
257
- ::LibUI.send("new_#{@keyword}", *@args)
261
+ ControlProxy.new_control(@keyword, @args)
258
262
  elsif ::LibUI.respond_to?(keyword)
259
263
  @args[0] = @args.first.libui if @args.first.is_a?(ControlProxy)
260
264
  ::LibUI.send(@keyword, *@args)
@@ -27,6 +27,13 @@ module Glimmer
27
27
  #
28
28
  # Follows the Proxy Design Pattern
29
29
  class DatePickerProxy < DateTimePickerProxy
30
+ def time(value = nil)
31
+ if value.nil?
32
+ super.slice(:mday, :mon, :year, :wday, :yday)
33
+ else
34
+ super
35
+ end
36
+ end
30
37
  end
31
38
  end
32
39
  end
@@ -30,6 +30,39 @@ module Glimmer
30
30
  def libui_api_keyword
31
31
  'date_time_picker'
32
32
  end
33
+
34
+ def time(value = nil)
35
+ @time ||= ::LibUI::FFI::TM.malloc
36
+ ::LibUI.date_time_picker_time(@libui, @time)
37
+ if value.nil?
38
+ {
39
+ sec: @time.tm_sec,
40
+ min: @time.tm_min,
41
+ hour: @time.tm_hour,
42
+ mday: @time.tm_mday,
43
+ mon: @time.tm_mon + 1,
44
+ year: @time.tm_year + 1900,
45
+ wday: @time.tm_wday + 1,
46
+ yday: @time.tm_yday + 1,
47
+ dst: @time.tm_isdst == 1
48
+ }
49
+ else
50
+ @time.tm_sec = value[:sec] unless value[:sec].nil?
51
+ @time.tm_min = value[:min] unless value[:min].nil?
52
+ @time.tm_hour = value[:hour] unless value[:hour].nil?
53
+ @time.tm_mday = value[:mday] unless value[:mday].nil?
54
+ @time.tm_mon = value[:mon] - 1 unless value[:mon].nil?
55
+ @time.tm_year = value[:year] - 1900 unless value[:year].nil?
56
+ ::LibUI.date_time_picker_set_time(@libui, @time)
57
+ end
58
+ end
59
+ alias set_time time
60
+ alias time= time
61
+
62
+ def destroy
63
+ Fiddle.free @time unless @time.nil?
64
+ super
65
+ end
33
66
  end
34
67
  end
35
68
  end
@@ -0,0 +1,54 @@
1
+ # Copyright (c) 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
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class FormProxy < ControlProxy
27
+ APPEND_PROPERTIES = %w[label stretchy]
28
+
29
+ def post_initialize_child(child)
30
+ child.label = '' if child.label.nil?
31
+ child.stretchy = true if child.stretchy.nil?
32
+ ::LibUI.form_append(@libui, child.label, child.libui, ControlProxy.boolean_to_integer(child.stretchy))
33
+ children << child
34
+ end
35
+
36
+ def children
37
+ @children ||= []
38
+ end
39
+
40
+ def destroy_child(child)
41
+ ::LibUI.send("form_delete", @libui, children.index(child))
42
+ ControlProxy.all_control_proxies.delete(child)
43
+ end
44
+
45
+ private
46
+
47
+ def build_control
48
+ super.tap do
49
+ self.padded = true
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,57 @@
1
+ # Copyright (c) 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
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class GridProxy < ControlProxy
27
+ APPEND_PROPERTIES = %w[left top xspan yspan hexpand halign vexpand valign]
28
+
29
+ def post_initialize_child(child)
30
+ child.left = 0 if child.left.nil?
31
+ child.top = 0 if child.top.nil?
32
+ child.xspan = 1 if child.xspan.nil?
33
+ child.yspan = 1 if child.yspan.nil?
34
+ child.hexpand = false if child.hexpand.nil?
35
+ child.halign = 0 if child.halign.nil?
36
+ child.vexpand = false if child.vexpand.nil?
37
+ child.valign = 0 if child.valign.nil?
38
+ ::LibUI.grid_append(@libui, child.libui, child.left, child.top, child.xspan, child.yspan, ControlProxy.boolean_to_integer(child.hexpand), child.halign, ControlProxy.boolean_to_integer(child.vexpand), child.valign)
39
+ children << child
40
+ end
41
+
42
+ def children
43
+ @children ||= []
44
+ end
45
+
46
+ # Note that there is no proper destroy_child(child) method for GridProxy due to libui not offering any API for it (no grid_delete)
47
+
48
+ private
49
+
50
+ def build_control
51
+ super.tap do
52
+ self.padded = true
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -27,6 +27,8 @@ module Glimmer
27
27
  #
28
28
  # Follows the Proxy Design Pattern
29
29
  class GroupProxy < ControlProxy
30
+ DEFAULT_TITLE = ''
31
+
30
32
  def post_initialize_child(child)
31
33
  ::LibUI.group_set_child(@libui, child.libui)
32
34
  end
@@ -39,7 +41,10 @@ module Glimmer
39
41
  private
40
42
 
41
43
  def build_control
42
- super.tap do
44
+ construction_args = @args.dup
45
+ construction_args[0] = DEFAULT_TITLE if construction_args.size == 0
46
+ @libui = ControlProxy.new_control(@keyword, construction_args)
47
+ @libui.tap do
43
48
  self.margined = true
44
49
  end
45
50
  end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 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
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ # Proxy for LibUI label objects
27
+ #
28
+ # Follows the Proxy Design Pattern
29
+ class LabelProxy < ControlProxy
30
+ DEFAULT_TEXT = ''
31
+
32
+ private
33
+
34
+ def build_control
35
+ construction_args = @args.dup
36
+ construction_args[0] = DEFAULT_TEXT if construction_args.size == 0
37
+ @libui = ControlProxy.new_control(@keyword, construction_args)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 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
+ require 'glimmer/libui/control_proxy'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ # Proxy for LibUI menu objects
27
+ #
28
+ # Follows the Proxy Design Pattern
29
+ class MenuProxy < ControlProxy
30
+ DEFAULT_TEXT = ''
31
+
32
+ private
33
+
34
+ def build_control
35
+ construction_args = @args.dup
36
+ construction_args[0] = DEFAULT_TEXT if construction_args.size == 0
37
+ @libui = ControlProxy.new_control(@keyword, construction_args)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -27,6 +27,13 @@ module Glimmer
27
27
  #
28
28
  # Follows the Proxy Design Pattern
29
29
  class TimePickerProxy < DateTimePickerProxy
30
+ def time(value = nil)
31
+ if value.nil?
32
+ super.slice(:sec, :min, :hour)
33
+ else
34
+ super
35
+ end
36
+ end
30
37
  end
31
38
  end
32
39
  end
@@ -27,7 +27,7 @@ module Glimmer
27
27
  #
28
28
  # Follows the Proxy Design Pattern
29
29
  class WindowProxy < ControlProxy
30
- DEFAULT_TITLE = 'Glimmer'
30
+ DEFAULT_TITLE = ''
31
31
  DEFAULT_WIDTH = 150
32
32
  DEFAULT_HEIGHT = 150
33
33
  DEFAULT_HAS_MENUBAR = 1
@@ -79,7 +79,7 @@ module Glimmer
79
79
  construction_args[2] = DEFAULT_HEIGHT if construction_args.size == 2
80
80
  construction_args[3] = DEFAULT_HAS_MENUBAR if construction_args.size == 3
81
81
  construction_args[3] = ControlProxy.boolean_to_integer(construction_args[3]) if construction_args.size == 4 && (construction_args[3].is_a?(TrueClass) || construction_args[3].is_a?(FalseClass))
82
- @libui = ::LibUI.send("new_window", *construction_args)
82
+ @libui = ControlProxy.new_control(@keyword, construction_args)
83
83
  @libui.tap do
84
84
  handle_listener('on_closing') do
85
85
  destroy
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -186,7 +186,10 @@ files:
186
186
  - examples/basic_window2.rb
187
187
  - examples/color_button.rb
188
188
  - examples/control_gallery.rb
189
+ - examples/date_time_picker.rb
189
190
  - examples/font_button.rb
191
+ - examples/form.rb
192
+ - examples/grid.rb
190
193
  - examples/meta_example.rb
191
194
  - examples/midi_player.rb
192
195
  - examples/simple_notepad.rb
@@ -202,7 +205,9 @@ files:
202
205
  - lib/glimmer/dsl/libui/tab_item_expression.rb
203
206
  - lib/glimmer/libui/about_menu_item_proxy.rb
204
207
  - lib/glimmer/libui/box.rb
208
+ - lib/glimmer/libui/button_proxy.rb
205
209
  - lib/glimmer/libui/check_menu_item_proxy.rb
210
+ - lib/glimmer/libui/checkbox_proxy.rb
206
211
  - lib/glimmer/libui/color_button_proxy.rb
207
212
  - lib/glimmer/libui/combobox_proxy.rb
208
213
  - lib/glimmer/libui/control_proxy.rb
@@ -210,9 +215,13 @@ files:
210
215
  - lib/glimmer/libui/date_time_picker_proxy.rb
211
216
  - lib/glimmer/libui/editable_combobox_proxy.rb
212
217
  - lib/glimmer/libui/font_button_proxy.rb
218
+ - lib/glimmer/libui/form_proxy.rb
219
+ - lib/glimmer/libui/grid_proxy.rb
213
220
  - lib/glimmer/libui/group_proxy.rb
214
221
  - lib/glimmer/libui/horizontal_box_proxy.rb
222
+ - lib/glimmer/libui/label_proxy.rb
215
223
  - lib/glimmer/libui/menu_item_proxy.rb
224
+ - lib/glimmer/libui/menu_proxy.rb
216
225
  - lib/glimmer/libui/multiline_entry_proxy.rb
217
226
  - lib/glimmer/libui/non_wrapping_multiline_entry_proxy.rb
218
227
  - lib/glimmer/libui/preferences_menu_item_proxy.rb