glimmer-dsl-libui 0.12.7 → 0.13.0
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -6
- data/VERSION +1 -1
- data/bin/girb +1 -1
- data/bin/girb_runner.rb +1 -1
- data/bin/glimmer +1 -1
- data/docs/examples/GLIMMER-DSL-LIBUI-ADVANCED-EXAMPLES.md +1 -1
- data/examples/button_counter.rb +8 -10
- data/examples/snake/model/game.rb +12 -12
- data/examples/tetris/model/block.rb +1 -1
- data/examples/tetris/model/game.rb +1 -1
- data/examples/tetris/model/past_game.rb +1 -1
- data/examples/tetris/model/tetromino.rb +1 -1
- data/examples/tetris.rb +1 -1
- data/examples/tic_tac_toe/board.rb +1 -1
- data/examples/tic_tac_toe/cell.rb +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/content_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/control_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/custom_control_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/custom_control_slot_content_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/custom_shape_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/dsl.rb +1 -1
- data/lib/glimmer/dsl/libui/file_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/listener_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/observe_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/open_file_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/open_folder_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/operation_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/property_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/save_file_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/shape_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/shine_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/string_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/tab_item_expression.rb +1 -1
- data/lib/glimmer/fiddle_consumer.rb +1 -1
- data/lib/glimmer/libui/attributed_string.rb +1 -1
- data/lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/area_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/box/horizontal_box_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/box/vertical_box_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/box.rb +1 -1
- data/lib/glimmer/libui/control_proxy/button_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/checkbox_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/color_button_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/background_color_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/button_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/checkbox_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/checkbox_text_color_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/checkbox_text_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/image_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/image_text_color_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/image_text_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/progress_bar_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/text_color_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column/text_column_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/column.rb +1 -1
- data/lib/glimmer/libui/control_proxy/combobox_proxy.rb +16 -11
- data/lib/glimmer/libui/control_proxy/date_time_picker_proxy/date_picker_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/date_time_picker_proxy/time_picker_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/date_time_picker_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/dual_column.rb +1 -1
- data/lib/glimmer/libui/control_proxy/editable_column.rb +1 -1
- data/lib/glimmer/libui/control_proxy/editable_combobox_proxy.rb +10 -10
- data/lib/glimmer/libui/control_proxy/enableable_column.rb +1 -1
- data/lib/glimmer/libui/control_proxy/entry_proxy/password_entry_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/entry_proxy/search_entry_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/entry_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/font_button_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/form_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/grid_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/group_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/image_part_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/image_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/label_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/matrix_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy/about_menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy/check_menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy/preferences_menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy/quit_menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy/radio_menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy/separator_menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/menu_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/message_box/msg_box_error_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/message_box/msg_box_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/message_box.rb +1 -1
- data/lib/glimmer/libui/control_proxy/multiline_entry_proxy/non_wrapping_multiline_entry_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/multiline_entry_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/open_type_features_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/open_type_tag_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/path_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/radio_buttons_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/slider_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/spinbox_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/tab_item_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/table_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/text_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy/transformable.rb +1 -1
- data/lib/glimmer/libui/control_proxy/triple_column.rb +1 -1
- data/lib/glimmer/libui/control_proxy/window_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy.rb +1 -1
- data/lib/glimmer/libui/custom_control/code_area.rb +1 -1
- data/lib/glimmer/libui/custom_control/code_entry.rb +1 -1
- data/lib/glimmer/libui/custom_control/refined_table.rb +2 -2
- data/lib/glimmer/libui/custom_control.rb +1 -1
- data/lib/glimmer/libui/custom_shape.rb +1 -1
- data/lib/glimmer/libui/custom_window.rb +1 -1
- data/lib/glimmer/libui/data_bindable.rb +1 -1
- data/lib/glimmer/libui/parent.rb +1 -1
- data/lib/glimmer/libui/shape/arc.rb +1 -1
- data/lib/glimmer/libui/shape/bezier.rb +1 -1
- data/lib/glimmer/libui/shape/circle.rb +1 -1
- data/lib/glimmer/libui/shape/figure.rb +1 -1
- data/lib/glimmer/libui/shape/line.rb +1 -1
- data/lib/glimmer/libui/shape/polybezier.rb +1 -1
- data/lib/glimmer/libui/shape/polygon.rb +1 -1
- data/lib/glimmer/libui/shape/polyline.rb +1 -1
- data/lib/glimmer/libui/shape/rectangle.rb +1 -1
- data/lib/glimmer/libui/shape/square.rb +1 -1
- data/lib/glimmer/libui/shape.rb +1 -1
- data/lib/glimmer/libui.rb +2 -2
- data/lib/glimmer/rake_task/package.rb +1 -1
- data/lib/glimmer/rake_task/scaffold.rb +1 -1
- data/lib/glimmer/rake_task.rb +1 -1
- data/lib/glimmer-dsl-libui.rb +1 -1
- metadata +20 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43ae658184be717b4516022b2233f3ecba9dca4f258b307bc81b9488b8387f70
|
|
4
|
+
data.tar.gz: e09b32411f1301deba1312b78f86288708dc56964e08a97165b1d55e156dfc80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 899b60f962b0df986a447353e2cd80578a1306fadee0edfefea1bf9089c8856576189dfca33a3bb2ebb8239394f9d719195cef03bbc9e31eb714ef44058b3186
|
|
7
|
+
data.tar.gz: bb6ec4a596ce49130190fa3870ca472965d5b958ec05c1e0d7ecdf2a3c0593ab290079d4dc60823c098f610f8bb85c8270330c5ecd3e634c0f5ecfbe11becf21
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
- Support `combobox` `items` unidirectional data-binding
|
|
6
|
+
- Update color gem to version 2
|
|
7
|
+
- Refactor/simplify examples/button_counter.rb by removing unnecessary `vertical_box` (Glimmer DSL for LibUI implicitly adds it automatically when needed)
|
|
8
|
+
- Fix issue of `combobox` `selected_item` bidirectional data-binding not working correctly like `selected` data-binding does
|
|
9
|
+
|
|
10
|
+
## 0.12.8
|
|
11
|
+
|
|
12
|
+
- Fix issue with refined_table crashing when filtering by a specific column (e.g. name:john) and column is not found
|
|
13
|
+
- Fix broken spec/examples/snake/model/game_spec.rb due to method being made private incorrectly
|
|
14
|
+
|
|
3
15
|
## 0.12.7
|
|
4
16
|
|
|
5
17
|
- Application Scaffolding now generates the main view as `SomeNameApplication` (with `_application` suffix in file name) to indicate clearly it is a `Glimmer::LibUI::Application` class.
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,12 +1,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.
|
|
2
|
-
## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](
|
|
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.13.0
|
|
2
|
+
## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](https://andymaleh.blogspot.com/2022/02/glimmer-dsl-for-libui-wins-fukuoka-ruby.html))
|
|
3
3
|
### The Quickest Way From Zero To GUI
|
|
4
4
|
[](http://badge.fury.io/rb/glimmer-dsl-libui)
|
|
5
5
|
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
6
6
|
|
|
7
7
|
**[If You Liked Shoes, You'll Love Glimmer!](https://github.com/AndyObtiva/glimmer#faq)**
|
|
8
8
|
|
|
9
|
-
(**[Fukuoka Ruby Award Competition 2022 Special Award Winner](https://andymaleh.blogspot.com/2022/02/glimmer-dsl-for-libui-wins-fukuoka-ruby.html)**
|
|
9
|
+
(**[Fukuoka Ruby Award Competition 2022 Special Award Winner](https://andymaleh.blogspot.com/2022/02/glimmer-dsl-for-libui-wins-fukuoka-ruby.html)**)
|
|
10
10
|
|
|
11
11
|
(**[***RubyConf 2024 Workshop - How To Build Basic Desktop Applications in Ruby***](https://www.youtube.com/watch?v=TTSqRdTVtDY)**)
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
[**(Ruby Rogues Podcast Interview - Desktop Apps in Ruby ft. Andy)**](https://andymaleh.blogspot.com/2022/05/ruby-rogues-podcast-interview-desktop.html)
|
|
18
18
|
|
|
19
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [LibUI](https://github.com/libui-ng/libui-ng) is a [Fukuoka Award Winning](
|
|
19
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [LibUI](https://github.com/libui-ng/libui-ng) is a [Fukuoka Award Winning](https://andymaleh.blogspot.com/2022/02/glimmer-dsl-for-libui-wins-fukuoka-ruby.html) prerequisite-free [MRI Ruby](https://www.ruby-lang.org) desktop development cross-platform native GUI (Graphical User Interface) library. No need to pre-install any prerequisites. Just install the [gem](https://rubygems.org/gems/glimmer-dsl-libui) and have cross-platform native GUI that just works on Mac, Windows, and Linux!
|
|
20
20
|
|
|
21
21
|
Mac | Windows | Linux
|
|
22
22
|
----|---------|------
|
|
@@ -26,6 +26,8 @@ Mac | Windows | Linux
|
|
|
26
26
|
|
|
27
27
|
The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) as opposed to [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) or [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) is the fact that [SWT](https://www.eclipse.org/swt/) and [Tk](https://www.tcl.tk/) are more mature than mid-alpha [libui](https://github.com/libui-ng/libui-ng) as GUI toolkits. Still, if there is only a need to build a small simple application, [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) could be a good convenient choice due to having zero prerequisites (beyond Ruby and the dependencies included in the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui)). Also, just like [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk), its apps start instantly and have a small memory footprint. [LibUI](https://github.com/kojix2/LibUI) is a promising new GUI toolkit that might prove quite worthy in the future.
|
|
28
28
|
|
|
29
|
+
Note that the new [Glimmer DSL for WX](https://github.com/AndyObtiva/glimmer-dsl-wx) is supporting the new wxruby3 binding for wxWidgets, which offers native GUI support just like LibUI, but with a mature toolkit. If you need to build more serious native GUI apps and prefer CRuby over JRuby, then [Glimmer DSL for WX](https://github.com/AndyObtiva/glimmer-dsl-wx) could be the best option for that.
|
|
30
|
+
|
|
29
31
|
[Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
|
|
30
32
|
- [Declarative DSL syntax](#glimmer-gui-dsl-concepts) that visually maps to the GUI control hierarchy
|
|
31
33
|
- [Convention over configuration](#smart-defaults-and-conventions) via smart defaults and automation of low-level details
|
|
@@ -466,7 +468,7 @@ gem install glimmer-dsl-libui
|
|
|
466
468
|
Or install via Bundler `Gemfile`:
|
|
467
469
|
|
|
468
470
|
```ruby
|
|
469
|
-
gem 'glimmer-dsl-libui', '~> 0.
|
|
471
|
+
gem 'glimmer-dsl-libui', '~> 0.13.0'
|
|
470
472
|
```
|
|
471
473
|
|
|
472
474
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
|
@@ -4601,7 +4603,7 @@ Note that the latest development sometimes takes place in the [development](http
|
|
|
4601
4603
|
|
|
4602
4604
|
[MIT](LICENSE.txt)
|
|
4603
4605
|
|
|
4604
|
-
Copyright (c) 2021-
|
|
4606
|
+
Copyright (c) 2021-2025 Andy Maleh
|
|
4605
4607
|
|
|
4606
4608
|
--
|
|
4607
4609
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.13.0
|
data/bin/girb
CHANGED
data/bin/girb_runner.rb
CHANGED
data/bin/glimmer
CHANGED
|
@@ -2916,7 +2916,7 @@ class Tetris
|
|
|
2916
2916
|
|
|
2917
2917
|
def show_about_dialog
|
|
2918
2918
|
Glimmer::LibUI.queue_main do
|
|
2919
|
-
msg_box('About', 'Glimmer Tetris - Glimmer DSL for LibUI Example - Copyright (c) 2021-
|
|
2919
|
+
msg_box('About', 'Glimmer Tetris - Glimmer DSL for LibUI Example - Copyright (c) 2021-2025 Andy Maleh')
|
|
2920
2920
|
end
|
|
2921
2921
|
end
|
|
2922
2922
|
end
|
data/examples/button_counter.rb
CHANGED
|
@@ -17,16 +17,14 @@ class ButtonCounter
|
|
|
17
17
|
|
|
18
18
|
body {
|
|
19
19
|
window('Hello, Button!', 190, 20) {
|
|
20
|
-
|
|
21
|
-
button
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
}
|
|
20
|
+
button {
|
|
21
|
+
# data-bind button text to @counter count, converting to string on read from model.
|
|
22
|
+
text <= [@counter, :count, on_read: ->(count) {"Count: #{count}"}]
|
|
23
|
+
|
|
24
|
+
on_clicked do
|
|
25
|
+
# This count change will automatically propagate to button text through data-binding above
|
|
26
|
+
@counter.count += 1
|
|
27
|
+
end
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
}
|
|
@@ -24,18 +24,6 @@ class Snake
|
|
|
24
24
|
@high_score = File.read(FILE_HIGH_SCORE).to_i rescue 0
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def score=(new_score)
|
|
28
|
-
@score = new_score
|
|
29
|
-
self.high_score = @score if @score > @high_score
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def high_score=(new_high_score)
|
|
33
|
-
@high_score = new_high_score
|
|
34
|
-
File.write(FILE_HIGH_SCORE, @high_score.to_s)
|
|
35
|
-
rescue => e
|
|
36
|
-
puts e.full_message
|
|
37
|
-
end
|
|
38
|
-
|
|
39
27
|
def start
|
|
40
28
|
self.over = false
|
|
41
29
|
self.score = 0
|
|
@@ -63,6 +51,18 @@ class Snake
|
|
|
63
51
|
def inspect
|
|
64
52
|
"#{super[0, 75]}... >"
|
|
65
53
|
end
|
|
54
|
+
|
|
55
|
+
def score=(new_score)
|
|
56
|
+
@score = new_score
|
|
57
|
+
self.high_score = @score if @score > @high_score
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def high_score=(new_high_score)
|
|
61
|
+
@high_score = new_high_score
|
|
62
|
+
File.write(FILE_HIGH_SCORE, @high_score.to_s)
|
|
63
|
+
rescue => e
|
|
64
|
+
puts e.full_message
|
|
65
|
+
end
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
end
|
data/examples/tetris.rb
CHANGED
|
@@ -396,7 +396,7 @@ class Tetris
|
|
|
396
396
|
|
|
397
397
|
def show_about_dialog
|
|
398
398
|
Glimmer::LibUI.queue_main do
|
|
399
|
-
msg_box('About', 'Glimmer Tetris - Glimmer DSL for LibUI Example - Copyright (c) 2021-
|
|
399
|
+
msg_box('About', 'Glimmer Tetris - Glimmer DSL for LibUI Example - Copyright (c) 2021-2025 Andy Maleh')
|
|
400
400
|
end
|
|
401
401
|
end
|
|
402
402
|
end
|
data/glimmer-dsl-libui.gemspec
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2021-
|
|
1
|
+
# Copyright (c) 2021-2025 Andy Maleh
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
4
4
|
# a copy of this software and associated documentation files (the
|
|
@@ -42,23 +42,28 @@ module Glimmer
|
|
|
42
42
|
alias selected= selected
|
|
43
43
|
alias set_selected selected
|
|
44
44
|
|
|
45
|
-
def items(*
|
|
46
|
-
|
|
47
|
-
if
|
|
48
|
-
@
|
|
45
|
+
def items(*item_values)
|
|
46
|
+
item_values = item_values.first if item_values.first.is_a?(Array)
|
|
47
|
+
if item_values.empty?
|
|
48
|
+
@items
|
|
49
49
|
else
|
|
50
|
-
@
|
|
51
|
-
|
|
50
|
+
@items = item_values
|
|
51
|
+
clear
|
|
52
|
+
@items.each { |item| append(item) }
|
|
52
53
|
end
|
|
53
54
|
end
|
|
54
55
|
alias set_items items
|
|
55
56
|
alias items= items
|
|
56
57
|
|
|
57
|
-
def selected_item(
|
|
58
|
-
if
|
|
59
|
-
|
|
58
|
+
def selected_item(item_value = nil)
|
|
59
|
+
if item_value.nil?
|
|
60
|
+
if selected == -1 # no value selected (unselected)
|
|
61
|
+
nil
|
|
62
|
+
else
|
|
63
|
+
items[selected]
|
|
64
|
+
end
|
|
60
65
|
else
|
|
61
|
-
self.selected = items.index(
|
|
66
|
+
self.selected = items.index(item_value)
|
|
62
67
|
end
|
|
63
68
|
end
|
|
64
69
|
alias set_selected_item selected_item
|