glimmer-dsl-libui 0.0.24 → 0.0.25

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: 48620214d8ee4d8658822fd623fbc35cacca3a65fdb9b50b9c0e594f37bce0ad
4
- data.tar.gz: 595c65cc0ec5c8f94eea6b2aa542cd3f55870d537d3de4fa230b237e58a13835
3
+ metadata.gz: ef6b80413ffc1933a0e36dd536f06d67538002ef7777aa682ef19f7ef01f7b28
4
+ data.tar.gz: fb188b7bb041bdaf0a95aee368f339268459d41de7aa76947fa1504b56d465d2
5
5
  SHA512:
6
- metadata.gz: 52bfdf8599bc77a418a96a3ed4e3e072c06c328a9597325d66b21419cfde80ade7475f3744870ad0413383d72154db9caea0158e5a2f82e2e7446f231b1eb800
7
- data.tar.gz: b8f10cae326f757cf6fdbff6085db5d9302696109158046c19cca0d57aaad63f9d28e30509155e69fa3d26bcc48541e3276e04d21c27969425663177da32a3a5
6
+ metadata.gz: 1530e1e986263701efebab10a2eff549bcadb7bc23c8e67cdde4c622822b9c6a54d74d9b2ccffb700f48021d1f34b6b10b683d85d0062202055b4d7b20acfb2f
7
+ data.tar.gz: 89df7b4eab9bdd449ead5ac40a92fa1f7e5b56a72191dc649bc53df96994a733d048eb99f1710149a1e26a87123e45413f2d4d973704ca0e16406a43764ce0c2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.25
4
+
5
+ - New examples/basic_table_checkbox_text.rb
6
+ - Support table `checkbox_text_column`
7
+
3
8
  ## 0.0.24
4
9
 
