libui 0.0.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/lib/libui.rb +24 -0
- data/lib/libui/ffi.rb +218 -0
- data/lib/libui/version.rb +5 -0
- data/vendor/LICENSE +9 -0
- data/vendor/README.md +195 -0
- data/vendor/libui.dll +0 -0
- data/vendor/libui.dylib +0 -0
- data/vendor/libui.so +0 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 26cb6f0a4c335c4c9f931abf064dbffff73fb8243e2220ccc6b592218bd29582
|
4
|
+
data.tar.gz: 2ef6c15d482a526f8526c69b7594e3623a962de67be653bf141f38755606072a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2628a7dc6419399749a04384f211dafafa135917a54b98578b400c666d552cb698a5177a2bce5b6f5af4ce19c7ca982f72a44096f25946703220a18ec764fbf2
|
7
|
+
data.tar.gz: 373ded59492ba9268635c96f0232f00a2c82f42f96c96e57d11ad54af357bc34170ab9cd66249f8937983ac20aa0a70e3dba4626f7009b88b97fd17de7013635
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 kojix2
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# libui
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
|
3
|
+
|
4
|
+
[libui](https://github.com/andlabs/libui) - a portable GUI library -for Ruby
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```
|
9
|
+
gem install libui --pre
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
## Development
|
15
|
+
|
16
|
+
* Keep it simple
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kojix2/libui.
|
21
|
+
|
22
|
+
## Acknowledgement
|
23
|
+
|
24
|
+
libui-ruby ispired this project.
|
25
|
+
* https://github.com/jamescook/libui-ruby
|
26
|
+
|
27
|
+
While libui-ruby uses FFI, this gem uses Fiddle.
|
28
|
+
|
29
|
+
## License
|
30
|
+
|
31
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
data/lib/libui.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'libui/version'
|
4
|
+
|
5
|
+
module LibUI
|
6
|
+
class Error < StandardError; end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :ffi_lib
|
10
|
+
end
|
11
|
+
self.ffi_lib = case RbConfig::CONFIG['host_os']
|
12
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
13
|
+
# File.expand_path("libui.dll", ENV['LIBUIDIR'])
|
14
|
+
File.expand_path('../vendor/libui.dll', __dir__)
|
15
|
+
when /darwin|mac os/
|
16
|
+
# File.expand_path("libui.dylib", ENV['LIBUIDIR'])
|
17
|
+
File.expand_path('../vendor/libui.dylib', __dir__)
|
18
|
+
else # TODO: Mac
|
19
|
+
# File.expand_path("libui.so", ENV['LIBUIDIR'])
|
20
|
+
File.expand_path('../vendor/libui.so', __dir__)
|
21
|
+
end
|
22
|
+
|
23
|
+
autoload :FFI, 'libui/ffi'
|
24
|
+
end
|
data/lib/libui/ffi.rb
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fiddle/import'
|
4
|
+
|
5
|
+
module LibUI
|
6
|
+
module FFI
|
7
|
+
extend Fiddle::Importer
|
8
|
+
|
9
|
+
begin
|
10
|
+
dlload LibUI.ffi_lib
|
11
|
+
rescue LoadError
|
12
|
+
raise LoadError, 'Could not find libui'
|
13
|
+
end
|
14
|
+
|
15
|
+
typealias("uint32_t", "unsigned int")
|
16
|
+
|
17
|
+
InitOptions = struct(['size_t size'])
|
18
|
+
|
19
|
+
extern 'const char *uiInit(uiInitOptions *options)'
|
20
|
+
extern 'void uiUninit(void)'
|
21
|
+
extern 'void uiFreeInitError(const char *err)'
|
22
|
+
|
23
|
+
extern 'void uiMain(void)'
|
24
|
+
extern 'void uiMainSteps(void)'
|
25
|
+
extern 'int uiMainStep(int wait)'
|
26
|
+
extern 'void uiQuit(void)'
|
27
|
+
extern 'void uiQueueMain(void (*f)(void *data), void *data)'
|
28
|
+
extern 'void uiTimer(int milliseconds, int (*f)(void *data), void *data)'
|
29
|
+
extern 'void uiOnShouldQuit(int (*f)(void *data), void *data)'
|
30
|
+
extern 'void uiFreeText(char *text)'
|
31
|
+
|
32
|
+
struct ['uint32_t Signature',
|
33
|
+
'uint32_t OSSignature',
|
34
|
+
'uint32_t TypeSignature',
|
35
|
+
'void (*Destroy)(uiControl *)',
|
36
|
+
'uintptr_t (*Handle)(uiControl *)',
|
37
|
+
'uiControl *(*Parent)(uiControl *)',
|
38
|
+
'void (*SetParent)(uiControl *, uiControl *)',
|
39
|
+
'int (*Toplevel)(uiControl *)',
|
40
|
+
'int (*Visible)(uiControl *)',
|
41
|
+
'void (*Show)(uiControl *)',
|
42
|
+
'void (*Hide)(uiControl *)',
|
43
|
+
'int (*Enabled)(uiControl *)',
|
44
|
+
'void (*Enable)(uiControl *)',
|
45
|
+
'void (*Disable)(uiControl *)']
|
46
|
+
|
47
|
+
extern 'void uiControlDestroy(uiControl *)'
|
48
|
+
extern 'uintptr_t uiControlHandle(uiControl *)'
|
49
|
+
extern 'uiControl *uiControlParent(uiControl *)'
|
50
|
+
extern 'void uiControlSetParent(uiControl *, uiControl *)'
|
51
|
+
extern 'int uiControlToplevel(uiControl *)'
|
52
|
+
extern 'int uiControlVisible(uiControl *)'
|
53
|
+
extern 'void uiControlShow(uiControl *)'
|
54
|
+
extern 'void uiControlHide(uiControl *)'
|
55
|
+
extern 'int uiControlEnabled(uiControl *)'
|
56
|
+
extern 'void uiControlEnable(uiControl *)'
|
57
|
+
extern 'void uiControlDisable(uiControl *)'
|
58
|
+
|
59
|
+
extern 'uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr)'
|
60
|
+
extern 'void uiFreeControl(uiControl *)'
|
61
|
+
|
62
|
+
extern 'void uiControlVerifySetParent(uiControl *, uiControl *)'
|
63
|
+
extern 'int uiControlEnabledToUser(uiControl *)'
|
64
|
+
|
65
|
+
extern 'void uiUserBugCannotSetParentOnToplevel(const char *type)'
|
66
|
+
|
67
|
+
# uiWindow
|
68
|
+
extern 'char *uiWindowTitle(uiWindow *w)'
|
69
|
+
extern 'void uiWindowSetTitle(uiWindow *w, const char *title)'
|
70
|
+
extern 'void uiWindowContentSize(uiWindow *w, int *width, int *height)'
|
71
|
+
extern 'void uiWindowSetContentSize(uiWindow *w, int width, int height)'
|
72
|
+
extern 'int uiWindowFullscreen(uiWindow *w)'
|
73
|
+
extern 'void uiWindowSetFullscreen(uiWindow *w, int fullscreen)'
|
74
|
+
extern 'void uiWindowOnContentSizeChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data)'
|
75
|
+
extern 'void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *w, void *data), void *data)'
|
76
|
+
extern 'int uiWindowBorderless(uiWindow *w)'
|
77
|
+
extern 'void uiWindowSetBorderless(uiWindow *w, int borderless)'
|
78
|
+
extern 'void uiWindowSetChild(uiWindow *w, uiControl *child)'
|
79
|
+
extern 'int uiWindowMargined(uiWindow *w)'
|
80
|
+
extern 'void uiWindowSetMargined(uiWindow *w, int margined)'
|
81
|
+
extern 'uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)'
|
82
|
+
|
83
|
+
# uiButton
|
84
|
+
extern 'char *uiButtonText(uiButton *b)'
|
85
|
+
extern 'void uiButtonSetText(uiButton *b, const char *text)'
|
86
|
+
extern 'void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *b, void *data), void *data)'
|
87
|
+
extern 'uiButton *uiNewButton(const char *text)'
|
88
|
+
|
89
|
+
# uiBox
|
90
|
+
extern 'void uiBoxAppend(uiBox *b, uiControl *child, int stretchy)'
|
91
|
+
extern 'void uiBoxDelete(uiBox *b, int index)'
|
92
|
+
extern 'int uiBoxPadded(uiBox *b)'
|
93
|
+
extern 'void uiBoxSetPadded(uiBox *b, int padded)'
|
94
|
+
extern 'uiBox *uiNewHorizontalBox(void)'
|
95
|
+
extern 'uiBox *uiNewVerticalBox(void)'
|
96
|
+
|
97
|
+
# uiCheckbox
|
98
|
+
extern 'char *uiCheckboxText(uiCheckbox *c)'
|
99
|
+
extern 'void uiCheckboxSetText(uiCheckbox *c, const char *text)'
|
100
|
+
extern 'void uiCheckboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *c, void *data), void *data)'
|
101
|
+
extern 'int uiCheckboxChecked(uiCheckbox *c)'
|
102
|
+
extern 'void uiCheckboxSetChecked(uiCheckbox *c, int checked)'
|
103
|
+
extern 'uiCheckbox *uiNewCheckbox(const char *text)'
|
104
|
+
|
105
|
+
# uiEntry
|
106
|
+
extern 'char *uiEntryText(uiEntry *e)'
|
107
|
+
extern 'void uiEntrySetText(uiEntry *e, const char *text)'
|
108
|
+
extern 'void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data)'
|
109
|
+
extern 'int uiEntryReadOnly(uiEntry *e)'
|
110
|
+
extern 'void uiEntrySetReadOnly(uiEntry *e, int readonly)'
|
111
|
+
extern 'uiEntry *uiNewEntry(void)'
|
112
|
+
extern 'uiEntry *uiNewPasswordEntry(void)'
|
113
|
+
extern 'uiEntry *uiNewSearchEntry(void)'
|
114
|
+
|
115
|
+
# uiLabel
|
116
|
+
extern 'char *uiLabelText(uiLabel *l)'
|
117
|
+
extern 'void uiLabelSetText(uiLabel *l, const char *text)'
|
118
|
+
extern 'uiLabel *uiNewLabel(const char *text)'
|
119
|
+
|
120
|
+
# uiTab
|
121
|
+
extern 'void uiTabAppend(uiTab *t, const char *name, uiControl *c)'
|
122
|
+
extern 'void uiTabInsertAt(uiTab *t, const char *name, int before, uiControl *c)'
|
123
|
+
extern 'void uiTabDelete(uiTab *t, int index)'
|
124
|
+
extern 'int uiTabNumPages(uiTab *t)'
|
125
|
+
extern 'int uiTabMargined(uiTab *t, int page)'
|
126
|
+
extern 'void uiTabSetMargined(uiTab *t, int page, int margined)'
|
127
|
+
extern 'uiTab *uiNewTab(void)'
|
128
|
+
|
129
|
+
# uiGroup
|
130
|
+
extern 'char *uiGroupTitle(uiGroup *g)'
|
131
|
+
extern 'void uiGroupSetTitle(uiGroup *g, const char *title)'
|
132
|
+
extern 'void uiGroupSetChild(uiGroup *g, uiControl *c)'
|
133
|
+
extern 'int uiGroupMargined(uiGroup *g)'
|
134
|
+
extern 'void uiGroupSetMargined(uiGroup *g, int margined)'
|
135
|
+
extern 'uiGroup *uiNewGroup(const char *title)'
|
136
|
+
|
137
|
+
# uiSpinbox
|
138
|
+
extern 'int uiSpinboxValue(uiSpinbox *s)'
|
139
|
+
extern 'void uiSpinboxSetValue(uiSpinbox *s, int value)'
|
140
|
+
extern 'void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *s, void *data), void *data)'
|
141
|
+
extern 'uiSpinbox *uiNewSpinbox(int min, int max)'
|
142
|
+
|
143
|
+
# uiSlider
|
144
|
+
extern 'int uiSliderValue(uiSlider *s)'
|
145
|
+
extern 'void uiSliderSetValue(uiSlider *s, int value)'
|
146
|
+
extern 'void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *s, void *data), void *data)'
|
147
|
+
extern 'uiSlider *uiNewSlider(int min, int max)'
|
148
|
+
|
149
|
+
# uiProgressBar
|
150
|
+
extern 'int uiProgressBarValue(uiProgressBar *p)'
|
151
|
+
extern 'void uiProgressBarSetValue(uiProgressBar *p, int n)'
|
152
|
+
extern 'uiProgressBar *uiNewProgressBar(void)'
|
153
|
+
|
154
|
+
# uiSeparator
|
155
|
+
extern 'uiSeparator *uiNewHorizontalSeparator(void)'
|
156
|
+
extern 'uiSeparator *uiNewVerticalSeparator(void)'
|
157
|
+
|
158
|
+
# uiCombobox
|
159
|
+
extern 'void uiComboboxAppend(uiCombobox *c, const char *text)'
|
160
|
+
extern 'int uiComboboxSelected(uiCombobox *c)'
|
161
|
+
extern 'void uiComboboxSetSelected(uiCombobox *c, int n)'
|
162
|
+
extern 'void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data)'
|
163
|
+
extern 'uiCombobox *uiNewCombobox(void)'
|
164
|
+
|
165
|
+
# uiEditableCombobox
|
166
|
+
extern 'void uiEditableComboboxAppend(uiEditableCombobox *c, const char *text)'
|
167
|
+
extern 'char *uiEditableComboboxText(uiEditableCombobox *c)'
|
168
|
+
extern 'void uiEditableComboboxSetText(uiEditableCombobox *c, const char *text)'
|
169
|
+
extern 'void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *c, void *data), void *data)'
|
170
|
+
extern 'uiEditableCombobox *uiNewEditableCombobox(void)'
|
171
|
+
|
172
|
+
# uiRadioButtons
|
173
|
+
extern 'void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)'
|
174
|
+
extern 'int uiRadioButtonsSelected(uiRadioButtons *r)'
|
175
|
+
extern 'void uiRadioButtonsSetSelected(uiRadioButtons *r, int n)'
|
176
|
+
extern 'void uiRadioButtonsOnSelected(uiRadioButtons *r, void (*f)(uiRadioButtons *, void *), void *data)'
|
177
|
+
extern 'uiRadioButtons *uiNewRadioButtons(void)'
|
178
|
+
|
179
|
+
# uiDataTimePicker
|
180
|
+
extern 'void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)'
|
181
|
+
extern 'void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)'
|
182
|
+
extern 'void uiDateTimePickerOnChanged(uiDateTimePicker *d, void (*f)(uiDateTimePicker *, void *), void *data)'
|
183
|
+
extern 'uiDateTimePicker *uiNewDateTimePicker(void)'
|
184
|
+
extern 'uiDateTimePicker *uiNewDatePicker(void)'
|
185
|
+
extern 'uiDateTimePicker *uiNewTimePicker(void)'
|
186
|
+
|
187
|
+
# uiMultilineEntry
|
188
|
+
extern 'char *uiMultilineEntryText(uiMultilineEntry *e)'
|
189
|
+
extern 'void uiMultilineEntrySetText(uiMultilineEntry *e, const char *text)'
|
190
|
+
extern 'void uiMultilineEntryAppend(uiMultilineEntry *e, const char *text)'
|
191
|
+
extern 'void uiMultilineEntryOnChanged(uiMultilineEntry *e, void (*f)(uiMultilineEntry *e, void *data), void *data)'
|
192
|
+
extern 'int uiMultilineEntryReadOnly(uiMultilineEntry *e)'
|
193
|
+
extern 'void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly)'
|
194
|
+
extern 'uiMultilineEntry *uiNewMultilineEntry(void)'
|
195
|
+
extern 'uiMultilineEntry *uiNewNonWrappingMultilineEntry(void)'
|
196
|
+
|
197
|
+
# uiMenuItem
|
198
|
+
extern 'void uiMenuItemEnable(uiMenuItem *m)'
|
199
|
+
extern 'void uiMenuItemDisable(uiMenuItem *m)'
|
200
|
+
extern 'void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender, uiWindow *window, void *data), void *data)'
|
201
|
+
extern 'int uiMenuItemChecked(uiMenuItem *m)'
|
202
|
+
extern 'void uiMenuItemSetChecked(uiMenuItem *m, int checked)'
|
203
|
+
|
204
|
+
# uiMenu
|
205
|
+
extern 'uiMenuItem *uiMenuAppendItem(uiMenu *m, const char *name)'
|
206
|
+
extern 'uiMenuItem *uiMenuAppendCheckItem(uiMenu *m, const char *name)'
|
207
|
+
extern 'uiMenuItem *uiMenuAppendQuitItem(uiMenu *m)'
|
208
|
+
extern 'uiMenuItem *uiMenuAppendPreferencesItem(uiMenu *m)'
|
209
|
+
extern 'uiMenuItem *uiMenuAppendAboutItem(uiMenu *m)'
|
210
|
+
extern 'void uiMenuAppendSeparator(uiMenu *m)'
|
211
|
+
extern 'uiMenu *uiNewMenu(const char *name)'
|
212
|
+
|
213
|
+
extern 'char *uiOpenFile(uiWindow *parent)'
|
214
|
+
extern 'char *uiSaveFile(uiWindow *parent)'
|
215
|
+
extern 'void uiMsgBox(uiWindow *parent, const char *title, const char *description)'
|
216
|
+
extern 'void uiMsgBoxError(uiWindow *parent, const char *title, const char *description)'
|
217
|
+
end
|
218
|
+
end
|
data/vendor/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Copyright (c) 2014 Pietro Gagliardi
|
2
|
+
|
3
|
+
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:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
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
|
+
|
9
|
+
(this is called the MIT License or Expat License; see http://www.opensource.org/licenses/MIT)
|
data/vendor/README.md
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
# libui: a portable GUI library for C
|
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)
|
6
|
+
|
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.
|
36
|
+
|
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.
|
40
|
+
|
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.
|
67
|
+
|
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.
|
72
|
+
|
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.
|
77
|
+
|
78
|
+
*Old announcements can be found in the NEWS.md file.*
|
79
|
+
|
80
|
+
## Runtime Requirements
|
81
|
+
|
82
|
+
* Windows: Windows Vista SP2 with Platform Update or newer
|
83
|
+
* Unix: GTK+ 3.10 or newer
|
84
|
+
* Mac OS X: OS X 10.8 or newer
|
85
|
+
|
86
|
+
## Build Requirements
|
87
|
+
|
88
|
+
* All platforms:
|
89
|
+
* [Meson](https://mesonbuild.com/) 0.48.0 or newer
|
90
|
+
* 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
|
+
* Windows: either
|
92
|
+
* Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
|
93
|
+
* MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in:
|
94
|
+
* [Isolation awareness](https://msdn.microsoft.com/en-us/library/aa375197%28v=vs.85%29.aspx), which is how you get themed controls from a DLL without needing a manifest
|
95
|
+
* Unix: nothing else specific
|
96
|
+
* Mac OS X: nothing else specific, so long as you can build Cocoa programs
|
97
|
+
|
98
|
+
## Building
|
99
|
+
|
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:
|
101
|
+
|
102
|
+
```
|
103
|
+
$ # you must be in the top-level libui directory, otherwise this won't work
|
104
|
+
$ meson setup build [options]
|
105
|
+
$ ninja -C build
|
106
|
+
```
|
107
|
+
|
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.)
|
109
|
+
|
110
|
+
The most important options are:
|
111
|
+
|
112
|
+
* `--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
|
+
* `--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
|
+
* `-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
|
+
* `--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).
|
116
|
+
|
117
|
+
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
|
+
|
119
|
+
The Meson website and documentation has more in-depth usage instructions.
|
120
|
+
|
121
|
+
For the sake of completeness, I should note that the default value of `--layout` is `flat`, not the usual `mirror`. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
|
122
|
+
|
123
|
+
Backends other than `ninja` should work, but are untested by me.
|
124
|
+
|
125
|
+
## Installation
|
126
|
+
|
127
|
+
Meson also supports installing from source; if you use Ninja, just do
|
128
|
+
|
129
|
+
```
|
130
|
+
$ ninja -C build install
|
131
|
+
```
|
132
|
+
|
133
|
+
When running `meson`, the `--prefix` option will set the installation prefix. [The Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options) has more information, and even lists more fine-grained options that you can use to control the installation.
|
134
|
+
|
135
|
+
#### Arch Linux
|
136
|
+
|
137
|
+
Can be built from AUR: https://aur.archlinux.org/packages/libui-git/
|
138
|
+
|
139
|
+
## Documentation
|
140
|
+
|
141
|
+
Needs to be written. Consult `ui.h` and the examples for details for now.
|
142
|
+
|
143
|
+
## Language Bindings
|
144
|
+
|
145
|
+
libui was originally written as part of my [package ui for Go](https://github.com/andlabs/ui). Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.
|
146
|
+
|
147
|
+
Other people have made bindings to other languages:
|
148
|
+
|
149
|
+
Language | Bindings
|
150
|
+
--- | ---
|
151
|
+
C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
|
152
|
+
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)
|
154
|
+
CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
|
155
|
+
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)
|
157
|
+
D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
|
158
|
+
Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
|
159
|
+
Harbour | [hbui](https://github.com/rjopek/hbui)
|
160
|
+
Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
|
161
|
+
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
|
+
Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
|
163
|
+
Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
|
164
|
+
Lua | [libuilua](https://github.com/zevv/libuilua), [libui-lua](https://github.com/mdombroski/libui-lua), [lui](http://tset.de/lui/index.html), [lui](https://github.com/zhaozg/lui)
|
165
|
+
Nim | [ui](https://github.com/nim-lang/ui)
|
166
|
+
Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
|
167
|
+
PHP | [ui](https://github.com/krakjoe/ui)
|
168
|
+
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)
|
171
|
+
Scala | [scalaui](https://github.com/lolgab/scalaui)
|
172
|
+
Swift | [libui-swift](https://github.com/sclukey/libui-swift)
|
173
|
+
|
174
|
+
## Frequently Asked Questions
|
175
|
+
|
176
|
+
### Why does my program start in the background on OS X if I run from the command line?
|
177
|
+
OS X normally does not start program executables directly; instead, it uses [Launch Services](https://developer.apple.com/reference/coreservices/1658613-launch_services?language=objc) to coordinate the launching of the program between the various parts of the system and the loading of info from an .app bundle. One of these coordination tasks is responsible for bringing a newly launched app into the foreground. This is called "activation".
|
178
|
+
|
179
|
+
When you run a binary directly from the Terminal, however, you are running it directly, not through Launch Services. Therefore, the program starts in the background, because no one told it to activate! Now, it turns out [there is an API](https://developer.apple.com/reference/appkit/nsapplication/1428468-activateignoringotherapps) that we can use to force our app to be activated. But if we use it, then we'd be trampling over Launch Services, which already knows whether it should activate or not. Therefore, libui does not step over Launch Services, at the cost of requiring an extra user step if running directly from the command line.
|
180
|
+
|
181
|
+
See also [this](https://github.com/andlabs/libui/pull/20#issuecomment-211381971) and [this](http://stackoverflow.com/questions/25318524/what-exactly-should-i-pass-to-nsapp-activateignoringotherapps-to-get-my-appl).
|
182
|
+
|
183
|
+
## Contributing
|
184
|
+
|
185
|
+
See `CONTRIBUTING.md`.
|
186
|
+
|
187
|
+
## Screenshots
|
188
|
+
|
189
|
+
From examples/controlgallery:
|
190
|
+
|
191
|
+
![Windows](examples/controlgallery/windows.png)
|
192
|
+
|
193
|
+
![Unix](examples/controlgallery/unix.png)
|
194
|
+
|
195
|
+
![OS X](examples/controlgallery/darwin.png)
|
data/vendor/libui.dll
ADDED
Binary file
|
data/vendor/libui.dylib
ADDED
Binary file
|
data/vendor/libui.so
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kojix2
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- 2xijok@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- LICENSE.txt
|
77
|
+
- README.md
|
78
|
+
- lib/libui.rb
|
79
|
+
- lib/libui/ffi.rb
|
80
|
+
- lib/libui/version.rb
|
81
|
+
- vendor/LICENSE
|
82
|
+
- vendor/README.md
|
83
|
+
- vendor/libui.dll
|
84
|
+
- vendor/libui.dylib
|
85
|
+
- vendor/libui.so
|
86
|
+
homepage: https://github.com/kojix2/libui
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2.5'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.3.1
|
104
|
+
requirements: []
|
105
|
+
rubygems_version: 3.0.3
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Ruby bindings to libui
|
109
|
+
test_files: []
|