glimmer-dsl-libui 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 032f3de542f72c7bec706935b9e233b59a861fc88568fef5dd1b1b788137674c
4
- data.tar.gz: 9791ad59faff6d21dd4fa59668d65266b5da1ffbfa49c0bd5cfaf900ee2a2c8c
3
+ metadata.gz: d4f4c60e8967700c477acdd623d75af1b119ab243f90e22b4f9861d9fbde3705
4
+ data.tar.gz: f92952b04a511a54107114cad3b7b336b4731720b4a6844097353c97fd16f4a5
5
5
  SHA512:
6
- metadata.gz: 013d2d62c31f7738a06bd41aefcef7b7646a570148d7e6f413971df7f938cdb2781d050ae25143c56d8c77cc9b50537f783991415b5a5169dfab75741f9f4dd2
7
- data.tar.gz: 8bd2666d00a15e966f3ea7e5c391cb88a1307249e9af63a576b2d6f29989c79a89b245bcc6fc9a36286f38aa2cc2b386586b4328eecb08b58a53119b347b8162
6
+ metadata.gz: 7fb3cd049cadd55cfb9750c6167804a8af54d793498bc3a67ac1efe913ec4497e2dec7ed19c176d644ecf8f49e721ad33e5b4d49fc32cafb073ccf5b0b08cc9c
7
+ data.tar.gz: bf246270c2651c86fa311ac72e02dd75c1ba03074286e254edfb6a99ae2dc59a1084e4317649d04cea31abf1c6b68908bf962d5b091a5a205d56830b138eb0ee
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.20
4
+
5
+ - New examples/editable_column_table.rb
6
+ - Support `editable` property for `text_column`
7
+
3
8
  ## 0.0.19
4
9
 