5
10
  - New examples/basic_table_checkbox.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.24
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.25
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.24](#-glimmer-dsl-for-libui-0024)
46
+ - [Glimmer DSL for LibUI 0.0.25](#-glimmer-dsl-for-libui-0025)
47
47
  - [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
48
48
  - [Usage](#usage)
49
49
  - [API](#api)
@@ -76,6 +76,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
76
76
  - [Basic Table Image Text](#basic-table-image-text)
77
77
  - [Basic Table Button](#basic-table-button)
78
78
  - [Basic Table Checkbox](#basic-table-checkbox)
79
+ - [Basic Table Checkbox Text](#basic-table-checkbox-text)
79
80
  - [Contributing to glimmer-dsl-libui](#contributing-to-glimmer-dsl-libui)
80
81
  - [Help](#help)
81
82
  - [Issues](#issues)
@@ -163,7 +164,7 @@ gem install glimmer-dsl-libui
163
164
  Or install via Bundler `Gemfile`:
164
165
 
165
166
  ```ruby
166
- gem 'glimmer-dsl-libui', '~> 0.0.24'
167
+ gem 'glimmer-dsl-libui', '~> 0.0.25'
167
168
  ```
168
169
 
169
170
  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.
@@ -223,6 +224,7 @@ Control(Args) | Properties | Listeners
223
224
  `button_column(name as String)` | `enabled` (Boolean) | None
224
225
  `checkbox(text as String)` | `checked` (Boolean), `text` (`String`) | `on_toggled`
225
226
  `checkbox_column(name as String)` | None | None
227
+ `checkbox_text_column(name as String)` | `editable` (Boolean) | None
226
228
  `combobox` | `items` (`Array` of `String`), `selected` (`Integer`) | `on_selected`
227
229
  `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`
228
230
  `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`
@@ -255,7 +257,7 @@ Control(Args) | Properties | Listeners
255
257
  `tab` | `margined` (Boolean), `num_pages` (`Integer`) | None
256
258
  `tab_item(name as String)` | `index` [read-only] (`Integer`), `margined` (Boolean), `name` [read-only] (`String`) | None
257
259
  `table` | `cell_rows` (`Array` (rows) of `Arrays` (row columns) of cell values (e.g. `String` values for `text_column` cells or `Array` of `image`/`String` for `image_text_column`)), `editable` as Boolean | None
258
- `text_column(name as String)` | `editable` as Boolean | None
260
+ `text_column(name as String)` | `editable` (Boolean) | None
259
261
  `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`
260
262
  `vertical_box` | `padded` (Boolean) | None
261
263
  `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`
@@ -2357,6 +2359,58 @@ window('Animal sounds', 300, 200) {
2357
2359
  }.show
2358
2360
  ```
2359
2361
 
2362
+ ### Basic Table Checkbox Text
2363
+
2364
+ [examples/basic_table_checkbox_text.rb](examples/basic_table_checkbox_text.rb)
2365
+
2366
+ Run with this command from the root of the project if you cloned the project:
2367
+
2368
+ ```
2369
+ ruby -r './lib/glimmer-dsl-libui' examples/basic_table_checkbox_text.rb
2370
+ ```
2371
+
2372
+ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
2373
+
2374
+ ```
2375
+ ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_checkbox_text'"
2376
+ ```
2377
+
2378
+ Mac
2379
+
2380
+ ![glimmer-dsl-libui-mac-basic-table-checkbox-text.png](images/glimmer-dsl-libui-mac-basic-table-checkbox-text.png)
2381
+
2382
+ Linux
2383
+
2384
+ ![glimmer-dsl-libui-linux-basic-table-checkbox-text.png](images/glimmer-dsl-libui-linux-basic-table-checkbox-text.png)
2385
+
2386
+ New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
2387
+
2388
+ ```ruby
2389
+ require 'glimmer-dsl-libui'
2390
+
2391
+ include Glimmer
2392
+
2393
+ data = [
2394
+ ['cat', 'meow', [true, 'mammal']],
2395
+ ['dog', 'woof', [true, 'mammal']],
2396
+ ['chicken', 'cock-a-doodle-doo', [false, 'mammal']],
2397
+ ['horse', 'neigh', [true, 'mammal']],
2398
+ ['cow', 'moo', [true, 'mammal']]
2399
+ ]
2400
+
2401
+ window('Animal sounds', 400, 200) {
2402
+ horizontal_box {
2403
+ table {
2404
+ text_column('Animal')
2405
+ text_column('Sound')
2406
+ checkbox_text_column('Description')
2407
+
2408
+ cell_rows data
2409
+ }
2410
+ }
2411
+ }.show
2412
+ ```
2413
+
2360
2414
  ## Contributing to glimmer-dsl-libui
2361
2415
 
2362
2416
  - Check out the latest master to make sure the feature hasn't been
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.24
1
+ 0.0.25
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'glimmer-dsl-libui'
4
+
5
+ include Glimmer
6
+
7
+ data = [
8
+ ['cat', 'meow', [true, 'mammal']],
9
+ ['dog', 'woof', [true, 'mammal']],
10
+ ['chicken', 'cock-a-doodle-doo', [false, 'mammal']],
11
+ ['horse', 'neigh', [true, 'mammal']],
12
+ ['cow', 'moo', [true, 'mammal']]
13
+ ]
14
+
15
+ window('Animal sounds', 400, 200) {
16
+ horizontal_box {
17
+ table {
18
+ text_column('Animal')
19
+ text_column('Sound')
20
+ checkbox_text_column('Description')
21
+
22
+ cell_rows data
23
+ }
24
+ }
25
+ }.show
Binary file
@@ -0,0 +1,44 @@
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
+ require 'glimmer/libui/column'
24
+ require 'glimmer/libui/dual_column'
25
+ require 'glimmer/libui/editable_column'
26
+
27
+ module Glimmer
28
+ module LibUI
29
+ # Proxy for LibUI checkbox text column objects
30
+ #
31
+ # Follows the Proxy Design Pattern
32
+ class CheckboxTextColumnProxy < ControlProxy
33
+ include Column
34
+ include DualColumn
35
+ include EditableColumn # TODO split into editable_checkbox and editable_text properties in the future given that checkbox and text can be edited separately
36
+
37
+ private
38
+
39
+ def build_control
40
+ @parent_proxy.append_checkbox_text_column(name, column_index, -1, second_column_index, editable_value)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -111,10 +111,8 @@ module Glimmer
111
111
  0
112
112
  when ImageColumnProxy, ImageTextColumnProxy
113
113
  1
114
- when CheckboxColumnProxy
114
+ when CheckboxColumnProxy, CheckboxTextColumnProxy
115
115
  2
116
- # when CheckboxTextColumnProxy
117
- # 2
118
116
  # when ProgressBarColumnProxy
119
117
  # 2
120
118
  end
@@ -127,7 +125,7 @@ module Glimmer
127
125
  ::LibUI.new_table_value_string((expanded_cell_rows[row] && expanded_cell_rows[row][column]).to_s)
128
126
  when ImageColumnProxy, ImageTextColumnProxy
129
127
  ::LibUI.new_table_value_image((expanded_cell_rows[row] && (expanded_cell_rows[row][column].respond_to?(:libui) ? expanded_cell_rows[row][column].libui : expanded_cell_rows[row][column])))
130
- when CheckboxColumnProxy
128
+ when CheckboxColumnProxy, CheckboxTextColumnProxy
131
129
  ::LibUI.new_table_value_int((expanded_cell_rows[row] && (expanded_cell_rows[row][column] == 1 || expanded_cell_rows[row][column].to_s.strip.downcase == 'true' ? 1 : 0)))
132
130
  end
133
131
  end
@@ -142,7 +140,7 @@ module Glimmer
142
140
  @cell_rows[row][column][1] = ::LibUI.table_value_string(val).to_s
143
141
  when ButtonColumnProxy
144
142
  @columns[column].notify_listeners(:on_clicked, row)
145
- when CheckboxColumnProxy
143
+ when CheckboxColumnProxy, CheckboxTextColumnProxy
146
144
  column = @columns[column].index
147
145
  @cell_rows[row] ||= []
148
146
  @cell_rows[row][column] = ::LibUI.table_value_int(val).to_i == 1
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.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
@@ -199,6 +199,7 @@ files:
199
199
  - examples/basic_table.rb
200
200
  - examples/basic_table_button.rb
201
201
  - examples/basic_table_checkbox.rb
202
+ - examples/basic_table_checkbox_text.rb
202
203
  - examples/basic_table_image.rb
203
204
  - examples/basic_table_image_text.rb
204
205
  - examples/basic_window.rb
@@ -231,6 +232,7 @@ files:
231
232
  - lib/glimmer/libui/check_menu_item_proxy.rb
232
233
  - lib/glimmer/libui/checkbox_column_proxy.rb
233
234
  - lib/glimmer/libui/checkbox_proxy.rb
235
+ - lib/glimmer/libui/checkbox_text_column_proxy.rb
234
236
  - lib/glimmer/libui/color_button_proxy.rb
235
237
  - lib/glimmer/libui/column.rb
236
238
  - lib/glimmer/libui/combobox_proxy.rb