libui 0.0.2.alpha → 0.0.3.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libui.rb +16 -1
  3. data/lib/libui/ffi.rb +196 -180
  4. data/lib/libui/version.rb +1 -1
  5. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09456751242352f4fe59f4b7ddd7bf6edd03678a07a5dc8ec8be329315c1e8c8'
4
- data.tar.gz: a3607f0af3721ff11af7701d788752a22aa9a27051d23c7217da7429372e6cfe
3
+ metadata.gz: 6483e7a5d01aa51e2013350a38da4926d813416cf8f3f039f9203471bbb59968
4
+ data.tar.gz: e37424f71ec7991076a3fdb9cfc007aa2bf8fcd027210513d842b82d1056de21
5
5
  SHA512:
6
- metadata.gz: c62aa930687976948eb9ae1320a07cd6cbd55cdc8b672a169b7edf40b80b9f510ec8ccc48f3382be9ceaa6cc97d5d463151d3a263608c3f1174cbcba1edc0b77
7
- data.tar.gz: 304c0a45435553228fc459668e30d7404f0ac5353a1224ca1280ef25bbd748d56da7381ab8003030fdac42ee20f6419d20c9c0ec1275d60f646879371f039e83
6
+ metadata.gz: f3e515578dcfa6d4357c0f0154c9b59db64f75ab94e37e6518916621a11aefd19842f1545c04984d719d8d61b74602e6d976504bf3312df3e6df29e421f20701
7
+ data.tar.gz: cdd83d3ec0e75e4730c158aae01cd5e29f24b6d5893a26e95759f7e9e6b92bb23b6008fb9292e53af2d925a1f08c3335be8843ecd895fbd24858b8c0c8836b4c
@@ -8,6 +8,7 @@ module LibUI
8
8
  class << self
9
9
  attr_accessor :ffi_lib
10
10
  end
11
+
11
12
  self.ffi_lib = case RbConfig::CONFIG['host_os']
12
13
  when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
13
14
  # File.expand_path("libui.dll", ENV['LIBUIDIR'])
@@ -20,5 +21,19 @@ module LibUI
20
21
  File.expand_path('../vendor/libui.so', __dir__)
21
22
  end
22
23
 
23
- autoload :FFI, 'libui/ffi'
24
+ require_relative 'libui/ffi'
25
+
26
+ class << self
27
+ FFI.ffi_methods.each do |original_method_name|
28
+ name = original_method_name.delete_prefix('ui')
29
+ .gsub(/::/, '/')
30
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
31
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
32
+ .tr('-', '_')
33
+ .downcase
34
+ define_method(name) do |*args|
35
+ FFI.public_send(original_method_name, *args)
36
+ end
37
+ end
38
+ end
24
39
  end
@@ -9,25 +9,43 @@ module LibUI
9
9
  begin
10
10
  dlload LibUI.ffi_lib
11
11
  rescue LoadError
12
- raise LoadError, 'Could not find libui'
12
+ raise LoadError, 'Could not find libui shared library'
13
13
  end
14
14
 
15
- typealias("uint32_t", "unsigned int")
15
+ class << self
16
+ attr_reader :ffi_methods
17
+
18
+ # Improved extern method.
19
+ # 1. Ignore functions that cannot be attached.
20
+ # 2. Available function (names) are stored in @ffi_methods.
21
+ def try_extern(signature, *opts)
22
+ @ffi_methods ||= []
23
+ begin
24
+ func = extern(signature, *opts)
25
+ @ffi_methods << func.name
26
+ func
27
+ rescue StandardError => e
28
+ warn "#{e.class.name}: #{e.message}"
29
+ end
30
+ end
31
+ end
32
+
33
+ typealias('uint32_t', 'unsigned int')
16
34
 
17
35
  InitOptions = struct(['size_t size'])
18
36
 
