glimmer-dsl-libui 0.7.0 → 0.7.1

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: a247176e108fe8ba8dd7016b69bb0c6413e3b6c00c78aa068c28e70c11ec5330
4
- data.tar.gz: 94aa3f51dd0576748ea09a9899d0f26f230457a315dce3a55ef5c4aa22ce4434
3
+ metadata.gz: 26461689045ba139f45bc8b50392f77a261c4f3ade65ed9f64da188086d0f2e5
4
+ data.tar.gz: a8745528d47f04cff8c6d65d03e7d732dc06ab3b35dbea6d754253a5eddcd543
5
5
  SHA512:
6
- metadata.gz: 7a2e9ef07ac5b946e871577be49c34e0b8e38dbc506d0787178d1f5c01d1fe3294c1656bcb0ede0e6b16323760d1f47688ee023251079b95bdfa55a4e805f936
7
- data.tar.gz: 1d335aaa18baad73376426d7c8cdd4669a14e961b91f9c7cdf58f9427afde8cb1ab100b436fae24f72e9249e41f23aae8accb55679cfa23692b7ab62725d6a4a
6
+ metadata.gz: 286be15f2b3df417ee6c7e904508d186353118a74547a87d0eef1d79670d7d4b405a803b3ba7c86c96d0665fbf7e8673f846aad55b2ce71f45b478ce05a904f7
7
+ data.tar.gz: 93e2451a94d4ec59c04a20dd6cd6cd34c3b8efb00d19d40cba7cbe6ef5c57efb0e0c689ea122d884fb0873dc7fcd50b3d68c032b0c712b9581e66303b8148257
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.7.1
4
+
5
+ - `table` column `on_clicked` listener (can be nested under `text_column`, `text_color_column`, `button_column`, `checkbox_column`, `checkbox_text_color_column`, `image_column`, `image_text_color_column`, `image_text_column`, and `progress_bar_column`)
6
+ - `table` column `sort_indicator` property (can be `nil`, `:ascending` [aliases: `:asc`, `:a`], `:descending` [aliases: `:desc`, `:d`])
7
+ - `table` column `set_sort_indicator` alias for `sort_indicator=` can accept an option of `reset_columns: false` to avoid resetting sort indicator of other columns when setting sort indicator on a specific column
8
+ - `table` `header_visible` property (Boolean)
9
+ - Fix issue with `table` `selection_mode` getting set to `nil` if not specified
10
+
3
11
  ## 0.7.0
4
12
 
5
13
  - Upgrade to libui v0.1.2.pre (including newer libui-ng with table selection API)
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.7.0
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.7.1
2
2
  ## Prerequisite-Free Ruby Desktop Development GUI Library
3
3
  ### The Quickest Way From Zero To GUI
4
4
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
@@ -544,7 +544,7 @@ gem install glimmer-dsl-libui
544
544
  Or install via Bundler `Gemfile`:
545
545
 
546
546
  ```ruby
547
- gem 'glimmer-dsl-libui', '~> 0.7.0'
547
+ gem 'glimmer-dsl-libui', '~> 0.7.1'
548
548
  ```
549
549
 