5
10
  - New examples/editable_table.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.0.19
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.20
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.19](#-glimmer-dsl-for-libui-0019)
46
+ - [Glimmer DSL for LibUI 0.0.20](#-glimmer-dsl-for-libui-0020)
47
47
  - [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
48
48
  - [Usage](#usage)
49
49
  - [API](#api)
@@ -70,6 +70,9 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
70
70
  - [Grid](#grid)
71
71
  - [Form](#form)
72
72
  - [Basic Table](#basic-table)
73
+ - [Editable Table](#editable-table)
74
+ - [Editable Column Table](#editable-column-table)
75
+ - [Basic Table Image](#basic-table-image)
73
76
  - [Contributing to glimmer-dsl-libui](#contributing-to-glimmer-dsl-libui)
74
77
  - [Help](#help)
75
78
  - [Issues](#issues)
@@ -157,7 +160,7 @@ gem install glimmer-dsl-libui
157
160
  Or install via Bundler `Gemfile`:
158
161
 
159
162
  ```ruby
160
- gem 'glimmer-dsl-libui', '~> 0.0.19'
163
+ gem 'glimmer-dsl-libui', '~> 0.0.20'
161
164
  ```
162
165
 
163
166
  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.
@@ -246,7 +249,7 @@ Control(Args) | Properties | Listeners
246
249
  `tab` | `margined` (Boolean), `num_pages` (`Integer`) | None
247
250
  `tab_item(name as String)` | `index` [read-only] (`Integer`), `margined` (Boolean), `name` [read-only] (`String`) | None
248
251
  `table` | `cell_rows` (`Array` (rows) of `Arrays` (row columns) of cell values (e.g. `String` values)), `editable` as Boolean | None
249
- `text_column(name as String)` | None | None
252
+ `text_column(name as String)` | `editable` as Boolean | None
250
253
  `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`
251
254
  `vertical_box` | `padded` (Boolean) | None
252
255
  `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`
@@ -311,7 +314,7 @@ Control(Args) | Properties | Listeners
311
314
  - When destroying a control nested under a `window` or `group`, it is automatically unset as their child to allow successful destruction
312
315
  - 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`
313
316
  - Smart defaults for `grid` child attributes are `left` (`0`), `top` (`0`), `xspan` (`1`), `yspan` (`1`), `hexpand` (`false`), `halign` (`0`), `vexpand` (`false`), and `valign` (`0`)
314
- - The `table` control automatically constructs required `TableModelHandler`, `TableModel`, and `TableParams`, calculating all their arguments from `cell_rows` property (e.g. `NumRows`)
317
+ - 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`)
315
318
  - Table model instances are automatically freed from memory after `window` is destroyed.
316
319
  - `image` instances are automatically freed from memory after `window` is destroyed.
317
320
 
@@ -1940,6 +1943,65 @@ window('Editable animal sounds', 300, 200) {
1940
1943
  }.show
1941
1944
  ```
1942
1945
 
1946
+ ### Editable Column Table
1947
+
1948
+ [examples/editable_column_table.rb](examples/editable_column_table.rb)
1949
+
1950
+ Run with this command from the root of the project if you cloned the project:
1951
+
1952
+ ```
1953
+ ruby -r './lib/glimmer-dsl-libui' examples/editable_column_table.rb
1954
+ ```
1955
+
1956
+ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
1957
+
1958
+ ```
1959
+ ruby -r glimmer-dsl-libui -e "require 'examples/editable_column_table'"
1960
+ ```
1961
+
1962
+ Mac
1963
+
1964
+ ![glimmer-dsl-libui-mac-editable-column-table-editing.png](images/glimmer-dsl-libui-mac-editable-column-table-editing.png)
1965
+ ![glimmer-dsl-libui-mac-editable-column-table-edited.png](images/glimmer-dsl-libui-mac-editable-column-table-edited.png)
1966
+
1967
+ Linux
1968
+
1969
+ ![glimmer-dsl-libui-linux-editable-column-table-editing.png](images/glimmer-dsl-libui-linux-editable-column-table-editing.png)
1970
+ ![glimmer-dsl-libui-linux-editable-column-table-edited.png](images/glimmer-dsl-libui-linux-editable-column-table-edited.png)
1971
+
1972
+ New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
1973
+
1974
+ ```ruby
1975
+ require 'glimmer-dsl-libui'
1976
+
1977
+ include Glimmer
1978
+
1979
+ data = [
1980
+ %w[cat calm meow],
1981
+ %w[dog loyal woof],
1982
+ %w[chicken bird cock-a-doodle-doo],
1983
+ %w[hourse fast neigh],
1984
+ %w[cow slow moo]
1985
+ ]
1986
+
1987
+ window('Editable column animal sounds', 400, 200) {
1988
+ horizontal_box {
1989
+ table {
1990
+ text_column('Animal')
1991
+ text_column('Description')
1992
+ text_column('Sound (Editable)') {
1993
+ editable true
1994
+ }
1995
+
1996
+ cell_rows data
1997
+ }
1998
+ }
1999
+
2000
+ on_closing do
2001
+ puts 'Bye Bye'
2002
+ end
2003
+ }.show
2004
+ ```
1943
2005
 
1944
2006
  ### Basic Table Image
1945
2007
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.19
1
+ 0.0.20
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'glimmer-dsl-libui'
4
+
5
+ include Glimmer
6
+
7
+ data = [
8
+ %w[cat calm meow],
9
+ %w[dog loyal woof],
10
+ %w[chicken bird cock-a-doodle-doo],
11
+ %w[hourse fast neigh],
12
+ %w[cow slow moo]
13
+ ]
14
+
15
+ window('Editable column animal sounds', 400, 200) {
16
+ horizontal_box {
17
+ table {
18
+ text_column('Animal')
19
+ text_column('Description')
20
+ text_column('Sound (Editable)') {
21
+ editable true
22
+ }
23
+
24
+ cell_rows data
25
+ }
26
+ }
27
+
28
+ on_closing do
29
+ puts 'Bye Bye'
30
+ end
31
+ }.show
Binary file
@@ -30,10 +30,21 @@ module Glimmer
30
30
  class TextColumnProxy < ControlProxy
31
31
  include Column
32
32
 
33
+ def editable(value = nil)
34
+ if value.nil?
35
+ @editable
36
+ else
37
+ @editable = !!value
38
+ end
39
+ end
40
+ alias editable= editable
41
+ alias set_editable editable
42
+ alias editable? editable
43
+
33
44
  private
34
45
 
35
46
  def build_control
36
- @parent_proxy.append_text_column(name, next_column_index, @parent_proxy.editable? ? -2 : -1)
47
+ @parent_proxy.append_text_column(name, next_column_index, @parent_proxy.editable? || editable? ? -2 : -1)
37
48
  super
38
49
  end
39
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
@@ -177,7 +177,7 @@ dependencies:
177
177
  - !ruby/object:Gem::Version
178
178
  version: 1.4.0
179
179
  description: Glimmer DSL for LibUI - Prerequisite-Free Ruby Desktop Development GUI
180
- Library (no need to pre-install any prerequisites. Just install the gem and have
180
+ Library (No need to pre-install any prerequisites. Just install the gem and have
181
181
  platform-independent native GUI that just works!)
182
182
  email: andy.am@gmail.com
183
183
  executables:
@@ -203,6 +203,7 @@ files:
203
203
  - examples/color_button.rb
204
204
  - examples/control_gallery.rb
205
205
  - examples/date_time_picker.rb
206
+ - examples/editable_column_table.rb
206
207
  - examples/editable_table.rb
207
208
  - examples/font_button.rb
208
209
  - examples/form.rb