19
- extern 'const char *uiInit(uiInitOptions *options)'
20
- extern 'void uiUninit(void)'
21
- extern 'void uiFreeInitError(const char *err)'
37
+ try_extern 'const char *uiInit(uiInitOptions *options)'
38
+ try_extern 'void uiUninit(void)'
39
+ try_extern 'void uiFreeInitError(const char *err)'
22
40
 
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)'
41
+ try_extern 'void uiMain(void)'
42
+ try_extern 'void uiMainSteps(void)'
43
+ try_extern 'int uiMainStep(int wait)'
44
+ try_extern 'void uiQuit(void)'
45
+ try_extern 'void uiQueueMain(void (*f)(void *data), void *data)'
46
+ try_extern 'void uiTimer(int milliseconds, int (*f)(void *data), void *data)'
47
+ try_extern 'void uiOnShouldQuit(int (*f)(void *data), void *data)'
48
+ try_extern 'void uiFreeText(char *text)'
31
49
 
32
50
  struct ['uint32_t Signature',
33
51
  'uint32_t OSSignature',
@@ -43,200 +61,198 @@ module LibUI
43
61
  'int (*Enabled)(uiControl *)',
44
62
  'void (*Enable)(uiControl *)',
45
63
  '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)'
64
+
65
+ try_extern 'void uiControlDestroy(uiControl *)'
66
+ try_extern 'uintptr_t uiControlHandle(uiControl *)'
67
+ try_extern 'uiControl *uiControlParent(uiControl *)'
68
+ try_extern 'void uiControlSetParent(uiControl *, uiControl *)'
69
+ try_extern 'int uiControlToplevel(uiControl *)'
70
+ try_extern 'int uiControlVisible(uiControl *)'
71
+ try_extern 'void uiControlShow(uiControl *)'
72
+ try_extern 'void uiControlHide(uiControl *)'
73
+ try_extern 'int uiControlEnabled(uiControl *)'
74
+ try_extern 'void uiControlEnable(uiControl *)'
75
+ try_extern 'void uiControlDisable(uiControl *)'
76
+
77
+ try_extern 'uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr)'
78
+ try_extern 'void uiFreeControl(uiControl *)'
79
+
80
+ try_extern 'void uiControlVerifySetParent(uiControl *, uiControl *)'
81
+ try_extern 'int uiControlEnabledToUser(uiControl *)'
82
+
83
+ try_extern 'void uiUserBugCannotSetParentOnToplevel(const char *type)'
66
84
 
67
85
  # 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
-
86
+ try_extern 'char *uiWindowTitle(uiWindow *w)'
87
+ try_extern 'void uiWindowSetTitle(uiWindow *w, const char *title)'
88
+ try_extern 'void uiWindowContentSize(uiWindow *w, int *width, int *height)'
89
+ try_extern 'void uiWindowSetContentSize(uiWindow *w, int width, int height)'
90
+ try_extern 'int uiWindowFullscreen(uiWindow *w)'
91
+ try_extern 'void uiWindowSetFullscreen(uiWindow *w, int fullscreen)'
92
+ try_extern 'void uiWindowOnContentSizeChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data)'
93
+ try_extern 'void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *w, void *data), void *data)'
94
+ try_extern 'int uiWindowBorderless(uiWindow *w)'
95
+ try_extern 'void uiWindowSetBorderless(uiWindow *w, int borderless)'
96
+ try_extern 'void uiWindowSetChild(uiWindow *w, uiControl *child)'
97
+ try_extern 'int uiWindowMargined(uiWindow *w)'
98
+ try_extern 'void uiWindowSetMargined(uiWindow *w, int margined)'
99
+ try_extern 'uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)'
100
+
83
101
  # 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
-
102
+ try_extern 'char *uiButtonText(uiButton *b)'
103
+ try_extern 'void uiButtonSetText(uiButton *b, const char *text)'
104
+ try_extern 'void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *b, void *data), void *data)'
105
+ try_extern 'uiButton *uiNewButton(const char *text)'
106
+
89
107
  # 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
-
108
+ try_extern 'void uiBoxAppend(uiBox *b, uiControl *child, int stretchy)'
109
+ try_extern 'void uiBoxDelete(uiBox *b, int index)'
110
+ try_extern 'int uiBoxPadded(uiBox *b)'
111
+ try_extern 'void uiBoxSetPadded(uiBox *b, int padded)'
112
+ try_extern 'uiBox *uiNewHorizontalBox(void)'
113
+ try_extern 'uiBox *uiNewVerticalBox(void)'
114
+
97
115
  # 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
-
116
+ try_extern 'char *uiCheckboxText(uiCheckbox *c)'
117
+ try_extern 'void uiCheckboxSetText(uiCheckbox *c, const char *text)'
118
+ try_extern 'void uiCheckboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *c, void *data), void *data)'
119
+ try_extern 'int uiCheckboxChecked(uiCheckbox *c)'
120
+ try_extern 'void uiCheckboxSetChecked(uiCheckbox *c, int checked)'
121
+ try_extern 'uiCheckbox *uiNewCheckbox(const char *text)'
122
+
105
123
  # 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
-
124
+ try_extern 'char *uiEntryText(uiEntry *e)'
125
+ try_extern 'void uiEntrySetText(uiEntry *e, const char *text)'
126
+ try_extern 'void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data)'
127
+ try_extern 'int uiEntryReadOnly(uiEntry *e)'
128
+ try_extern 'void uiEntrySetReadOnly(uiEntry *e, int readonly)'
129
+ try_extern 'uiEntry *uiNewEntry(void)'
130
+ try_extern 'uiEntry *uiNewPasswordEntry(void)'
131
+ try_extern 'uiEntry *uiNewSearchEntry(void)'
132
+
115
133
  # uiLabel
116
- extern 'char *uiLabelText(uiLabel *l)'
117
- extern 'void uiLabelSetText(uiLabel *l, const char *text)'
118
- extern 'uiLabel *uiNewLabel(const char *text)'
119
-
134
+ try_extern 'char *uiLabelText(uiLabel *l)'
135
+ try_extern 'void uiLabelSetText(uiLabel *l, const char *text)'
136
+ try_extern 'uiLabel *uiNewLabel(const char *text)'
137
+
120
138
  # 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
-
139
+ try_extern 'void uiTabAppend(uiTab *t, const char *name, uiControl *c)'
140
+ try_extern 'void uiTabInsertAt(uiTab *t, const char *name, int before, uiControl *c)'
141
+ try_extern 'void uiTabDelete(uiTab *t, int index)'
142
+ try_extern 'int uiTabNumPages(uiTab *t)'
143
+ try_extern 'int uiTabMargined(uiTab *t, int page)'
144
+ try_extern 'void uiTabSetMargined(uiTab *t, int page, int margined)'
145
+ try_extern 'uiTab *uiNewTab(void)'
146
+
129
147
  # 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
-
148
+ try_extern 'char *uiGroupTitle(uiGroup *g)'
149
+ try_extern 'void uiGroupSetTitle(uiGroup *g, const char *title)'
150
+ try_extern 'void uiGroupSetChild(uiGroup *g, uiControl *c)'
151
+ try_extern 'int uiGroupMargined(uiGroup *g)'
152
+ try_extern 'void uiGroupSetMargined(uiGroup *g, int margined)'
153
+ try_extern 'uiGroup *uiNewGroup(const char *title)'
154
+
137
155
  # 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
-
156
+ try_extern 'int uiSpinboxValue(uiSpinbox *s)'
157
+ try_extern 'void uiSpinboxSetValue(uiSpinbox *s, int value)'
158
+ try_extern 'void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *s, void *data), void *data)'
159
+ try_extern 'uiSpinbox *uiNewSpinbox(int min, int max)'
160
+
143
161
  # 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
-
162
+ try_extern 'int uiSliderValue(uiSlider *s)'
163
+ try_extern 'void uiSliderSetValue(uiSlider *s, int value)'
164
+ try_extern 'void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *s, void *data), void *data)'
165
+ try_extern 'uiSlider *uiNewSlider(int min, int max)'
166
+
149
167
  # uiProgressBar
150
- extern 'int uiProgressBarValue(uiProgressBar *p)'
151
- extern 'void uiProgressBarSetValue(uiProgressBar *p, int n)'
152
- extern 'uiProgressBar *uiNewProgressBar(void)'
153
-
168
+ try_extern 'int uiProgressBarValue(uiProgressBar *p)'
169
+ try_extern 'void uiProgressBarSetValue(uiProgressBar *p, int n)'
170
+ try_extern 'uiProgressBar *uiNewProgressBar(void)'
171
+
154
172
  # uiSeparator
155
- extern 'uiSeparator *uiNewHorizontalSeparator(void)'
156
- extern 'uiSeparator *uiNewVerticalSeparator(void)'
157
-
173
+ try_extern 'uiSeparator *uiNewHorizontalSeparator(void)'
174
+ try_extern 'uiSeparator *uiNewVerticalSeparator(void)'
175
+
158
176
  # 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
-
177
+ try_extern 'void uiComboboxAppend(uiCombobox *c, const char *text)'
178
+ try_extern 'int uiComboboxSelected(uiCombobox *c)'
179
+ try_extern 'void uiComboboxSetSelected(uiCombobox *c, int n)'
180
+ try_extern 'void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data)'
181
+ try_extern 'uiCombobox *uiNewCombobox(void)'
182
+
165
183
  # 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
-
184
+ try_extern 'void uiEditableComboboxAppend(uiEditableCombobox *c, const char *text)'
185
+ try_extern 'char *uiEditableComboboxText(uiEditableCombobox *c)'
186
+ try_extern 'void uiEditableComboboxSetText(uiEditableCombobox *c, const char *text)'
187
+ try_extern 'void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *c, void *data), void *data)'
188
+ try_extern 'uiEditableCombobox *uiNewEditableCombobox(void)'
189
+
172
190
  # 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
-
191
+ try_extern 'void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)'
192
+ try_extern 'int uiRadioButtonsSelected(uiRadioButtons *r)'
193
+ try_extern 'void uiRadioButtonsSetSelected(uiRadioButtons *r, int n)'
194
+ try_extern 'void uiRadioButtonsOnSelected(uiRadioButtons *r, void (*f)(uiRadioButtons *, void *), void *data)'
195
+ try_extern 'uiRadioButtons *uiNewRadioButtons(void)'
196
+
179
197
  # 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
-
198
+ try_extern 'void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)'
199
+ try_extern 'void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)'
200
+ try_extern 'void uiDateTimePickerOnChanged(uiDateTimePicker *d, void (*f)(uiDateTimePicker *, void *), void *data)'
201
+ try_extern 'uiDateTimePicker *uiNewDateTimePicker(void)'
202
+ try_extern 'uiDateTimePicker *uiNewDatePicker(void)'
203
+ try_extern 'uiDateTimePicker *uiNewTimePicker(void)'
204
+
187
205
  # 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
-
206
+ try_extern 'char *uiMultilineEntryText(uiMultilineEntry *e)'
207
+ try_extern 'void uiMultilineEntrySetText(uiMultilineEntry *e, const char *text)'
208
+ try_extern 'void uiMultilineEntryAppend(uiMultilineEntry *e, const char *text)'
209
+ try_extern 'void uiMultilineEntryOnChanged(uiMultilineEntry *e, void (*f)(uiMultilineEntry *e, void *data), void *data)'
210
+ try_extern 'int uiMultilineEntryReadOnly(uiMultilineEntry *e)'
211
+ try_extern 'void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly)'
212
+ try_extern 'uiMultilineEntry *uiNewMultilineEntry(void)'
213
+ try_extern 'uiMultilineEntry *uiNewNonWrappingMultilineEntry(void)'
214
+
197
215
  # 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)'
216
+ try_extern 'void uiMenuItemEnable(uiMenuItem *m)'
217
+ try_extern 'void uiMenuItemDisable(uiMenuItem *m)'
218
+ try_extern 'void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender, uiWindow *window, void *data), void *data)'
219
+ try_extern 'int uiMenuItemChecked(uiMenuItem *m)'
220
+ try_extern 'void uiMenuItemSetChecked(uiMenuItem *m, int checked)'
203
221
 
204
222
  # 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)'
223
+ try_extern 'uiMenuItem *uiMenuAppendItem(uiMenu *m, const char *name)'
224
+ try_extern 'uiMenuItem *uiMenuAppendCheckItem(uiMenu *m, const char *name)'
225
+ try_extern 'uiMenuItem *uiMenuAppendQuitItem(uiMenu *m)'
226
+ try_extern 'uiMenuItem *uiMenuAppendPreferencesItem(uiMenu *m)'
227
+ try_extern 'uiMenuItem *uiMenuAppendAboutItem(uiMenu *m)'
228
+ try_extern 'void uiMenuAppendSeparator(uiMenu *m)'
229
+ try_extern 'uiMenu *uiNewMenu(const char *name)'
230
+
231
+ try_extern 'char *uiOpenFile(uiWindow *parent)'
232
+ try_extern 'char *uiSaveFile(uiWindow *parent)'
233
+ try_extern 'void uiMsgBox(uiWindow *parent, const char *title, const char *description)'
234
+ try_extern 'void uiMsgBoxError(uiWindow *parent, const char *title, const char *description)'
217
235
 
218
236
  # uiArea
219
- extern 'void uiAreaSetSize(uiArea *a, int width, int height)'
220
- extern 'void uiAreaQueueRedrawAll(uiArea *a)'
221
- extern 'void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)'
222
- extern 'void uiAreaBeginUserWindowMove(uiArea *a)'
237
+ try_extern 'void uiAreaSetSize(uiArea *a, int width, int height)'
238
+ try_extern 'void uiAreaQueueRedrawAll(uiArea *a)'
239
+ try_extern 'void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)'
240
+ try_extern 'void uiAreaBeginUserWindowMove(uiArea *a)'
223
241
  typealias 'uiWindowResizeEdge', 'char' # FIXME: uint8
224
- extern 'void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge)'
225
- extern 'uiArea *uiNewArea(uiAreaHandler *ah)'
226
- extern 'uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)'
227
-
228
- #
242
+ try_extern 'void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge)'
243
+ try_extern 'uiArea *uiNewArea(uiAreaHandler *ah)'
244
+ try_extern 'uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)'
229
245
 
230
246
  # uiFontButton
231
- extern 'void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc)'
232
- extern 'void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data)'
233
- extern 'uiFontButton *uiNewFontButton(void)'
234
- extern 'void uiFreeFontButtonFont(uiFontDescriptor *desc)'
247
+ try_extern 'void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc)'
248
+ try_extern 'void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data)'
249
+ try_extern 'uiFontButton *uiNewFontButton(void)'
250
+ try_extern 'void uiFreeFontButtonFont(uiFontDescriptor *desc)'
235
251
 
236
252
  # uiColorButton
237
- extern 'void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a)'
238
- extern 'void uiColorButtonSetColor(uiColorButton *b, double r, double g, double bl, double a)'
239
- extern 'void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data)'
240
- extern 'uiColorButton *uiNewColorButton(void)'
253
+ try_extern 'void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a)'
254
+ try_extern 'void uiColorButtonSetColor(uiColorButton *b, double r, double g, double bl, double a)'
255
+ try_extern 'void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data)'
256
+ try_extern 'uiColorButton *uiNewColorButton(void)'
241
257
  end
242
258
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibUI
4
- VERSION = '0.0.2.alpha'
4
+ VERSION = '0.0.3.alpha'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.alpha
4
+ version: 0.0.3.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-07 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubyzip
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email:
71
85
  - 2xijok@gmail.com