550
550
  Test that installation worked by running the [Meta-Example](#examples):
@@ -736,9 +736,9 @@ Keyword(Args) | Properties | Listeners
736
736
  `string(string = '')` | `font`, `color` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, hex, or [X11](https://en.wikipedia.org/wiki/X11_color_names) color), `background` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, hex, or [X11](https://en.wikipedia.org/wiki/X11_color_names) color), `underline`, `underline_color` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, hex, or [X11](https://en.wikipedia.org/wiki/X11_color_names) color), `open_type_features`, `string` (`String`) | None
737
737
  `tab` | `margined` (Boolean), `num_pages` (`Integer`) | None
738
738
  `tab_item(name as String)` | `index` [read-only] (`Integer`), `margined` (Boolean), `name` [read-only] (`String`) | None
739
- `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, `selection_mode` (`:zero_or_many` , `:none` , `:zero_or_one` , or `:one`), `selection` (`Integer` for row index or `Array` of multiple row indexes) | `on_changed {|row, type, row_data| ...}`, `on_edited {|row, row_data| ...}`, `on_row_clicked {|table, row| }`, `on_row_double_clicked {|table, row| }`, and `on_selection_changed {|table| }`
739
+ `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, `selection_mode` (`:zero_or_many` , `:none` , `:zero_or_one` , or `:one`), `selection` (`Integer` for row index or `Array` of multiple row indexes), `header_visible` (Boolean) | `on_changed {|row, type, row_data| ...}`, `on_edited {|row, row_data| ...}`, `on_row_clicked {|table, row| }`, `on_row_double_clicked {|table, row| }`, and `on_selection_changed {|table| }`
740
740
  `text(x = 0 as Numeric, y = 0 as Numeric, width = area_width as Numeric)` | `align`, `default_font` | None
741
- `text_column(name as String)` | `editable` (Boolean) | None
741
+ `text_column(name as String)` | `editable` (Boolean), `sort_indicator` (`:ascending` [alias: `:asc`, `:a`], `:descending` [alias: `:desc`, `:d`], or `nil`) | `on_clicked {|tc, column_index| }`
742
742
  `text_color_column(name as String)` | `editable` (Boolean) | None
743
743
  `time_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`) | `on_changed`
744
744
  `vertical_box` | `padded` (Boolean) | None
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -1520,6 +1520,8 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
1520
1520
  ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_selection'"
1521
1521
  ```
1522
1522
 
1523
+ ![glimmer-dsl-libui-mac-basic-table-selection-one.png](/images/glimmer-dsl-libui-mac-basic-table-selection-one.png)
1524
+
1523
1525
  ## Basic Area
1524
1526
 
1525
1527
  [examples/basic_area.rb](/examples/basic_area.rb)
@@ -4,13 +4,16 @@ class BasicTableSelection
4
4
  include Glimmer::LibUI::Application
5
5
 
6
6
  before_body do
7
- @data = [
7
+ @one_data = [
8
8
  %w[cat meow],
9
9
  %w[dog woof],
10
10
  %w[chicken cock-a-doodle-doo],
11
11
  %w[horse neigh],
12
12
  %w[cow moo]
13
13
  ]
14
+ @zero_or_one_data = @one_data.dup
15
+ @zero_or_many_data = @one_data.dup
16
+ @none_data = @one_data.dup
14
17
  end
15
18
 
16
19
  body {
@@ -22,7 +25,7 @@ class BasicTableSelection
22
25
  stretchy false
23
26
 
24
27
  @one_radio_buttons = radio_buttons {
25
- items @data.size.times.map { |row| "Row #{row} Selection" }
28
+ items @one_data.size.times.map { |row| "Row #{row} Selection" }
26
29
 
27
30
  on_selected do |rb|
28
31
  @one_table.selection = [rb.selected]
@@ -30,13 +33,44 @@ class BasicTableSelection
30
33
  }
31
34
  }
32
35
 
36
+ button('Toggle Table Header Visibility') {
37
+ stretchy false
38
+
39
+ on_clicked do
40
+ @one_table.header_visible = !@one_table.header_visible
41
+ end
42
+ }
43
+
33
44
  @one_table = table {
34
- text_column('Animal')
35
- text_column('Description')
45
+ text_column('Animal') {
46
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
47
+
48
+ on_clicked do |tc, column|
49
+ puts "Clicked column #{column}: #{tc.name}"
50
+ selected_row = @one_table.selection && @one_data[@one_table.selection]
51
+ tc.toggle_sort_indicator
52
+ @one_data.sort_by! { |row_data| row_data[column] }
53
+ @one_data.reverse! if tc.sort_indicator == :descending
54
+ @one_table.selection = @one_data.index(selected_row)
55
+ end
56
+ }
57
+ text_column('Description') {
58
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
59
+
60
+ on_clicked do |tc, column|
61
+ puts "Clicked column #{column}: #{tc.name}"
62
+ selected_row = @one_table.selection && @one_data[@one_table.selection]
63
+ tc.toggle_sort_indicator
64
+ @one_data.sort_by! { |row_data| row_data[column] }
65
+ @one_data.reverse! if tc.sort_indicator == :descending
66
+ @one_table.selection = @one_data.index(selected_row)
67
+ end
68
+ }
36
69
 
37
- cell_rows @data
38
- selection_mode :one # other values are :zero_or_many , :zero_or_one, :none
70
+ cell_rows @one_data
71
+ selection_mode :one # other values are :zero_or_many , :zero_or_one, :none (default is :zero_or_one if not specified)
39
72
  selection 2 # initial selection row index (could be nil too or just left off, defaulting to 0)
73
+ # header_visible true # default
40
74
 
41
75
  on_row_clicked do |t, row|
42
76
  puts "Row Clicked: #{row}"
@@ -62,7 +96,7 @@ class BasicTableSelection
62
96
  stretchy false
63
97
 
64
98
  @zero_or_one_radio_buttons = radio_buttons {
65
- items @data.size.times.map { |row| "Row #{row} Selection" }
99
+ items @zero_or_one_data.size.times.map { |row| "Row #{row} Selection" }
66
100
 
67
101
  on_selected do |rb|
68
102
  @zero_or_one_table.selection = [rb.selected]
@@ -70,13 +104,44 @@ class BasicTableSelection
70
104
  }
71
105
  }
72
106
 
107
+ button('Toggle Table Header Visibility') {
108
+ stretchy false
109
+
110
+ on_clicked do
111
+ @zero_or_one_table.header_visible = !@zero_or_one_table.header_visible
112
+ end
113
+ }
114
+
73
115
  @zero_or_one_table = table {
74
- text_column('Animal')
75
- text_column('Description')
116
+ text_column('Animal') {
117
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
118
+
119
+ on_clicked do |tc, column|
120
+ puts "Clicked column #{column}: #{tc.name}"
121
+ selected_row = @zero_or_one_table.selection && @zero_or_one_data[@zero_or_one_table.selection]
122
+ tc.toggle_sort_indicator
123
+ @zero_or_one_data.sort_by! { |row_data| row_data[column] }
124
+ @zero_or_one_data.reverse! if tc.sort_indicator == :descending
125
+ @zero_or_one_table.selection = @zero_or_one_data.index(selected_row)
126
+ end
127
+ }
128
+ text_column('Description') {
129
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
130
+
131
+ on_clicked do |tc, column|
132
+ puts "Clicked column #{column}: #{tc.name}"
133
+ selected_row = @zero_or_one_table.selection && @zero_or_one_data[@zero_or_one_table.selection]
134
+ tc.toggle_sort_indicator
135
+ @zero_or_one_data.sort_by! { |row_data| row_data[column] }
136
+ @zero_or_one_data.reverse! if tc.sort_indicator == :descending
137
+ @zero_or_one_table.selection = @zero_or_one_data.index(selected_row)
138
+ end
139
+ }
76
140
 
77
- cell_rows @data
78
- selection_mode :zero_or_one # other values are :zero_or_many , :one, :none
141
+ cell_rows @zero_or_one_data
142
+ selection_mode :zero_or_one # other values are :zero_or_many , :one, :none (default is :zero_or_one if not specified)
79
143
  # selection 0 # initial selection row index (could be nil too or just left off)
144
+ # header_visible true # default
80
145
 
81
146
  on_row_clicked do |t, row|
82
147
  puts "Row Clicked: #{row}"
@@ -101,7 +166,7 @@ class BasicTableSelection
101
166
  vertical_box {
102
167
  stretchy false
103
168
 
104
- @zero_or_many_checkboxes = @data.size.times.map do |row|
169
+ @zero_or_many_checkboxes = @zero_or_many_data.size.times.map do |row|
105
170
  checkbox("Row #{row} Selection") {
106
171
  on_toggled do |c|
107
172
  table_selection = @zero_or_many_table.selection.to_a
@@ -116,13 +181,44 @@ class BasicTableSelection
116
181
  end
117
182
  }
118
183
 
184
+ button('Toggle Table Header Visibility') {
185
+ stretchy false
186
+
187
+ on_clicked do
188
+ @zero_or_many_table.header_visible = !@zero_or_many_table.header_visible
189
+ end
190
+ }
191
+
119
192
  @zero_or_many_table = table {
120
- text_column('Animal')
121
- text_column('Description')
193
+ text_column('Animal') {
194
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
195
+
196
+ on_clicked do |tc, column|
197
+ puts "Clicked column #{column}: #{tc.name}"
198
+ selected_rows = @zero_or_many_table.selection&.map { |row| @zero_or_many_data[row] }
199
+ tc.toggle_sort_indicator
200
+ @zero_or_many_data.sort_by! { |row_data| row_data[column] }
201
+ @zero_or_many_data.reverse! if tc.sort_indicator == :descending
202
+ @zero_or_many_table.selection = selected_rows&.map {|row_data| @zero_or_many_data.index(row_data) }
203
+ end
204
+ }
205
+ text_column('Description') {
206
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
207
+
208
+ on_clicked do |tc, column|
209
+ puts "Clicked column #{column}: #{tc.name}"
210
+ selected_rows = @zero_or_many_table.selection&.map { |row| @zero_or_many_data[row] }
211
+ tc.toggle_sort_indicator
212
+ @zero_or_many_data.sort_by! { |row_data| row_data[column] }
213
+ @zero_or_many_data.reverse! if tc.sort_indicator == :descending
214
+ @zero_or_many_table.selection = selected_rows&.map {|row_data| @zero_or_many_data.index(row_data) }
215
+ end
216
+ }
122
217
 
123
- cell_rows @data
124
- selection_mode :zero_or_many # other values are :none , :zero_or_one , and :one
218
+ cell_rows @zero_or_many_data
219
+ selection_mode :zero_or_many # other values are :none , :zero_or_one , and :one (default is :zero_or_one if not specified)
125
220
  selection 0, 2, 4 # initial selection row indexes (could be empty array too or just left off)
221
+ # header_visible true # default
126
222
 
127
223
  on_row_clicked do |t, row|
128
224
  puts "Row Clicked: #{row}"
@@ -147,12 +243,43 @@ class BasicTableSelection
147
243
 
148
244
  tab_item('None') {
149
245
  vertical_box {
246
+ button('Toggle Table Header Visibility') {
247
+ stretchy false
248
+
249
+ on_clicked do
250
+ @none_table.header_visible = !@none_table.header_visible
251
+ end
252
+ }
253
+
150
254
  @none_table = table {
151
- text_column('Animal')
152
- text_column('Description')
255
+ text_column('Animal') {
256
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
257
+
258
+ on_clicked do |tc, column|
259
+ puts "Clicked column #{column}: #{tc.name}"
260
+ selected_row = @none_table.selection && @none_data[@none_table.selection]
261
+ tc.toggle_sort_indicator
262
+ @none_data.sort_by! { |row_data| row_data[column] }
263
+ @none_data.reverse! if tc.sort_indicator == :descending
264
+ @none_table.selection = @none_data.index(selected_row)
265
+ end
266
+ }
267
+ text_column('Description') {
268
+ # sort_indicator :descending # can be :ascending, :descending, or nil (default)
269
+
270
+ on_clicked do |tc, column|
271
+ puts "Clicked column #{column}: #{tc.name}"
272
+ selected_row = @none_table.selection && @none_data[@none_table.selection]
273
+ tc.toggle_sort_indicator
274
+ @none_data.sort_by! { |row_data| row_data[column] }
275
+ @none_data.reverse! if tc.sort_indicator == :descending
276
+ @none_table.selection = @none_data.index(selected_row)
277
+ end
278
+ }
153
279
 
154
- cell_rows @data
155
- selection_mode :none # other values are :zero_or_many , :zero_or_one, :one
280
+ cell_rows @none_data
281
+ selection_mode :none # other values are :zero_or_many , :zero_or_one, :one (default is :zero_or_one if not specified)
282
+ # header_visible true # default
156
283
 
157
284
  on_row_clicked do |t, row|
158
285
  puts "Row Clicked: #{row}"
Binary file
@@ -52,7 +52,58 @@ module Glimmer
52
52
 
53
53
  # actual index within table columns (disregarding extra fillings that account for DualColumn instances)
54
54
  def index
55
- @parent_proxy.columns.select {|c| c.is_a?(Column)}.index(self)
55
+ @parent_proxy.column_proxies.index(self)
56
+ end
57
+
58
+ def other_columns
59
+ @parent_proxy.column_proxies.reject {|c| c == self}
60
+ end
61
+
62
+ def sort_indicator
63
+ return @sort_indicator if !@content_added
64
+
65
+ result = ::LibUI.table_header_sort_indicator(@parent_proxy.libui, index)
66
+ LibUI.integer_to_column_sort_indicator(result)
67
+ end
68
+
69
+ def sort_indicator=(*args)
70
+ options = args.last.is_a?(Hash) ? args.pop : {reset_columns: true}
71
+ value = args.first
72
+ @sort_indicator = value
73
+ return @sort_indicator if !@content_added
74
+
75
+ other_columns.each { |c| c.set_sort_indicator(nil, reset_columns: false) } if options[:reset_columns]
76
+ value = LibUI.column_sort_indicator_to_integer(value)
77
+ ::LibUI.table_header_set_sort_indicator(@parent_proxy.libui, index, value)
78
+ end
79
+ alias set_sort_indicator sort_indicator=
80
+
81
+ def toggle_sort_indicator(value = nil)
82
+ if value.nil?
83
+ self.sort_indicator = self.sort_indicator != :ascending ? :ascending : :descending
84
+ else
85
+ self.sort_indicator = value
86
+ end
87
+ end
88
+
89
+ def can_handle_listener?(listener_name)
90
+ listener_name == 'on_clicked'
91
+ end
92
+
93
+ def handle_listener(listener_name, &listener)
94
+ column_listeners_for(listener_name) << listener
95
+ end
96
+
97
+ def column_listeners
98
+ @column_listeners ||= {}
99
+ end
100
+
101
+ def column_listeners_for(listener_name)
102
+ column_listeners[listener_name] ||= []
103
+ end
104
+
105
+ def configure_sort_indicator
106
+ set_sort_indicator(@sort_indicator, reset_columns: false)
56
107
  end
57
108
  end
58
109
  end
@@ -61,8 +61,11 @@ module Glimmer
61
61
  super
62
62
  # TODO consider automatically detecting what properties/listeners accumulated dynamically to avoid hardcoding code below
63
63
  register_listeners
64
+ register_column_listeners
64
65
  configure_selection_mode
65
66
  configure_selection
67
+ configure_header_visible
68
+ configure_column_sort_indicators
66
69
  end
67
70
 
68
71
  def post_initialize_child(child)
@@ -142,6 +145,7 @@ module Glimmer
142
145
  end
143
146
  end
144
147
  alias selection_mode= selection_mode
148
+ alias set_selection_mode selection_mode
145
149
 
146
150
  def selection
147
151
  return @selection if !@content_added
@@ -171,6 +175,24 @@ module Glimmer
171
175
  # ensure
172
176
  # ::LibUI.free_table_selection(ts)
173
177
  end
178
+ alias set_selection selection=
179
+
180
+ def header_visible
181
+ return @header_visible if !@content_added
182
+
183
+ result = ::LibUI.table_header_visible(@libui)
184
+ LibUI.integer_to_boolean(result)
185
+ end
186
+
187
+ def header_visible=(value)
188
+ @header_visible = value
189
+ return @header_visible if !@content_added
190
+ return if value.nil?
191
+
192
+ value = LibUI.boolean_to_integer(value)
193
+ ::LibUI.table_header_set_visible(@libui, value)
194
+ end
195
+ alias set_header_visible header_visible=
174
196
 
175
197
  def column_attributes
176
198
  @column_attributes ||= columns.select {|column| column.is_a?(Column)}.map(&:name).map(&:underscore)
@@ -221,6 +243,10 @@ module Glimmer
221
243
  compound_columns.index(compound_column)
222
244
  end
223
245
 
246
+ def column_proxies
247
+ @columns&.select {|c| c.is_a?(Column)}
248
+ end
249
+
224
250
  def handle_listener(listener_name, &listener)
225
251
  # if content has been added, then you can register listeners immediately (without accumulation
226
252
  if CUSTOM_LISTENER_NAMES.include?(listener_name.to_s) || @content_added
@@ -579,13 +605,40 @@ module Glimmer
579
605
  end
580
606
  end
581
607
 
608
+ def register_column_listeners
609
+ # register accumulated column listeners after table content is closed
610
+ return if @columns.nil? || @columns.empty?
611
+ if @columns.any? {|column| column.is_a?(Column) && !column.column_listeners_for('on_clicked').empty? }
612
+ ::LibUI.table_header_on_clicked(@libui) do |_, column_index|
613
+ actual_columns = @columns.select {|column| column.is_a?(Column)}
614
+ column = actual_columns[column_index]
615
+ if column.is_a?(Column)
616
+ column_listeners = column.column_listeners_for('on_clicked')
617
+ if !column_listeners.empty?
618
+ column_listeners.each do |column_listener|
619
+ column_listener.call(column, column_index)
620
+ end
621
+ end
622
+ end
623
+ end
624
+ end
625
+ end
626
+
582
627
  def configure_selection_mode
583
- send_to_libui('selection_mode=', @selection_mode)
628
+ send_to_libui('selection_mode=', @selection_mode) if @selection_mode
584
629
  end
585
630
 
586
631
  def configure_selection
587
632
  self.selection = @selection
588
633
  end
634
+
635
+ def configure_header_visible
636
+ self.header_visible = @header_visible
637
+ end
638
+
639
+ def configure_column_sort_indicators
640
+ column_proxies.each {|c| c.configure_sort_indicator }
641
+ end
589
642
  end
590
643
  end
591
644
  end
data/lib/glimmer/libui.rb CHANGED
@@ -35,6 +35,33 @@ module Glimmer
35
35
  bool.nil? ? (allow_nil ? nil : 0) : (allow_integer && bool.is_a?(Integer) ? bool : (bool.is_a?(TrueClass) || bool.is_a?(FalseClass) ? (bool == true ? 1 : 0) : (allow_nil ? nil : 0)))
36
36
  end
37
37
 
38
+ def column_sort_indicator_to_integer(value)
39
+ return value if value.is_a?(Integer)
40
+
41
+ if value.nil?
42
+ 0
43
+ elsif 'ascending'.start_with?(value.to_s)
44
+ 1
45
+ elsif 'descending'.start_with?(value.to_s)
46
+ 2
47
+ else
48
+ 0
49
+ end
50
+ end
51
+
52
+ def integer_to_column_sort_indicator(value)
53
+ return value if value.is_a?(String) || value.is_a?(Symbol)
54
+
55
+ case value
56
+ when 1
57
+ :ascending
58
+ when 2
59
+ :descending
60
+ else
61
+ nil
62
+ end
63
+ end
64
+
38
65
  def degrees_to_radians(degrees)
39
66
  ((Math::PI * 2.0) / 360.00) * degrees.to_f
40
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-11 00:00:00.000000000 Z
11
+ date: 2023-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer