iup-ffi 0.13.0-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/LICENCE.md +21 -0
  3. data/README.md +139 -0
  4. data/lib/iup-ffi-plain.rb +51 -0
  5. data/lib/iup-ffi.rb +70 -0
  6. data/lib/library/linux/libcd.so +0 -0
  7. data/lib/library/linux/libim.so +0 -0
  8. data/lib/library/linux/libiup.so +0 -0
  9. data/lib/library/linux/libiup_scintilla.so +0 -0
  10. data/lib/library/linux/libiupcd.so +0 -0
  11. data/lib/library/linux/libiupcontrols.so +0 -0
  12. data/lib/library/linux/libiupim.so +0 -0
  13. data/lib/library/linux/libiupimglib.so +0 -0
  14. data/lib/plain/iupcdlib.rb +158 -0
  15. data/lib/plain/iupcontrolslib.rb +28 -0
  16. data/lib/plain/iupimglib.rb +15 -0
  17. data/lib/plain/iupimlib.rb +18 -0
  18. data/lib/plain/iuplib.rb +354 -0
  19. data/lib/plain/scintilla-lib.rb +17 -0
  20. data/lib/wrapped/attribute-builders.rb +93 -0
  21. data/lib/wrapped/attribute-reference.rb +27 -0
  22. data/lib/wrapped/background-box.rb +37 -0
  23. data/lib/wrapped/button.rb +152 -0
  24. data/lib/wrapped/callback-setter.rb +78 -0
  25. data/lib/wrapped/canvas.rb +698 -0
  26. data/lib/wrapped/colorbar.rb +212 -0
  27. data/lib/wrapped/colordialog.rb +121 -0
  28. data/lib/wrapped/common-attributes.rb +34 -0
  29. data/lib/wrapped/constants.rb +504 -0
  30. data/lib/wrapped/dial.rb +129 -0
  31. data/lib/wrapped/dialog.rb +309 -0
  32. data/lib/wrapped/drag-drop-attributes.rb +98 -0
  33. data/lib/wrapped/dynamic-fill-methods.rb +22 -0
  34. data/lib/wrapped/expander.rb +128 -0
  35. data/lib/wrapped/filedialog.rb +168 -0
  36. data/lib/wrapped/fill.rb +29 -0
  37. data/lib/wrapped/fontdialog.rb +71 -0
  38. data/lib/wrapped/frame.rb +70 -0
  39. data/lib/wrapped/gridbox.rb +188 -0
  40. data/lib/wrapped/hbox.rb +90 -0
  41. data/lib/wrapped/image-attributes.rb +58 -0
  42. data/lib/wrapped/image.rb +178 -0
  43. data/lib/wrapped/iup-global.rb +46 -0
  44. data/lib/wrapped/label.rb +110 -0
  45. data/lib/wrapped/link.rb +54 -0
  46. data/lib/wrapped/list.rb +567 -0
  47. data/lib/wrapped/matrix.rb +575 -0
  48. data/lib/wrapped/menu.rb +91 -0
  49. data/lib/wrapped/menuitem.rb +150 -0
  50. data/lib/wrapped/messagedialog.rb +127 -0
  51. data/lib/wrapped/progressbar.rb +91 -0
  52. data/lib/wrapped/progressdialog.rb +85 -0
  53. data/lib/wrapped/radio.rb +74 -0
  54. data/lib/wrapped/scintilla.rb +1112 -0
  55. data/lib/wrapped/scrollbar-attributes.rb +178 -0
  56. data/lib/wrapped/scrollbox.rb +40 -0
  57. data/lib/wrapped/separator.rb +24 -0
  58. data/lib/wrapped/splitbox.rb +114 -0
  59. data/lib/wrapped/stretchbox.rb +70 -0
  60. data/lib/wrapped/submenu.rb +58 -0
  61. data/lib/wrapped/tabs.rb +223 -0
  62. data/lib/wrapped/text.rb +382 -0
  63. data/lib/wrapped/timer.rb +82 -0
  64. data/lib/wrapped/toggle.rb +150 -0
  65. data/lib/wrapped/tree.rb +612 -0
  66. data/lib/wrapped/val.rb +162 -0
  67. data/lib/wrapped/vbox.rb +93 -0
  68. data/lib/wrapped/widget.rb +282 -0
  69. data/lib/wrapped/zbox.rb +80 -0
  70. metadata +131 -0
