glimmer-dsl-libui 0.2.4 → 0.2.5

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: 65d8bf2e6e00eeece96482279bc7dedb367ee21f4a88dd8b96869ff78e051e2f
4
- data.tar.gz: 3b3ca0d276675e9787a22f8318089bf4d88f3fea1df0d225d024a1037f63d5fc
3
+ metadata.gz: b691a0eeec6e7d571ac6815c272e0dd5ae48c0f0302fc11876ae373cb92cba1e
4
+ data.tar.gz: 576d6840f47182d0dc0bd3ccccdb301b5a9efb2f7b7038efa3e5fa8d8ea30537
5
5
  SHA512:
6
- metadata.gz: 00a8a549d4aa8c13fe2824f2fda437d6de675b02108ac3e6196c149db02ee0fd48a6ff11e509155eecf512a9ae66e89c60b850cd99cae44ad1302c1533405330
7
- data.tar.gz: 9432f12897bad09cbaf9b72077d15968bc87852a35055e083923779ad311ef5b1221e1a9e1382f7623c0a1524540d98e2e20e91583530facaac5d505cece357c
6
+ metadata.gz: d00b9ecc527e56e144d1baead2910e62a29f9f429af9fc57a1da05a4d590d9286f47c2fe8d840062c1a989f42183f9dfc717a0800db2ec6467acc434201d3707
7
+ data.tar.gz: 53dbe182b9b9607111915412af9d418571511af560dc5af83d792214139c62f91358aa5555147d962a040802852d74f581413b99d287827454ea2ca865ec110b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.2.5
4
+
5
+ - Support attributed `string` `underline_color` property (built-in enum symbols and custom color)
6
+
3
7
  ## 0.2.4
4
8
 
5
9
  - Support examples/custom_draw_text.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.2.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.2.5
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)
@@ -197,7 +197,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
197
197
 
198
198
  ## Table of Contents
199
199
 
