libui 0.2.0-x64-mingw-ucrt → 0.2.1-x64-mingw-ucrt
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/LICENSE.txt +1 -1
- data/README.md +42 -22
- data/lib/libui/version.rb +1 -1
- data/lib/libui.rb +100 -0
- data/vendor/libui.x64.dll +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fd629f452a548a8e8ee6e7a831ab863eb4b43e3e709e1641e8c582a24e8f554
|
|
4
|
+
data.tar.gz: 5c81d5116b2a04fc64212a3f57004b890cf6f7e01ba04d513b51ff825f05e2fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9783a914542fa8e534b56e64cc928564f66f9c093e37b3ca278342613c8f2d066eb9aec64f41b40606362f17becfec69985794f81533bc874db4e952772ec5bb
|
|
7
|
+
data.tar.gz: b4953c59f245f284c8322a6f127de698980f44b8b32a30efcad343792bf5fe9350ebca77fa891267ed33b6a032b7970e34c41274060ad2902312e9a45068d10f
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -16,20 +16,12 @@ LibUI is a Ruby wrapper for libui family.
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
It is recommended to use libui-ng, via the --pre commandline flag:
|
|
20
|
-
|
|
21
19
|
```sh
|
|
22
|
-
gem install libui
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
If for some reason you would like to install the slightly older libui-0.1.2.gem release, issue:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
gem install libui
|
|
20
|
+
gem install libui # --pre
|
|
29
21
|
```
|
|
30
22
|
|
|
31
23
|
- The gem package includes the libui-ng shared library for Windows, Mac, and Linux.
|
|
32
|
-
- Namely `libui.dll`, `libui.dylib`, or `libui.so`.
|
|
24
|
+
- Namely `libui.x64.dll`/`libui.x86.dll`, `libui.x86_64.dylib`/`libui.arm64.dylib`, or `libui.x86_64.so`/`libui.aarch64.so`.
|
|
33
25
|
- No dependencies required.
|
|
34
26
|
- The libui gem uses the standard Ruby library [Fiddle](https://github.com/ruby/fiddle) to call C functions.
|
|
35
27
|
|
|
@@ -85,7 +77,7 @@ Compared to the original libui library written in C:
|
|
|
85
77
|
- The block will be converted to a Proc object and added as the last argument.
|
|
86
78
|
- The last argument can still be omitted when nil.
|
|
87
79
|
|
|
88
|
-
You can use [the
|
|
80
|
+
You can use [the libui-ng API documentation](https://libui-ng.github.io/libui-ng/) as a reference.
|
|
89
81
|
|
|
90
82
|
### DSLs for LibUI
|
|
91
83
|
|
|
@@ -104,12 +96,26 @@ UI = LibUI
|
|
|
104
96
|
UI.init
|
|
105
97
|
```
|
|
106
98
|
|
|
107
|
-
|
|
99
|
+
Text getter methods such as `label_text`, `entry_text`, and `window_title`
|
|
100
|
+
return `Fiddle::Pointer` objects for strings allocated by libui. Convert the
|
|
101
|
+
pointer to a Ruby string, then release it with `free_text`.
|
|
108
102
|
|
|
109
103
|
```ruby
|
|
110
104
|
label = UI.new_label("Ruby")
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
pointer = UI.label_text(label) # #<Fiddle::Pointer>
|
|
106
|
+
text = pointer.to_s
|
|
107
|
+
UI.free_text(pointer)
|
|
108
|
+
p text # Ruby
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use `ensure` if the code between conversion and cleanup can raise:
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
def ui_text(text_pointer)
|
|
115
|
+
text_pointer.to_s
|
|
116
|
+
ensure
|
|
117
|
+
UI.free_text(text_pointer) if text_pointer && !text_pointer.null?
|
|
118
|
+
end
|
|
113
119
|
```
|
|
114
120
|
|
|
115
121
|
If you need to use C structs, you can do the following:
|
|
@@ -124,11 +130,15 @@ font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
|
|
|
124
130
|
|
|
125
131
|
UI.font_button_on_changed(font_button) do
|
|
126
132
|
UI.font_button_font(font_button, font_descriptor)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
begin
|
|
134
|
+
p family: font_descriptor.Family.to_s,
|
|
135
|
+
size: font_descriptor.Size,
|
|
136
|
+
weight: font_descriptor.Weight,
|
|
137
|
+
italic: font_descriptor.Italic,
|
|
138
|
+
stretch: font_descriptor.Stretch
|
|
139
|
+
ensure
|
|
140
|
+
UI.free_font_button_font(font_descriptor)
|
|
141
|
+
end
|
|
132
142
|
end
|
|
133
143
|
```
|
|
134
144
|
|
|
@@ -206,8 +216,8 @@ If you build libui-ng yourself, set `LIBUIDIR` to the directory containing the c
|
|
|
206
216
|
Push a version tag to automatically publish platform-specific gems:
|
|
207
217
|
|
|
208
218
|
```sh
|
|
209
|
-
git tag v0.
|
|
210
|
-
git push origin v0.
|
|
219
|
+
git tag v0.2.0
|
|
220
|
+
git push origin v0.2.0
|
|
211
221
|
```
|
|
212
222
|
|
|
213
223
|
Requires `RUBYGEMS_API_KEY` repository secret with scoped API key.
|
|
@@ -225,9 +235,19 @@ find pkg -name *.gem -exec sh -c "echo; echo \# {}; tar -O -f {} -x data.tar.gz
|
|
|
225
235
|
rake release_platform # publish gems
|
|
226
236
|
```
|
|
227
237
|
|
|
238
|
+
Windows Ruby (x64-mingw32 or x64-mingw-ucrt)
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
gem install rake rubyzip
|
|
242
|
+
GEM_PLATFORM=x64-mingw32 rake vendor:clean
|
|
243
|
+
GEM_PLATFORM=x64-mingw32 rake vendor:auto
|
|
244
|
+
GEM_PLATFORM=x64-mingw32 gem build libui.gemspec
|
|
245
|
+
gem push libui-0.2.0-x64-mingw32.gem
|
|
246
|
+
```
|
|
247
|
+
|
|
228
248
|
### libui or libui-ng
|
|
229
249
|
|
|
230
|
-
- From version 0.1.X,
|
|
250
|
+
- From version 0.1.X, LibUI supports only libui-ng.
|
|
231
251
|
- Version 0.0.X only supports andlabs/libui.
|
|
232
252
|
|
|
233
253
|
## Contributing
|
data/lib/libui/version.rb
CHANGED
data/lib/libui.rb
CHANGED
|
@@ -59,6 +59,106 @@ module LibUI
|
|
|
59
59
|
nil
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
def new_button(text = '')
|
|
63
|
+
super(text)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def new_checkbox(text = '')
|
|
67
|
+
super(text)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def window_set_title(window, title = '')
|
|
71
|
+
super(window, title)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def button_set_text(button, text = '')
|
|
75
|
+
super(button, text)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def checkbox_set_text(checkbox, text = '')
|
|
79
|
+
super(checkbox, text)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def entry_set_text(entry, text = '')
|
|
83
|
+
super(entry, text)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def label_set_text(label, text = '')
|
|
87
|
+
super(label, text)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def new_label(text = '')
|
|
91
|
+
super(text)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def group_set_title(group, title = '')
|
|
95
|
+
super(group, title)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def new_group(title = '')
|
|
99
|
+
super(title)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def combobox_append(combobox, text = '')
|
|
103
|
+
super(combobox, text)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def combobox_insert_at(combobox, index, text = '')
|
|
107
|
+
super(combobox, index, text)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def editable_combobox_append(combobox, text = '')
|
|
111
|
+
super(combobox, text)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def editable_combobox_set_text(combobox, text = '')
|
|
115
|
+
super(combobox, text)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def radio_buttons_append(radio_buttons, text = '')
|
|
119
|
+
super(radio_buttons, text)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def multiline_entry_set_text(entry, text = '')
|
|
123
|
+
super(entry, text)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def multiline_entry_append(entry, text = '')
|
|
127
|
+
super(entry, text)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def menu_append_item(menu, name = '')
|
|
131
|
+
super(menu, name)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def menu_append_check_item(menu, name = '')
|
|
135
|
+
super(menu, name)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def new_menu(name = '')
|
|
139
|
+
super(name)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def msg_box(parent, title, description = '')
|
|
143
|
+
super(parent, title, description)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def msg_box_error(parent, title, description = '')
|
|
147
|
+
super(parent, title, description)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def new_attributed_string(initial_string = '')
|
|
151
|
+
super(initial_string)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def attributed_string_append_unattributed(attributed_string, str = '')
|
|
155
|
+
super(attributed_string, str)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def new_table_value_string(str = '')
|
|
159
|
+
super(str)
|
|
160
|
+
end
|
|
161
|
+
|
|
62
162
|
# Gets the window position.
|
|
63
163
|
# Coordinates are measured from the top left corner of the screen.
|
|
64
164
|
# @param w [Fiddle::Pointer] Pointer of uiWindow instance.
|
data/vendor/libui.x64.dll
CHANGED
|
Binary file
|