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,309 @@
1
+ module Iup
2
+
3
+ # A top-level window, containing a single widget. Supports
4
+ # standard window decorations and a menu.
5
+ #
6
+ # === Example
7
+ #
8
+ # The following example displays a label widget within the dialog,
9
+ # setting the dialog's title and size before showing it.
10
+ #
11
+ # Iup::Dialog.new(label) do |d|
12
+ # d.title = " ... from IUP"
13
+ # d.size = "150x50"
14
+ # end.show
15
+ #
16
+ # Also see: Menu.
17
+ #
18
+ class Dialog < Iup::Widget
19
+ include DragDropAttributes
20
+ include AttributeReference
21
+
22
+ # Creates a new dialog for given widget.
23
+ # If a block is given, the new instance is yielded to it.
24
+ # * +widget+ - the child widget to display.
25
+ #
26
+ # Use +show+ to display the dialog after initialisation;
27
+ # some widgets require the dialog to be mapped first,
28
+ # and then shown after the widget is initialised.
29
+ def initialize widget
30
+ @handle = IupLib.IupDialog(widget.handle)
31
+
32
+ # run any provided block on instance, to set up further attributes
33
+ yield self if block_given?
34
+ end
35
+
36
+ # Hides the dialog from view.
37
+ def hide
38
+ IupLib.IupHide @handle
39
+ end
40
+
41
+ # Lays out the child widget and its contents, without showing the dialog.
42
+ def map
43
+ IupLib.IupMap @handle
44
+ self
45
+ end
46
+
47
+ # Shows the dialog at position (x, y).
48
+ # * +x+ - x-coordinate to use, or one of {show constants}[../Iup.html#Dialog+show+position]
49
+ # * +y+ - y-coordinate to use, or one of {show constants}[../Iup.html#Dialog+show+position]
50
+ def popup x=nil, y=nil
51
+ IupLib.IupPopup @handle, x.to_i, y.to_i
52
+ end
53
+
54
+ # Shows the dialog at the default screen position,
55
+ # or at (x, y) if specified.
56
+ # * +x+ - x-coordinate to use, or one of {show constants}[../Iup.html#Dialog+show+position]
57
+ # * +y+ - y-coordinate to use, or one of {show constants}[../Iup.html#Dialog+show+position]
58
+ def show x=nil, y=nil
59
+ if x.nil? and y.nil?
60
+ IupLib.IupShow @handle
61
+ else
62
+ IupLib.IupShowXY @handle, x.to_i, y.to_i
63
+ end
64
+ end
65
+
66
+ # -- attributes
67
+
68
+ # --- common
69
+
70
+ ##
71
+ # :attr: background
72
+ # RGB color for background of dialog and children.
73
+ define_attribute :background
74
+
75
+ ##
76
+ # :attr: border
77
+ # If set, displays a resize border around dialog.
78
+ define_attribute :border
79
+
80
+ ##
81
+ # :attr_reader: clientoffset
82
+ # returns current offset of box in its client as "widthxheight".
83
+ define_reader :clientoffset
84
+
85
+ ##
86
+ # :attr_reader: clientsize
87
+ # returns current size of box as "widthxheight".
88
+ define_reader :clientsize
89
+
90
+ ##
91
+ # :attr: cursor
92
+ # Defines the mouse shape / cursor for the dialog.
93
+
94
+ # --
95
+ def cursor
96
+ attribute_reference('CURSOR', ImageWidget, nil)
97
+ end
98
+
99
+ def cursor= image # :nodoc:
100
+ attribute_reference('CURSOR', ImageWidget, image)
101
+ end
102
+
103
+ ##
104
+ # :attr: expand
105
+ # Allows container to fill available space in indicated direction.
106
+ # Values 'no' / 'horizontal' / 'vertical' / 'yes'.
107
+ define_attribute :expand
108
+
109
+ ##
110
+ # :attr: rastersize
111
+ # Size of the dialog, in pixels, value as "widthxheight".
112
+ define_attribute :rastersize
113
+
114
+ ##
115
+ # :attr_reader: screenposition
116
+ # returns position in pixels on screen as "x,y".
117
+ define_reader :screenposition
118
+
119
+ ##
120
+ # :attr: tip
121
+ # Tooltip string.
122
+ define_attribute :tip
123
+
124
+ ##
125
+ # :attr: title
126
+ # Displayed as dialog title.
127
+ define_attribute :title
128
+
129
+ # --- exclusive
130
+
131
+ ##
132
+ # :attr: defaultenter
133
+ #
134
+ # Identifies button to activate when 'enter' is pressed.
135
+
136
+ # --
137
+ def defaultenter
138
+ attribute_reference('DEFAULTENTER', Button, nil)
139
+ end
140
+
141
+ def defaultenter= item # :nodoc:
142
+ attribute_reference('DEFAULTENTER', Button, item)
143
+ end
144
+
145
+ ##
146
+ # :attr: defaultesc
147
+ # Identifies button to activate when 'escape' is pressed.
148
+
149
+ # --
150
+ def defaultesc
151
+ attribute_reference('DEFAULTESC', Button, nil)
152
+ end
153
+
154
+ def defaultesc= item # :nodoc:
155
+ attribute_reference('DEFAULTESC', Button, item)
156
+ end
157
+
158
+ ##
159
+ # :attr: fullscreen
160
+ # 'no' / 'yes'.
161
+ define_attribute :fullscreen
162
+
163
+ ##
164
+ # :attr: icon
165
+ # An ImageWidget instance to use for dialog.
166
+
167
+ # --
168
+ def icon
169
+ attribute_reference('ICON', ImageWidget, nil)
170
+ end
171
+
172
+ def icon= item # :nodoc:
173
+ attribute_reference('ICON', ImageWidget, item)
174
+ end
175
+
176
+ ##
177
+ # :attr: maxbox
178
+ # 'no' / 'yes', to show maximize box on dialog.
179
+ define_attribute :maxbox
180
+
181
+ ##
182
+ # :attr: menu
183
+ # Assigns given item as the menu for this dialog.
184
+ # item may be an instance of Menu, or the string name for a menu.
185
+
186
+ # --
187
+ def menu
188
+ attribute_reference('MENU', Menu, nil)
189
+ end
190
+
191
+ def menu= item # :nodoc:
192
+ attribute_reference('MENU', Menu, item)
193
+ end
194
+
195
+ ##
196
+ # :attr: menubox
197
+ # 'no' / 'yes', to show system menu box on dialog.
198
+ define_attribute :menubox
199
+
200
+ ##
201
+ # :attr: minbox
202
+ # 'no' / 'yes', to show minimize box on dialog.
203
+ define_attribute :minbox
204
+
205
+ ##
206
+ # :attr_reader: modal
207
+ # Returns modal state of dialog.
208
+ define_reader :modal
209
+
210
+ ##
211
+ # :attr: parentdialog
212
+ # This dialog will be always in front of the parent dialog.
213
+ # If the parent is minimized, this dialog is automatically minimized.
214
+ # *Important* Closing the parent will also close the child, but the
215
+ # child dialog's CLOSE_CB method will not be called.
216
+
217
+ # --
218
+ def parentdialog
219
+ attribute_reference('PARENTDIALOG', Dialog, nil)
220
+ end
221
+
222
+ def parentdialog= parent # :nodoc:
223
+ attribute_reference('PARENTDIALOG', Dialog, parent)
224
+ end
225
+
226
+ ##
227
+ # :attr: placement
228
+ # 'normal' / 'maximized' / 'minimized' / 'full'.
229
+ define_attribute :placement
230
+
231
+ ##
232
+ # :attr: resize
233
+ # 'no' / 'yes'.
234
+ define_attribute :resize
235
+
236
+ ##
237
+ # :attr: shrink
238
+ # 'no' / 'yes', allows dialog's children to reduce their size if
239
+ # the dialog is made smaller.
240
+ define_attribute :shrink
241
+
242
+ ##
243
+ # :attr: startfocus
244
+ # Name of widget to gain focus when dialog first shown.
245
+
246
+ # --
247
+ def startfocus
248
+ attribute_reference('STARTFOCUS', Widget, nil)
249
+ end
250
+
251
+ def startfocus= item # :nodoc:
252
+ attribute_reference('STARTFOCUS', Widget, item)
253
+ end
254
+
255
+ # :section: Callbacks
256
+
257
+ ##
258
+ # :attr_writer: close_cb
259
+ # Sets callback called right before the dialog is closed.
260
+ # Callback must respond to +call+ and take no arguments.
261
+
262
+ # --
263
+ def close_cb= callback # :nodoc:
264
+ unless callback.arity.zero?
265
+ raise ArgumentError, 'close_cb callback must take 0 arguments'
266
+ end
267
+ cb = Proc.new do |ih|
268
+ callback.call
269
+ end
270
+ define_callback cb, 'CLOSE_CB', :plain
271
+ end
272
+
273
+ ##
274
+ # :attr_writer: resize_cb
275
+ # Callback called when the dialog size is changed.
276
+ # Callback must respond to +call+ and takes 2 arguments: (width, height).
277
+ # * +width+ -internal width of canvas (client width)
278
+ # * +height+ - internal height of canvas (client height)
279
+
280
+ # --
281
+ def resize_cb= callback # :nodoc:
282
+ unless callback.arity == 2
283
+ raise ArgumentError, 'resize_cb callback must take 2 arguments: (width, height)'
284
+ end
285
+ cb = Proc.new do |ih, width, height|
286
+ callback.call width, height
287
+ end
288
+ define_callback cb, 'RESIZE_CB', :ii_i
289
+ end
290
+
291
+ ##
292
+ # :attr_writer: show_cb
293
+ # Sets callback called right after the dialog visible state changes,
294
+ # such as from shown to hidden, or maximised to minimised.
295
+ # Callback must respond to +call+ and takes one argument: (state)
296
+ # * +state+ - of the change, see {state constants}[../Iup.html#Dialog+show_cb+state]
297
+
298
+ # --
299
+ def show_cb= callback #:nodoc:
300
+ unless callback.arity == 1
301
+ raise ArgumentError, 'show_cb callback must take 1 argument: (state)'
302
+ end
303
+ cb = Proc.new do |ih, state|
304
+ callback.call state
305
+ end
306
+ define_callback cb, 'SHOW_CB', :i_i
307
+ end
308
+ end
309
+ end
@@ -0,0 +1,98 @@
1
+ module Iup
2
+
3
+ # defines attributes and methods for drag and drop
4
+ #
5
+ # Steps to use the Drag & Drop support in an IUP application:
6
+ #
7
+ # AT SOURCE::
8
+ #
9
+ # * Enable the element as source using the attribute DRAGSOURCE=YES;
10
+ # * Define the data types supported by the element for the drag operation using the DRAGTYPES attribute;
11
+ # * Register the required callbacks DRAGBEGIN_CB, DRAGDATASIZE_CB and DRAGDATA_CB for drag handling. DRAGEND_CB is the only optional drag callback, all other callbacks and attributes must be set.
12
+ #
13
+ # AT TARGET::
14
+ #
15
+ # * Enable the element as target using the attribute DROPTARGET=YES;
16
+ # * Define the data types supported by the element for the drop using the DROPTYPES attribute;
17
+ # * Register the required callback DROPDATA_CB for handling the data received. This callback and all the drop target attributes must be set too. DROPMOTION_CB is the only optional drop callback.
18
+ #
19
+ module DragDropAttributes
20
+ extend AttributeBuilders
21
+
22
+ # attributes for drag-n-drop
23
+
24
+ ##
25
+ # :attr: dragsource
26
+ define_attribute :dragsource
27
+
28
+ ##
29
+ # :attr: dragtypes
30
+ define_attribute :dragtypes
31
+
32
+ ##
33
+ # :attr: dragsourcemove
34
+ define_attribute :dragsourcemove
35
+
36
+ ##
37
+ # :attr: droptarget
38
+ define_attribute :droptarget
39
+
40
+ ##
41
+ # :attr: droptypes
42
+ define_attribute :droptypes
43
+
44
+ # :section: Callbacks
45
+ # callbacks for drag-n-drop
46
+
47
+ ##
48
+ # :attr_writer: dragbegin_cb
49
+
50
+ # --
51
+ def dragbegin_cb= callback
52
+ define_callback callback, 'DRAGBEGIN_CB', :ii_i
53
+ end
54
+
55
+ ##
56
+ # :attr_writer: dragdatasize_cb
57
+
58
+ # --
59
+ def dragdatasize_cb= callback
60
+ define_callback callback, 'DRAGDATASIZE_CB', :s_i
61
+ end
62
+
63
+ ##
64
+ # :attr_writer: dragdata_cb
65
+ # Note: user data assumed to be a string
66
+
67
+ # --
68
+ def dragdata_cb= callback
69
+ define_callback callback, 'DRAGDATA_CB', :ssi_i
70
+ end
71
+
72
+ ##
73
+ # :attr_writer: dragend_cb
74
+
75
+ # --
76
+ def dragend_cb= callback
77
+ define_callback callback, 'DRAGEND_CB', :i_i
78
+ end
79
+
80
+ ##
81
+ # :attr_writer: dropdata_cb
82
+ # Note: user data assumed to be a string
83
+
84
+ # --
85
+ def dropdata_cb= callback
86
+ define_callback callback, 'DROPDATA_CB', :ssiii_i
87
+ end
88
+
89
+ ##
90
+ # :attr_writer: dropmotion_cb
91
+
92
+ # --
93
+ def dropmotion_cb= callback
94
+ define_callback callback, 'DROPMOTION_CB', :iis_i
95
+ end
96
+ end
97
+ end
98
+
@@ -0,0 +1,22 @@
1
+ module Iup
2
+
3
+ # Methods for containers where the child elements can be added after construction.
4
+ #
5
+ module DynamicFillMethods
6
+
7
+ # Inserts an element at the end of the container,
8
+ # after the last element of the container.
9
+ def append child
10
+ IupLib.IupAppend(@handle, child.handle)
11
+ end
12
+
13
+ # Inserts an element before another child of the container.
14
+ def insert(ref_child, new_child)
15
+ if ref_child.nil?
16
+ IupLib.IupInsert(@handle, nil, new_child.handle)
17
+ else
18
+ IupLib.IupInsert(@handle, ref_child.handle, new_child.handle)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,128 @@
1
+ module Iup
2
+
3
+ # An expandable container for a single widget.
4
+ # The user can show or hide the child widget, as required.
5
+ #
6
+ # === Example
7
+ #
8
+ # The following places a button in an expandable area, with a
9
+ # blue title:
10
+ #
11
+ # bt = Iup::Button.new('Button ONE')
12
+ #
13
+ # exp = Iup::Expander.new(bt) do |e|
14
+ # e.title = 'Expander title'
15
+ # e.forecolor = '0 0 255'
16
+ # end
17
+ #
18
+ class Expander < Iup::Widget
19
+
20
+ # Creates an instance of the Expander.
21
+ # If a block is given, the new instance is yielded to it.
22
+ # * +child+ - the child widget to display.
23
+ def initialize child
24
+ @handle = IupLib.IupExpander(child.handle)
25
+
26
+ yield self if block_given?
27
+ end
28
+
29
+ # -- attributes
30
+
31
+ ##
32
+ # :attr: autoshow
33
+ # If set, child will be shown when mouse hovers over container.
34
+ # Values 'yes' / 'no'.
35
+ define_attribute :autoshow
36
+
37
+ ##
38
+ # :attr: backcolor
39
+ # Color of background in title area, as "r g b".
40
+ define_attribute :backcolor
41
+
42
+ ##
43
+ # :attr: barposition
44
+ # Position of expander bar, as 'top' / 'bottom' / 'left' / 'right'.
45
+ define_attribute :barposition
46
+
47
+ ##
48
+ # :attr: barsize
49
+ # Size of bar - defaults to text line height + 5.
50
+ define_attribute :barsize
51
+
52
+ ##
53
+ # :attr_reader: clientoffset
54
+ # Returns current offset of box in its client as "widthxheight".
55
+ define_reader :clientoffset
56
+
57
+ ##
58
+ # :attr_reader: clientsize
59
+ # Returns current size of box as "widthxheight".
60
+ define_reader :clientsize
61
+
62
+ ##
63
+ # :attr: expand
64
+ # Allows container to fill available space in indicated direction.
65
+ # Values 'no' / 'horizontal' / 'vertical' / 'yes'.
66
+ define_attribute :expand
67
+
68
+ ##
69
+ # :attr: forecolor
70
+ # Color of text in title area, as "r g b".
71
+ define_attribute :forecolor
72
+
73
+ ##
74
+ # :attr_reader: position
75
+ # Returns position in pixels within client window as "x,y".
76
+ define_attribute :position
77
+
78
+ ##
79
+ # :attr: rastersize
80
+ # Size of the container, in pixels, value as "widthxheight".
81
+ define_attribute :rastersize
82
+
83
+ ##
84
+ # :attr: state
85
+ # Show or hide child, as 'open' / 'close'.
86
+ define_attribute :state
87
+
88
+ ##
89
+ # :attr: title
90
+ # Displayed on box in title area.
91
+ define_attribute :title
92
+
93
+ # :section: Callbacks
94
+
95
+ ##
96
+ # :attr_writer: action
97
+ # Callback called after the expander state is interactively changed.
98
+ # Callback must respond to +call+ and take no arguments.
99
+
100
+ # --
101
+ def action= callback
102
+ unless callback.arity.zero?
103
+ raise ArgumentError, 'action callback must take 0 arguments'
104
+ end
105
+ cb = Proc.new do |ih|
106
+ callback.call
107
+ end
108
+ define_callback cb, 'ACTION', :plain
109
+ end
110
+
111
+ ##
112
+ # :attr_writer: openclose_cb
113
+ # Callback called before the expander state is interactively changed.
114
+ # Callback must respond to +call+ and take no arguments, returning
115
+ # new state or Iup::IGNORE.
116
+
117
+ # --
118
+ def openclose_cb= callback
119
+ unless callback.arity.zero?
120
+ raise ArgumentError, 'openclose_cb callback must take 0 arguments'
121
+ end
122
+ cb = Proc.new do |ih|
123
+ callback.call
124
+ end
125
+ define_callback cb, 'OPENCLOSE_CB', :plain
126
+ end
127
+ end
128
+ end