glimmer-dsl-libui 0.1.7 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +430 -13
- data/VERSION +1 -1
- data/examples/area_gallery.rb +48 -0
- data/examples/area_gallery2.rb +48 -0
- data/examples/area_gallery3.rb +48 -0
- data/examples/area_gallery4.rb +48 -0
- data/examples/control_gallery.rb +1 -1
- data/examples/form_table.rb +20 -0
- data/examples/grid.rb +38 -2
- data/examples/login.rb +45 -0
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb +40 -0
- data/lib/glimmer/libui/control_proxy/area_proxy.rb +111 -27
- data/lib/glimmer/libui/control_proxy/entry_proxy/password_entry_proxy.rb +36 -0
- data/lib/glimmer/libui/control_proxy/entry_proxy/search_entry_proxy.rb +36 -0
- data/lib/glimmer/libui/control_proxy/entry_proxy.rb +39 -0
- data/lib/glimmer/libui/control_proxy/grid_proxy.rb +12 -1
- data/lib/glimmer/libui/control_proxy/path_proxy.rb +3 -30
- data/lib/glimmer/libui/control_proxy.rb +34 -1
- data/lib/glimmer/libui.rb +17 -0
- data/lib/glimmer-dsl-libui.rb +1 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b34fe2a7db4662a9588587bd62efa37358ebe3f543d40d771471ff46406767b5
|
4
|
+
data.tar.gz: e743595f9c5f25d54da5ad7abdeb634d074487b9d724ab787b70abad3c4aa7e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df37167d19bb74775589ab3471578d75d4ff485f5f85076cf986617fa9190adc1075eda7e87c133e15517f907efdcc7b985bc37dcd02cabde382fd11afcf76ae
|
7
|
+
data.tar.gz: a0cc3fae77a4d382035ddeaae2671953283a1bc148f3dcfab89c037eb5ba6bbbc1527579890fde4794cea8ed85ca04b4ef65d23ea482589c6a786581487a301d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.1.11
|
4
|
+
|
5
|
+
- New examples/login.rb
|
6
|
+
- Amend examples/form_table.rb with use of a `search_entry` to support table filtering
|
7
|
+
- Support `password_entry` control
|
8
|
+
- Support `search_entry` control
|
9
|
+
- Fix issue with setting control `enabled` property
|
10
|
+
|
11
|
+
## 0.1.10
|
12
|
+
|
13
|
+
- Upgrade to glimmer 2.2.1
|
14
|
+
- Add a 3rd tab to examples/grid.rb showcasing the halign and valign properties
|
15
|
+
- Support `grid` `halign`/`valign` symbol values of `:fill` (default), `:start`, `:center`, `:end`
|
16
|
+
- Add `key_value` to `area_key_event` `Hash`
|
17
|
+
- Add `ext_key_value` to `area_key_event` `Hash`
|
18
|
+
|
19
|
+
## 0.1.9
|
20
|
+
|
21
|
+
- Support `area` listener: `on_key_event`
|
22
|
+
- Support `area` listener: `on_key_down`
|
23
|
+
- Support `area` listener: `on_key_up`
|
24
|
+
|
25
|
+
## 0.1.8
|
26
|
+
|
27
|
+
- Support `area` listener: `on_mouse_event`
|
28
|
+
- Support `area` listener: `on_mouse_down`
|
29
|
+
- Support `area` listener: `on_mouse_up`
|
30
|
+
- Support `area` listener: `on_mouse_drag_start`
|
31
|
+
- Support `area` listener: `on_mouse_drag`
|
32
|
+
- Support `area` listener: `on_mouse_drop`
|
33
|
+
- Support `area` listener: `on_mouse_crossed`
|
34
|
+
- Support `area` listener: `on_mouse_enter`
|
35
|
+
- Support `area` listener: `on_mouse_exit`
|
36
|
+
- Support `area` listener: `on_drag_broken`
|
37
|
+
|
3
38
|
## 0.1.7
|
4
39
|
|
5
40
|
- Support `stroke` `:dashes` and use in examples/area_gallery.rb
|
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.1.
|
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.1.11
|
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)
|
@@ -123,6 +123,54 @@ window('Area Gallery', 400, 400) {
|
|
123
123
|
fill r: 202, g: 102, b: 204, a: 0.5
|
124
124
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
125
125
|
}
|
126
|
+
|
127
|
+
on_mouse_event do |area_mouse_event|
|
128
|
+
p area_mouse_event
|
129
|
+
end
|
130
|
+
|
131
|
+
on_mouse_moved do |area_mouse_event|
|
132
|
+
puts 'moved'
|
133
|
+
end
|
134
|
+
|
135
|
+
on_mouse_down do |area_mouse_event|
|
136
|
+
puts 'mouse down'
|
137
|
+
end
|
138
|
+
|
139
|
+
on_mouse_up do |area_mouse_event|
|
140
|
+
puts 'mouse up'
|
141
|
+
end
|
142
|
+
|
143
|
+
on_mouse_drag_started do |area_mouse_event|
|
144
|
+
puts 'drag started'
|
145
|
+
end
|
146
|
+
|
147
|
+
on_mouse_dragged do |area_mouse_event|
|
148
|
+
puts 'dragged'
|
149
|
+
end
|
150
|
+
|
151
|
+
on_mouse_dropped do |area_mouse_event|
|
152
|
+
puts 'dropped'
|
153
|
+
end
|
154
|
+
|
155
|
+
on_mouse_entered do
|
156
|
+
puts 'entered'
|
157
|
+
end
|
158
|
+
|
159
|
+
on_mouse_exited do
|
160
|
+
puts 'exited'
|
161
|
+
end
|
162
|
+
|
163
|
+
on_key_event do |area_key_event|
|
164
|
+
p area_key_event
|
165
|
+
end
|
166
|
+
|
167
|
+
on_key_up do |area_key_event|
|
168
|
+
puts 'key up'
|
169
|
+
end
|
170
|
+
|
171
|
+
on_key_down do |area_key_event|
|
172
|
+
puts 'key down'
|
173
|
+
end
|
126
174
|
}
|
127
175
|
}.show
|
128
176
|
```
|
@@ -143,7 +191,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
143
191
|
|
144
192
|
## Table of Contents
|
145
193
|
|
146
|
-
- [Glimmer DSL for LibUI 0.1.
|
194
|
+
- [Glimmer DSL for LibUI 0.1.10](#-glimmer-dsl-for-libui-0111)
|
147
195
|
- [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
|
148
196
|
- [Usage](#usage)
|
149
197
|
- [Girb (Glimmer IRB)](#girb-glimmer-irb)
|
@@ -186,6 +234,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
186
234
|
- [Area Gallery](#area-gallery)
|
187
235
|
- [Histogram](#histogram)
|
188
236
|
- [Basic Transform](#basic-transform)
|
237
|
+
- [Login](#login)
|
189
238
|
- [Contributing to glimmer-dsl-libui](#contributing-to-glimmer-dsl-libui)
|
190
239
|
- [Help](#help)
|
191
240
|
- [Issues](#issues)
|
@@ -273,7 +322,7 @@ gem install glimmer-dsl-libui
|
|
273
322
|
Or install via Bundler `Gemfile`:
|
274
323
|
|
275
324
|
```ruby
|
276
|
-
gem 'glimmer-dsl-libui', '~> 0.1.
|
325
|
+
gem 'glimmer-dsl-libui', '~> 0.1.10'
|
277
326
|
```
|
278
327
|
|
279
328
|
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.
|
@@ -347,7 +396,7 @@ w.libui # => #<Fiddle::Pointer:0x00007fde53997980 ptr=0x00007fde51352a60 size=0
|
|
347
396
|
Control(Args) | Properties | Listeners
|
348
397
|
------------- | ---------- | ---------
|
349
398
|
`about_menu_item` | None | `on_clicked`
|
350
|
-
`area` | None | `on_draw`
|
399
|
+
`area` | None | `on_draw(area_draw_params)`, `on_mouse_event(area_mouse_event)`, `on_mouse_down(area_mouse_event)`, `on_mouse_up(area_mouse_event)`, `on_mouse_drag_started(area_mouse_event)`, `on_mouse_dragged(area_mouse_event)`, `on_mouse_dropped(area_mouse_event)`, `on_mouse_entered`, `on_mouse_exited`, `on_key_event(area_key_event)`, `on_key_down(area_key_event)`, `on_key_up(area_key_event)`
|
351
400
|
`arc(x_center as Numeric, y_center as Numeric, radius as Numeric, start_angle as Numeric, sweep as Numeric, is_negative as Boolean)` | `x_center` (`Numeric`), `y_center` (`Numeric`), `radius` (`Numeric`), `start_angle` (`Numeric`), `sweep` (`Numeric`), `is_negative` (Boolean) | None
|
352
401
|
`bezier(c1_x as Numeric, c1_y as Numeric, c2_x as Numeric, c2_y as Numeric, end_x as Numeric, end_y as Numeric)` | `c1_x` (`Numeric`), `c1_y` (`Numeric`), `c2_x` (`Numeric`), `c2_y` (`Numeric`), `end_x` (`Numeric`), `end_y` (`Numeric`) | None
|
353
402
|
`button(text as String)` | `text` (`String`) | `on_clicked`
|
@@ -381,6 +430,7 @@ Control(Args) | Properties | Listeners
|
|
381
430
|
`msg_box(window = main_window as Glimmer::LibUI::WindowProxy, title as String, description as String)` | None | None
|
382
431
|
`msg_box_error(window = main_window as Glimmer::LibUI::WindowProxy, title as String, description as String)` | None | None
|
383
432
|
`non_wrapping_multiline_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
433
|
+
`password_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
384
434
|
`path(draw_fill_mode = :winding)` | `fill` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`), `stroke` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, `:cap` as (`:round`, `:square`, `:flat`), `:join` as (`:miter`, `:round`, `:bevel`), `:thickness` as `Numeric`, `:miter_limit` as `Numeric`, `:dashes` as `Array` of `Numeric` ) | None
|
385
435
|
`preferences_menu_item` | None | `on_clicked`
|
386
436
|
`progress_bar` | `value` (`Numeric`) | None
|
@@ -388,6 +438,7 @@ Control(Args) | Properties | Listeners
|
|
388
438
|
`quit_menu_item` | None | `on_clicked`
|
389
439
|
`radio_buttons` | `selected` (`Integer`) | `on_selected`
|
390
440
|
`rectangle(x as Numeric, y as Numeric, width as Numeric, height as Numeric)` | `x` (`Numeric`), `y` (`Numeric`), `width` (`Numeric`), `height` (`Numeric`) | None
|
441
|
+
`search_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
391
442
|
`slider(min as Numeric, max as Numeric)` | `value` (`Numeric`) | `on_changed`
|
392
443
|
`spinbox(min as Numeric, max as Numeric)` | `value` (`Numeric`) | `on_changed`
|
393
444
|
`square(x as Numeric, y as Numeric, length as Numeric)` | `x` (`Numeric`), `y` (`Numeric`), `length` (`Numeric`) | None
|
@@ -397,6 +448,7 @@ Control(Args) | Properties | Listeners
|
|
397
448
|
`text_column(name as String)` | `editable` (Boolean) | None
|
398
449
|
`time_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`) | `on_changed`
|
399
450
|
`vertical_box` | `padded` (Boolean) | None
|
451
|
+
`vertical_separator` | None | None
|
400
452
|
`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`, `on_destroy`
|
401
453
|
|
402
454
|
### Common Control Properties
|
@@ -412,9 +464,9 @@ Control(Args) | Properties | Listeners
|
|
412
464
|
- `xspan` [dsl-only] (`Integer`) [default=`1`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
|
413
465
|
- `yspan` [dsl-only] (`Integer`) [default=`1`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
|
414
466
|
- `hexpand` [dsl-only] (Boolean) [default=`false`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
|
415
|
-
- `halign` [dsl-only] (`
|
467
|
+
- `halign` [dsl-only] (`:fill`, `:start`, `:center`, or `:end`) [default=`:fill`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
|
416
468
|
- `vexpand` [dsl-only] (Boolean) [default=`false`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
|
417
|
-
- `valign` [dsl-only] (`
|
469
|
+
- `valign` [dsl-only] (`:fill`, `:start`, `:center`, or `:end`) [default=`:fill`]: available in [Glimmer GUI DSL](#glimmer-gui-dsl-concepts) when nested under `grid`
|
418
470
|
|
419
471
|
### Common Control Operations
|
420
472
|
- `destroy`
|
@@ -608,6 +660,41 @@ The `area_draw_params` argument for `on_draw` block is a hash consisting of the
|
|
608
660
|
|
609
661
|
In general, it is recommended to use declarative stable paths whenever feasible since they require less code and simpler maintenance. But, in more advanced cases, semi-declarative dynamic paths could be used instead, especially if there are thousands of dynamic paths that need maximum performance and low memory footprint.
|
610
662
|
|
663
|
+
`area` supported mouse listeners are:
|
664
|
+
- `on_key_event {|area_key_event| ...}`: general catch-all key event (recommend using fine-grained key events below instead)
|
665
|
+
- `on_key_down {|area_key_event| ...}`
|
666
|
+
- `on_key_up {|area_key_event| ...}`
|
667
|
+
- `on_mouse_event {|area_mouse_event| ...}`: general catch-all mouse event (recommend using fine-grained mouse events below instead)
|
668
|
+
- `on_mouse_down {|area_mouse_event| ...}`
|
669
|
+
- `on_mouse_up {|area_mouse_event| ...}`
|
670
|
+
- `on_mouse_drag_started {|area_mouse_event| ...}`
|
671
|
+
- `on_mouse_dragged {|area_mouse_event| ...}`
|
672
|
+
- `on_mouse_dropped {|area_mouse_event| ...}`
|
673
|
+
- `on_mouse_entered {...}`
|
674
|
+
- `on_mouse_exited {...}`
|
675
|
+
- `on_mouse_crossed {|left| ...}` (NOT RECOMMENDED; it does what `on_mouse_entered` and `on_mouse_exited` do by returning a `left` argument indicating if mouse left `area`)
|
676
|
+
- `on_drag_broken {...}` (NOT RECOMMENDED; varies per platforms; use `on_mouse_dropped` instead)
|
677
|
+
|
678
|
+
The `area_mouse_event` `Hash` argument for mouse events that receive it (e.g. `on_mouse_up`, `on_mouse_dragged`) consist of the following hash keys:
|
679
|
+
- `:x`: mouse x location in relation to area's top-left-corner
|
680
|
+
- `:y`: mouse y location in relation to area's top-left-corner
|
681
|
+
- `:area_width`: area current width
|
682
|
+
- `:area_height`: area current height
|
683
|
+
- `:down`: mouse pressed button (e.g. `1` is left button, `3` is right button)
|
684
|
+
- `:up`: mouse depressed button (e.g. `1` is left button, `3` is right button)
|
685
|
+
- `:count`: count of mouse clicks (e.g. `2` for double-click, `1` for single-click)
|
686
|
+
- `:modifers`: `Array` of `Symbol`s from one of the following: `[:command, :shift, :alt, :control]`
|
687
|
+
- `:held`: mouse held button during dragging (e.g. `1` is left button, `4` is right button)
|
688
|
+
|
689
|
+
The `area_key_event` `Hash` argument for keyboard events that receive it (e.g. `on_key_up`, `on_key_down`) consist of the following hash keys:
|
690
|
+
- `:key`: key character (`String`)
|
691
|
+
- `:key_value`: key value (`Integer`). Useful in rare cases for numeric processing of keys instead of dealing with as `:key` character `String`
|
692
|
+
- `:ext_key`: non-character extra key (`Symbol`) from `Glimmer::LibUI.enum_symbols(:ext_key)` such as `:left`, `:right`, `:escape`, `:insert`
|
693
|
+
- `:ext_key_value`: non-character extra key value (`Integer`). Useful in rare cases for numeric processing of extra keys instead of dealing with as `:ext_key` `Symbol`
|
694
|
+
- `:modifier`: modifier key pressed alone (e.g. `:shift` or `:control`)
|
695
|
+
- `:modifiers`: modifier keys pressed simultaneously with `:key`, `:ext_key`, or `:modifier`
|
696
|
+
- `:up`: indicates if key has been released or not (Boolean)
|
697
|
+
|
611
698
|
Note that when nesting an `area` directly underneath `window` (without a layout control like `vertical_box`), it is automatically reparented with `vertical_box` in between the `window` and `area` since it would not show up on Linux otherwise.
|
612
699
|
|
613
700
|
To redraw an `area`, you may call the `#queue_redraw_all` method, or simply `#redraw`.
|
@@ -705,7 +792,7 @@ Check [Histogram](#histogram) example for use of hex colors.
|
|
705
792
|
- When destroying a control nested under a `form`, it is automatically deleted from the form's children
|
706
793
|
- When destroying a control nested under a `window` or `group`, it is automatically unset as their child to allow successful destruction
|
707
794
|
- 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`
|
708
|
-
- Smart defaults for `grid` child attributes are `left` (`0`), `top` (`0`), `xspan` (`1`), `yspan` (`1`), `hexpand` (`false`), `halign` (`
|
795
|
+
- Smart defaults for `grid` child attributes are `left` (`0`), `top` (`0`), `xspan` (`1`), `yspan` (`1`), `hexpand` (`false`), `halign` (`:fill`), `vexpand` (`false`), and `valign` (`:fill`)
|
709
796
|
- The `table` control automatically constructs required `TableModelHandler`, `TableModel`, and `TableParams`, calculating all their arguments from `cell_rows` and `editable` properties (e.g. `NumRows`) as well as nested columns (e.g. `text_column`)
|
710
797
|
- Table model instances are automatically freed from memory after `window` is destroyed.
|
711
798
|
- Table `cell_rows` data has implicit data-binding to table cell values for deletion, insertion, and change (done by diffing `cell_rows` value before and after change and auto-informing `table` of deletions [`LibUI.table_model_row_deleted`], insertions [`LibUI.table_model_row_deleted`], and changes [`LibUI.table_model_row_changed`]). When deleting data rows from `cell_rows` array, then actual rows from the `table` are automatically deleted. When inserting data rows into `cell_rows` array, then actual `table` rows are automatically inserted. When updating data rows in `cell_rows` array, then actual `table` rows are automatically updated.
|
@@ -746,6 +833,8 @@ The following examples include reimplementions of the examples in the [LibUI](ht
|
|
746
833
|
|
747
834
|
To browse all examples, simply launch the [Meta-Example](examples/meta_example.rb), which lists all examples and displays each example's code when selected. It also enables code editing to facilitate experimentation and learning.
|
748
835
|
|
836
|
+
(note that for examples that emit output to terminal/command-line via `p` or `puts`, you must run them directly to see output)
|
837
|
+
|
749
838
|
[examples/meta_example.rb](examples/meta_example.rb)
|
750
839
|
|
751
840
|
Run with this command from the root of the project if you cloned the project:
|
@@ -2014,13 +2103,15 @@ ruby -r glimmer-dsl-libui -e "require 'examples/grid'"
|
|
2014
2103
|
|
2015
2104
|
Mac
|
2016
2105
|
|
2017
|
-
![glimmer-dsl-libui-mac-grid-
|
2018
|
-
![glimmer-dsl-libui-mac-grid-
|
2106
|
+
![glimmer-dsl-libui-mac-grid-span.png](images/glimmer-dsl-libui-mac-grid-span.png)
|
2107
|
+
![glimmer-dsl-libui-mac-grid-expand.png](images/glimmer-dsl-libui-mac-grid-expand.png)
|
2108
|
+
![glimmer-dsl-libui-mac-grid-align.png](images/glimmer-dsl-libui-mac-grid-align.png)
|
2019
2109
|
|
2020
2110
|
Linux
|
2021
2111
|
|
2022
|
-
![glimmer-dsl-libui-linux-grid-
|
2023
|
-
![glimmer-dsl-libui-linux-grid-
|
2112
|
+
![glimmer-dsl-libui-linux-grid-span.png](images/glimmer-dsl-libui-linux-grid-span.png)
|
2113
|
+
![glimmer-dsl-libui-linux-grid-expand.png](images/glimmer-dsl-libui-linux-grid-expand.png)
|
2114
|
+
![glimmer-dsl-libui-linux-grid-align.png](images/glimmer-dsl-libui-linux-grid-align.png)
|
2024
2115
|
|
2025
2116
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
2026
2117
|
|
@@ -2031,7 +2122,7 @@ include Glimmer
|
|
2031
2122
|
|
2032
2123
|
window('Grid') {
|
2033
2124
|
tab {
|
2034
|
-
tab_item('
|
2125
|
+
tab_item('Span') {
|
2035
2126
|
grid {
|
2036
2127
|
4.times { |top_value|
|
2037
2128
|
4.times { |left_value|
|
@@ -2071,7 +2162,7 @@ window('Grid') {
|
|
2071
2162
|
}
|
2072
2163
|
}
|
2073
2164
|
}
|
2074
|
-
tab_item('
|
2165
|
+
tab_item('Expand') {
|
2075
2166
|
grid {
|
2076
2167
|
label("(0, 0) hexpand/vexpand\nall available horizontal space is taken\nand\nall\navailable\nvertical\nspace\nis\ntaken") {
|
2077
2168
|
left 0
|
@@ -2093,6 +2184,42 @@ window('Grid') {
|
|
2093
2184
|
}
|
2094
2185
|
}
|
2095
2186
|
}
|
2187
|
+
tab_item('Align') {
|
2188
|
+
grid {
|
2189
|
+
label("(0, 0) halign/valign fill\nall available horizontal space is taken\nand\nall\navailable\nvertical\nspace\nis\ntaken") {
|
2190
|
+
left 0
|
2191
|
+
top 0
|
2192
|
+
hexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2193
|
+
vexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2194
|
+
halign :fill
|
2195
|
+
valign :fill
|
2196
|
+
}
|
2197
|
+
label("(1, 0) halign/valign start") {
|
2198
|
+
left 1
|
2199
|
+
top 0
|
2200
|
+
hexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2201
|
+
vexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2202
|
+
halign :start
|
2203
|
+
valign :start
|
2204
|
+
}
|
2205
|
+
label("(0, 1) halign/valign center") {
|
2206
|
+
left 0
|
2207
|
+
top 1
|
2208
|
+
hexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2209
|
+
vexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2210
|
+
halign :center
|
2211
|
+
valign :center
|
2212
|
+
}
|
2213
|
+
label("(1, 1) halign/valign end") {
|
2214
|
+
left 1
|
2215
|
+
top 1
|
2216
|
+
hexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2217
|
+
vexpand true unless OS.mac? # on Mac, only the first label is given all space, so avoid expanding
|
2218
|
+
halign :end
|
2219
|
+
valign :end
|
2220
|
+
}
|
2221
|
+
}
|
2222
|
+
}
|
2096
2223
|
}
|
2097
2224
|
}.show
|
2098
2225
|
```
|
@@ -2872,15 +2999,19 @@ Mac
|
|
2872
2999
|
|
2873
3000
|
![glimmer-dsl-libui-mac-form-table.png](images/glimmer-dsl-libui-mac-form-table.png)
|
2874
3001
|
![glimmer-dsl-libui-mac-form-table-contact-entered.png](images/glimmer-dsl-libui-mac-form-table-contact-entered.png)
|
3002
|
+
![glimmer-dsl-libui-mac-form-table-filtered.png](images/glimmer-dsl-libui-mac-form-table-filtered.png)
|
2875
3003
|
|
2876
3004
|
Linux
|
2877
3005
|
|
2878
3006
|
![glimmer-dsl-libui-linux-form-table.png](images/glimmer-dsl-libui-linux-form-table.png)
|
2879
3007
|
![glimmer-dsl-libui-linux-form-table-contact-entered.png](images/glimmer-dsl-libui-linux-form-table-contact-entered.png)
|
3008
|
+
![glimmer-dsl-libui-linux-form-table-filtered.png](images/glimmer-dsl-libui-linux-form-table-filtered.png)
|
2880
3009
|
|
2881
3010
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
2882
3011
|
|
2883
3012
|
```ruby
|
3013
|
+
# frozen_string_literal: true
|
3014
|
+
|
2884
3015
|
require 'glimmer-dsl-libui'
|
2885
3016
|
|
2886
3017
|
include Glimmer
|
@@ -2926,6 +3057,7 @@ window('Contacts', 600, 600) { |w|
|
|
2926
3057
|
msg_box_error(w, 'Validation Error!', 'All fields are required! Please make sure to enter a value for all fields.')
|
2927
3058
|
else
|
2928
3059
|
data << new_row # automatically inserts a row into the table due to implicit data-binding
|
3060
|
+
@unfiltered_data = data.dup
|
2929
3061
|
@name_entry.text = ''
|
2930
3062
|
@email_entry.text = ''
|
2931
3063
|
@phone_entry.text = ''
|
@@ -2935,6 +3067,25 @@ window('Contacts', 600, 600) { |w|
|
|
2935
3067
|
end
|
2936
3068
|
}
|
2937
3069
|
|
3070
|
+
search_entry { |se|
|
3071
|
+
stretchy false
|
3072
|
+
|
3073
|
+
on_changed do
|
3074
|
+
filter_value = se.text
|
3075
|
+
@unfiltered_data ||= data.dup
|
3076
|
+
# Unfilter first to remove any previous filters
|
3077
|
+
data.replace(@unfiltered_data) # affects table indirectly through implicit data-binding
|
3078
|
+
# Now, apply filter if entered
|
3079
|
+
unless filter_value.empty?
|
3080
|
+
data.filter! do |row_data| # affects table indirectly through implicit data-binding
|
3081
|
+
row_data.any? do |cell|
|
3082
|
+
cell.to_s.downcase.include?(filter_value.downcase)
|
3083
|
+
end
|
3084
|
+
end
|
3085
|
+
end
|
3086
|
+
end
|
3087
|
+
}
|
3088
|
+
|
2938
3089
|
table {
|
2939
3090
|
text_column('Name')
|
2940
3091
|
text_column('Email')
|
@@ -3377,6 +3528,54 @@ window('Area Gallery', 400, 400) {
|
|
3377
3528
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3378
3529
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
3379
3530
|
}
|
3531
|
+
|
3532
|
+
on_mouse_event do |area_mouse_event|
|
3533
|
+
p area_mouse_event
|
3534
|
+
end
|
3535
|
+
|
3536
|
+
on_mouse_moved do |area_mouse_event|
|
3537
|
+
puts 'moved'
|
3538
|
+
end
|
3539
|
+
|
3540
|
+
on_mouse_down do |area_mouse_event|
|
3541
|
+
puts 'mouse down'
|
3542
|
+
end
|
3543
|
+
|
3544
|
+
on_mouse_up do |area_mouse_event|
|
3545
|
+
puts 'mouse up'
|
3546
|
+
end
|
3547
|
+
|
3548
|
+
on_mouse_drag_started do |area_mouse_event|
|
3549
|
+
puts 'drag started'
|
3550
|
+
end
|
3551
|
+
|
3552
|
+
on_mouse_dragged do |area_mouse_event|
|
3553
|
+
puts 'dragged'
|
3554
|
+
end
|
3555
|
+
|
3556
|
+
on_mouse_dropped do |area_mouse_event|
|
3557
|
+
puts 'dropped'
|
3558
|
+
end
|
3559
|
+
|
3560
|
+
on_mouse_entered do
|
3561
|
+
puts 'entered'
|
3562
|
+
end
|
3563
|
+
|
3564
|
+
on_mouse_exited do
|
3565
|
+
puts 'exited'
|
3566
|
+
end
|
3567
|
+
|
3568
|
+
on_key_event do |area_key_event|
|
3569
|
+
p area_key_event
|
3570
|
+
end
|
3571
|
+
|
3572
|
+
on_key_up do |area_key_event|
|
3573
|
+
puts 'key up'
|
3574
|
+
end
|
3575
|
+
|
3576
|
+
on_key_down do |area_key_event|
|
3577
|
+
puts 'key down'
|
3578
|
+
end
|
3380
3579
|
}
|
3381
3580
|
}.show
|
3382
3581
|
```
|
@@ -3493,6 +3692,54 @@ window('Area Gallery', 400, 400) {
|
|
3493
3692
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3494
3693
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
3495
3694
|
}
|
3695
|
+
|
3696
|
+
on_mouse_event do |area_mouse_event|
|
3697
|
+
p area_mouse_event
|
3698
|
+
end
|
3699
|
+
|
3700
|
+
on_mouse_moved do |area_mouse_event|
|
3701
|
+
puts 'moved'
|
3702
|
+
end
|
3703
|
+
|
3704
|
+
on_mouse_down do |area_mouse_event|
|
3705
|
+
puts 'mouse down'
|
3706
|
+
end
|
3707
|
+
|
3708
|
+
on_mouse_up do |area_mouse_event|
|
3709
|
+
puts 'mouse up'
|
3710
|
+
end
|
3711
|
+
|
3712
|
+
on_mouse_drag_started do |area_mouse_event|
|
3713
|
+
puts 'drag started'
|
3714
|
+
end
|
3715
|
+
|
3716
|
+
on_mouse_dragged do |area_mouse_event|
|
3717
|
+
puts 'dragged'
|
3718
|
+
end
|
3719
|
+
|
3720
|
+
on_mouse_dropped do |area_mouse_event|
|
3721
|
+
puts 'dropped'
|
3722
|
+
end
|
3723
|
+
|
3724
|
+
on_mouse_entered do
|
3725
|
+
puts 'entered'
|
3726
|
+
end
|
3727
|
+
|
3728
|
+
on_mouse_exited do
|
3729
|
+
puts 'exited'
|
3730
|
+
end
|
3731
|
+
|
3732
|
+
on_key_event do |area_key_event|
|
3733
|
+
p area_key_event
|
3734
|
+
end
|
3735
|
+
|
3736
|
+
on_key_up do |area_key_event|
|
3737
|
+
puts 'key up'
|
3738
|
+
end
|
3739
|
+
|
3740
|
+
on_key_down do |area_key_event|
|
3741
|
+
puts 'key down'
|
3742
|
+
end
|
3496
3743
|
}
|
3497
3744
|
}.show
|
3498
3745
|
```
|
@@ -3550,6 +3797,54 @@ window('Area Gallery', 400, 400) {
|
|
3550
3797
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
3551
3798
|
}
|
3552
3799
|
end
|
3800
|
+
|
3801
|
+
on_mouse_event do |area_mouse_event|
|
3802
|
+
p area_mouse_event
|
3803
|
+
end
|
3804
|
+
|
3805
|
+
on_mouse_moved do |area_mouse_event|
|
3806
|
+
puts 'moved'
|
3807
|
+
end
|
3808
|
+
|
3809
|
+
on_mouse_down do |area_mouse_event|
|
3810
|
+
puts 'mouse down'
|
3811
|
+
end
|
3812
|
+
|
3813
|
+
on_mouse_up do |area_mouse_event|
|
3814
|
+
puts 'mouse up'
|
3815
|
+
end
|
3816
|
+
|
3817
|
+
on_mouse_drag_started do |area_mouse_event|
|
3818
|
+
puts 'drag started'
|
3819
|
+
end
|
3820
|
+
|
3821
|
+
on_mouse_dragged do |area_mouse_event|
|
3822
|
+
puts 'dragged'
|
3823
|
+
end
|
3824
|
+
|
3825
|
+
on_mouse_dropped do |area_mouse_event|
|
3826
|
+
puts 'dropped'
|
3827
|
+
end
|
3828
|
+
|
3829
|
+
on_mouse_entered do
|
3830
|
+
puts 'entered'
|
3831
|
+
end
|
3832
|
+
|
3833
|
+
on_mouse_exited do
|
3834
|
+
puts 'exited'
|
3835
|
+
end
|
3836
|
+
|
3837
|
+
on_key_event do |area_key_event|
|
3838
|
+
p area_key_event
|
3839
|
+
end
|
3840
|
+
|
3841
|
+
on_key_up do |area_key_event|
|
3842
|
+
puts 'key up'
|
3843
|
+
end
|
3844
|
+
|
3845
|
+
on_key_down do |area_key_event|
|
3846
|
+
puts 'key down'
|
3847
|
+
end
|
3553
3848
|
}
|
3554
3849
|
}.show
|
3555
3850
|
```
|
@@ -3668,6 +3963,54 @@ window('Area Gallery', 400, 400) {
|
|
3668
3963
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
3669
3964
|
}
|
3670
3965
|
end
|
3966
|
+
|
3967
|
+
on_mouse_event do |area_mouse_event|
|
3968
|
+
p area_mouse_event
|
3969
|
+
end
|
3970
|
+
|
3971
|
+
on_mouse_moved do |area_mouse_event|
|
3972
|
+
puts 'moved'
|
3973
|
+
end
|
3974
|
+
|
3975
|
+
on_mouse_down do |area_mouse_event|
|
3976
|
+
puts 'mouse down'
|
3977
|
+
end
|
3978
|
+
|
3979
|
+
on_mouse_up do |area_mouse_event|
|
3980
|
+
puts 'mouse up'
|
3981
|
+
end
|
3982
|
+
|
3983
|
+
on_mouse_drag_started do |area_mouse_event|
|
3984
|
+
puts 'drag started'
|
3985
|
+
end
|
3986
|
+
|
3987
|
+
on_mouse_dragged do |area_mouse_event|
|
3988
|
+
puts 'dragged'
|
3989
|
+
end
|
3990
|
+
|
3991
|
+
on_mouse_dropped do |area_mouse_event|
|
3992
|
+
puts 'dropped'
|
3993
|
+
end
|
3994
|
+
|
3995
|
+
on_mouse_entered do
|
3996
|
+
puts 'entered'
|
3997
|
+
end
|
3998
|
+
|
3999
|
+
on_mouse_exited do
|
4000
|
+
puts 'exited'
|
4001
|
+
end
|
4002
|
+
|
4003
|
+
on_key_event do |area_key_event|
|
4004
|
+
p area_key_event
|
4005
|
+
end
|
4006
|
+
|
4007
|
+
on_key_up do |area_key_event|
|
4008
|
+
puts 'key up'
|
4009
|
+
end
|
4010
|
+
|
4011
|
+
on_key_down do |area_key_event|
|
4012
|
+
puts 'key down'
|
4013
|
+
end
|
3671
4014
|
}
|
3672
4015
|
}.show
|
3673
4016
|
```
|
@@ -4069,6 +4412,80 @@ window('Basic Transform', 350, 350) {
|
|
4069
4412
|
}.show
|
4070
4413
|
```
|
4071
4414
|
|
4415
|
+
### Login
|
4416
|
+
|
4417
|
+
[examples/login.rb](examples/login.rb)
|
4418
|
+
|
4419
|
+
Run with this command from the root of the project if you cloned the project:
|
4420
|
+
|
4421
|
+
```
|
4422
|
+
ruby -r './lib/glimmer-dsl-libui' examples/login.rb
|
4423
|
+
```
|
4424
|
+
|
4425
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
4426
|
+
|
4427
|
+
```
|
4428
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/login'"
|
4429
|
+
```
|
4430
|
+
|
4431
|
+
Mac
|
4432
|
+
|
4433
|
+
![glimmer-dsl-libui-mac-login.png](images/glimmer-dsl-libui-mac-login.png)
|
4434
|
+
![glimmer-dsl-libui-mac-login-logged-in.png](images/glimmer-dsl-libui-mac-login-logged-in.png)
|
4435
|
+
|
4436
|
+
Linux
|
4437
|
+
|
4438
|
+
![glimmer-dsl-libui-linux-login.png](images/glimmer-dsl-libui-linux-login.png)
|
4439
|
+
![glimmer-dsl-libui-linux-login-logged-in.png](images/glimmer-dsl-libui-linux-login-logged-in.png)
|
4440
|
+
|
4441
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
4442
|
+
|
4443
|
+
```ruby
|
4444
|
+
require 'glimmer-dsl-libui'
|
4445
|
+
|
4446
|
+
include Glimmer
|
4447
|
+
|
4448
|
+
window('Login') {
|
4449
|
+
margined true
|
4450
|
+
|
4451
|
+
vertical_box {
|
4452
|
+
form {
|
4453
|
+
@username_entry = entry {
|
4454
|
+
label 'Username:'
|
4455
|
+
}
|
4456
|
+
|
4457
|
+
@password_entry = password_entry {
|
4458
|
+
label 'Password:'
|
4459
|
+
}
|
4460
|
+
}
|
4461
|
+
|
4462
|
+
horizontal_box {
|
4463
|
+
@login_button = button('Login') {
|
4464
|
+
on_clicked do
|
4465
|
+
@username_entry.enabled = false
|
4466
|
+
@password_entry.enabled = false
|
4467
|
+
@login_button.enabled = false
|
4468
|
+
@logout_button.enabled = true
|
4469
|
+
end
|
4470
|
+
}
|
4471
|
+
|
4472
|
+
@logout_button = button('Logout') {
|
4473
|
+
enabled false
|
4474
|
+
|
4475
|
+
on_clicked do
|
4476
|
+
@username_entry.text = ''
|
4477
|
+
@password_entry.text = ''
|
4478
|
+
@username_entry.enabled = true
|
4479
|
+
@password_entry.enabled = true
|
4480
|
+
@login_button.enabled = true
|
4481
|
+
@logout_button.enabled = false
|
4482
|
+
end
|
4483
|
+
}
|
4484
|
+
}
|
4485
|
+
}
|
4486
|
+
}.show
|
4487
|
+
```
|
4488
|
+
|
4072
4489
|
## Contributing to glimmer-dsl-libui
|
4073
4490
|
|
4074
4491
|
- Check out the latest master to make sure the feature hasn't been
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|