libui 0.2.0-x86_64-darwin → 0.2.1-x86_64-darwin

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d2954e0190af33bfe1bb68cc123b57b5d5bc10a90ef21167b6db870ff40524d
4
- data.tar.gz: e5748e4586617b1809dfc384bb897f92e298d91ec50e15eb6a7bef763f17dab7
3
+ metadata.gz: 2da7e4d17eb4d0cc4479b3c67bb96e13525abaa67b0d148fb7d102501f5afffa
4
+ data.tar.gz: 8995dea62c2f064e1166e3df975fe8c2fc17582a10479cbd74d0f725ebce41c5
5
5
  SHA512:
6
- metadata.gz: dacbc63fe500b48d6216d64090b8d94a1ac0e466eadc9cd9ad266c65e61bf45c3da768778cf03388d094abe67e1fd20723d728758c419d85e04c310f6fc5f65d
7
- data.tar.gz: c55a34901a8dc3a997d055d0034a84e574fbe6fb1aad6eab6e4419a1bd4b42e10b94750d590d77e524500a64fac28f1e61c3cb257ac5682f4a80ca6ae7476b5f
6
+ metadata.gz: 52812b379c2644c91d133cc3a2a55d64280cbcca7a45a404ef3ae53ac76ad1aa98e3166f5310440b2fb61186fa2db4bd13571d131e26b7883362f71c34d1e426
7
+ data.tar.gz: 8625c35e8e2918a73afcc550aed29e8f024b5bf6782aabf2e5d8e82f9c41533879aa50eba8a490d959564d1a094db89924b2e4773ab79ac935762c34b7dfc922
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020-2025 kojix2
3
+ Copyright (c) 2020-present kojix2
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 --pre # libui-ng; this will fetch libui-0.1.3.pre-x86_64-linux.gem
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 documentation for libui's Go bindings](https://pkg.go.dev/github.com/andlabs/ui) as a reference.
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
- To convert a pointer to a string:
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
- p pointer = UI.label_text(label) # #<Fiddle::Pointer>
112
- p pointer.to_s # Ruby
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
- p family: font_descriptor.Family.to_s,
128
- size: font_descriptor.Size,
129
- weight: font_descriptor.Weight,
130
- italic: font_descriptor.Italic,
131
- stretch: font_descriptor.Stretch
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.1.3
210
- git push origin v0.1.3
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, we plan to support only libui-ng/libui-ng.
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
@@ -1,3 +1,3 @@
1
1
  module LibUI
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
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.
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - kojix2