iup-ffi 0.12.0

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 (64) hide show
  1. checksums.yaml +7 -0
  2. data/LICENCE.txt +21 -0
  3. data/README.rdoc +348 -0
  4. data/lib/iup-ffi-plain.rb +9 -0
  5. data/lib/iup-ffi.rb +76 -0
  6. data/lib/plain/iupcdlib.rb +107 -0
  7. data/lib/plain/iupcontrolslib.rb +24 -0
  8. data/lib/plain/iupimglib.rb +14 -0
  9. data/lib/plain/iupimlib.rb +16 -0
  10. data/lib/plain/iuplib.rb +209 -0
  11. data/lib/plain/scintilla-lib.rb +15 -0
  12. data/lib/wrapped/attribute-builders.rb +105 -0
  13. data/lib/wrapped/attribute-reference.rb +27 -0
  14. data/lib/wrapped/background-box.rb +33 -0
  15. data/lib/wrapped/button.rb +108 -0
  16. data/lib/wrapped/callback-setter.rb +78 -0
  17. data/lib/wrapped/canvas.rb +467 -0
  18. data/lib/wrapped/colourbar.rb +94 -0
  19. data/lib/wrapped/colourdialog.rb +63 -0
  20. data/lib/wrapped/common-attributes.rb +64 -0
  21. data/lib/wrapped/constants.rb +953 -0
  22. data/lib/wrapped/dial.rb +87 -0
  23. data/lib/wrapped/dialog.rb +176 -0
  24. data/lib/wrapped/dialogs.rb +106 -0
  25. data/lib/wrapped/drag-drop-attributes.rb +57 -0
  26. data/lib/wrapped/dynamic-fill-methods.rb +27 -0
  27. data/lib/wrapped/expander.rb +65 -0
  28. data/lib/wrapped/filedialog.rb +93 -0
  29. data/lib/wrapped/fill.rb +26 -0
  30. data/lib/wrapped/fontdialog.rb +42 -0
  31. data/lib/wrapped/frame.rb +47 -0
  32. data/lib/wrapped/gridbox.rb +94 -0
  33. data/lib/wrapped/hbox.rb +49 -0
  34. data/lib/wrapped/image-attributes.rb +27 -0
  35. data/lib/wrapped/image.rb +118 -0
  36. data/lib/wrapped/internal-drag-drop-attributes.rb +21 -0
  37. data/lib/wrapped/iup-global.rb +51 -0
  38. data/lib/wrapped/label.rb +98 -0
  39. data/lib/wrapped/link.rb +59 -0
  40. data/lib/wrapped/list.rb +353 -0
  41. data/lib/wrapped/matrix.rb +233 -0
  42. data/lib/wrapped/menu.rb +50 -0
  43. data/lib/wrapped/menuitem.rb +80 -0
  44. data/lib/wrapped/messagedialog.rb +51 -0
  45. data/lib/wrapped/progressbar.rb +48 -0
  46. data/lib/wrapped/progressdialog.rb +111 -0
  47. data/lib/wrapped/radio.rb +43 -0
  48. data/lib/wrapped/scintilla.rb +277 -0
  49. data/lib/wrapped/scrollbar-attributes.rb +141 -0
  50. data/lib/wrapped/scrollbox.rb +147 -0
  51. data/lib/wrapped/separator.rb +11 -0
  52. data/lib/wrapped/splitbox.rb +48 -0
  53. data/lib/wrapped/stretchbox.rb +42 -0
  54. data/lib/wrapped/submenu.rb +34 -0
  55. data/lib/wrapped/tabs.rb +149 -0
  56. data/lib/wrapped/text.rb +225 -0
  57. data/lib/wrapped/timer.rb +42 -0
  58. data/lib/wrapped/toggle.rb +98 -0
  59. data/lib/wrapped/tree.rb +465 -0
  60. data/lib/wrapped/val.rb +97 -0
  61. data/lib/wrapped/vbox.rb +51 -0
  62. data/lib/wrapped/widget.rb +137 -0
  63. data/lib/wrapped/zbox.rb +54 -0
  64. metadata +124 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4da0308e74093ebf8c476f7f3583ff762013eafe1be412894daf037c507829fe
