libui 0.0.8 → 0.0.12

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: 02ee9e67a91414cbea40a50448a58bbb320f8962f34a35fa9c26d7ed0019878d
4
- data.tar.gz: cfde88b2432abbf23f9dd0d195db0258c143bfd1ff339f51b3112ccaf4742af2
3
+ metadata.gz: f74d579c937d71a61c613abe93ca07ae1bafa8c78933d7cd4f979fc92b327883
4
+ data.tar.gz: f091c583e9fd5c53673232b4babc90f87c626a8185c4fcfb576ce9d89d36affa
5
5
  SHA512:
6
- metadata.gz: cb131ab13e11e6573058c0ec611c7467557756904b49d4121541f4075518958d3fdf2adc74e21d52f0f433c537faeffd6a77ab4162f7d42321fdec75437d1be0
7
- data.tar.gz: 0dc6139433b79bec3e0a096f376db6af7eedc6b989ccab25bf4d3a1123afc75d053d43625d5302122952b2a527a8a17665ec9bc1472c1574f5ae4262bef80197
6
+ metadata.gz: 8897e6b92a054070600be68a2f646e7b79468ace0ed6b6c0de4713a2b3cf8e7a72ef35e6934d72f1d31112778a6f948c49ca74130d805e189a72c448144fd35f
7
+ data.tar.gz: ad4f816e611238801cfefdbff60891f86703c92554fbca79691e4bcff1fd9a4dff45ebeabd78acd57aedaf56ff3f120b9cd16ca95788a469bb0cb58060194dcc
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ![build](https://github.com/kojix2/libui/workflows/build/badge.svg)
4
4
  [![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
5
5
 
6
- :radio_button: [libui](https://github.com/andlabs/libui) - a portable GUI library -for Ruby
6
+ :radio_button: [libui](https://github.com/andlabs/libui) - a portable GUI library - for Ruby
7
7
 
8
8
  ## Installation
9
9
 
@@ -20,25 +20,29 @@ gem install libui
20
20
  |---------|-----|-------|
21
21
  |<img src="https://user-images.githubusercontent.com/5798442/103118046-900ea780-46b0-11eb-81fc-32626762e4df.png">|<img src="https://user-images.githubusercontent.com/5798442/103118059-99980f80-46b0-11eb-9d12-324ec4d297c9.png">|<img src="https://user-images.githubusercontent.com/5798442/103118068-a0bf1d80-46b0-11eb-8c5c-3bdcc3dcfb26.png">|
22
22
 
23
+ Note: If you are using the 32-bit (x86) version of Ruby, you need to download the 32-bit (x86) native dll. See [Development](#development).
24
+
23
25
  ## Usage
24
26
 
25
27
  ```ruby
26
28
  require 'libui'
29
+
27
30
  UI = LibUI
28
31
 
29
32
  UI.init
30
33
 
31
- main_window = UI.new_window('hello world', 300, 200, 1)
32
- UI.window_on_closing(main_window) do
33
- puts 'Bye Bye'
34
- UI.control_destroy(main_window)
35
- UI.quit
36
- 0
37
- end
34
+ main_window = UI.new_window('hello world', 200, 100, 1)
38
35
 
39
36
  button = UI.new_button('Button')
37
+
40
38
  UI.button_on_clicked(button) do
41
39
  UI.msg_box(main_window, 'Information', 'You clicked the button')
40
+ end
41
+
42
+ UI.window_on_closing(main_window) do
43
+ puts 'Bye Bye'
44
+ UI.control_destroy(main_window)
45
+ UI.quit
42
46
  0
43
47
  end
44
48
 
@@ -58,15 +62,20 @@ Compared to original libui written in C,
58
62
  * The method names are snake_case.
59
63
  * If the last argument is nil, it can be omitted.
60
64
  * You can pass a block as a callback.
61
- * Please return 0 explicitly in the block.
62
65
  * The block will be converted to a Proc object and added to the last argument.
63
66
  * Even in that case, it is possible to omit the last argument nil.
64
-
67
+
68
+ You can use [the documentation for libui's Go bindings](https://pkg.go.dev/github.com/andlabs/ui) as a reference.
69
+
65
70
  ### Not object oriented?
66
71
 
67
72
  * At the moment, it is not object-oriented.
68
73
  * Instead of providing a half-baked object-oriented approach, leave it as is.
69
74
 
75
+ ### DSLs for LibUI
76
+ * [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
77
+ * [libui_paradise](https://rubygems.org/gems/libui_paradise)
78
+
70
79
  ### How to use fiddle pointers?
71
80
 
72
81
  ```ruby
@@ -90,6 +99,7 @@ font_button = UI.new_font_button
90
99
 
91
100
  # Allocate memory
92
101
  font_descriptor = UI::FFI::FontDescriptor.malloc
102
+ font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
93
103
 
94
104
  UI.font_button_on_changed(font_button) do
95
105
  UI.font_button_font(font_button, font_descriptor)
@@ -101,35 +111,79 @@ UI.font_button_on_changed(font_button) do
101
111
  end
102
112
  ```
103
113
 
114
+ * Callbacks
115
+ * In Ruby/Fiddle, C callback function is written as an object of
116
+ `Fiddle::Closure::BlockCaller` or `Fiddle::Closure`.
117
+ In this case, you need to be careful about Ruby's garbage collection.
118
+ If the function object is collected, memory will be freed
119
+ and a segmentation violation will occur when the callback is invoked.
120
+
121
+ ```ruby
122
+ # to a local variable to prevent it from being collected by GC.
123
+ handler.MouseEvent = (c1 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
124
+ handler.MouseCrossed = (c2 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
125
+ handler.DragBroken = (c3 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
126
+ ```
127
+
104
128
  ### How to create an executable (.exe) on Windows
105
129
 
106
130
  OCRA (One-Click Ruby Application) builds Windows executables from Ruby source code.
107
131
  * https://github.com/larsch/ocra/
108
132
 
133
+ In order to build a exe with Ocra, include 3 DLLs from ruby_builtin_dlls folder:
134
+
135
+ ```sh
136
+ ocra examples/control_gallery.rb ^
137
+ --dll ruby_builtin_dlls/libssp-0.dll ^
138
+ --dll ruby_builtin_dlls/libgmp-10.dll ^
139
+ --dll ruby_builtin_dlls/libffi-7.dll ^
140
+ --gem-all=fiddle ^
141
+ ```
142
+
143
+ Add additional options below if necessary.
144
+
145
+ ```sh
146
+ --window ^
147
+ --add-all-core ^
148
+ --chdir-first ^
149
+ --icon assets\app.ico ^
150
+ --verbose ^
151
+ --output out\gallery.exe
152
+ ```
153
+
109
154
  ## Development
110
155
 
111
156
  ```sh
112
157
  git clone https://github.com/kojix2/libui
113
158
  cd libui
114
159
  bundle install
115
- bundle exec rake vendor:all
160
+ bundle exec rake vendor:all_x64 # download shared libraries for all platforms
116
161
  bundle exec rake test
117
162
  ```
118
163
 
119
- Use the following rake tasks to download the libui binary files and save them in the vendor directory.
164
+ You can use the following rake tasks to download the shared library required for your platform.
120
165
 
121
166
  `rake -T`
122
167
 
123
168
  ```
124
- rake vendor:all # Download libui.so, libui.dylib, and libui.dll to ve...
125
- rake vendor:linux # Download libui.so for Linux to vendor directory
126
- rake vendor:mac # Download libui.dylib for Mac to vendor directory
127
- rake vendor:windows # Download libui.dll for Windows to vendor directory
169
+ rake vendor:all_x64 # Download libui.so, libui.dylib, and libui.dll to...
170
+ rake vendor:linux_x64 # Download libui.so for Linux to vendor directory
171
+ rake vendor:linux_x86 # Download libui.so for Linux to vendor directory
172
+ rake vendor:mac_x64 # Download libui.dylib for Mac to vendor directory
173
+ rake vendor:windows_x64 # Download libui.dll for Windows to vendor directory
174
+ rake vendor:windows_x86 # Download libui.dll for Windows to vendor directory
128
175
  ```
129
176
 
177
+ For example, If you are using a 32-bit (x86) version of Ruby on Windows, type `rake vendor:windows_x86`.
178
+
179
+ Or Set environment variable `LIBUIDIR` to specify the path to the shared library.
180
+
130
181
  ## Contributing
131
182
 
132
- Bug reports and pull requests are welcome on GitHub at https://github.com/kojix2/libui.
183
+ Would you like to add your commits to libui?
184
+ * Please feel free to send us your [pull requests](https://github.com/kojix2/libui/pulls).
185
+ * Small corrections, such as typofixes, are appreciated.
186
+ * Did you find any bugs? Write it in the [issues](https://github.com/kojix2/LibUI/issue) section!
133
187
 
134
188
  ## Acknowledgement
135
189
 
data/lib/libui/ffi.rb CHANGED
@@ -1,78 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fiddle/import'
4
-
5
- module Fiddle
6
- # Change the Function to hold a little more information.
7
- class Function
8
- # Note:
9
- # Ruby 2.7 Fiddle::Function dose not have @argument_types
10
- # Ruby 3.0 Fiddle::Function has @argument_types
11
- attr_accessor :callback_argument_types, :argument_types
12
- end
13
-
14
- module Importer
15
- def parse_signature(signature, tymap = nil)
16
- tymap ||= {}
17
- ctype, func, args = case compact(signature)
18
- when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
19
- [TYPE_VOIDP, Regexp.last_match(1), Regexp.last_match(2)]
20
- when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
21
- [parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
22
- else
23
- raise("can't parserake the function prototype: #{signature}")
24
- end
25
- symname = func
26
- callback_argument_types = {} # Added
27
- argtype = split_arguments(args).collect.with_index do |arg, idx| # Added with_index
28
- # Check if it is a function pointer or not
29
- if arg =~ /\(\*.*\)\(.*\)/ # Added
30
- # From the arguments, create a notation that looks like a function declaration
31
- # int(*f)(int *, void *) -> int f(int *, void *)
32
- func_arg = arg.sub('(*', ' ').sub(')', '') # Added
33
- # Use Fiddle's parse_signature method again.
34
- callback_argument_types[idx] = parse_signature(func_arg) # Added
35
- end
36
- parse_ctype(arg, tymap)
37
- end
38
- # Added callback_argument_types. Original method return only 3 values.
39
- [symname, ctype, argtype, callback_argument_types]
40
- end
41
-
42
- def extern(signature, *opts)
43
- symname, ctype, argtype, callback_argument_types = parse_signature(signature, type_alias)
44
- opt = parse_bind_options(opts)
45
- func = import_function(symname, ctype, argtype, opt[:call_type])
46
-
47
- func.callback_argument_types = callback_argument_types # Added
48
- # Ruby 2.7 Fiddle::Function dose not have @argument_types
49
- # Ruby 3.0 Fiddle::Function has @argument_types
50
- func.argument_types = argtype
51
-
52
- name = symname.gsub(/@.+/, '')
53
- @func_map[name] = func
54
- # define_method(name){|*args,&block| f.call(*args,&block)}
55
- begin
56
- /^(.+?):(\d+)/ =~ caller.first
57
- file = Regexp.last_match(1)
58
- line = Regexp.last_match(2).to_i
59
- rescue StandardError
60
- file, line = __FILE__, __LINE__ + 3
61
- end
62
- module_eval(<<-EOS, file, line)
63
- def #{name}(*args, &block)
64
- @func_map['#{name}'].call(*args,&block)
65
- end
66
- EOS
67
- module_function(name)
68
- func
69
- end
70
- end
71
- end
4
+ require_relative 'fiddle_patch'
72
5
 
73
6
  module LibUI
74
7
  module FFI
75
8
  extend Fiddle::Importer
9
+ extend FiddlePatch
76
10
 
77
11
  begin
78
12
  dlload LibUI.ffi_lib
@@ -100,6 +34,9 @@ module LibUI
100
34
  'size_t Size'
101
35
  ]
102
36
 
37
+ # https://github.com/andlabs/libui/blob/master/ui.h
38
+ # keep same order
39
+
103
40
  try_extern 'const char *uiInit(uiInitOptions *options)'
104
41
  try_extern 'void uiUninit(void)'
105
42
  try_extern 'void uiFreeInitError(const char *err)'
@@ -280,17 +217,33 @@ module LibUI
280
217
  # uiDateTimePicker
281
218
 
282
219
  # time.h
283
- TM = struct [
284
- 'int tm_sec',
285
- 'int tm_min',
286
- 'int tm_hour',
287
- 'int tm_mday',
288
- 'int tm_mon',
289
- 'int tm_year',
290
- 'int tm_wday',
291
- 'int tm_yday',
292
- 'int tm_isdst'
293
- ]
220
+ TM = if Fiddle::WINDOWS
221
+ struct [
222
+ 'int tm_sec',
223
+ 'int tm_min',
224
+ 'int tm_hour',
225
+ 'int tm_mday',
226
+ 'int tm_mon',
227
+ 'int tm_year',
228
+ 'int tm_wday',
229
+ 'int tm_yday',
230
+ 'int tm_isdst'
231
+ ]
232
+ else # The GNU C Library (glibc)
233
+ struct [
234
+ 'int tm_sec',
235
+ 'int tm_min',
236
+ 'int tm_hour',
237
+ 'int tm_mday',
238
+ 'int tm_mon',
239
+ 'int tm_year',
240
+ 'int tm_wday',
241
+ 'int tm_yday',
242
+ 'int tm_isdst',
243
+ 'long tm_gmtoff',
244
+ 'const char *tm_zone'
245
+ ]
246
+ end
294
247
 
295
248
  try_extern 'void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)'
296
249
  try_extern 'void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)'
@@ -0,0 +1,79 @@
1
+ module LibUI
2
+ module FiddlePatch
3
+ def parse_signature(signature, tymap = nil)
4
+ tymap ||= {}
5
+ ctype, func, args = case compact(signature)
6
+ when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
7
+ [TYPE_VOIDP, Regexp.last_match(1), Regexp.last_match(2)]
8
+ when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
9
+ [parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
10
+ else
11
+ raise("can't parserake the function prototype: #{signature}")
12
+ end
13
+ symname = func
14
+ callback_argument_types = {} # Added
15
+ argtype = split_arguments(args).collect.with_index do |arg, idx| # Added with_index
16
+ # Check if it is a function pointer or not
17
+ if arg =~ /\(\*.*\)\(.*\)/ # Added
18
+ # From the arguments, create a notation that looks like a function declaration
19
+ # int(*f)(int *, void *) -> int f(int *, void *)
20
+ func_arg = arg.sub('(*', ' ').sub(')', '') # Added
21
+ # Use Fiddle's parse_signature method again.
22
+ callback_argument_types[idx] = parse_signature(func_arg) # Added
23
+ end
24
+ parse_ctype(arg, tymap)
25
+ end
26
+ # Added callback_argument_types. Original method return only 3 values.
27
+ [symname, ctype, argtype, callback_argument_types]
28
+ end
29
+
30
+ def extern(signature, *opts)
31
+ symname, ctype, argtype, callback_argument_types = parse_signature(signature, type_alias)
32
+ opt = parse_bind_options(opts)
33
+ func = import_function(symname, ctype, argtype, opt[:call_type])
34
+
35
+ # callback_argument_types
36
+ func.instance_variable_set(:@callback_argument_types,
37
+ callback_argument_types) # Added
38
+ # attr_reader
39
+ def func.callback_argument_types
40
+ @callback_argument_types
41
+ end
42
+
43
+ # argument_types
44
+ # Ruby 2.7 Fiddle::Function dose not have @argument_types
45
+ # Ruby 3.0 Fiddle::Function has @argument_types
46
+ if func.instance_variable_defined?(:@argument_types)
47
+ # check if @argument_types are the same
48
+ if func.instance_variable_get(:@argument_types) != argtype
49
+ warn "#{symname} func.argument_types:#{func.argument_types} != argtype #{argtype}"
50
+ end
51
+ else
52
+ func.instance_variable_set(:@argument_types, argtype)
53
+ end
54
+ # attr_reader
55
+ def func.argument_types
56
+ @argument_types
57
+ end
58
+
59
+ name = symname.gsub(/@.+/, '')
60
+ @func_map[name] = func
61
+ # define_method(name){|*args,&block| f.call(*args,&block)}
62
+ begin
63
+ /^(.+?):(\d+)/ =~ caller.first
64
+ file = Regexp.last_match(1)
65
+ line = Regexp.last_match(2).to_i
66
+ rescue StandardError
67
+ file, line = __FILE__, __LINE__ + 3
68
+ end
69
+ module_eval(<<-EOS, file, line)
70
+ def #{name}(*args, &block)
71
+ @func_map['#{name}'].call(*args,&block)
72
+ end
73
+ EOS
74
+ module_function(name)
75
+ func
76
+ end
77
+ end
78
+ private_constant :FiddlePatch
79
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibUI
4
+ module LibUIBase
5
+ FFI.func_map.each_key do |original_method_name|
6
+ name = Utils.convert_to_ruby_method(original_method_name)
7
+ func = FFI.func_map[original_method_name]
8
+
9
+ define_method(name) do |*args, &blk|
10
+ # Assume that block is the last argument.
11
+ args << blk if blk
12
+
13
+ # The proc object is converted to a Closure::BlockCaller object.
14
+ args.map!.with_index do |arg, idx|
15
+ if arg.is_a?(Proc)
16
+ # The types of the function arguments are recorded beforehand.
17
+ # See the monkey patch in ffi.rb.
18
+ callback = Fiddle::Closure::BlockCaller.new(
19
+ *func.callback_argument_types[idx][1..2], &arg
20
+ )
21
+ # Protect from GC
22
+ # See https://github.com/kojix2/LibUI/issues/8
23
+ receiver = args[0]
24
+ if receiver.instance_variable_defined?(:@callbacks)
25
+ receiver.instance_variable_get(:@callbacks) << callback
26
+ else
27
+ receiver.instance_variable_set(:@callbacks, [callback])
28
+ end
29
+ callback
30
+ else
31
+ arg
32
+ end
33
+ end
34
+
35
+ # Make it possible to omit the last nil. This may be an over-optimization.
36
+ siz = func.argument_types.size - 1
37
+ args[siz] = nil if args.size == siz
38
+
39
+ FFI.public_send(original_method_name, *args)
40
+ end
41
+ end
42
+ end
43
+
44
+ private_constant :LibUIBase
45
+ end
data/lib/libui/utils.rb CHANGED
@@ -8,7 +8,7 @@ module LibUI
8
8
  # Converting camel case to underscore case in ruby
9
9
  # https://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby#1509939
10
10
  def underscore(str)
11
- str.gsub(/::/, '/')
11
+ str.gsub(/::/, '/') # Maybe we don't need it.
12
12
  .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
13
13
  .gsub(/([a-z\d])([A-Z])/, '\1_\2')
14
14
  .tr('-', '_')
data/lib/libui/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibUI
4
- VERSION = '0.0.8'
4
+ VERSION = '0.0.12'
5
5
  end
data/lib/libui.rb CHANGED
@@ -10,14 +10,7 @@ module LibUI
10
10
  attr_accessor :ffi_lib
11
11
  end
12
12
 
13
- lib_name = case RbConfig::CONFIG['host_os']
14
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
15
- 'libui.dll'
16
- when /darwin|mac os/
17
- 'libui.dylib'
18
- else
19
- 'libui.so'
20
- end
13
+ lib_name = "libui.#{RbConfig::CONFIG['SOEXT']}"
21
14
 
22
15
  self.ffi_lib = if ENV['LIBUIDIR'] && !ENV['LIBUIDIR'].empty?
23
16
  File.expand_path(lib_name, ENV['LIBUIDIR'])
@@ -26,54 +19,189 @@ module LibUI
26
19
  end
27
20
 
28
21
  require_relative 'libui/ffi'
22
+ require_relative 'libui/libui_base'
23
+
24
+ extend LibUIBase
29
25
 
30
26
  class << self
31
- FFI.func_map.each_key do |original_method_name|
32
- name = Utils.convert_to_ruby_method(original_method_name)
33
- func = FFI.func_map[original_method_name]
34
-
35
- define_method(name) do |*args, &blk|
36
- # Assume that block is the last argument.
37
- args << blk if blk
38
-
39
- # The proc object is converted to a Closure::BlockCaller object.
40
- args.map!.with_index do |arg, idx|
41
- if arg.is_a?(Proc)
42
- # The types of the function arguments are recorded beforehand.
43
- # See the monkey patch in ffi.rb.
44
- callback = Fiddle::Closure::BlockCaller.new(
45
- *func.callback_argument_types[idx][1..2], &arg
46
- )
47
- # Protect from GC
48
- # See https://github.com/kojix2/LibUI/issues/8
49
- receiver = args[0]
50
- callbacks = receiver.instance_variable_get(:@callbacks) || []
51
- callbacks << callback
52
- receiver.instance_variable_set(:@callbacks, callback)
53
- callback
54
- else
55
- arg
56
- end
57
- end
58
-
59
- # Make it possible to omit the last nil. This may be an over-optimization.
60
- siz = func.argument_types.size - 1
61
- args[siz] = nil if args.size == siz
62
-
63
- FFI.public_send(original_method_name, *args)
27
+ def init(opt = nil)
28
+ unless opt
29
+ opt = FFI::InitOptions.malloc
30
+ opt.to_ptr.free = Fiddle::RUBY_FREE
64
31
  end
65
- end
32
+ i = super(opt)
33
+ return if i.size.zero?
66
34
 
67
- module CustomMethods
68
- def init(opt = FFI::InitOptions.malloc)
69
- i = super(opt)
70
- unless i.size.zero?
71
- warn 'error'
72
- warn UI.free_init_error(init)
73
- end
74
- end
35
+ warn 'error'
36
+ warn UI.free_init_error(init)
75
37
  end
76
-
77
- prepend CustomMethods
78
38
  end
39
+
40
+ # UI_ENUM
41
+ # https://github.com/andlabs/libui/blob/master/ui.h
42
+
43
+ # ForEach
44
+ ForEachContinue = 0
45
+ ForEachStop = 1
46
+
47
+ # WindowResizeEdge
48
+ WindowResizeEdgeLeft = 0
49
+ WindowResizeEdgeTop = 1
50
+ WindowResizeEdgeRight = 2
51
+ WindowResizeEdgeBottom = 3
52
+ WindowResizeEdgeTopLeft = 4
53
+ WindowResizeEdgeTopRight = 5
54
+ WindowResizeEdgeBottomLeft = 6
55
+ WindowResizeEdgeBottomRight = 7
56
+
57
+ # DrawBrushType
58
+ DrawBrushTypeSolid = 0
59
+ DrawBrushTypeLinearGradient = 1
60
+ DrawBrushTypeRadialGradient = 2
61
+ DrawBrushTypeImage = 3
62
+
63
+ # DrawLineCap
64
+ DrawLineCapFlat = 0
65
+ DrawLineCapRound = 1
66
+ DrawLineCapSquare = 2
67
+
68
+ # DrawLineJoin
69
+ DrawLineJoinMiter = 0
70
+ DrawLineJoinRound = 1
71
+ DrawLineJoinBevel = 2
72
+
73
+ DrawDefaultMiterLimit = 10.0
74
+
75
+ # DrawFillMode
76
+ DrawFillModeWinding = 0
77
+ DrawFillModeAlternate = 1
78
+
79
+ # AttributeType
80
+ AttributeTypeFamily = 0
81
+ AttributeTypeSize = 1
82
+ AttributeTypeWeight = 2
83
+ AttributeTypeItalic = 3
84
+ AttributeTypeStretch = 4
85
+ AttributeTypeColor = 5
86
+ AttributeTypeBackground = 6
87
+ AttributeTypeUnderline = 7
88
+ AttributeTypeUnderlineColor = 8
89
+ AttributeTypeFeatures = 9
90
+
91
+ # TextWeight
92
+ TextWeightMinimum = 0
93
+ TextWeightThin = 100
94
+ TextWeightUltraLight = 200
95
+ TextWeightLight = 300
96
+ TextWeightBook = 350
97
+ TextWeightNormal = 400
98
+ TextWeightMedium = 500
99
+ TextWeightSemiBold = 600
100
+ TextWeightBold = 700
101
+ TextWeightUltraBold = 800
102
+ TextWeightHeavy = 900
103
+ TextWeightUltraHeavy = 950
104
+ TextWeightMaximum = 1000
105
+
106
+ # TextItalic
107
+ TextItalicNormal = 0
108
+ TextItalicOblique = 1
109
+ TextItalicItalic = 2
110
+
111
+ # TextStretch
112
+ TextStretchUltraCondensed = 0
113
+ TextStretchExtraCondensed = 1
114
+ TextStretchCondensed = 2
115
+ TextStretchSemiCondensed = 3
116
+ TextStretchNormal = 4
117
+ TextStretchSemiExpanded = 5
118
+ TextStretchExpanded = 6
119
+ TextStretchExtraExpanded = 7
120
+ TextStretchUltraExpanded = 8
121
+
122
+ # Underline
123
+ UnderlineNone = 0
124
+ UnderlineSingle = 1
125
+ UnderlineDouble = 2
126
+ UnderlineSuggestion = 3
127
+
128
+ # UnderlineColor
129
+ UnderlineColorCustom = 0
130
+ UnderlineColorSpelling = 1
131
+ UnderlineColorGrammar = 2
132
+ UnderlineColorAuxiliary = 3
133
+
134
+ # DrawTextAlign
135
+ DrawTextAlignLeft = 0
136
+ DrawTextAlignCenter = 1
137
+ DrawTextAlignRight = 2
138
+
139
+ # Modifiers
140
+ ModifierCtrl = (1 << 0)
141
+ ModifierAlt = (1 << 1)
142
+ ModifierShift = (1 << 2)
143
+ ModifierSuper = (1 << 3)
144
+
145
+ # ExtKey
146
+ ExtKeyEscape = 1
147
+ ExtKeyInsert = 2
148
+ ExtKeyDelete = 3
149
+ ExtKeyHome = 4
150
+ ExtKeyEnd = 5
151
+ ExtKeyPageUp = 6
152
+ ExtKeyPageDown = 7
153
+ ExtKeyUp = 8
154
+ ExtKeyDown = 9
155
+ ExtKeyLeft = 10
156
+ ExtKeyRight = 11
157
+ ExtKeyF1 = 12
158
+ ExtKeyF2 = 13
159
+ ExtKeyF3 = 14
160
+ ExtKeyF4 = 15
161
+ ExtKeyF5 = 16
162
+ ExtKeyF6 = 17
163
+ ExtKeyF7 = 18
164
+ ExtKeyF8 = 19
165
+ ExtKeyF9 = 20
166
+ ExtKeyF10 = 21
167
+ ExtKeyF11 = 22
168
+ ExtKeyF12 = 23
169
+ ExtKeyN0 = 24
170
+ ExtKeyN1 = 25
171
+ ExtKeyN2 = 26
172
+ ExtKeyN3 = 27
173
+ ExtKeyN4 = 28
174
+ ExtKeyN5 = 29
175
+ ExtKeyN6 = 30
176
+ ExtKeyN7 = 31
177
+ ExtKeyN8 = 32
178
+ ExtKeyN9 = 33
179
+ ExtKeyNDot = 34
180
+ ExtKeyNEnter = 35
181
+ ExtKeyNAdd = 36
182
+ ExtKeyNSubtract = 37
183
+ ExtKeyNMultiply = 38
184
+ ExtKeyNDivide = 39
185
+
186
+ # Align
187
+ AlignFill = 0
188
+ AlignStart = 1
189
+ AlignCenter = 2
190
+ AlignEnd = 3
191
+
192
+ # At
193
+ AtLeading = 0
194
+ AtTop = 1
195
+ AtTrailing = 2
196
+ AtBottom = 3
197
+
198
+ # TableValueType
199
+ TableValueTypeString = 0
200
+ TableValueTypeImage = 1
201
+ TableValueTypeInt = 2
202
+ TableValueTypeColor = 3
203
+
204
+ # editable
205
+ TableModelColumnNeverEditable = -1
206
+ TableModelColumnAlwaysEditable = -2
79
207
  end
data/vendor/libui.so CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-03 00:00:00.000000000 Z
11
+ date: 2021-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,6 +91,8 @@ files:
91
91
  - README.md
92
92
  - lib/libui.rb
93
93
  - lib/libui/ffi.rb
94
+ - lib/libui/fiddle_patch.rb
95
+ - lib/libui/libui_base.rb
94
96
  - lib/libui/utils.rb
95
97
  - lib/libui/version.rb
96
98
  - vendor/LICENSE
@@ -117,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
119
  - !ruby/object:Gem::Version
118
120
  version: '0'
119
121
  requirements: []
120
- rubygems_version: 3.1.4
122
+ rubygems_version: 3.2.22
121
123
  signing_key:
122
124
  specification_version: 4
123
125
  summary: Ruby bindings to libui