@@ -0,0 +1,354 @@
1
+ # Binding to the libiup shared library.
2
+ # This module can be used to access features not available
3
+ # in Iup.
4
+ #
5
+ # As an example of using the library:
6
+ #
7
+ # require 'iup-ffi-plain'
8
+ #
9
+ # IupLib.IupOpen(0, nil)
10
+ # IupLib.IupMessage("IupMessage Example", "Press the button")
11
+ # IupLib.IupClose
12
+ #
13
+ # For reference, the following functions are bound:
14
+ #
15
+ # * pango_font_family_get_type, [], :ulong
16
+ # * pango_font_face_get_type, [], :ulong
17
+ # * pango_font_description_get_type, [], :ulong
18
+ # * IupSetAttribute, [:pointer, :string, :string], :void
19
+ # * IupSetAttributes, [:pointer, :string], :pointer
20
+ # * IupGetAttribute, [:pointer, :string], :strptr
21
+ # * IupSetAttributeHandle, [:pointer, :string, :pointer], :void
22
+ # * IupSetGlobal, [:string, :string], :void
23
+ # * IupGetGlobal, [:string], :strptr
24
+ # * IupSetFunction, [:string, :iup_callback], :iup_callback
25
+ # * IupGetInt, [:pointer, :string], :int
26
+ # * IupOpen, [:int, :pointer], :int
27
+ # * IupMainLoop, [], :void
28
+ # * IupClose, [], :void
29
+ # * IupDestroy, [:pointer], :void
30
+ # * IupRedraw, [:pointer], :void
31
+ # * IupMap, [:pointer], :void
32
+ # * IupSetCallbackD_I, :IupSetCallback, [:pointer, :string, :iup_callback_d_i], :iup_callback_d_i
33
+ # * IupSetCallbackFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_ff_i], :iup_callback_ff_i
34
+ # * IupSetCallbackFIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_fiis_i], :iup_callback_fiis_i
35
+ # * IupSetCallbackS_I, :IupSetCallback, [:pointer, :string, :iup_callback_s_i], :iup_callback_s_i
36
+ # * IupSetCallbackSII_I, :IupSetCallback, [:pointer, :string, :iup_callback_sii_i], :iup_callback_sii_i
37
+ # * IupSetCallbackI_I, :IupSetCallback, [:pointer, :string, :iup_callback_i_i], :iup_callback_i_i
38
+ # * IupSetCallbackI_S, :IupSetCallback, [:pointer, :string, :iup_callback_i_s], :iup_callback_i_s
39
+ # * IupSetCallbackIFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_iff_i], :iup_callback_iff_i
40
+ # * IupSetCallbackII_I, :IupSetCallback, [:pointer, :string, :iup_callback_ii_i], :iup_callback_ii_i
41
+ # * IupSetCallbackIIFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiff_i], :iup_callback_iiff_i
42
+ # * IupSetCallbackIIFFI_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiffi_i], :iup_callback_iiffi_i
43
+ # * IupSetCallbackIIFFFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiffff_i], :iup_callback_iiffff_i
44
+ # * IupSetCallbackIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_is_i], :iup_callback_is_i
45
+ # * IupSetCallbackIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_iis_i], :iup_callback_iis_i
46
+ # * IupSetCallbackIII_I, :IupSetCallback, [:pointer, :string, :iup_callback_iii_i], :iup_callback_iii_i
47
+ # * IupSetCallbackIIII_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiii_i], :iup_callback_iiii_i
48
+ # * IupSetCallbackIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_iis_i], :iup_callback_iis_i
49
+ # * IupSetCallbackIIIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiiis_i], :iup_callback_iiiis_i
50
+ # * IupSetCallbackPlain, :IupSetCallback, [:pointer, :string, :iup_callback_plain], :iup_callback_plain
51
+ # * IupSetCallbackPlain_V, :IupSetCallback, [:pointer, :string, :iup_callback_plain_v], :iup_callback_plain_v
52
+ # * IupSetCallbackP_I, :IupSetCallback, [:pointer, :string, :iup_callback_p_i], :iup_callback_p_i
53
+ # * IupSetCallbackPP_I, :IupSetCallback, [:pointer, :string, :iup_callback_pp_i], :iup_callback_pp_i
54
+ # * IupSetCallbackSS_I, :IupSetCallback, [:pointer, :string, :iup_callback_ss_i], :iup_callback_ss_i
55
+ # * IupSetCallbackSSI_I, :IupSetCallback, [:pointer, :string, :iup_callback_ssi_i], :iup_callback_ssi_i
56
+ # * IupSetCallbackSSIII_I, :IupSetCallback, [:pointer, :string, :iup_callback_ssiii_i], :iup_callback_ssiii_i
57
+ # * IupFill, [], :pointer
58
+ # * IupGridBox, [:pointer, :varargs], :pointer
59
+ # * IupVbox, [:pointer, :varargs], :pointer
60
+ # * IupHbox, [:pointer, :varargs], :pointer
61
+ # * IupZbox, [:pointer, :varargs], :pointer
62
+ # * IupRadio, [:pointer], :pointer
63
+ # * IupNormalizer, [:pointer, :varargs], :pointer
64
+ # * IupBackgroundBox, [:pointer], :pointer
65
+ # * IupCbox, [:pointer, :varargs], :pointer
66
+ # * IupDetachBox, [:pointer], :pointer
67
+ # * IupExpander, [:pointer], :pointer
68
+ # * IupSbox, [:pointer], :pointer
69
+ # * IupScrollBox, [:pointer], :pointer
70
+ # * IupSplit, [:pointer, :pointer], :pointer
71
+ # * IupAppend, [:pointer, :pointer], :pointer
72
+ # * IupDetach, [:pointer], :void
73
+ # * IupInsert, [:pointer, :pointer, :pointer], :pointer
74
+ # * IupReparent, [:pointer, :pointer, :pointer], :int
75
+ # * IupGetParent, [:pointer], :pointer
76
+ # * IupGetChild, [:pointer, :int], :pointer
77
+ # * IupGetChildPos, [:pointer, :pointer], :int
78
+ # * IupGetChildCount, [:pointer], :int
79
+ # * IupGetNextChild, [:pointer, :pointer], :pointer
80
+ # * IupGetBrother, [:pointer], :pointer
81
+ # * IupGetDialog, [:pointer], :pointer
82
+ # * IupGetDialogChild, [:pointer, :string], :pointer
83
+ # * IupRefresh, [:pointer], :void
84
+ # * IupRefreshChildren, [:pointer], :void
85
+ # * IupUpdate, [:pointer], :void
86
+ # * IupRedraw, [:pointer, :int], :void
87
+ # * IupConvertXYToPos, [:pointer, :int, :int], :int
88
+ # * IupDialog, [:pointer], :pointer
89
+ # * IupPopup, [:pointer, :int, :int], :int
90
+ # * IupShow, [:pointer], :void
91
+ # * IupShowXY, [:pointer, :int, :int], :int
92
+ # * IupHide, [:pointer], :void
93
+ # * IupFileDlg, [], :pointer
94
+ # * IupMessageDlg, [], :pointer
95
+ # * IupColorDlg, [], :pointer
96
+ # * IupFontDlg, [], :pointer
97
+ # * IupProgressDlg, [], :pointer
98
+ # * IupAlarm, [:string, :string, :string, :string, :string], :int
99
+ # * IupGetFile, [:string], :int
100
+ # * IupGetColor, [:int, :int, :pointer, :pointer, :pointer], :int
101
+ # * IupGetText, [:pointer, :pointer], :int
102
+ # * IupListDialog, [:int, :string, :int, :pointer, :int, :int, :int, :pointer], :int
103
+ # * IupMessage, [:string, :string], :void
104
+ # * IupButton, [:string, :string], :pointer
105
+ # * IupCanvas, [:string], :pointer
106
+ # * IupFrame, [:pointer], :pointer
107
+ # * IupLabel, [:string], :pointer
108
+ # * IupLink, [:string, :string], :pointer
109
+ # * IupList, [:string], :pointer
110
+ # * IupProgressBar, [], :pointer
111
+ # * IupSpin, [], :pointer
112
+ # * IupTabs, [:pointer, :varargs], :pointer
113
+ # * IupText, [:string], :pointer
114
+ # * IupToggle, [:string, :string], :pointer
115
+ # * IupTree, [], :pointer
116
+ # * IupVal, [:string], :pointer
117
+ # * IupImage, [:int, :int, :pointer], :pointer
118
+ # * IupImageRGB, [:int, :int, :pointer], :pointer
119
+ # * IupImageRGBA, [:int, :int, :pointer], :pointer
120
+ # * IupSaveImageAsText, [:pointer, :string, :string, :string], :int
121
+ # * IupNextField, [:pointer], :pointer
122
+ # * IupPreviousField, [:pointer], :pointer
123
+ # * IupGetFocus, [], :pointer
124
+ # * IupSetFocus, [:pointer], :pointer
125
+ # * IupItem, [:string, :string], :pointer
126
+ # * IupMenu, [:pointer, :varargs], :pointer
127
+ # * IupSeparator, [], :pointer
128
+ # * IupSubmenu, [:string, :pointer], :pointer
129
+ # * IupSetHandle, [:string, :pointer], :void
130
+ # * IupGetHandle, [:string], :pointer
131
+ # * IupGetName, [:pointer], :strptr
132
+ # * IupSetLanguage, [:string], :void
133
+ # * IupGetLanguage, [], :strptr
134
+ # * IupClipboard, [], :pointer
135
+ # * IupTimer, [], :pointer
136
+ # * IupHelp, [:string], :int
137
+ #
138
+ module IupLib
139
+ extend FFI::Library
140
+
141
+ ffi_lib *Iup::IUP_LIBS
142
+
143
+ if /linux|cygwin/ === RbConfig::CONFIG['host_os']
144
+ # This function returns the GType ID for a PangoFontFamily.
145
+ # Calling it forces Pango to register its types with GObject.
146
+ attach_function :pango_font_family_get_type, [], :ulong
147
+ attach_function :pango_font_face_get_type, [], :ulong
148
+ attach_function :pango_font_description_get_type, [], :ulong
149
+
150
+ # Note: ping the Pango Type System to register types
151
+ # between the shared libraries and GObject
152
+ pango_font_family_get_type()
153
+ pango_font_face_get_type()
154
+ pango_font_description_get_type()
155
+ end
156
+
157
+ # Attributes
158
+ attach_function :IupSetAttribute, [:pointer, :string, :string], :void
159
+ attach_function :IupSetAttributes, [:pointer, :string], :pointer
160
+ attach_function :IupGetAttribute, [:pointer, :string], :strptr
161
+ attach_function :IupSetAttributeHandle, [:pointer, :string, :pointer], :void
162
+ attach_function :IupSetGlobal, [:string, :string], :void
163
+ attach_function :IupGetGlobal, [:string], :strptr
164
+
165
+ callback :iup_callback, [], :int
166
+ attach_function :IupSetFunction, [:string, :iup_callback], :iup_callback
167
+
168
+ attach_function :IupGetInt, [:pointer, :string], :int
169
+
170
+ # Events
171
+ attach_function :IupOpen, [:int, :pointer], :int
172
+ attach_function :IupMainLoop, [], :void
173
+ attach_function :IupClose, [], :void
174
+ attach_function :IupDestroy, [:pointer], :void
175
+ attach_function :IupRedraw, [:pointer], :void
176
+
177
+ attach_function :IupMap, [:pointer], :void
178
+
179
+ # -- Callbacks
180
+ callback :iup_callback_d_i, [:pointer, :double], :int
181
+ callback :iup_callback_ff_i, [:pointer, :float, :float], :int
182
+ callback :iup_callback_fiis_i, [:pointer, :float, :int, :int, :string], :int
183
+ callback :iup_callback_s_i, [:pointer, :string], :int
184
+ callback :iup_callback_sii_i, [:pointer, :string, :int, :int], :int
185
+ callback :iup_callback_i_i, [:pointer, :int], :int
186
+ callback :iup_callback_i_s, [:pointer, :int], :strptr
187
+ callback :iup_callback_iff_i, [:pointer, :int, :float, :float], :int
188
+ callback :iup_callback_ii_i, [:pointer, :int, :int], :int
189
+ callback :iup_callback_iiff_i, [:pointer, :int, :int, :float, :float], :int
190
+ callback :iup_callback_iiffi_i, [:pointer, :int, :int, :float, :float, :int], :int
191
+ callback :iup_callback_iiffff_i, [:pointer, :int, :int, :float, :float, :float, :float], :int
192
+ callback :iup_callback_is_i, [:pointer, :int, :string], :int
193
+ callback :iup_callback_iis_i, [:pointer, :int, :int, :string], :int
194
+ callback :iup_callback_iii_i, [:pointer, :int, :int, :int], :int
195
+ callback :iup_callback_iiii_i, [:pointer, :int, :int, :int, :int], :int
196
+ callback :iup_callback_iiis_i, [:pointer, :int, :int, :string], :int
197
+ callback :iup_callback_iis_i, [:pointer, :int, :int, :string], :int
198
+ callback :iup_callback_iiiis_i, [:pointer, :int, :int, :int, :int, :string], :int
199
+ callback :iup_callback_plain, [:pointer], :int
200
+ callback :iup_callback_plain_v, [:pointer], :void
201
+ callback :iup_callback_p_i, [:pointer, :pointer], :int
202
+ callback :iup_callback_pp_i, [:pointer, :pointer, :pointer], :int
203
+ callback :iup_callback_ss_i, [:pointer, :string, :string], :int
204
+ callback :iup_callback_ssi_i, [:pointer, :string, :string, :int], :int
205
+ callback :iup_callback_ssiii_i, [:pointer, :string, :string, :int, :int, :int], :int
206
+
207
+ attach_function :IupSetCallbackD_I, :IupSetCallback, [:pointer, :string, :iup_callback_d_i], :iup_callback_d_i
208
+ attach_function :IupSetCallbackFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_ff_i], :iup_callback_ff_i
209
+ attach_function :IupSetCallbackFIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_fiis_i], :iup_callback_fiis_i
210
+ attach_function :IupSetCallbackS_I, :IupSetCallback, [:pointer, :string, :iup_callback_s_i], :iup_callback_s_i
211
+ attach_function :IupSetCallbackSII_I, :IupSetCallback, [:pointer, :string, :iup_callback_sii_i], :iup_callback_sii_i
212
+ attach_function :IupSetCallbackI_I, :IupSetCallback, [:pointer, :string, :iup_callback_i_i], :iup_callback_i_i
213
+ attach_function :IupSetCallbackI_S, :IupSetCallback, [:pointer, :string, :iup_callback_i_s], :iup_callback_i_s
214
+ attach_function :IupSetCallbackIFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_iff_i], :iup_callback_iff_i
215
+ attach_function :IupSetCallbackII_I, :IupSetCallback, [:pointer, :string, :iup_callback_ii_i], :iup_callback_ii_i
216
+ attach_function :IupSetCallbackIIFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiff_i], :iup_callback_iiff_i
217
+ attach_function :IupSetCallbackIIFFI_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiffi_i], :iup_callback_iiffi_i
218
+ attach_function :IupSetCallbackIIFFFF_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiffff_i], :iup_callback_iiffff_i
219
+ attach_function :IupSetCallbackIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_is_i], :iup_callback_is_i
220
+ attach_function :IupSetCallbackIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_iis_i], :iup_callback_iis_i
221
+ attach_function :IupSetCallbackIII_I, :IupSetCallback, [:pointer, :string, :iup_callback_iii_i], :iup_callback_iii_i
222
+ attach_function :IupSetCallbackIIII_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiii_i], :iup_callback_iiii_i
223
+ attach_function :IupSetCallbackIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_iis_i], :iup_callback_iis_i
224
+ attach_function :IupSetCallbackIIIIS_I, :IupSetCallback, [:pointer, :string, :iup_callback_iiiis_i], :iup_callback_iiiis_i
225
+ attach_function :IupSetCallbackPlain, :IupSetCallback, [:pointer, :string, :iup_callback_plain], :iup_callback_plain
226
+ attach_function :IupSetCallbackPlain_V, :IupSetCallback, [:pointer, :string, :iup_callback_plain_v], :iup_callback_plain_v
227
+ attach_function :IupSetCallbackP_I, :IupSetCallback, [:pointer, :string, :iup_callback_p_i], :iup_callback_p_i
228
+ attach_function :IupSetCallbackPP_I, :IupSetCallback, [:pointer, :string, :iup_callback_pp_i], :iup_callback_pp_i
229
+ attach_function :IupSetCallbackSS_I, :IupSetCallback, [:pointer, :string, :iup_callback_ss_i], :iup_callback_ss_i
230
+ attach_function :IupSetCallbackSSI_I, :IupSetCallback, [:pointer, :string, :iup_callback_ssi_i], :iup_callback_ssi_i
231
+ attach_function :IupSetCallbackSSIII_I, :IupSetCallback, [:pointer, :string, :iup_callback_ssiii_i], :iup_callback_ssiii_i
232
+
233
+ # Layout
234
+ # -- Composition
235
+ attach_function :IupFill, [], :pointer
236
+ attach_function :IupGridBox, [:pointer, :varargs], :pointer
237
+ attach_function :IupVbox, [:pointer, :varargs], :pointer
238
+ attach_function :IupHbox, [:pointer, :varargs], :pointer
239
+ attach_function :IupZbox, [:pointer, :varargs], :pointer
240
+ attach_function :IupRadio, [:pointer], :pointer
241
+ attach_function :IupNormalizer, [:pointer, :varargs], :pointer
242
+ attach_function :IupBackgroundBox, [:pointer], :pointer
243
+ attach_function :IupCbox, [:pointer, :varargs], :pointer
244
+ attach_function :IupDetachBox, [:pointer], :pointer
245
+ attach_function :IupExpander, [:pointer], :pointer
246
+ attach_function :IupSbox, [:pointer], :pointer
247
+ attach_function :IupScrollBox, [:pointer], :pointer
248
+ attach_function :IupSplit, [:pointer, :pointer], :pointer
249
+ # -- Hierarchy
250
+ attach_function :IupAppend, [:pointer, :pointer], :pointer
251
+ attach_function :IupDetach, [:pointer], :void
252
+ attach_function :IupInsert, [:pointer, :pointer, :pointer], :pointer
253
+ attach_function :IupReparent, [:pointer, :pointer, :pointer], :int
254
+ attach_function :IupGetParent, [:pointer], :pointer
255
+ attach_function :IupGetChild, [:pointer, :int], :pointer
256
+ attach_function :IupGetChildPos, [:pointer, :pointer], :int
257
+ attach_function :IupGetChildCount, [:pointer], :int
258
+ attach_function :IupGetNextChild, [:pointer, :pointer], :pointer
259
+ attach_function :IupGetBrother, [:pointer], :pointer
260
+ attach_function :IupGetDialog, [:pointer], :pointer
261
+ attach_function :IupGetDialogChild, [:pointer, :string], :pointer
262
+ # -- Utilities
263
+ attach_function :IupRefresh, [:pointer], :void
264
+ attach_function :IupRefreshChildren, [:pointer], :void
265
+ attach_function :IupUpdate, [:pointer], :void
266
+ attach_function :IupRedraw, [:pointer, :int], :void
267
+ attach_function :IupConvertXYToPos, [:pointer, :int, :int], :int
268
+
269
+ # Dialogs
270
+ # -- reference
271
+ attach_function :IupDialog, [:pointer], :pointer
272
+ attach_function :IupPopup, [:pointer, :int, :int], :int
273
+ attach_function :IupShow, [:pointer], :void
274
+ attach_function :IupShowXY, [:pointer, :int, :int], :int
275
+ attach_function :IupHide, [:pointer], :void
276
+
277
+ # -- predefined
278
+ attach_function :IupFileDlg, [], :pointer
279
+ attach_function :IupMessageDlg, [], :pointer
280
+ attach_function :IupColorDlg, [], :pointer
281
+ attach_function :IupFontDlg, [], :pointer
282
+ attach_function :IupProgressDlg, [], :pointer
283
+ attach_function :IupAlarm, [:string, :string, :string, :string, :string], :int
284
+ attach_function :IupGetFile, [:string], :int
285
+ attach_function :IupGetColor, [:int, :int, :pointer, :pointer, :pointer], :int
286
+ attach_function :IupGetText, [:pointer, :pointer], :int
287
+ attach_function :IupListDialog, [:int, :string, :int, :pointer, :int, :int, :int, :pointer], :int
288
+ attach_function :IupMessage, [:string, :string], :void
289
+
290
+ # Controls
291
+ # -- standard
292
+ attach_function :IupButton, [:string, :string], :pointer
293
+ attach_function :IupCanvas, [:string], :pointer
294
+ attach_function :IupFrame, [:pointer], :pointer
295
+ attach_function :IupLabel, [:string], :pointer
296
+ attach_function :IupLink, [:string, :string], :pointer
297
+ attach_function :IupList, [:string], :pointer
298
+ attach_function :IupProgressBar, [], :pointer
299
+ attach_function :IupSpin, [], :pointer
300
+ attach_function :IupTabs, [:pointer, :varargs], :pointer
301
+ attach_function :IupText, [:string], :pointer
302
+ attach_function :IupToggle, [:string, :string], :pointer
303
+ attach_function :IupTree, [], :pointer
304
+ attach_function :IupVal, [:string], :pointer
305
+
306
+ # Resources
307
+ # -- images
308
+ attach_function :IupImage, [:int, :int, :pointer], :pointer
309
+ attach_function :IupImageRGB, [:int, :int, :pointer], :pointer
310
+ attach_function :IupImageRGBA, [:int, :int, :pointer], :pointer
311
+ attach_function :IupSaveImageAsText, [:pointer, :string, :string, :string], :int
312
+ # -- keyboard
313
+ attach_function :IupNextField, [:pointer], :pointer
314
+ attach_function :IupPreviousField, [:pointer], :pointer
315
+ attach_function :IupGetFocus, [], :pointer
316
+ attach_function :IupSetFocus, [:pointer], :pointer
317
+ # -- menus
318
+ attach_function :IupItem, [:string, :string], :pointer
319
+ attach_function :IupMenu, [:pointer, :varargs], :pointer
320
+ attach_function :IupSeparator, [], :pointer
321
+ attach_function :IupSubmenu, [:string, :pointer], :pointer
322
+ # -- handle names
323
+ attach_function :IupSetHandle, [:string, :pointer], :void
324
+ attach_function :IupGetHandle, [:string], :pointer
325
+ attach_function :IupGetName, [:pointer], :strptr
326
+ # -- string names
327
+ attach_function :IupSetLanguage, [:string], :void
328
+ attach_function :IupGetLanguage, [], :strptr
329
+
330
+ attach_function :IupClipboard, [], :pointer
331
+ attach_function :IupTimer, [], :pointer
332
+ attach_function :IupHelp, [:string], :int
333
+
334
+ # helper functions, to create memory structures from arrays
335
+
336
+ # Creates a memory structure from an array.
337
+ # Input:: an array of chars
338
+ # Output:: pointer to memory holding array of chars
339
+ def self.pointer_from_chars array
340
+ ptr = FFI::MemoryPointer.new :char, array.size
341
+ ptr.write_array_of_char array
342
+ return ptr
343
+ end
344
+
345
+ # Creates a memory structure from an array.
346
+ # Input:: an array of ints
347
+ # Output:: pointer to memory holding array of ints
348
+ def self.pointer_from_ints array
349
+ ptr = FFI::MemoryPointer.new :int, array.size
350
+ ptr.write_array_of_int array
351
+ return ptr
352
+ end
353
+ end
354
+
@@ -0,0 +1,17 @@
1
+ # Binding to the iup_scintilla shared library.
2
+ # This module can be used to access features not available
3
+ # in Iup.
4
+ #
5
+ # For reference, the following functions are bound:
6
+ #
7
+ # * IupScintilla, [], :pointer
8
+ # * IupScintillaOpen, [], :void
9
+ #
10
+ module ScintillaLib
11
+ extend FFI::Library
12
+
13
+ ffi_lib *Iup::IUP_LIBS
14
+
15
+ attach_function :IupScintilla, [], :pointer
16
+ attach_function :IupScintillaOpen, [], :void
17
+ end
@@ -0,0 +1,93 @@
1
+ module Iup
2
+
3
+ # methods to help construct attribute methods
4
+ #
5
+ module AttributeBuilders # :nodoc: all
6
+
7
+ # Given the name of an attribute, this method creates
8
+ # reader and writer methods.
9
+ def define_attribute name
10
+ define_reader name
11
+ define_writer name
12
+ end
13
+
14
+ # Creates a reader method for attribute of given name.
15
+ def define_reader name
16
+ attribute = name.to_s.upcase
17
+ define_method name do
18
+ IupLib.IupGetAttribute(@handle, attribute).first
19
+ end
20
+ end
21
+
22
+ # Creates a writer method for attribute of given name.
23
+ def define_writer name
24
+ attribute = name.to_s.upcase
25
+ define_method "#{name}=" do |val|
26
+ IupLib.IupSetAttribute(@handle, attribute, val.to_s)
27
+ end
28
+ end
29
+
30
+ # Given the name of an attribute, this method creates a new
31
+ # method requiring an id number as a parameter and an optional value.
32
+ # Providing the value will set the named attribute for this object using the
33
+ # id number, e.g. "ITEM1", or else the current value will be returned.
34
+ # This supports attributes such as "ITEM1" "ITEM2" by making the id number a parameter.
35
+ def define_id_attribute name
36
+ define_method "#{name}" do |id, val=nil|
37
+ if val.nil?
38
+ IupLib.IupGetAttribute(@handle, "#{name}#{id}".upcase).first
39
+ else
40
+ IupLib.IupSetAttribute(@handle, "#{name}#{id}".upcase, val.to_s)
41
+ end
42
+ end
43
+ end
44
+
45
+ # Creates a reader method for an indexed attribute.
46
+ # Note: index starts from 1, as in IUP.
47
+ # This supports attributes such as "ITEM1" "ITEM2" by making the id number a parameter.
48
+ def define_id_reader name
49
+ define_method "#{name}" do |id|
50
+ IupLib.IupGetAttribute(@handle, "#{name}#{id}".upcase).first
51
+ end
52
+ end
53
+
54
+ # Creates a writer method for an indexed attribute.
55
+ # Note: index starts from 1, as in IUP.
56
+ # This supports attributes such as "ITEM1" "ITEM2" by making the id number a parameter.
57
+ def define_id_writer name
58
+ define_method "#{name}" do |id, val|
59
+ IupLib.IupSetAttribute(@handle, "#{name}#{id}".upcase, val.to_s)
60
+ end
61
+ end
62
+
63
+ # Creates reader/writer method for a property attribute.
64
+ def define_property_attribute name
65
+ attribute = name.to_s.upcase
66
+ define_method "#{name}" do |property, val=nil|
67
+ if val.nil?
68
+ IupLib.IupSetAttribute(@handle, attribute, property.upcase).first
69
+ else
70
+ IupLib.IupSetAttribute(@handle, attribute, "#{property}=#{val}".upcase)
71
+ end
72
+ end
73
+ end
74
+
75
+ # Creates a reader method for a property attribute.
76
+ # This supports attributes such as "ITEM=val", providing a parameter for the property name.
77
+ def define_property_reader name
78
+ attribute = name.to_s.upcase
79
+ define_method "#{name}" do |property|
80
+ IupLib.IupGetAttribute(@handle, attribute, property.upcase).first
81
+ end
82
+ end
83
+
84
+ # Creates a writer method for a property attribute.
85
+ # This supports attributes such as "ITEM=val", providing a parameter for the property name.
86
+ def define_property_writer name
87
+ attribute = name.to_s.upcase
88
+ define_method "#{name}" do |property, val|
89
+ IupLib.IupSetAttribute(@handle, attribute, "#{property}=#{val}".upcase)
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,27 @@
1
+ module Iup
2
+
3
+ # Defines method for getting/setting attribute values.
4
+ module AttributeReference # :nodoc: all
5
+
6
+ # Method used to get or set the value of attributes.
7
+ # when retrieving:: simply return the attribute with given name.
8
+ # when setting:: an attribute reference can be defined by its
9
+ # string name or directly as an instance of target class
10
+ def attribute_reference(name, target, val=nil)
11
+ case val
12
+ when NilClass
13
+ IupLib.IupGetAttribute(@handle, name).first
14
+ when String
15
+ IupLib.IupSetAttribute @handle, name, val
16
+ when target
17
+ target_name = IupLib.IupGetName(name).first
18
+ if target_name.nil? or target_name.empty?
19
+ target_name = SecureRandom.uuid
20
+ val.assign_handle(target_name)
21
+ end
22
+ IupLib.IupSetAttribute(@handle, name, target_name)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,37 @@
1
+ module Iup
2
+
3
+ # Contains a child widget, but itself provides no visible decorations.
4
+ # Its intended use is within a ZBox or ExpanderBox.
5
+ #
6
+ class BackgroundBox < Iup::Canvas
7
+ include DynamicFillMethods
8
+
9
+ # Creates an instance of the background box.
10
+ # If a block is given, the new instance is yielded to it.
11
+ #
12
+ # * +widget+ - the child widget to contain
13
+ #
14
+ def initialize widget
15
+ @handle = IupLib.IupBackgroundBox(widget.handle)
16
+
17
+ # run any provided block on instance, to set up further attributes
18
+ yield self if block_given?
19
+ end
20
+
21
+ ##
22
+ # :attr_reader: clientoffset
23
+ # returns current offset of box in its client as "widthxheight".
24
+ define_reader :clientoffset
25
+
26
+ ##
27
+ # :attr_reader: clientsize
28
+ # returns current size of box as "widthxheight".
29
+ define_reader :clientsize
30
+
31
+ ##
32
+ # :attr: expand
33
+ # Allows box to fill available space in indicated direction.
34
+ # Values 'no' / 'horizontal' / 'vertical' / 'yes'.
35
+ define_attribute :expand
36
+ end
37
+ end
@@ -0,0 +1,152 @@
1
+ module Iup
2
+
3
+ # A button can display some text, an image, or both. When clicked, a
4
+ # specified _action_ function is called. The action should return
5
+ # +Iup::DEFAULT+, or, if the button should exit the application,
6
+ # +Iup::CLOSE+.
7
+ #
8
+ # (1) A button with some text and an action
9
+ #
10
+ # Iup::Button.new('click me', ->{
11
+ # puts 'clicked'
12
+ # Iup::DEFAULT
13
+ # })
14
+ #
15
+ # (2) A button with an image stored in +img+ and
16
+ # action specified by a separate method; some padding around
17
+ # the image within the button.
18
+ #
19
+ # def click_fn
20
+ # puts 'clicked'
21
+ # Iup::DEFAULT
22
+ # end
23
+ #
24
+ # Iup:Button.new('', ->{ click_fn }) do |b|
25
+ # b.image = img
26
+ # b.padding = '50x20'
27
+ # end
28
+ #
29
+ # (3) A button with text and image, image placed above
30
+ # text. The text contains an & before the "x", so the action
31
+ # can be triggered using ALT+x, and closes the application.
32
+ #
33
+ # Iup::Button.new('e&xit', ->{ puts 'exit'; Iup::CLOSE }) do |b|
34
+ # b.image = img
35
+ # b.imageposition = 'top'
36
+ # end
37
+ #
38
+ class Button < Iup::Widget
39
+ include ImageAttributes
40
+
41
+ # Creates an instance of a button.
42
+ # If a block is given, the new instance is yielded to it.
43
+ # * +title+ - the text to display on the button.
44
+ # * +callback+ - procedure to call when button is left-clicked, passed to #action.
45
+ def initialize(title='', callback = nil)
46
+ @handle = IupLib.IupButton(title, nil)
47
+
48
+ self.action = callback unless callback.nil?
49
+
50
+ # run any provided block on instance, to set up further attributes
51
+ yield self if block_given?
52
+ end
53
+
54
+ # -- attributes
55
+
56
+ ##
57
+ # :attr: alignment
58
+ # Sets the horizontal and vertical alignment.
59
+ # The value is a string "horizontal:vertical", with
60
+ # horizontal options ALEFT, ACENTER, ARIGHT and
61
+ # vertical options ATOP, ACENTER, ABOTTOM.
62
+ # Partial values also accepted, e.g. "ARIGHT", ":ATOP".
63
+ define_attribute :alignment
64
+
65
+ ##
66
+ # :attr: canfocus
67
+ # Enables the control to gain focus. Values 'yes' / 'no'.
68
+ define_attribute :canfocus
69
+
70
+ ##
71
+ # :attr: expand
72
+ # Allows button to fill available space in indicated direction.
73
+ # Values 'no' / 'horizontal' / 'vertical' / 'yes'.
74
+ define_attribute :expand
75
+
76
+ ##
77
+ # :attr: alignment
78
+ # Sets the horizontal and vertical alignment.
79
+ # The value is a string "horizontal:vertical", with options ALEFT, ACENTER,
80
+ # ARIGHT or none.
81
+ define_attribute :flat
82
+
83
+ ##
84
+ # :attr: impressborder
85
+ # If set, shows button borders even if impress defined.
86
+ # Values 'yes' / 'no'.
87
+ define_attribute :impressborder
88
+
89
+ ##
90
+ # :attr: imageposition
91
+ # Position of image relative to text.
92
+ # Values 'left' / 'right' / 'top' / 'bottom'/
93
+ define_attribute :imageposition
94
+
95
+ ##
96
+ # :attr: padding
97
+ # Margin in x and y directions, value as "mxn".
98
+ define_attribute :padding
99
+
100
+ ##
101
+ # :attr_reader: position
102
+ # Returns position in pixels within client window as "x,y".
103
+ define_reader :position
104
+
105
+ ##
106
+ # :attr: rastersize
107
+ # Size of the button, in pixels, value as "widthxheight".
108
+ define_attribute :rastersize
109
+
110
+ ##
111
+ # :attr_reader: screenposition
112
+ # Returns position in pixels on screen as "x,y".
113
+ define_reader :screenposition
114
+
115
+ ##
116
+ # :attr: spacing
117
+ # Space between image and text, value as a number.
118
+ define_attribute :spacing
119
+
120
+ ##
121
+ # :attr: tip
122
+ # Tooltip string.
123
+ define_attribute :tip
124
+
125
+ ##
126
+ # :attr: title
127
+ # Displayed on the button as a text label.
128
+ define_attribute :title
129
+
130
+ # :section: Callbacks
131
+
132
+ ##
133
+ # :attr_writer: action
134
+ #
135
+ # Sets action called when the button 1 (usually left) is selected.
136
+ # Callback must respond to +call+ and take no arguments.
137
+
138
+ # --
139
+ def action= callback
140
+ unless callback.arity.zero?
141
+ raise ArgumentError, 'action must take 0 arguments'
142
+ end
143
+ cb = Proc.new do |ih|
144
+ callback.call
145
+ end
146
+ define_callback(cb, 'ACTION', :plain)
147
+ end
148
+
149
+ include ButtonCallback
150
+ end
151
+ end
152
+