200
- - [Glimmer DSL for LibUI 0.2.4](#-glimmer-dsl-for-libui-024)
200
+ - [Glimmer DSL for LibUI 0.2.5](#-glimmer-dsl-for-libui-025)
201
201
  - [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
202
202
  - [Usage](#usage)
203
203
  - [Girb (Glimmer IRB)](#girb-glimmer-irb)
@@ -333,7 +333,7 @@ gem install glimmer-dsl-libui
333
333
  Or install via Bundler `Gemfile`:
334
334
 
335
335
  ```ruby
336
- gem 'glimmer-dsl-libui', '~> 0.2.4'
336
+ gem 'glimmer-dsl-libui', '~> 0.2.5'
337
337
  ```
338
338
 
339
339
  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.
@@ -5260,7 +5260,7 @@ class CustomDrawText
5260
5260
  include Glimmer
5261
5261
 
5262
5262
  def launch
5263
- window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
5263
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
5264
5264
  margined true
5265
5265
 
5266
5266
  vertical_box {
@@ -5349,7 +5349,7 @@ class CustomDrawText
5349
5349
  include Glimmer
5350
5350
 
5351
5351
  def launch
5352
- window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
5352
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
5353
5353
  margined true
5354
5354
 
5355
5355
  vertical_box {
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -7,7 +7,7 @@ class CustomDrawText
7
7
  include Glimmer
8
8
 
9
9
  def launch
10
- window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
10
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
11
11
  margined true
12
12
 
13
13
  vertical_box {
@@ -44,6 +44,28 @@ class CustomDrawText
44
44
  @string.underline = c.selected_item.underscore
45
45
  end
46
46
  }
47
+ combobox { |c|
48
+ label 'Underline Built-In Color'
49
+ items Glimmer::LibUI.enum_symbols(:underline_color).map(&:to_s).map(&:capitalize)
50
+ selected 'Custom'
51
+
52
+ on_selected do
53
+ @underline_custom_color_button.enabled = c.selected_item == 'Custom'
54
+ if c.selected_item == 'Custom'
55
+ @string.underline_color = @underline_custom_color_button.color
56
+ else
57
+ @string.underline_color = c.selected_item.underscore
58
+ @underline_custom_color_button.color = :black
59
+ end
60
+ end
61
+ }
62
+ @underline_custom_color_button = color_button {
63
+ label 'Underline Custom Color'
64
+
65
+ on_changed do
66
+ @string.underline_color = @underline_custom_color_button.color
67
+ end
68
+ }
47
69
  }
48
70
 
49
71
  area {
@@ -7,7 +7,7 @@ class CustomDrawText
7
7
  include Glimmer
8
8
 
9
9
  def launch
10
- window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
10
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
11
11
  margined true
12
12
 
13
13
  vertical_box {
@@ -48,6 +48,30 @@ class CustomDrawText
48
48
  @area.queue_redraw_all
49
49
  end
50
50
  }
51
+ combobox { |c|
52
+ label 'Underline Built-In Color'
53
+ items Glimmer::LibUI.enum_symbols(:underline_color).map(&:to_s).map(&:capitalize)
54
+ selected 'Custom'
55
+
56
+ on_selected do
57
+ @underline_custom_color_button.enabled = c.selected_item == 'Custom'
58
+ if c.selected_item == 'Custom'
59
+ @underline_color = @underline_custom_color_button.color
60
+ else
61
+ @underline_color = c.selected_item.underscore
62
+ @underline_custom_color_button.color = :black
63
+ end
64
+ @area.queue_redraw_all
65
+ end
66
+ }
67
+ @underline_custom_color_button = color_button {
68
+ label 'Underline Custom Color'
69
+
70
+ on_changed do
71
+ @underline_color = @underline_custom_color_button.color
72
+ @area.queue_redraw_all
73
+ end
74
+ }
51
75
  }
52
76
 
53
77
  @area = area {
@@ -60,6 +84,7 @@ class CustomDrawText
60
84
  color @color
61
85
  background @background
62
86
  underline @underline
87
+ underline_color @underline_color
63
88
 
64
89
  ' At last Ygramul sensed that something was coming toward ' \
65
90
  'her. With the speed of lightning, she turned about, confronting ' \
Binary file
@@ -70,7 +70,7 @@ module Glimmer
70
70
  end
71
71
  end
72
72
  alias background= background
73
- alias background background
73
+ alias set_background background
74
74
 
75
75
  def underline(value = nil)
76
76
  if value.nil?
@@ -81,7 +81,18 @@ module Glimmer
81
81
  end
82
82
  end
83
83
  alias underline= underline
84
- alias underline underline
84
+ alias set_underline underline
85
+
86
+ def underline_color(value = nil)
87
+ if value.nil?
88
+ @underline_color
89
+ else
90
+ @underline_color = value
91
+ redraw
92
+ end
93
+ end
94
+ alias underline_color= underline_color
95
+ alias set_underline_color underline_color
85
96
 
86
97
  def post_add_content
87
98
  block_result = block&.call
@@ -104,6 +115,16 @@ module Glimmer
104
115
  underline_attribute = ::LibUI.new_underline_attribute(Glimmer::LibUI.enum_symbol_to_value(:underline, @underline))
105
116
  ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, underline_attribute, @start, @start + @string.size)
106
117
  end
118
+ unless underline_color.nil?
119
+ if Glimmer::LibUI.enum_symbols(:underline_color).include?(underline_color.to_s.to_sym) && underline_color.to_s.to_sym != :custom
120
+ underline_color_attribute = ::LibUI.new_underline_color_attribute(Glimmer::LibUI.enum_symbol_to_value(:underline_color, @underline_color), 0, 0, 0, 0)
121
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, underline_color_attribute, @start, @start + @string.size)
122
+ else
123
+ the_color = Glimmer::LibUI.interpret_color(@underline_color)
124
+ underline_color_attribute = ::LibUI.new_underline_color_attribute(0, the_color[:r].to_f / 255.0, the_color[:g].to_f / 255.0, the_color[:b].to_f / 255.0, the_color[:a] || 1.0)
125
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, underline_color_attribute, @start, @start + @string.size)
126
+ end
127
+ end
107
128
  unless font.nil?
108
129
  family_attribute = ::LibUI.new_family_attribute(font[:family])
109
130
  ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, family_attribute, @start, @start + @string.size)
@@ -51,6 +51,8 @@ module Glimmer
51
51
  ::LibUI.color_button_set_color(@libui, value[:r].to_f / 255.0, value[:g].to_f / 255.0, value[:b].to_f / 255.0, value[:a])
52
52
  end
53
53
  end
54
+ alias color= color
55
+ alias set_color color
54
56
 
55
57
  def red(value = nil)
56
58
  if value.nil?
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.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh