libui 0.0.15 → 0.1.0.pre.0

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: 2fe04f1f03b5bc2cdc5596993230212f76b2582d05e943a1b0f67cfa8a26c1d5
4
- data.tar.gz: 9fa47e55f1d5fd30191d7c48e546269fd72c727fea98850ab6a665beeeccd4ce
3
+ metadata.gz: 86351824e7a0d8285f2f853268a3085116c5499e0c0cbc68f567a18df02d6659
4
+ data.tar.gz: 3648436c3fa23817f2317cd70c55924931413bb16cc2a7e671004aceabddabfd
5
5
  SHA512:
6
- metadata.gz: 31a67b3239d6f80f3be0693b9a06be1903cba54157a790d5a3a008dc282470e8e6037716e0c3428ff461ab6207d1b64f1ae59d2d33aa7cdd4348d4e831e56929
7
- data.tar.gz: f2a9feac43d98eca7d952f2c6970ceb90ab32c778b497fa09396a5cde7739bf00330529f53aa8c4a4896b71eeffb0dea93f5c5849cd29a22291a1ca2fdd52c1f
6
+ metadata.gz: 29ca304955f3f8f36a74c3484e1220330fd562c128654626c680422fec6d715102d0135f2eedbb95200febcf0e3e0fe6087acd9be9b81bc6766f0a06c18d339e
7
+ data.tar.gz: 4f449bc98a90c9bb0ea42ccc1973fe9b53112f8ffe4b2e5bc7b89b6f52ccad5d6aa7341d78c053a28138b39af0fe5aae04ca6d5a01ce539ee74980dce6318f88
data/README.md CHANGED
@@ -4,7 +4,11 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
5
5
  <a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
6
6
 
