libui 0.0.7 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -17
- data/lib/libui/ffi.rb +5 -64
- data/lib/libui/fiddle_patch.rb +79 -0
- data/lib/libui/libui_base.rb +45 -0
- data/lib/libui/utils.rb +1 -1
- data/lib/libui/version.rb +1 -1
- data/lib/libui.rb +177 -44
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60340ec43dace0a242ef186a57ef756931f286350555b97c39baff6d072d6cb
|
4
|
+
data.tar.gz: fbf6e4dbd6ae9018fc6227c17f9250326b6b0850e764bb04d13780a764b8d777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d5618424d35ed377ae722b925dc5b2c808317e8b1d6657b0108db0d4e2cd9a8d65acc338e708eaad53bfa5733a6d6488e58a58ff428e94ffbae0d8c4db7a6f0
|
7
|
+
data.tar.gz: '095d839f03a9e511d2912c8c7310c02143f2a2968af301237b1f31184b0f85592ce0fb8a379768b0a79837ed7a3789f01c5280a20829690400807bd1d5c2b82d'
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# LibUI
|
2
2
|
|
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',
|
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,7 +62,6 @@ 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
|
|
@@ -66,6 +69,7 @@ Compared to original libui written in C,
|
|
66
69
|
|
67
70
|
* At the moment, it is not object-oriented.
|
68
71
|
* Instead of providing a half-baked object-oriented approach, leave it as is.
|
72
|
+
* [A list of DSLs for LibUI.](https://github.com/kojix2/LibUI/wiki/DSL-for-LibUI)
|
69
73
|
|
70
74
|
### How to use fiddle pointers?
|
71
75
|
|
@@ -101,35 +105,79 @@ UI.font_button_on_changed(font_button) do
|
|
101
105
|
end
|
102
106
|
```
|
103
107
|
|
108
|
+
* Callbacks
|
109
|
+
* In Ruby/Fiddle, C callback function is written as an object of
|
110
|
+
`Fiddle::Closure::BlockCaller` or `Fiddle::Closure`.
|
111
|
+
In this case, you need to be careful about Ruby's garbage collection.
|
112
|
+
If the function object is collected, memory will be freed
|
113
|
+
and a segmentation violation will occur when the callback is invoked.
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
# to a local variable to prevent it from being collected by GC.
|
117
|
+
handler.MouseEvent = (c1 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
|
118
|
+
handler.MouseCrossed = (c2 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
|
119
|
+
handler.DragBroken = (c3 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
|
120
|
+
```
|
121
|
+
|
104
122
|
### How to create an executable (.exe) on Windows
|
105
123
|
|
106
124
|
OCRA (One-Click Ruby Application) builds Windows executables from Ruby source code.
|
107
125
|
* https://github.com/larsch/ocra/
|
108
126
|
|
127
|
+
In order to build a exe with Ocra, include 3 DLLs from ruby_builtin_dlls folder:
|
128
|
+
|
129
|
+
```sh
|
130
|
+
ocra examples/control_gallery.rb ^
|
131
|
+
--dll ruby_builtin_dlls/libssp-0.dll ^
|
132
|
+
--dll ruby_builtin_dlls/libgmp-10.dll ^
|
133
|
+
--dll ruby_builtin_dlls/libffi-7.dll ^
|
134
|
+
--gem-all=fiddle ^
|
135
|
+
```
|
136
|
+
|
137
|
+
Add additional options below if necessary.
|
138
|
+
|
139
|
+
```sh
|
140
|
+
--window ^
|
141
|
+
--add-all-core ^
|
142
|
+
--chdir-first ^
|
143
|
+
--icon assets\app.ico ^
|
144
|
+
--verbose ^
|
145
|
+
--output out\gallery.exe
|
146
|
+
```
|
147
|
+
|
109
148
|
## Development
|
110
149
|
|
111
150
|
```sh
|
112
151
|
git clone https://github.com/kojix2/libui
|
113
152
|
cd libui
|
114
153
|
bundle install
|
115
|
-
bundle exec rake vendor:all
|
154
|
+
bundle exec rake vendor:all_x64 # download shared libraries for all platforms
|
116
155
|
bundle exec rake test
|
117
156
|
```
|
118
157
|
|
119
|
-
|
158
|
+
You can use the following rake tasks to download the shared library required for your platform.
|
120
159
|
|
121
160
|
`rake -T`
|
122
161
|
|
123
162
|
```
|
124
|
-
rake vendor:
|
125
|
-
rake vendor:
|
126
|
-
rake vendor:
|
127
|
-
rake vendor:
|
163
|
+
rake vendor:all_x64 # Download libui.so, libui.dylib, and libui.dll to...
|
164
|
+
rake vendor:linux_x64 # Download libui.so for Linux to vendor directory
|
165
|
+
rake vendor:linux_x86 # Download libui.so for Linux to vendor directory
|
166
|
+
rake vendor:mac_x64 # Download libui.dylib for Mac to vendor directory
|
167
|
+
rake vendor:windows_x64 # Download libui.dll for Windows to vendor directory
|
168
|
+
rake vendor:windows_x86 # Download libui.dll for Windows to vendor directory
|
128
169
|
```
|
129
170
|
|
171
|
+
For example, If you are using a 32-bit (x86) version of Ruby on Windows, type `rake vendor:windows_x86`.
|
172
|
+
|
173
|
+
Or Set environment variable `LIBUIDIR` to specify the path to the shared library.
|
174
|
+
|
130
175
|
## Contributing
|
131
176
|
|
132
|
-
|
177
|
+
Would you like to add your commits to libui?
|
178
|
+
* Please feel free to send us your [pull requests](https://github.com/kojix2/libui/pulls).
|
179
|
+
* Small corrections, such as typofixes, are appreciated.
|
180
|
+
* Did you find any bugs? Write it in the [issues](https://github.com/kojix2/LibUI/issue) section!
|
133
181
|
|
134
182
|
## Acknowledgement
|
135
183
|
|
data/lib/libui/ffi.rb
CHANGED
@@ -1,74 +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
|
-
# FIXME: Give inner_function a better name.
|
8
|
-
class Function
|
9
|
-
attr_accessor :inner_functions, :argtype
|
10
|
-
end
|
11
|
-
|
12
|
-
module Importer
|
13
|
-
def parse_signature(signature, tymap = nil)
|
14
|
-
tymap ||= {}
|
15
|
-
ctype, func, args = case compact(signature)
|
16
|
-
when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
|
17
|
-
[TYPE_VOIDP, Regexp.last_match(1), Regexp.last_match(2)]
|
18
|
-
when /^([\w\*\s]+[*\s])(\w+)\((.*?)\);?$/
|
19
|
-
[parse_ctype(Regexp.last_match(1).strip, tymap), Regexp.last_match(2), Regexp.last_match(3)]
|
20
|
-
else
|
21
|
-
raise("can't parserake the function prototype: #{signature}")
|
22
|
-
end
|
23
|
-
symname = func
|
24
|
-
inner_funcs = [] # Added
|
25
|
-
argtype = split_arguments(args).collect.with_index do |arg, idx| # Added with_index
|
26
|
-
# Check if it is a function pointer or not
|
27
|
-
if arg =~ /\(\*.*\)\(.*\)/ # Added
|
28
|
-
# From the arguments, create a notation that looks like a function declaration
|
29
|
-
# int(*f)(int *, void *) -> int f(int *, void *)
|
30
|
-
func_arg = arg.sub('(*', ' ').sub(')', '') # Added
|
31
|
-
# Use Fiddle's parse_signature method again.
|
32
|
-
inner_funcs[idx] = parse_signature(func_arg) # Added
|
33
|
-
end # Added
|
34
|
-
parse_ctype(arg, tymap)
|
35
|
-
end
|
36
|
-
# Added inner_funcs. Original method return only 3 values.
|
37
|
-
[symname, ctype, argtype, inner_funcs]
|
38
|
-
end
|
39
|
-
|
40
|
-
def extern(signature, *opts)
|
41
|
-
symname, ctype, argtype, inner_funcs = parse_signature(signature, type_alias)
|
42
|
-
opt = parse_bind_options(opts)
|
43
|
-
f = import_function(symname, ctype, argtype, opt[:call_type])
|
44
|
-
|
45
|
-
f.inner_functions = inner_funcs # Added
|
46
|
-
f.argtype = argtype # Added
|
47
|
-
|
48
|
-
name = symname.gsub(/@.+/, '')
|
49
|
-
@func_map[name] = f
|
50
|
-
# define_method(name){|*args,&block| f.call(*args,&block)}
|
51
|
-
begin
|
52
|
-
/^(.+?):(\d+)/ =~ caller.first
|
53
|
-
file = Regexp.last_match(1)
|
54
|
-
line = Regexp.last_match(2).to_i
|
55
|
-
rescue StandardError
|
56
|
-
file, line = __FILE__, __LINE__ + 3
|
57
|
-
end
|
58
|
-
module_eval(<<-EOS, file, line)
|
59
|
-
def #{name}(*args, &block)
|
60
|
-
@func_map['#{name}'].call(*args,&block)
|
61
|
-
end
|
62
|
-
EOS
|
63
|
-
module_function(name)
|
64
|
-
f
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
4
|
+
require_relative 'fiddle_patch'
|
68
5
|
|
69
6
|
module LibUI
|
70
7
|
module FFI
|
71
8
|
extend Fiddle::Importer
|
9
|
+
extend FiddlePatch
|
72
10
|
|
73
11
|
begin
|
74
12
|
dlload LibUI.ffi_lib
|
@@ -96,6 +34,9 @@ module LibUI
|
|
96
34
|
'size_t Size'
|
97
35
|
]
|
98
36
|
|
37
|
+
# https://github.com/andlabs/libui/blob/master/ui.h
|
38
|
+
# keep same order
|
39
|
+
|
99
40
|
try_extern 'const char *uiInit(uiInitOptions *options)'
|
100
41
|
try_extern 'void uiUninit(void)'
|
101
42
|
try_extern 'void uiFreeInitError(const char *err)'
|
@@ -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
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 =
|
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,45 +19,185 @@ 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.
|
32
|
-
|
33
|
-
|
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
|
-
Fiddle::Closure::BlockCaller.new(*func.inner_functions[idx][1..2], &arg)
|
45
|
-
else
|
46
|
-
arg
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Make it possible to omit the last nil. This may be an over-optimization.
|
51
|
-
siz = func.argtype.size - 1
|
52
|
-
args[siz] = nil if args.size == siz
|
53
|
-
|
54
|
-
FFI.public_send(original_method_name, *args)
|
55
|
-
end
|
56
|
-
end
|
27
|
+
def init(opt = FFI::InitOptions.malloc)
|
28
|
+
i = super(opt)
|
29
|
+
return if i.size.zero?
|
57
30
|
|
58
|
-
|
59
|
-
|
60
|
-
i = super(opt)
|
61
|
-
unless i.size.zero?
|
62
|
-
warn 'error'
|
63
|
-
warn UI.free_init_error(init)
|
64
|
-
end
|
65
|
-
end
|
31
|
+
warn 'error'
|
32
|
+
warn UI.free_init_error(init)
|
66
33
|
end
|
67
|
-
|
68
|
-
prepend CustomMethods
|
69
34
|
end
|
35
|
+
|
36
|
+
# UI_ENUM
|
37
|
+
# https://github.com/andlabs/libui/blob/master/ui.h
|
38
|
+
|
39
|
+
# ForEach
|
40
|
+
ForEachContinue = 0
|
41
|
+
ForEachStop = 1
|
42
|
+
|
43
|
+
# WindowResizeEdge
|
44
|
+
WindowResizeEdgeLeft = 0
|
45
|
+
WindowResizeEdgeTop = 1
|
46
|
+
WindowResizeEdgeRight = 2
|
47
|
+
WindowResizeEdgeBottom = 3
|
48
|
+
WindowResizeEdgeTopLeft = 4
|
49
|
+
WindowResizeEdgeTopRight = 5
|
50
|
+
WindowResizeEdgeBottomLeft = 6
|
51
|
+
WindowResizeEdgeBottomRight = 7
|
52
|
+
|
53
|
+
# DrawBrushType
|
54
|
+
DrawBrushTypeSolid = 0
|
55
|
+
DrawBrushTypeLinearGradient = 1
|
56
|
+
DrawBrushTypeRadialGradient = 2
|
57
|
+
DrawBrushTypeImage = 3
|
58
|
+
|
59
|
+
# DrawLineCap
|
60
|
+
DrawLineCapFlat = 0
|
61
|
+
DrawLineCapRound = 1
|
62
|
+
DrawLineCapSquare = 2
|
63
|
+
|
64
|
+
# DrawLineJoin
|
65
|
+
DrawLineJoinMiter = 0
|
66
|
+
DrawLineJoinRound = 1
|
67
|
+
DrawLineJoinBevel = 2
|
68
|
+
|
69
|
+
DrawDefaultMiterLimit = 10.0
|
70
|
+
|
71
|
+
# DrawFillMode
|
72
|
+
DrawFillModeWinding = 0
|
73
|
+
DrawFillModeAlternate = 1
|
74
|
+
|
75
|
+
# AttributeType
|
76
|
+
AttributeTypeFamily = 0
|
77
|
+
AttributeTypeSize = 1
|
78
|
+
AttributeTypeWeight = 2
|
79
|
+
AttributeTypeItalic = 3
|
80
|
+
AttributeTypeStretch = 4
|
81
|
+
AttributeTypeColor = 5
|
82
|
+
AttributeTypeBackground = 6
|
83
|
+
AttributeTypeUnderline = 7
|
84
|
+
AttributeTypeUnderlineColor = 8
|
85
|
+
AttributeTypeFeatures = 9
|
86
|
+
|
87
|
+
# TextWeight
|
88
|
+
TextWeightMinimum = 0
|
89
|
+
TextWeightThin = 100
|
90
|
+
TextWeightUltraLight = 200
|
91
|
+
TextWeightLight = 300
|
92
|
+
TextWeightBook = 350
|
93
|
+
TextWeightNormal = 400
|
94
|
+
TextWeightMedium = 500
|
95
|
+
TextWeightSemiBold = 600
|
96
|
+
TextWeightBold = 700
|
97
|
+
TextWeightUltraBold = 800
|
98
|
+
TextWeightHeavy = 900
|
99
|
+
TextWeightUltraHeavy = 950
|
100
|
+
TextWeightMaximum = 1000
|
101
|
+
|
102
|
+
# TextItalic
|
103
|
+
TextItalicNormal = 0
|
104
|
+
TextItalicOblique = 1
|
105
|
+
TextItalicItalic = 2
|
106
|
+
|
107
|
+
# TextStretch
|
108
|
+
TextStretchUltraCondensed = 0
|
109
|
+
TextStretchExtraCondensed = 1
|
110
|
+
TextStretchCondensed = 2
|
111
|
+
TextStretchSemiCondensed = 3
|
112
|
+
TextStretchNormal = 4
|
113
|
+
TextStretchSemiExpanded = 5
|
114
|
+
TextStretchExpanded = 6
|
115
|
+
TextStretchExtraExpanded = 7
|
116
|
+
TextStretchUltraExpanded = 8
|
117
|
+
|
118
|
+
# Underline
|
119
|
+
UnderlineNone = 0
|
120
|
+
UnderlineSingle = 1
|
121
|
+
UnderlineDouble = 2
|
122
|
+
UnderlineSuggestion = 3
|
123
|
+
|
124
|
+
# UnderlineColor
|
125
|
+
UnderlineColorCustom = 0
|
126
|
+
UnderlineColorSpelling = 1
|
127
|
+
UnderlineColorGrammar = 2
|
128
|
+
UnderlineColorAuxiliary = 3
|
129
|
+
|
130
|
+
# DrawTextAlign
|
131
|
+
DrawTextAlignLeft = 0
|
132
|
+
DrawTextAlignCenter = 1
|
133
|
+
DrawTextAlignRight = 2
|
134
|
+
|
135
|
+
# Modifiers
|
136
|
+
ModifierCtrl = (1 << 0)
|
137
|
+
ModifierAlt = (1 << 1)
|
138
|
+
ModifierShift = (1 << 2)
|
139
|
+
ModifierSuper = (1 << 3)
|
140
|
+
|
141
|
+
# ExtKey
|
142
|
+
ExtKeyEscape = 1
|
143
|
+
ExtKeyInsert = 2
|
144
|
+
ExtKeyDelete = 3
|
145
|
+
ExtKeyHome = 4
|
146
|
+
ExtKeyEnd = 5
|
147
|
+
ExtKeyPageUp = 6
|
148
|
+
ExtKeyPageDown = 7
|
149
|
+
ExtKeyUp = 8
|
150
|
+
ExtKeyDown = 9
|
151
|
+
ExtKeyLeft = 10
|
152
|
+
ExtKeyRight = 11
|
153
|
+
ExtKeyF1 = 12
|
154
|
+
ExtKeyF2 = 13
|
155
|
+
ExtKeyF3 = 14
|
156
|
+
ExtKeyF4 = 15
|
157
|
+
ExtKeyF5 = 16
|
158
|
+
ExtKeyF6 = 17
|
159
|
+
ExtKeyF7 = 18
|
160
|
+
ExtKeyF8 = 19
|
161
|
+
ExtKeyF9 = 20
|
162
|
+
ExtKeyF10 = 21
|
163
|
+
ExtKeyF11 = 22
|
164
|
+
ExtKeyF12 = 23
|
165
|
+
ExtKeyN0 = 24
|
166
|
+
ExtKeyN1 = 25
|
167
|
+
ExtKeyN2 = 26
|
168
|
+
ExtKeyN3 = 27
|
169
|
+
ExtKeyN4 = 28
|
170
|
+
ExtKeyN5 = 29
|
171
|
+
ExtKeyN6 = 30
|
172
|
+
ExtKeyN7 = 31
|
173
|
+
ExtKeyN8 = 32
|
174
|
+
ExtKeyN9 = 33
|
175
|
+
ExtKeyNDot = 34
|
176
|
+
ExtKeyNEnter = 35
|
177
|
+
ExtKeyNAdd = 36
|
178
|
+
ExtKeyNSubtract = 37
|
179
|
+
ExtKeyNMultiply = 38
|
180
|
+
ExtKeyNDivide = 39
|
181
|
+
|
182
|
+
# Align
|
183
|
+
AlignFill = 0
|
184
|
+
AlignStart = 1
|
185
|
+
AlignCenter = 2
|
186
|
+
AlignEnd = 3
|
187
|
+
|
188
|
+
# At
|
189
|
+
AtLeading = 0
|
190
|
+
AtTop = 1
|
191
|
+
AtTrailing = 2
|
192
|
+
AtBottom = 3
|
193
|
+
|
194
|
+
# TableValueType
|
195
|
+
TableValueTypeString = 0
|
196
|
+
TableValueTypeImage = 1
|
197
|
+
TableValueTypeInt = 2
|
198
|
+
TableValueTypeColor = 3
|
199
|
+
|
200
|
+
# editable
|
201
|
+
TableModelColumnNeverEditable = -1
|
202
|
+
TableModelColumnAlwaysEditable = -2
|
70
203
|
end
|
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.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-03 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.2.
|
122
|
+
rubygems_version: 3.2.22
|
121
123
|
signing_key:
|
122
124
|
specification_version: 4
|
123
125
|
summary: Ruby bindings to libui
|