4
+ data.tar.gz: 1d20c7fb3d37676ce2a375dbb6e7a29582cf97283cd0d31d1338dccc4bafb6ad
5
+ SHA512:
6
+ metadata.gz: febbb65f5bcdf7897ac7b7e504337ae8188e907b5242f5c8f95f9283318736d703be6806fe5519242e32107a17413c428b9cfa864bb513c41ae5f313d39c4c7e
7
+ data.tar.gz: cef7c7426dc4af9b20a23e3e27e1f8687264044459c5fd4a73128308a816771856e36c63188c1fcf95549913f22a2987af376e89938f1320c7c8a97ea4238bbd
data/LICENCE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT Licence (MIT)
2
+
3
+ Copyright (c) 2014-26, Peter Lane.
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.rdoc ADDED
@@ -0,0 +1,348 @@
1
+ = ruby-iup-binding
2
+
3
+ FFI binding for Ruby to the IUP[http://www.tecgraf.puc-rio.br/iup/] portable user interface toolkit.
4
+ The library provides both a low-level binding to the C library calls, and a high-level wrapping
5
+ of most widgets to give a more natural Ruby syntax.
6
+
7
+ == Install IUP Libraries
8
+
9
+ This library currently only works on Linux.
10
+
11
+ Install the shared libraries from
12
+ {IUP downloads}[https://www.tecgraf.puc-rio.br/iup/en/download_tips.html] for IUP,
13
+ IM and CD. The shared files must be placed where the system will find them: instead
14
+ of using the provided installer, I copied the files to /usr/local/lib on Ubuntu.
15
+
16
+ The required files are:
17
+
18
+ * libcd.so - from CD files
19
+ * libim.so - from IM files
20
+
21
+ And, from IUP files:
22
+
23
+ * libiupcontrols.so
24
+ * libiup_scintilla.so
25
+ * libiupimglib.so
26
+ * libiup.so
27
+ * libiupcd.so
28
+ * libiupim.so
29
+
30
+ == Simple Example
31
+
32
+ === With 'iup-ffi'
33
+
34
+ The module Iup provides a Ruby-flavoured syntax for creating a GUI, wrapping
35
+ each widget in a Ruby class with suitable mutators/accessors for the
36
+ attributes. For example:
37
+
38
+ require 'iup-ffi'
39
+ include Iup
40
+
41
+ mainloop do
42
+ btn = Button.new 'click me', ->{ puts 'clicked' } do
43
+ font 'Times, Bold 18'
44
+ end
45
+ puts "Button font is: ", btn.font
46
+
47
+ Dialog.new btn do
48
+ title 'Example program'
49
+ end.show
50
+ end
51
+
52
+ === With 'iup-ffi-plain'
53
+
54
+ A direct mapping to the C API of IUP is available by requiring 'iup-ffi-plain'.
55
+ This can be useful when converting code from other sources, or to access options
56
+ not available in Iup. For example:
57
+
58
+ require 'iup-ffi-plain'
59
+
60
+ IupLib.IupOpen 0, nil
61
+ IupLib.IupMessage "IupMessage Example", "Press the button"
62
+ IupLib.IupClose
63
+
64
+
65
+ == Behind the Scenes
66
+
67
+ In IUP, widgets are referenced using a +handle+. Behaviour is modified using
68
+ +attributes+ and +callbacks+.
69
+
70
+ Attributes are accessed by name through +get+ and +set+ methods. Instances of
71
+ Ruby classes represent each widget, container or other IUP object. Each class
72
+ provides one method per attribute. Attributes come in three forms, and a
73
+ consistent scheme is used to represent these attributes as Ruby methods.
74
+
75
+ === Attributes by name
76
+
77
+ Most attributes are accessed using a simple name.
78
+ e.g. to define a text widget as a multiline or single line. In C:
79
+
80
+ // to get the value of the attribute
81
+ IupGetAttribute(handle, "MULTILINE");
82
+ // to set the value of the attribute
83
+ IupSetAttribute(handle, "MULTILINE", "YES");
84
+
85
+ In Ruby, a method is provided with the same name as the attribute.
86
+ Use the method with no values to retrieve the attribute's current
87
+ value; pass an argument to set the attribute's value.
88
+
89
+ # to get the value of the attribute
90
+ text.multiline
91
+ # to set the value of the attribute
92
+ text.multiline 'YES'
93
+
94
+ === Attributes with id
95
+
96
+ Some of the attributes take an id or index. For example, in a list control,
97
+ items are placed using an index number. The attribute uses the index number
98
+ within the attribute name. In C:
99
+
100
+ // get the first item in a list
101
+ IupGetAttribute(handle, "ITEM1");
102
+ // set the first item in a list
103
+ IupSetAttribute(handle, "ITEM1", "value");
104
+
105
+ In Ruby, such attributes are represented by a method which takes
106
+ a parameter for the index:
107
+
108
+ # get the first item in a list
109
+ list.item 1
110
+ # set the first item in a list
111
+ list.item 1, 'value'
112
+
113
+ === Attributes with properties
114
+
115
+ A few attributes take a complex value, representing a property-value pair.
116
+ For example, in Scintilla the attribute +markerdefine+ takes as value
117
+ a setting, value pair. In C:
118
+
119
+ // get markerdefine folder
120
+ IupGetAttribute(handle, "MARKERDEFINE", "FOLDER");
121
+ // set markerdefine folder to plus
122
+ IupSetAttribute(handle, "MARKERDEFINE", "FOLDER=PLUS");
123
+
124
+ In Ruby, such attributes are represented by a method which takes a
125
+ parameter for the property:
126
+
127
+ # get markerdefine folder
128
+ scintilla.markerdefine 'folder'
129
+ # set markerdefine folder to plus
130
+ scintilla.markerdefine 'folder', 'plus'
131
+
132
+ === References
133
+
134
+ Some attributes take references to other objects. For example, setting the
135
+ image to display on a button. In IUP, images (and other widgets) may be given
136
+ names, called their "handle", which are referred to when attaching the image to
137
+ a button.
138
+
139
+ For example, in C (from http://www.tecgraf.puc-rio.br/iup/examples/C/button.c):
140
+
141
+ /* Defines released button's image size */
142
+ img_release = IupImage(16, 16, pixmap_release); // <1>
143
+
144
+ /* Associates img_release with handle "img_release" */
145
+ IupSetHandle( "img_release", img_release ); // <2>
146
+
147
+ /* Creates a button */
148
+ btn_image = IupButton ( "Button with image", "btn_image"); // <3>
149
+
150
+ /* Sets released, pressed and inactive button images */
151
+ IupSetAttribute( btn_image, "IMAGE", "img_release" ); // <4>
152
+
153
+ 1. Create an +Image+.
154
+ 2. Attach the name "img_release" to the image.
155
+ 3. Create a +Button+.
156
+ 4. Attach the image named "img_release" to the button.
157
+
158
+ In Ruby, instances of widgets can be used as arguments directly where appropriate, without naming them:
159
+
160
+ img_release = Image.new(16, 16, pixmap_release) # <1>
161
+ btn_image = Button.new('Button with image') do # <2>
162
+ image img_release # <3>
163
+ end
164
+
165
+ 1. Create an +Image+.
166
+ 2. Create a +Button+.
167
+ 3. Attach the image referenced in +img_release+ to the button.
168
+
169
+
170
+ == Differences to IUP
171
+
172
+ The Ruby library provides a not-quite-complete binding to IUP[http://www.tecgraf.puc-rio.br/iup/].
173
+
174
+ Some of the missing elements include:
175
+
176
+ * anything that has been _deprecated_. For example, the +multiline+ text
177
+ widget has been deprecated in favour of using a +text+ widget with its
178
+ +multiline+ attribute set to "yes".
179
+ * various platform specific functionality.
180
+ * dropfiles
181
+ * GetParam
182
+
183
+ Some control names have been changed, to be more informative:
184
+
185
+ * IUP name -> Iup-FFI Ruby name
186
+ * Sbox -> StretchBox
187
+ * Split -> SplitBox
188
+
189
+
190
+ == Using the FFI directly
191
+
192
+ To use the C API directly, without the Ruby wrapper:
193
+
194
+ require 'iup-ffi-plain'
195
+
196
+ This provides modules giving direct access to the C API of IUP through FFI:
197
+
198
+ * +IupLib+ the core IUP controls and functions.
199
+ * +ImgLib+ the image library.
200
+ * +ScintillaLib+ the Scintilla widget.
201
+
202
+ The names used echo those of the C API. For instance, +IupSetAttribute+ is
203
+ +IupLib.IupSetAttribute+. The C API is almost completely wrapped, and can be
204
+ accessed if necessary for anything not covered within "iup-ffi".
205
+
206
+ In most cases, calls to the C API will need the _handle_ of the widget: this is
207
+ available for the Ruby classes using the +handle+ attribute.
208
+
209
+ For example:
210
+
211
+ btn = Button.new 'text'
212
+ IupLib.IupSetAttribute btn.handle, 'FONT', 'TIMES, BOLD 18'
213
+
214
+ The layout widgets +Normalizer+ and +Zbox+ are only available through the C
215
+ API. To create a +Zbox+ with two children, use:
216
+
217
+ handle = IupLib.IupZbox child1.handle, :pointer, child2.handle, :pointer, nil
218
+
219
+ == Resources
220
+
221
+ === Cursors
222
+
223
+ Available cursors (see list and image at http://www.tecgraf.puc-rio.br/iup/en/attrib/iup_cursor.html):
224
+
225
+ * "NONE" or "NULL"
226
+ * "ARROW"
227
+ * "BUSY"
228
+ * "CROSS"
229
+ * "HAND"
230
+ * "HELP"
231
+ * "MOVE"
232
+ * "PEN"
233
+ * "RESIZE_N"
234
+ * "RESIZE_S"
235
+ * "RESIZE_NS"
236
+ * "RESIZE_W"
237
+ * "RESIZE_E"
238
+ * "RESIZE_WE"
239
+ * "RESIZE_NE
240
+ * "RESIZE_SW"
241
+ * "RESIZE_NW
242
+ * "RESIZE_SE"
243
+ * "TEXT"
244
+ * "UPARROW"
245
+
246
+ === Fonts
247
+
248
+ Fonts are described as a triple: "font-name, font-styles font-size". For consistency,
249
+ restrict use to the following:
250
+
251
+ Font-name:
252
+
253
+ * courier
254
+ * helvetica
255
+ * times
256
+
257
+ Font-style:
258
+
259
+ * bold
260
+ * italic
261
+ * strikeout
262
+ * underline
263
+
264
+ Font-size is in points (1/72 of an inch), or in pixels (with negative numbers).
265
+
266
+ Examples:
267
+
268
+ * "Times, bold 12"
269
+ * "Courier, bold italic 18"
270
+
271
+ === Images
272
+
273
+ Various ways of obtaining, creating and using images are supported by Iup::ImageWidget
274
+ and its child classes.
275
+
276
+ The library also includes a number of pre-defined images, which can be used by name
277
+ wherever an image is expected.
278
+ For details see: http://www.tecgraf.puc-rio.br/iup/en/iupimglib.html
279
+
280
+ For example, a button with an ActionOk icon:
281
+
282
+ Button.new do
283
+ image 'IUP_ActionOk'
284
+ end
285
+
286
+ The list of available images is:
287
+
288
+ * "IUP_ActionCancel"
289
+ * "IUP_ActionOk"
290
+ * "IUP_ArrowDown"
291
+ * "IUP_ArrowLeft"
292
+ * "IUP_ArrowRight"
293
+ * "IUP_ArrowUp"
294
+ * "IUP_EditCopy"
295
+ * "IUP_EditCut"
296
+ * "IUP_EditErase"
297
+ * "IUP_EditFind"
298
+ * "IUP_EditPaste"
299
+ * "IUP_EditRedo"
300
+ * "IUP_EditUndo"
301
+ * "IUP_FileClose"
302
+ * "IUP_FileCloseAll"
303
+ * "IUP_FileNew"
304
+ * "IUP_FileOpen"
305
+ * "IUP_FileProperties"
306
+ * "IUP_FileSave"
307
+ * "IUP_FileSaveAll"
308
+ * "IUP_FileText"
309
+ * "IUP_FontBold"
310
+ * "IUP_FontDialog"
311
+ * "IUP_FontItalic"
312
+ * "IUP_MediaForward"
313
+ * "IUP_MediaGotoBegin"
314
+ * "IUP_MediaGoToEnd"
315
+ * "IUP_MediaPause"
316
+ * "IUP_MediaPlay"
317
+ * "IUP_MediaRecord"
318
+ * "IUP_MediaReverse"
319
+ * "IUP_MediaRewind"
320
+ * "IUP_MediaStop"
321
+ * "IUP_MessageError"
322
+ * "IUP_MessageHelp"
323
+ * "IUP_MessageInfo"
324
+ * "IUP_NavigateHome"
325
+ * "IUP_NavigateRefresh"
326
+ * "IUP_Print"
327
+ * "IUP_PrintPreview"
328
+ * "IUP_ToolsColor"
329
+ * "IUP_ToolsSettings"
330
+ * "IUP_ToolsSortAscend"
331
+ * "IUP_ToolsSortDescend"
332
+ * "IUP_ViewFullScreen"
333
+ * "IUP_Webcam"
334
+ * "IUP_WindowsCascade"
335
+ * "IUP_WindowsTile"
336
+ * "IUP_Zoom"
337
+ * "IUP_ZoomActualSize"
338
+ * "IUP_ZoomIn"
339
+ * "IUP_ZoomOut"
340
+ * "IUP_ZoomSelection"
341
+ * "IUP_Tecgraf"
342
+ * "IUP_PUC-Rio"
343
+ * "IUP_BR"
344
+ * "IUP_Lua"
345
+ * "IUP_TecgrafPUC-Rio"
346
+ * "IUP_Petrobras"
347
+
348
+
@@ -0,0 +1,9 @@
1
+ # Provides the direct bindings through FFI to the IUP libraries.
2
+
3
+ require 'wrapped/constants'
4
+ require 'plain/iuplib'
5
+ require 'plain/iupcdlib'
6
+ require 'plain/iupcontrolslib'
7
+ require 'plain/iupimlib'
8
+ require 'plain/iupimglib'
9
+ require 'plain/scintilla-lib'
data/lib/iup-ffi.rb ADDED
@@ -0,0 +1,76 @@
1
+ # Requires files needed for wrapping the plain Iup libraries.
2
+ #
3
+ require 'ffi'
4
+ require 'rbconfig'
5
+
6
+ require 'iup-ffi-plain'
7
+
8
+ # helper code
9
+ require 'wrapped/attribute-builders'
10
+ require 'wrapped/attribute-reference'
11
+ require 'wrapped/dynamic-fill-methods'
12
+ require 'wrapped/common-attributes'
13
+ require 'wrapped/image-attributes'
14
+ require 'wrapped/callback-setter'
15
+ require 'wrapped/drag-drop-attributes'
16
+ require 'wrapped/internal-drag-drop-attributes'
17
+ require 'wrapped/scrollbar-attributes'
18
+
19
+ # the wrapper classes themselves
20
+ # -- core libraries
21
+ require 'wrapped/dialogs'
22
+
23
+ require 'wrapped/widget'
24
+ require 'wrapped/button'
25
+ require 'wrapped/canvas'
26
+ require 'wrapped/frame'
27
+ require 'wrapped/label'
28
+ require 'wrapped/link'
29
+ require 'wrapped/list'
30
+ require 'wrapped/progressbar'
31
+ require 'wrapped/tabs'
32
+ require 'wrapped/text'
33
+ require 'wrapped/toggle'
34
+ require 'wrapped/tree'
35
+ require 'wrapped/val'
36
+
37
+ # -- dialogs
38
+ require 'wrapped/colourdialog'
39
+ require 'wrapped/dialog'
40
+ require 'wrapped/filedialog'
41
+ require 'wrapped/fontdialog'
42
+ require 'wrapped/messagedialog'
43
+ require 'wrapped/progressdialog'
44
+
45
+ # -- resources
46
+ require 'wrapped/image'
47
+ require 'wrapped/menu'
48
+ require 'wrapped/menuitem'
49
+ require 'wrapped/separator'
50
+ require 'wrapped/submenu'
51
+ require 'wrapped/timer'
52
+
53
+ # -- layout
54
+ require 'wrapped/background-box'
55
+ require 'wrapped/expander'
56
+ require 'wrapped/fill'
57
+ require 'wrapped/gridbox'
58
+ require 'wrapped/hbox'
59
+ require 'wrapped/radio'
60
+ require 'wrapped/scrollbox'
61
+ require 'wrapped/splitbox'
62
+ require 'wrapped/stretchbox'
63
+ require 'wrapped/vbox'
64
+ require 'wrapped/zbox'
65
+
66
+ # -- extensions
67
+ require 'wrapped/scintilla'
68
+
69
+ # -- additional controls
70
+ require 'wrapped/colourbar'
71
+ require 'wrapped/dial'
72
+ require 'wrapped/matrix'
73
+
74
+ # -- global methods
75
+ require 'wrapped/iup-global'
76
+
@@ -0,0 +1,107 @@
1
+ # Binding to the CD library
2
+ #
3
+ # TODO:
4
+ # - images
5
+ # - various get functions
6
+ #
7
+ module CdLib # :nodoc:
8
+ extend FFI::Library
9
+
10
+ case RbConfig::CONFIG['host_os']
11
+ # when /mswin|mingw/
12
+ # ffi_lib 'lib/library/iup.dll'
13
+ when /linux|cygwin/
14
+ ffi_lib 'libiupcd'
15
+ else
16
+ raise Exception, 'iup libraries not found for this platform'
17
+ end
18
+
19
+ attach_function :cdContextIup, [], :pointer
20
+
21
+ # -- initialisation
22
+
23
+ attach_function :cdCreateCanvas, [:pointer, :pointer], :pointer
24
+ attach_function :cdKillCanvas, [:pointer], :void
25
+ attach_function :cdCanvasActivate, [:pointer], :int
26
+ attach_function :cdCanvasDeactivate, [:pointer], :void
27
+ attach_function :cdUseContextPlus, [:int], :int
28
+ # attach_function :cdInitContextPlus, [:void], :void
29
+ attach_function :cdCanvasGetContext, [:pointer], :pointer
30
+ attach_function :cdContextCaps, [:pointer], :int
31
+ attach_function :cdContextType, [:pointer], :int
32
+ attach_function :cdContextIsPlus, [:pointer], :int
33
+ attach_function :cdCanvasSimulate, [:pointer, :int], :int
34
+
35
+ attach_function :wdCanvasViewport, [:pointer, :int, :int, :int, :int], :void
36
+ attach_function :wdCanvasWindow, [:pointer, :double, :double, :double, :double], :void
37
+
38
+ # -- general attributes
39
+ attach_function :cdCanvasForeground, [:pointer, :long], :long
40
+ attach_function :cdCanvasBackground, [:pointer, :long], :long
41
+ attach_function :cdCanvasWriteMode, [:pointer, :int], :int
42
+
43
+ # -- control
44
+
45
+ attach_function :cdCanvasClear, [:pointer], :int
46
+
47
+ # -- begin/end blocks
48
+ attach_function :cdCanvasBegin, [:pointer, :int], :void
49
+ attach_function :cdCanvasVertex, [:pointer, :int, :int], :void
50
+ attach_function :cdCanvasEnd, [:pointer], :void
51
+ attach_function :cdCanvasPathSet, [:pointer, :int], :void
52
+
53
+ # --- marks
54
+ attach_function :cdCanvasPixel, [:pointer, :int, :int], :void
55
+ attach_function :cdCanvasMark, [:pointer, :int, :int], :void
56
+ attach_function :cdCanvasMarkType, [:pointer, :int], :int
57
+ attach_function :cdCanvasMarkSize, [:pointer, :int], :int
58
+
59
+ # --- lines
60
+
61
+ attach_function :cdCanvasLine, [:pointer, :int, :int, :int, :int], :void
62
+ attach_function :cdCanvasRect, [:pointer, :int, :int, :int, :int], :void
63
+ attach_function :cdCanvasArc, [:pointer, :int, :int, :int, :int, :double, :double], :void
64
+ attach_function :cdCanvasLineStyle, [:pointer, :int], :int
65
+ # attach_function :cdCanvasLineStyleDashes, [:pointer, :pointer, :int], :void # TODO: pointer to int array?
66
+ attach_function :cdCanvasLineWidth, [:pointer, :int], :int
67
+ attach_function :cdCanvasLineJoin, [:pointer, :int], :int
68
+ attach_function :cdCanvasLineCap, [:pointer, :int], :int
69
+
70
+ # --- filled areas
71
+
72
+ attach_function :cdCanvasBox, [:pointer, :int, :int, :int, :int], :void
73
+ attach_function :cdCanvasSector, [:pointer, :int, :int, :int, :int, :double, :double], :int
74
+ attach_function :cdCanvasChord, [:pointer, :int, :int, :int, :int, :double, :double], :int
75
+ attach_function :cdCanvasBackOpacity, [:pointer, :int], :int
76
+ attach_function :cdCanvasFillMode, [:pointer, :int], :int
77
+ attach_function :cdCanvasInteriorStyle, [:pointer, :int], :int
78
+ attach_function :cdCanvasHatch, [:pointer, :int], :int
79
+ attach_function :cdCanvasStipple, [:pointer, :int, :int, :string], :void
80
+
81
+ # --- text
82
+
83
+ attach_function :cdCanvasText, [:pointer, :int, :int, :string], :void
84
+ attach_function :cdCanvasFont, [:pointer, :string, :int, :int], :void
85
+ attach_function :cdCanvasNativeFont, [:pointer, :string], :string
86
+ attach_function :cdCanvasTextAlignment, [:pointer, :int], :int
87
+ attach_function :cdCanvasTextOrientation, [:pointer, :double], :double
88
+ # TODO: Get functions
89
+
90
+ # --- vector text
91
+
92
+ attach_function :cdCanvasVectorText, [:pointer, :int, :int, :string], :void
93
+ attach_function :cdCanvasVectorTextDirection, [:pointer, :int, :int, :int, :int], :void
94
+ attach_function :cdCanvasVectorTextSize, [:pointer, :int, :int, :string], :void
95
+ attach_function :cdCanvasVectorCharSize, [:pointer, :int], :void
96
+ attach_function :cdCanvasVectorFontSize, [:pointer, :double, :double], :void
97
+ attach_function :cdCanvasVectorFont, [:pointer, :string], :string
98
+ # TODO: Get functions
99
+
100
+ # --- client images
101
+
102
+ # --- server images
103
+
104
+ # -- colour functions
105
+
106
+ attach_function :cdEncodeColor, [:int, :int, :int], :long
107
+ end
@@ -0,0 +1,24 @@
1
+ module ControlsLib # :nodoc:
2
+ extend FFI::Library
3
+
4
+ case RbConfig::CONFIG['host_os']
5
+ # when /mswin|mingw/
6
+ # ffi_lib 'lib/library/iupcontrols.dll'
7
+ when /linux|cygwin/
8
+ ffi_lib 'libiupcontrols'
9
+ else
10
+ raise Exception, 'iup libraries not found for this platform'
11
+ end
12
+
13
+ attach_function :IupControlsOpen, [], :int
14
+
15
+ # -- additional
16
+ # attach_function :IupCells, [], :pointer
17
+ attach_function :IupColorbar, [], :pointer
18
+ # attach_function :IupColorBrowser, [], :pointer
19
+ attach_function :IupDial, [:string], :pointer
20
+ attach_function :IupMatrix, [:string], :pointer
21
+ # attach_function :IupMatrixList, [], :pointer
22
+ # attach_function :IupMatrixEx, [], :pointer
23
+ # attach_function :IupWebBrowser, [], :pointer
24
+ end
@@ -0,0 +1,14 @@
1
+ module ImgLib # :nodoc:
2
+ extend FFI::Library
3
+
4
+ case RbConfig::CONFIG['host_os']
5
+ when /mswin|mingw/
6
+ ffi_lib 'lib/library/iupimglib.lib'
7
+ when /linux|cygwin/
8
+ ffi_lib 'libiupimglib'
9
+ else
10
+ raise Exception, 'iup libraries not found for this platform'
11
+ end
12
+
13
+ attach_function :IupImageLibOpen, [], :void
14
+ end
@@ -0,0 +1,16 @@
1
+ module ImLib # :nodoc:
2
+ extend FFI::Library
3
+
4
+ case RbConfig::CONFIG['host_os']
5
+ # when /mswin|mingw/
6
+ # ffi_lib 'lib/library/iup.dll'
7
+ when /linux|cygwin/
8
+ ffi_lib 'libiupim'
9
+ else
10
+ raise Exception, 'iup libraries not found for this platform'
11
+ end
12
+
13
+ attach_function :IupLoadImage, [:string], :pointer
14
+ attach_function :IupSaveImage, [:string, :string], :int
15
+
16
+ end