7
- :radio_button: [libui](https://github.com/libui-ng/libui-ng) - a portable GUI library - for Ruby
7
+ LibUI is a Ruby wrapper for libui and libui-ng.
8
+
9
+ :rocket: [libui-ng](https://github.com/libui-ng/libui-ng) - A cross-platform portable GUI library
10
+
11
+ :radio_button: [libui](https://github.com/andlabs/libui) - Original version by andlabs
8
12
 
9
13
  ## Installation
10
14
 
@@ -24,6 +28,7 @@ gem install libui
24
28
  Note:
25
29
  * If you are using the 32-bit (x86) version of Ruby, you need to download the 32-bit (x86) native dll. See [Development](#development).
26
30
  * On Windows, libui may not work due to missing DLLs. In that case, you need to install [Visual C++ Redistributable](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist). See ([#48](https://github.com/kojix2/LibUI/issues/48))
31
+ * [Raspberry Pi](https://www.raspberrypi.com/) and other platform users will need to compile C libui. See [Development](#development).
27
32
 
28
33
  ## Usage
29
34
 
@@ -72,8 +77,9 @@ You can use [the documentation for libui's Go bindings](https://pkg.go.dev/githu
72
77
 
73
78
  ### DSLs for LibUI
74
79
 
75
- LibUI is not object-oriented, but provides high portability with minimal implementation.
76
- If you want to write in an object-oriented way, please use the following DSLs built on top of LibUI.
80
+ LibUI is intentionally not object-oriented because it is a thin Ruby wrapper (binding) for the procedural C libui library, so it mirrors its API structure.
81
+
82
+ It is recommended that you build actual applications using a DSL for LibUI because DSLs enable writing object-oriented code the Ruby way (instead of procedural code the C way):
77
83
 
78
84
  * [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
79
85
  * [libui_paradise](https://rubygems.org/gems/libui_paradise)
@@ -156,6 +162,8 @@ Add additional options below if necessary.
156
162
 
157
163
  ## Development
158
164
 
165
+ LibUI is not object-oriented, but it provides high portability with a minimal implementation.
166
+
159
167
  ```sh
160
168
  git clone https://github.com/kojix2/libui
161
169
  cd libui
@@ -180,7 +188,27 @@ rake vendor:windows_x86 # Download libui.dll for Windows to vendor directory
180
188
 
181
189
  For example, If you are using a 32-bit (x86) version of Ruby on Windows, type `rake vendor:windows_x86`.
182
190
 
183
- Or Set environment variable `LIBUIDIR` to specify the path to the shared library.
191
+ ### Use C libui compiled from source code
192
+
193
+ You can compile C libui from source code on your platform and tell ruby LibUI where to find the shared libraries. Set environment variable `LIBUIDIR` to specify the path to the shared library. (See [#46](https://github.com/kojix2/LibUI/issues/46#issuecomment-1041575792)). This is especially useful on platforms where the LibUI gem does not provide shared library, such as the ARM architecture (used in devices like Raspberry Pi).
194
+
195
+ Another simple approach is to replace the shared libraries in the gem vendor directory with the ones you have compiled.
196
+
197
+ ### libui-ng
198
+
199
+ Version 0.0.X only supports libui. From version 0.1.X, we plan to support only libui-ng.
200
+
201
+ [libui-ng](https://github.com/libui-ng/libui-ng) is the successor project to libui. Rake tasks are available to build or download libui-ng shared libraries.
202
+
203
+ ```
204
+ rake libui-ng:build[hash] # Build libui-ng latest master [commit hash]
205
+ rake libui-ng:mac # Download latest dev build for Mac to vendor directory
206
+ rake libui-ng:ubuntu_x64 # Download latest dev build for Ubuntu to vendor directory
207
+ ```
208
+
209
+ ```
210
+ rake install
211
+ ```
184
212
 
185
213
  ## Contributing
186
214
 
data/lib/libui/ffi.rb CHANGED
@@ -65,23 +65,23 @@ module LibUI
65
65
  'void (*Disable)(uiControl *)'
66
66
  ]
67
67
 
68
- try_extern 'void uiControlDestroy(uiControl *)'
69
- try_extern 'uintptr_t uiControlHandle(uiControl *)'
70
- try_extern 'uiControl *uiControlParent(uiControl *)'
71
- try_extern 'void uiControlSetParent(uiControl *, uiControl *)'
72
- try_extern 'int uiControlToplevel(uiControl *)'
73
- try_extern 'int uiControlVisible(uiControl *)'
74
- try_extern 'void uiControlShow(uiControl *)'
75
- try_extern 'void uiControlHide(uiControl *)'
76
- try_extern 'int uiControlEnabled(uiControl *)'
77
- try_extern 'void uiControlEnable(uiControl *)'
78
- try_extern 'void uiControlDisable(uiControl *)'
68
+ try_extern 'void uiControlDestroy(uiControl *c)'
69
+ try_extern 'uintptr_t uiControlHandle(uiControl *c)'
70
+ try_extern 'uiControl *uiControlParent(uiControl *c)'
71
+ try_extern 'void uiControlSetParent(uiControl *c, uiControl *parent)'
72
+ try_extern 'int uiControlToplevel(uiControl *c)'
73
+ try_extern 'int uiControlVisible(uiControl *c)'
74
+ try_extern 'void uiControlShow(uiControl *c)'
75
+ try_extern 'void uiControlHide(uiControl *c)'
76
+ try_extern 'int uiControlEnabled(uiControl *c)'
77
+ try_extern 'void uiControlEnable(uiControl *c)'
78
+ try_extern 'void uiControlDisable(uiControl *c)'
79
79
 
80
80
  try_extern 'uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr)'
81
- try_extern 'void uiFreeControl(uiControl *)'
81
+ try_extern 'void uiFreeControl(uiControl *c)'
82
82
 
83
- try_extern 'void uiControlVerifySetParent(uiControl *, uiControl *)'
84
- try_extern 'int uiControlEnabledToUser(uiControl *)'
83
+ try_extern 'void uiControlVerifySetParent(uiControl *c, uiControl *parent)'
84
+ try_extern 'int uiControlEnabledToUser(uiControl *c)'
85
85
 
86
86
  try_extern 'void uiUserBugCannotSetParentOnToplevel(const char *type)'
87
87
 
@@ -93,25 +93,30 @@ module LibUI
93
93
  try_extern 'void uiWindowSetContentSize(uiWindow *w, int width, int height)'
94
94
  try_extern 'int uiWindowFullscreen(uiWindow *w)'
95
95
  try_extern 'void uiWindowSetFullscreen(uiWindow *w, int fullscreen)'
96
- try_extern 'void uiWindowOnContentSizeChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data)'
97
- try_extern 'void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *w, void *data), void *data)'
96
+ try_extern 'void uiWindowOnContentSizeChanged(uiWindow *w, void (*f)(uiWindow *sender, void *senderData), void *data)'
97
+ try_extern 'void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *sender, void *senderData), void *data)'
98
+ try_extern 'void uiWindowOnFocusChanged(uiWindow *w, void (*f)(uiWindow *sender, void *senderData), void *data)'
99
+ try_extern 'int uiWindowFocused(uiWindow *w)'
98
100
  try_extern 'int uiWindowBorderless(uiWindow *w)'
99
101
  try_extern 'void uiWindowSetBorderless(uiWindow *w, int borderless)'
100
102
  try_extern 'void uiWindowSetChild(uiWindow *w, uiControl *child)'
101
103
  try_extern 'int uiWindowMargined(uiWindow *w)'
102
104
  try_extern 'void uiWindowSetMargined(uiWindow *w, int margined)'
105
+ try_extern 'int uiWindowResizeable(uiWindow *w)'
106
+ try_extern 'void uiWindowSetResizeable(uiWindow *w, int resizeable)'
103
107
  try_extern 'uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)'
104
108
 
105
109
  # uiButton
106
110
 
107
111
  try_extern 'char *uiButtonText(uiButton *b)'
108
112
  try_extern 'void uiButtonSetText(uiButton *b, const char *text)'
109
- try_extern 'void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *b, void *data), void *data)'
113
+ try_extern 'void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *sender, void *senderData), void *data)'
110
114
  try_extern 'uiButton *uiNewButton(const char *text)'
111
115
 
112
116
  # uiBox
113
117
 
114
118
  try_extern 'void uiBoxAppend(uiBox *b, uiControl *child, int stretchy)'
119
+ try_extern 'int uiBoxNumChildren(uiBox *b)'
115
120
  try_extern 'void uiBoxDelete(uiBox *b, int index)'
116
121
  try_extern 'int uiBoxPadded(uiBox *b)'
117
122
  try_extern 'void uiBoxSetPadded(uiBox *b, int padded)'
@@ -122,7 +127,7 @@ module LibUI
122
127
 
123
128
  try_extern 'char *uiCheckboxText(uiCheckbox *c)'
124
129
  try_extern 'void uiCheckboxSetText(uiCheckbox *c, const char *text)'
125
- try_extern 'void uiCheckboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *c, void *data), void *data)'
130
+ try_extern 'void uiCheckboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *sender, void *senderData), void *data)'
126
131
  try_extern 'int uiCheckboxChecked(uiCheckbox *c)'
127
132
  try_extern 'void uiCheckboxSetChecked(uiCheckbox *c, int checked)'
128
133
  try_extern 'uiCheckbox *uiNewCheckbox(const char *text)'
@@ -131,7 +136,7 @@ module LibUI
131
136
 
132
137
  try_extern 'char *uiEntryText(uiEntry *e)'
133
138
  try_extern 'void uiEntrySetText(uiEntry *e, const char *text)'
134
- try_extern 'void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data)'
139
+ try_extern 'void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *sender, void *senderData), void *data)'
135
140
  try_extern 'int uiEntryReadOnly(uiEntry *e)'
136
141
  try_extern 'void uiEntrySetReadOnly(uiEntry *e, int readonly)'
137
142
  try_extern 'uiEntry *uiNewEntry(void)'
@@ -147,11 +152,11 @@ module LibUI
147
152
  # uiTab
148
153
 
149
154
  try_extern 'void uiTabAppend(uiTab *t, const char *name, uiControl *c)'
150
- try_extern 'void uiTabInsertAt(uiTab *t, const char *name, int before, uiControl *c)'
155
+ try_extern 'void uiTabInsertAt(uiTab *t, const char *name, int index, uiControl *c)'
151
156
  try_extern 'void uiTabDelete(uiTab *t, int index)'
152
157
  try_extern 'int uiTabNumPages(uiTab *t)'
153
- try_extern 'int uiTabMargined(uiTab *t, int page)'
154
- try_extern 'void uiTabSetMargined(uiTab *t, int page, int margined)'
158
+ try_extern 'int uiTabMargined(uiTab *t, int index)'
159
+ try_extern 'void uiTabSetMargined(uiTab *t, int index, int margined)'
155
160
  try_extern 'uiTab *uiNewTab(void)'
156
161
 
157
162
  # uiGroup
@@ -167,14 +172,18 @@ module LibUI
167
172
 
168
173
  try_extern 'int uiSpinboxValue(uiSpinbox *s)'
169
174
  try_extern 'void uiSpinboxSetValue(uiSpinbox *s, int value)'
170
- try_extern 'void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *s, void *data), void *data)'
175
+ try_extern 'void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *sender, void *senderData), void *data)'
171
176
  try_extern 'uiSpinbox *uiNewSpinbox(int min, int max)'
172
177
 
173
178
  # uiSlider
174
179
 
175
180
  try_extern 'int uiSliderValue(uiSlider *s)'
176
181
  try_extern 'void uiSliderSetValue(uiSlider *s, int value)'
177
- try_extern 'void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *s, void *data), void *data)'
182
+ try_extern 'int uiSliderHasToolTip(uiSlider *s)'
183
+ try_extern 'void uiSliderSetHasToolTip(uiSlider *s, int hasToolTip)'
184
+ try_extern 'void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *sender, void *senderData), void *data)'
185
+ try_extern 'void uiSliderOnReleased(uiSlider *s, void (*f)(uiSlider *sender, void *senderData), void *data)'
186
+ try_extern 'void uiSliderSetRange(uiSlider *s, int min, int max)'
178
187
  try_extern 'uiSlider *uiNewSlider(int min, int max)'
179
188
 
180
189
  # uiProgressBar
@@ -191,9 +200,13 @@ module LibUI
191
200
  # uiCombobox
192
201
 
193
202
  try_extern 'void uiComboboxAppend(uiCombobox *c, const char *text)'
203
+ try_extern 'void uiComboboxInsertAt(uiCombobox *c, int index, const char *text)'
204
+ try_extern 'void uiComboboxDelete(uiCombobox *c, int index)'
205
+ try_extern 'void uiComboboxClear(uiCombobox *c)'
206
+ try_extern 'int uiComboboxNumItems(uiCombobox *c)'
194
207
  try_extern 'int uiComboboxSelected(uiCombobox *c)'
195
- try_extern 'void uiComboboxSetSelected(uiCombobox *c, int n)'
196
- try_extern 'void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data)'
208
+ try_extern 'void uiComboboxSetSelected(uiCombobox *c, int index)'
209
+ try_extern 'void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *sender, void *senderData), void *data)'
197
210
  try_extern 'uiCombobox *uiNewCombobox(void)'
198
211
 
199
212
  # uiEditableCombobox
@@ -201,15 +214,15 @@ module LibUI
201
214
  try_extern 'void uiEditableComboboxAppend(uiEditableCombobox *c, const char *text)'
202
215
  try_extern 'char *uiEditableComboboxText(uiEditableCombobox *c)'
203
216
  try_extern 'void uiEditableComboboxSetText(uiEditableCombobox *c, const char *text)'
204
- try_extern 'void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *c, void *data), void *data)'
217
+ try_extern 'void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *sender, void *senderData), void *data)'
205
218
  try_extern 'uiEditableCombobox *uiNewEditableCombobox(void)'
206
219
 
207
220
  # uiRadioButtons
208
221
 
209
222
  try_extern 'void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)'
210
223
  try_extern 'int uiRadioButtonsSelected(uiRadioButtons *r)'
211
- try_extern 'void uiRadioButtonsSetSelected(uiRadioButtons *r, int n)'
212
- try_extern 'void uiRadioButtonsOnSelected(uiRadioButtons *r, void (*f)(uiRadioButtons *, void *), void *data)'
224
+ try_extern 'void uiRadioButtonsSetSelected(uiRadioButtons *r, int index)'
225
+ try_extern 'void uiRadioButtonsOnSelected(uiRadioButtons *r, void (*f)(uiRadioButtons *sender, void *senderData), void *data)'
213
226
  try_extern 'uiRadioButtons *uiNewRadioButtons(void)'
214
227
 
215
228
  # uiDateTimePicker
@@ -245,7 +258,7 @@ module LibUI
245
258
 
246
259
  try_extern 'void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)'
247
260
  try_extern 'void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)'
248
- try_extern 'void uiDateTimePickerOnChanged(uiDateTimePicker *d, void (*f)(uiDateTimePicker *, void *), void *data)'
261
+ try_extern 'void uiDateTimePickerOnChanged(uiDateTimePicker *d, void (*f)(uiDateTimePicker *sender, void *senderData), void *data)'
249
262
  try_extern 'uiDateTimePicker *uiNewDateTimePicker(void)'
250
263
  try_extern 'uiDateTimePicker *uiNewDatePicker(void)'
251
264
  try_extern 'uiDateTimePicker *uiNewTimePicker(void)'
@@ -255,7 +268,7 @@ module LibUI
255
268
  try_extern 'char *uiMultilineEntryText(uiMultilineEntry *e)'
256
269
  try_extern 'void uiMultilineEntrySetText(uiMultilineEntry *e, const char *text)'
257
270
  try_extern 'void uiMultilineEntryAppend(uiMultilineEntry *e, const char *text)'
258
- try_extern 'void uiMultilineEntryOnChanged(uiMultilineEntry *e, void (*f)(uiMultilineEntry *e, void *data), void *data)'
271
+ try_extern 'void uiMultilineEntryOnChanged(uiMultilineEntry *e, void (*f)(uiMultilineEntry *sender, void *senderData), void *data)'
259
272
  try_extern 'int uiMultilineEntryReadOnly(uiMultilineEntry *e)'
260
273
  try_extern 'void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly)'
261
274
  try_extern 'uiMultilineEntry *uiNewMultilineEntry(void)'
@@ -265,7 +278,7 @@ module LibUI
265
278
 
266
279
  try_extern 'void uiMenuItemEnable(uiMenuItem *m)'
267
280
  try_extern 'void uiMenuItemDisable(uiMenuItem *m)'
268
- try_extern 'void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender, uiWindow *window, void *data), void *data)'
281
+ try_extern 'void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender, uiWindow *window, void *senderData), void *data)'
269
282
  try_extern 'int uiMenuItemChecked(uiMenuItem *m)'
270
283
  try_extern 'void uiMenuItemSetChecked(uiMenuItem *m, int checked)'
271
284
 
@@ -280,6 +293,7 @@ module LibUI
280
293
  try_extern 'uiMenu *uiNewMenu(const char *name)'
281
294
 
282
295
  try_extern 'char *uiOpenFile(uiWindow *parent)'
296
+ try_extern 'char *uiOpenFolder(uiWindow *parent)'
283
297
  try_extern 'char *uiSaveFile(uiWindow *parent)'
284
298
  try_extern 'void uiMsgBox(uiWindow *parent, const char *title, const char *description)'
285
299
  try_extern 'void uiMsgBoxError(uiWindow *parent, const char *title, const char *description)'
@@ -370,6 +384,7 @@ module LibUI
370
384
  try_extern 'void uiDrawPathBezierTo(uiDrawPath *p, double c1x, double c1y, double c2x, double c2y, double endX, double endY)'
371
385
  try_extern 'void uiDrawPathCloseFigure(uiDrawPath *p)'
372
386
  try_extern 'void uiDrawPathAddRectangle(uiDrawPath *p, double x, double y, double width, double height)'
387
+ try_extern 'int uiDrawPathEnded(uiDrawPath *p)'
373
388
  try_extern 'void uiDrawPathEnd(uiDrawPath *p)'
374
389
  try_extern 'void uiDrawStroke(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b, uiDrawStrokeParams *p)'
375
390
  try_extern 'void uiDrawFill(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b)'
@@ -471,6 +486,9 @@ module LibUI
471
486
  'uiTextStretch Stretch'
472
487
  ]
473
488
 
489
+ try_extern 'void uiLoadControlFont(uiFontDescriptor *f)'
490
+ try_extern 'void uiFreeFontDescriptor(uiFontDescriptor *desc)'
491
+
474
492
  typealias 'uiDrawTextAlign', 'int'
475
493
 
476
494
  DrawTextLayoutParams = struct [
@@ -488,7 +506,7 @@ module LibUI
488
506
  # uiFontButton
489
507
 
490
508
  try_extern 'void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc)'
491
- try_extern 'void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data)'
509
+ try_extern 'void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *sender, void *senderData), void *data)'
492
510
  try_extern 'uiFontButton *uiNewFontButton(void)'
493
511
  try_extern 'void uiFreeFontButtonFont(uiFontDescriptor *desc)'
494
512
 
@@ -520,12 +538,13 @@ module LibUI
520
538
 
521
539
  try_extern 'void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a)'
522
540
  try_extern 'void uiColorButtonSetColor(uiColorButton *b, double r, double g, double bl, double a)'
523
- try_extern 'void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data)'
541
+ try_extern 'void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *sender, void *senderData), void *data)'
524
542
  try_extern 'uiColorButton *uiNewColorButton(void)'
525
543
 
526
544
  # uiForm
527
545
 
528
546
  try_extern 'void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)'
547
+ try_extern 'int uiFormNumChildren(uiForm *f)'
529
548
  try_extern 'void uiFormDelete(uiForm *f, int index)'
530
549
  try_extern 'int uiFormPadded(uiForm *f)'
531
550
  try_extern 'void uiFormSetPadded(uiForm *f, int padded)'
@@ -594,6 +613,16 @@ module LibUI
594
613
  try_extern 'void uiTableAppendCheckboxTextColumn(uiTable *t, const char *name, int checkboxModelColumn, int checkboxEditableModelColumn, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams)'
595
614
  try_extern 'void uiTableAppendProgressBarColumn(uiTable *t, const char *name, int progressModelColumn)'
596
615
  try_extern 'void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonModelColumn, int buttonClickableModelColumn)'
616
+ try_extern 'int uiTableHeaderVisible(uiTable *t)'
617
+ try_extern 'void uiTableHeaderSetVisible(uiTable *t, int visible)'
597
618
  try_extern 'uiTable *uiNewTable(uiTableParams *params)'
619
+
620
+ typealias 'uiSortIndicator', 'int'
621
+
622
+ try_extern 'void uiTableHeaderSetSortIndicator(uiTable *t, int column, uiSortIndicator indicator)'
623
+ try_extern 'uiSortIndicator uiTableHeaderSortIndicator(uiTable *t, int column)'
624
+ try_extern 'void uiTableHeaderOnClicked(uiTable *t, void (*f)(uiTable *sender, int column, void *senderData), void *data)'
625
+ try_extern 'int uiTableColumnWidth(uiTable *t, int column)'
626
+ try_extern 'void uiTableColumnSetWidth(uiTable *t, int column, int width)'
598
627
  end
599
628
  end
data/lib/libui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LibUI
2
- VERSION = '0.0.15'
2
+ VERSION = '0.1.0.pre.0'
3
3
  end
data/lib/libui.rb CHANGED
@@ -215,6 +215,11 @@ module LibUI
215
215
  TableValueTypeInt = 2
216
216
  TableValueTypeColor = 3
217
217
 
218
+ # SortIndicator
219
+ SortIndicatorNone = 0
220
+ SortIndicatorAscending = 1
221
+ SortIndicatorDescending = 2
222
+
218
223
  # editable
219
224
  TableModelColumnNeverEditable = -1
220
225
  TableModelColumnAlwaysEditable = -2
@@ -1,3 +1,5 @@
1
+ Copyright (c) 2022 libui-ng authors
2
+
1
3
  Copyright (c) 2014 Pietro Gagliardi
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -6,4 +8,3 @@ The above copyright notice and this permission notice shall be included in all c
6
8
 
7
9
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
10
 
9
- (this is called the MIT License or Expat License; see http://www.opensource.org/licenses/MIT)
data/vendor/README.md CHANGED
@@ -1,81 +1,21 @@
1
- # libui: a portable GUI library for C
1
+ # libui-ng: a portable GUI library for C
2
2
 
3
- This README is being written.<br>
4
- [![Build Status, Azure Pipelines](https://dev.azure.com/andlabs/libui/_apis/build/status/andlabs.libui?branchName=master)](https://dev.azure.com/andlabs/libui/_build/latest?definitionId=1&branchName=master)<br>
5
- [![Build Status, AppVeyor](https://ci.appveyor.com/api/projects/status/ouyk78c52mmisa31/branch/master?svg=true)](https://ci.appveyor.com/project/andlabs/libui/branch/master)
3
+ Fork of [andlabs/libui](https://github.com/andlabs/libui). This README is being written.<br>
4
+ [![Build Status, GitHub Actions](https://github.com/libui-ng/libui-ng/actions/workflows/build.yml/badge.svg)](https://github.com/libui-ng/libui-ng/actions/workflows/build.yml)
5
+ [![GitLab](https://img.shields.io/badge/gitlab-%23181717.svg?style=for-the-badge&logo=gitlab&logoColor=white)](https://gitlab.com/libui-ng/libui-ng)
6
+ [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/libui-ng/libui-ng)
6
7
 
7
- ## Status
8
-
9
- It has come to my attention that I have not been particularly clear about how usable or feature-complete libui is, and that this has fooled many people into expecting more from libui right this moment than I have explicitly promised to make available. I apologize for not doing this sooner.
10
-
11
- libui is currently **mid-alpha** software. Much of what is currently present runs stabily enough for the examples and perhaps some small programs to work, but the stability is still a work-in-progress, much of what is already there is not feature-complete, some of it will be buggy on certain platforms, and there's a lot of stuff missing. In short, here's a list of features that I would like to add to libui, but that aren't in yet:
12
-
13
- - trees
14
- - clipboard support, including drag and drop
15
- - more and better dialogs
16
- - printing
17
- - accessibility for uiArea and custom controls
18
- - document-based programs
19
- - tighter OS integration (especially for document-based programs), to allow programs to fully feel native, rather than merely look and act native
20
- - better support for standard dialogs and features (search bars, etc.)
21
- - OpenGL support
22
-
23
- In addition, [here](https://github.com/andlabs/libui/issues?utf8=%E2%9C%93&q=master+in%3Atitle+is%3Aissue+is%3Aopen) is a list of issues generalizing existing problems.
24
-
25
- Furthermore, libui is not properly fully documented yet. This is mainly due to the fact that the API was initially unstable enough so as to result in rewriting documentation multiple times, in addition to me not being happy with really any existing C code documentation tool. That being said, I have started to pin down my ideal code documentation style in parts of `ui.h`, most notably in the uiAttributedString APIs. Over time, I plan on extending this to the rest of the headers. You can also use [the documentation for libui's Go bindings](https://godoc.org/github.com/andlabs/ui) as a reference, though it is somewhat stale and not optimally written.
26
-
27
- But libui is not dead; I am working on it whenever I can, and I hope to get it to a point of real quality soon!
28
-
29
- ## News
30
-
31
- *Note that today's entry (Eastern Time) may be updated later today.*
32
-
33
- * **7 April 2019**
34
- * **The build system has been switched to Meson.** See below for instructions. This change was made because the previous build system, CMake, caused countless headaches over trivial issues. Meson was chosen due to how unproblematic setting up libui's build just right was, as well as having design goals that are by coincidence closely aligned with what libui wants.
35
- * Travis CI has been replaced with Azure Pipelines and much of the AppVeyor CI configuration was integrated into the Azure Pipelines configuration. This shouldn't affect most developers.
8
+ ## About
36
9
 
37
- * **1 September 2018**
38
- * **Alpha 4.1 is here.** This is an emergency fix to Alpha 4 to fix `uiImageAppend()` not working as documented. It now works properly, with one important difference you'll need to care about: **it now requires image data to be alpha-premultiplied**. In addition, `uiImage` also is implemented slightly more nicely now, and `ui.h` has minor documentation typo fixes.
39
- * Alpha 4.1 also tries to make everything properly PIC-enabled.
10
+ Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
40
11
 
41
- * **10 August 2018**
42
- * **Alpha 4 is finally here.** Everything from Alpha 3.5 and what's listed below is in this release; the two biggest changes are still the new text drawing API and new uiTable control. In between all that is a whole bunch of bugfixes, and hopefully more stability too. Thanks to everybody who helped contribute!
43
- * Alpha 4 should hopefully also include automated binary releases via CI. Thanks to those who helped set that up!
44
-
45
- * **8 August 2018**
46
- * Finally introduced an API for loading images, `uiImage`, and a new control, `uiTable`, for displaying tabular data. These provide enough basic functionality for now, but will be improved over time. You can read the documentation for the new features as they are [here](https://github.com/andlabs/libui/blob/f47e1423cf95ad7b1001663f3381b5a819fc67b9/uitable.h). Thanks to everyone who helped get to this point, in particular @bcampbell for the initial Windows code, and to everyone else for their patience!
47
-
48
- * **30 May 2018**
49
- * Merged the previous Announcements and Updates section of this README into a single News section, and merged the respective archive files into a single NEWS.md file.
50
-
51
- * **16 May 2018**
52
- * Thanks to @parro-it and @msink, libui now has better CI, including AppVeyor for Windows CI, and automated creation of binary releases when I make a tagged release.
53
-
54
- * **13 May 2018**
55
- * Added new functions to work with uiDateTimePickers: `uiDateTimePickerTime()`, `uiDateTimePickerSetTime()`, and `uiDateTimePickerOnChanged()`. These operate on standard `<time.h>` `struct tm`s. Thanks @cody271!
56
- * Release builds on Windows with MSVC should be fixed now; thanks @l0calh05t, @slahn, @mischnic, and @zentner-kyle.
57
-
58
- * **12 May 2018**
59
- * GTK+ and OS X now have a cleaner build process for static libraries which no longer has intermediate files and differing configurations. As a result, certain issues should no longer be present. New naming rules for internal symbols of libui have also started being drafted; runtime symbols and edge cases still need to be handled (and the rules applied to Windows) before this can become a regular thing.
60
-
61
- * **2 May 2018**
62
- * On Windows, you no longer need to carry around a `libui.res` file with static builds. You do need to link in the appropriate manifest file, such as the one in the `windows/` folder (I still need to figure out exactly what is needed apart from the Common Controls v6 dependency, or at least to create a complete-ish template), or at least include it alongside your executables. This also means you should no longer see random cmake errors when building the static libraries.
63
-
64
- * **18 April 2018**
65
- * Introduced a new `uiTimer()` function for running code on a timer on the main thread. (Thanks to @cody271.)
66
- * Migrated all code in the `common/` directory to use `uipriv` prefixes for everything that isn't `static`. This is the first step toward fixing static library oddities within libui, allowing libui to truly be safely used as either a static library or a shared library.
12
+ ## Status
67
13
 
68
- * **18 March 2018**
69
- * Introduced an all-new formatted text API that allows you to process formatted text in ways that the old API wouldn't allow. You can read on the whole API [here](https://github.com/andlabs/libui/blob/8944a3fc5528445b9027b1294b6c86bae03eeb89/ui_attrstr.h). There is also a new examples for it: `drawtext`, which shows the whole API at a glance. It doesn't yet support measuring or manipulating text, nor does it currently support functions that would be necessary for things like text editors; all of this will be added back later.
70
- * libui also now uses my [utf library](https://github.com/andlabs/utf) for UTF-8 and UTF-16 processing, to allow consistent behavior across platforms. This usage is not completely propagated throughout libui, but the Windows port uses it in most places now, and eventually this will become what libui will use throughout.
71
- * Also introduced a formal set of contribution guidelines, see `CONTRIBUTING.md` for details. They are still WIP.
14
+ libui-ng is currently **mid-alpha** software.
72
15
 
73
- * **17 February 2018**
74
- * The longstanding Enter+Escape crashes on Windows have finally been fixed (thanks to @lxn).
75
- * **Alpha 3.5 is now here.** This is a quickie release primiarly intended to deploy the above fix to package ui itself. **It is a partial binary release; sorry!** More new things will come in the next release, which will also introduce semver (so it will be called v0.4.0 instead).
76
- * Alpha 3.5 also includes a new control gallery example. The screenshots below have not been updated yet.
16
+ See [CHANGELOG.md](CHANGELOG.md)
77
17
 
78
- *Old announcements can be found in the NEWS.md file.*
18
+ *Old announcements can be found in the [news.md](old/news.md) file.*
79
19
 
80
20
  ## Runtime Requirements
81
21
 
@@ -86,7 +26,7 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
86
26
  ## Build Requirements
87
27
 
88
28
  * All platforms:
89
- * [Meson](https://mesonbuild.com/) 0.48.0 or newer
29
+ * [Meson](https://mesonbuild.com/) 0.58.0 or newer
90
30
  * Any of Meson's backends; this section assumes you are using [Ninja](https://ninja-build.org/), but there is no reason the other backends shouldn't work.
91
31
  * Windows: either
92
32
  * Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
@@ -97,22 +37,28 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
97
37
 
98
38
  ## Building
99
39
 
100
- libui uses only [the standard Meson build options](https://mesonbuild.com/Builtin-options.html), so a libui build can be set up just like any other:
40
+ libui-ng mainly uses [the standard Meson build options](https://mesonbuild.com/Builtin-options.html).
101
41
 
102
42
  ```
103
- $ # you must be in the top-level libui directory, otherwise this won't work
43
+ $ # in the top-level libui-ng directory run:
104
44
  $ meson setup build [options]
105
45
  $ ninja -C build
106
46
  ```
107
47
 
108
- Once this completes, everything will be under `build/meson-out/`. (Note that unlike the previous build processes, everything is built by default, including tests and examples.)
48
+ Once this completes, everything will be under `build/meson-out/`.
49
+
50
+ libui-ng specific options:
51
+
52
+ - `-Dtests=(true|false)` controls whether tests are built; defaults to `true`
53
+ - `-Dexamples=(true|false)` controls whether examples are built; defaults to `true`
109
54
 
110
- The most important options are:
55
+ Most important Meson options:
111
56
 
112
57
  * `--buildtype=(debug|release|...)` controls the type of build made; the default is `debug`. For a full list of valid values, consult [the Meson documentation](https://mesonbuild.com/Running-Meson.html).
113
58
  * `--default-library=(shared|static)` controls whether libui is built as a shared library or a static library; the default is `shared`. You currently cannot specify `both`, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
114
59
  * `-Db_sanitize=which` allows enabling the chosen [sanitizer](https://github.com/google/sanitizers) on a system that supports sanitizers. The list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#base-options).
115
60
  * `--backend=backend` allows using the specified `backend` for builds instead of `ninja` (the default). A list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options).
61
+ * `--wrap-mode=(forcefallback|nofallback|nodownload|...)` controls which cmocka library version to use in test enabled builds. The default is `forcefallback` to pull and build a local copy. Package maintainers may wish to choose `nofallback` to use the system's library and declare `cmocka` a build time dependency or `nodownload`, see [the Meson documentation](https://mesonbuild.com/Subprojects.html#commandline-options) for more details.
116
62
 
117
63
  Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run `meson`.
118
64
 
@@ -134,7 +80,7 @@ When running `meson`, the `--prefix` option will set the installation prefix. [T
134
80
 
135
81
  #### Arch Linux
136
82
 
137
- Can be built from AUR: https://aur.archlinux.org/packages/libui-git/
83
+ Can be built from AUR: https://aur.archlinux.org/packages/libui-ng-git/
138
84
 
139
85
  ## Documentation
140
86
 
@@ -150,14 +96,15 @@ Language | Bindings
150
96
  --- | ---
151
97
  C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
152
98
  C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding)
153
- C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [TCD.UI](https://github.com/tacdevel/tcdfx)
99
+ C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [SimplexiDev.UI](https://github.com/simplexidev/sdfx)
154
100
  CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
155
101
  Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui)
156
- Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron)
102
+ Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron), [iu](https://github.com/grkek/iu)
157
103
  D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
158
104
  Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
159
105
  Harbour | [hbui](https://github.com/rjopek/hbui)
160
106
  Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
107
+ Janet | [JanetUI](https://github.com/janet-lang/janetui)
161
108
  JavaScript/Node.js | [libui-node](https://github.com/parro-it/libui-node), [libui.js (merged into libui-node?)](https://github.com/mavenave/libui.js), [proton-native](https://github.com/kusti8/proton-native), [vuido](https://github.com/mimecorg/vuido)
162
109
  Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
163
110
  Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
@@ -166,8 +113,9 @@ Nim | [ui](https://github.com/nim-lang/ui)
166
113
  Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
167
114
  PHP | [ui](https://github.com/krakjoe/ui)
168
115
  Python | [pylibui](https://github.com/joaoventura/pylibui)
169
- Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby)
170
- Rust | [libui-rs](https://github.com/rust-native-ui/libui-rs)
116
+ Ring | [RingLibui](https://github.com/ring-lang/ring/tree/master/extensions/ringlibui)
117
+ Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby), [LibUI](https://github.com/kojix2/libui), [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
118
+ Rust | [libui-ng-sys](https://github.com/norepimorphism/libui-ng-sys), [boing](https://github.com/norepimorphism/boing), [libui-rs](https://github.com/rust-native-ui/libui-rs)
171
119
  Scala | [scalaui](https://github.com/lolgab/scalaui)
172
120
  Swift | [libui-swift](https://github.com/sclukey/libui-swift)
173
121
 
@@ -182,7 +130,7 @@ See also [this](https://github.com/andlabs/libui/pull/20#issuecomment-211381971)
182
130
 
183
131
  ## Contributing
184
132
 
185
- See `CONTRIBUTING.md`.
133
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
186
134
 
187
135
  ## Screenshots
188
136
 
data/vendor/libui.dll CHANGED
Binary file
data/vendor/libui.dylib CHANGED
Binary file
data/vendor/libui.so CHANGED
Binary file
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.15
4
+ version: 0.1.0.pre.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-12 00:00:00.000000000 Z
11
+ date: 2022-11-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -25,9 +25,8 @@ files:
25
25
  - lib/libui/libui_base.rb
26
26
  - lib/libui/utils.rb
27
27
  - lib/libui/version.rb
28
- - vendor/LICENSE
28
+ - vendor/LICENSE.md
29
29
  - vendor/README.md
30
- - vendor/README_DYLIB.md
31
30
  - vendor/libui.dll
32
31
  - vendor/libui.dylib
33
32
  - vendor/libui.so
@@ -46,9 +45,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
45
  version: '2.5'
47
46
  required_rubygems_version: !ruby/object:Gem::Requirement
48
47
  requirements:
49
- - - ">="
48
+ - - ">"
50
49
  - !ruby/object:Gem::Version
51
- version: '0'
50
+ version: 1.3.1
52
51
  requirements: []
53
52
  rubygems_version: 3.3.7
54
53
  signing_key:
@@ -1,45 +0,0 @@
1
- # libui shared library for M1 Mac
2
-
3
- libui.dylib for Mac has been replaced with a universal binary to make LibUI compatible with M1 Mac.
4
-
5
- See https://github.com/kojix2/LibUI/issues/47
6
-
7
- The LibUI gem also includes libui.so for Linux and libui.dll for Windows, which are identical to the official binaries distributed by andlabs.
8
-
9
- ## Target libui version
10
-
11
- libui version alpha 4.1
12
- https://github.com/andlabs/libui
13
-
14
- ## Universal binary
15
-
16
- file command to show that it is a universal binary.
17
-
18
- ```
19
- file libui.dylib
20
- # libui.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
21
- # libui.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
22
- # libui.dylib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64
23
- ```
24
-
25
- ## sha256sum
26
-
27
- ```
28
- 6da2ff5acb6fba09b47eae0219b3aaefd002ace00003ab5d59689e396bcefff7 libui.dylib
29
- ```
30
-
31
- ## Build method
32
-
33
- 1. Get the libui version alpha 4.1 and create a shared library for arm64 on M1 mac.
34
- 2. Download the official shared library provided by [andlabs](https://github.com/andlabs/libui/releases/tag/alpha4.1).
35
- 3. Use the lipo command to merge the two files to create a universal binary.
36
-
37
- ## Contributing
38
-
39
- libui-ng is looking for a way to create a binary file for the M1 Mac.
40
- See https://github.com/libui-ng/libui-ng/issues/41
41
-
42
- ## License
43
-
44
- MIT
45
-