ruby-iup 0.0.1-i386-mswin32

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 (138) hide show
  1. data/doc/README +10 -0
  2. data/doc/build_install.txt +77 -0
  3. data/examples/README +16 -0
  4. data/examples/ctrl/cbox.rb +221 -0
  5. data/examples/ctrl/checkboard.rb +33 -0
  6. data/examples/ctrl/degrade.rb +73 -0
  7. data/examples/ctrl/example1.rb +53 -0
  8. data/examples/ctrl/example2.rb +39 -0
  9. data/examples/ctrl/iupcolorbar.rb +95 -0
  10. data/examples/ctrl/iupcolorbrowser.rb +45 -0
  11. data/examples/ctrl/iupdial.rb +117 -0
  12. data/examples/ctrl/iupgauge.rb +242 -0
  13. data/examples/ctrl/iupgetcolor.rb +8 -0
  14. data/examples/ctrl/iupgetparam.rb +62 -0
  15. data/examples/ctrl/iupglcanvas.rb +172 -0
  16. data/examples/ctrl/iupmask.rb +15 -0
  17. data/examples/ctrl/iupmatrix.rb +39 -0
  18. data/examples/ctrl/iupplot2.rb +603 -0
  19. data/examples/ctrl/iuptabs.rb +22 -0
  20. data/examples/ctrl/iuptree.rb +190 -0
  21. data/examples/ctrl/iupval.rb +71 -0
  22. data/examples/ctrl/numbering.rb +46 -0
  23. data/examples/ctrl/sample.rb +166 -0
  24. data/examples/dlg/iupalarm.rb +14 -0
  25. data/examples/dlg/iupfiledlg.rb +19 -0
  26. data/examples/dlg/iupgetfile.rb +19 -0
  27. data/examples/dlg/iuplistdialog.rb +26 -0
  28. data/examples/dlg/iupmessage.rb +5 -0
  29. data/examples/dlg/iupscanf.rb +17 -0
  30. data/examples/elem/iupbutton.rb +197 -0
  31. data/examples/elem/iupcanvas.rb +27 -0
  32. data/examples/elem/iupcanvas2.rb +113 -0
  33. data/examples/elem/iupcanvas3.rb +62 -0
  34. data/examples/elem/iupdialog.rb +71 -0
  35. data/examples/elem/iupdialog2.rb +25 -0
  36. data/examples/elem/iupfill.rb +51 -0
  37. data/examples/elem/iupframe.rb +25 -0
  38. data/examples/elem/iuphbox.rb +68 -0
  39. data/examples/elem/iupimage.rb +113 -0
  40. data/examples/elem/iupitem.rb +60 -0
  41. data/examples/elem/iuplabel.rb +57 -0
  42. data/examples/elem/iuplist.rb +41 -0
  43. data/examples/elem/iuplist2.rb +125 -0
  44. data/examples/elem/iupmenu.rb +32 -0
  45. data/examples/elem/iupmultiline.rb +24 -0
  46. data/examples/elem/iupmultiline2.rb +156 -0
  47. data/examples/elem/iupradio.rb +32 -0
  48. data/examples/elem/iupseparator.rb +81 -0
  49. data/examples/elem/iupsubmenu.rb +85 -0
  50. data/examples/elem/iuptext.rb +61 -0
  51. data/examples/elem/iuptimer.rb +36 -0
  52. data/examples/elem/iuptoggle.rb +110 -0
  53. data/examples/elem/iupvbox.rb +87 -0
  54. data/examples/elem/iupzbox.rb +60 -0
  55. data/examples/elem/mdisample.rb +376 -0
  56. data/examples/elem/progressbar.rb +294 -0
  57. data/examples/elem/scrollbar.rb +66 -0
  58. data/examples/elem/tray.rb +90 -0
  59. data/examples/func/iupgetattribute.rb +32 -0
  60. data/examples/func/iupidle.rb +48 -0
  61. data/ext/extconf.rb +27 -0
  62. data/ext/iup-win32/cd.dll +0 -0
  63. data/ext/iup-win32/cd.lib +0 -0
  64. data/ext/iup-win32/cdcontextplus.dll +0 -0
  65. data/ext/iup-win32/cdcontextplus.lib +0 -0
  66. data/ext/iup-win32/cdlua51.lib +0 -0
  67. data/ext/iup-win32/cdluacontextplus51.lib +0 -0
  68. data/ext/iup-win32/cdluaim51.lib +0 -0
  69. data/ext/iup-win32/cdluapdf51.lib +0 -0
  70. data/ext/iup-win32/cdpdf.dll +0 -0
  71. data/ext/iup-win32/cdpdf.lib +0 -0
  72. data/ext/iup-win32/freetype6.dll +0 -0
  73. data/ext/iup-win32/freetype6.lib +0 -0
  74. data/ext/iup-win32/im.dll +0 -0
  75. data/ext/iup-win32/im_avi.dll +0 -0
  76. data/ext/iup-win32/im_capture.dll +0 -0
  77. data/ext/iup-win32/im_ecw.dll +0 -0
  78. data/ext/iup-win32/im_fftw.dll +0 -0
  79. data/ext/iup-win32/im_jp2.dll +0 -0
  80. data/ext/iup-win32/im_process.dll +0 -0
  81. data/ext/iup-win32/im_wmv.dll +0 -0
  82. data/ext/iup-win32/iup.dll +0 -0
  83. data/ext/iup-win32/iup.lib +0 -0
  84. data/ext/iup-win32/iup_pplot.dll +0 -0
  85. data/ext/iup-win32/iup_pplot.lib +0 -0
  86. data/ext/iup-win32/iupcd.dll +0 -0
  87. data/ext/iup-win32/iupcd.lib +0 -0
  88. data/ext/iup-win32/iupcontrols.dll +0 -0
  89. data/ext/iup-win32/iupcontrols.lib +0 -0
  90. data/ext/iup-win32/iupgl.dll +0 -0
  91. data/ext/iup-win32/iupgl.lib +0 -0
  92. data/ext/iup-win32/iupim.dll +0 -0
  93. data/ext/iup-win32/iupim.lib +0 -0
  94. data/ext/iup-win32/iupimglib.dll +0 -0
  95. data/ext/iup-win32/iupimglib.lib +0 -0
  96. data/ext/iup-win32/iuplua51.lib +0 -0
  97. data/ext/iup-win32/iuplua_pplot51.lib +0 -0
  98. data/ext/iup-win32/iupluacd51.lib +0 -0
  99. data/ext/iup-win32/iupluacontrols51.lib +0 -0
  100. data/ext/iup-win32/iupluagl51.lib +0 -0
  101. data/ext/iup-win32/iupluaim51.lib +0 -0
  102. data/ext/iup-win32/iupluaimglib51.lib +0 -0
  103. data/ext/iup-win32/iupluaole51.lib +0 -0
  104. data/ext/iup-win32/iupole.dll +0 -0
  105. data/ext/iup-win32/iupole.lib +0 -0
  106. data/ext/iup-win32/iupstub.lib +0 -0
  107. data/ext/iup-win32/pdflib.dll +0 -0
  108. data/ext/iup-win32/pdflib.lib +0 -0
  109. data/ext/iup.c +1261 -0
  110. data/ext/mkrf_conf.rb +72 -0
  111. data/ext/rb_cd.h +1525 -0
  112. data/ext/rb_iup.h +2446 -0
  113. data/ext/rb_iup_pplot.h +129 -0
  114. data/ext/rb_iupcb.h +13 -0
  115. data/ext/rb_iupcbox.h +40 -0
  116. data/ext/rb_iupcells.h +15 -0
  117. data/ext/rb_iupcolorbar.h +17 -0
  118. data/ext/rb_iupcompat.h +237 -0
  119. data/ext/rb_iupcontrols.h +28 -0
  120. data/ext/rb_iupdef.h +3 -0
  121. data/ext/rb_iupdial.h +24 -0
  122. data/ext/rb_iupgauge.h +15 -0
  123. data/ext/rb_iupgc.h +18 -0
  124. data/ext/rb_iupgetparam.h +72 -0
  125. data/ext/rb_iupgl.h +58 -0
  126. data/ext/rb_iupim.h +25 -0
  127. data/ext/rb_iupmask.h +189 -0
  128. data/ext/rb_iupmatrix.h +80 -0
  129. data/ext/rb_iupole.h +24 -0
  130. data/ext/rb_iupsbox.h +23 -0
  131. data/ext/rb_iupspeech.h +25 -0
  132. data/ext/rb_iupspin.h +29 -0
  133. data/ext/rb_iuptabs.h +29 -0
  134. data/ext/rb_iuptree.h +94 -0
  135. data/ext/rb_iupval.h +24 -0
  136. data/lib/README +1 -0
  137. data/lib/iup.so +0 -0
  138. metadata +187 -0
@@ -0,0 +1,39 @@
1
+ require 'rubygems'
2
+ require 'iup'
3
+
4
+ def createtree()
5
+ tree = Iup.Tree(:size=>'80x80',:expand=>'YES',:font=>'COURIER_NORMAL_10',:name=>'Figures')
6
+ tree.addbranch='3D'
7
+ tree.addbranch='2D'
8
+ tree.addleaf1='trapeze'
9
+ tree.addbranch1='parallelogram'
10
+ tree.addleaf2='diamond'
11
+ tree.addleaf2='square'
12
+ tree.addbranch4='triangle'
13
+ tree.addleaf5='scalenus'
14
+ tree.addleaf5='isoceles'
15
+ tree.addleaf5='equilateral'
16
+ tree.value='6'
17
+ tree.addexpanded='NO'
18
+ return tree
19
+ end
20
+
21
+
22
+ tree = createtree()
23
+ sbox = Iup.Sbox(:elem=>tree,:direction=>'EAST')
24
+
25
+ cv = Iup.Canvas(:expand=>'YES')
26
+
27
+ ml = Iup.MultiLine(:expand=>'YES')
28
+ sbox2 = Iup.Sbox(:elem=>ml,:direction=>'WEST')
29
+
30
+ vbox = Iup.Hbox([sbox, cv, sbox2])
31
+
32
+ lb = Iup.Label(:title=>"This is a label",:expand=>'NO')
33
+ sbox3 = Iup.Sbox(:elem=>lb,:direction=>'NORTH')
34
+ dg = Iup.Dialog(Iup.Vbox([vbox, sbox3]))
35
+
36
+ dg.Show
37
+ Iup.MainLoop
38
+ dg.Destroy
39
+
@@ -0,0 +1,95 @@
1
+ require 'rubygems'
2
+ require 'iup'
3
+
4
+
5
+ cdcanvas = nil
6
+
7
+ repaint_cb = lambda do |h,posx,posy|
8
+ return Iup::DEFAULT if cdcanvas==nil
9
+
10
+ cdcanvas.CanvasActivate()
11
+ cdcanvas.CanvasClear()
12
+
13
+ cdcanvas.CanvasBegin(Cd::FILL)
14
+ cdcanvas.CanvasVertex(50,50)
15
+ cdcanvas.CanvasVertex(150,50)
16
+ cdcanvas.CanvasVertex(100,150)
17
+ cdcanvas.CanvasEnd()
18
+
19
+ Iup::DEFAULT
20
+ end
21
+
22
+
23
+ cb = Iup.Colorbar()
24
+ cb.rastersize = "70x"
25
+ cb.expand = "VERTICAL"
26
+ cb.num_parts = 2
27
+ cb.show_secondary = "YES"
28
+ cb.preview_size = 60
29
+ cb.squared = "NO"
30
+
31
+ cnvs = Iup.Canvas()
32
+ cnvs.action = repaint_cb
33
+
34
+ # Sets size, mininum and maximum values, position and size of the thumb
35
+ # of the horizontal scrollbar of the canvas
36
+ cnvs.rastersize = "200x300"
37
+
38
+ cb.select_cb = lambda do |h,cell,type|
39
+ ri,gi,bi = h["CELL#{cell}"].scan(/\d+/)
40
+ cd_color = Cd.EncodeColor(ri.to_i,gi.to_i,bi.to_i)
41
+
42
+ cdcanvas.CanvasActivate()
43
+ if (type==Iup::PRIMARY)
44
+ cdcanvas.CanvasSetForeground(cd_color)
45
+ else
46
+ cdcanvas.CanvasSetBackground(cd_color)
47
+ end
48
+ repaint_cb.call(nil,0,0)
49
+
50
+ Iup::DEFAULT
51
+ end
52
+
53
+ cb.cell_cb = lambda do |h,cell|
54
+ ri,gi,bi = h["CELL#{cell}"].scan(/\d+/)
55
+ res = Iup.GetColor(Iup::MOUSEPOS, Iup::MOUSEPOS)
56
+ if res
57
+ r,g,b = res
58
+ str = "#{r} #{g} #{b}"
59
+ cdcanvas.CanvasActivate()
60
+ cdcanvas.CanvasSetForeground(Cd.EncodeColor(r,g,b))
61
+ repaint_cb.call(nil,0,0)
62
+ return str
63
+ end
64
+ nil
65
+ end
66
+
67
+ cb.switch_cb = lambda do |h,primcell,seccell|
68
+ cdcanvas.CanvasActivate()
69
+ fgcolor = cdcanvas.CanvasForeground(Cd::QUERY)
70
+ cdcanvas.CanvasSetForeground(Cd.CanvasBackground(Cd::QUERY))
71
+ cdcanvas.CanvasSetBackground(fgcolor)
72
+ repaint_cb.call(nil,0,0)
73
+ end
74
+
75
+
76
+ # Creates a dialog with a vbox containing the canvas and the colorbar.
77
+ dlg = Iup.Dialog(Iup.Hbox([cnvs,cb]))
78
+
79
+ # Sets the dialog's title, so that it is mapped properly
80
+ dlg.title = "IupColorbar"
81
+
82
+ # Maps the dialog. This must be done before the creation of the CD canvas
83
+ dlg.Map
84
+
85
+ # Creates a CD canvas of type CD_IUP
86
+ cdcanvas = Cd.CreateCanvas(Cd.CD_IUP, cnvs)
87
+
88
+ # Shows dialog on the center of the screen
89
+ dlg.Show
90
+
91
+ # Initializes IUP main loop
92
+ Iup.MainLoop
93
+
94
+ dlg.Destroy
95
+
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'iup'
3
+
4
+
5
+ text_red = Iup.Text()
6
+ text_green = Iup.Text()
7
+ text_blue = Iup.Text()
8
+
9
+ clrbrwsr_drag_cb = lambda do |h,r,g,b|
10
+ text_red.value = r
11
+ text_green.value = g
12
+ text_blue.value = b
13
+ Iup.LoopStep
14
+
15
+ Iup::DEFAULT
16
+ end
17
+
18
+ clrbrwsr = Iup.ColorBrowser()
19
+ clrbrwsr.drag_cb = clrbrwsr_drag_cb
20
+ clrbrwsr.change_cb = clrbrwsr_drag_cb
21
+
22
+ # Creates a vbox */
23
+ vbox = Iup.Vbox([
24
+ Iup.Fill(),
25
+ text_red,
26
+ Iup.Fill(),
27
+ text_green,
28
+ Iup.Fill(),
29
+ text_blue,
30
+ Iup.Fill()
31
+ ])
32
+
33
+ # Creates an hbox */
34
+ hbox_final = Iup.Hbox([clrbrwsr, Iup.Fill(), vbox])
35
+
36
+ # Creates a dialog */
37
+ dlg = Iup.Dialog(hbox_final,:title=>"IupColorBrowser")
38
+
39
+ # Shows dialog in the center of the screen */
40
+ dlg.ShowXY(Iup::CENTER, Iup::CENTER)
41
+
42
+ # Initializes IUP main loop */
43
+ Iup.MainLoop
44
+
45
+ dlg.Destroy()
@@ -0,0 +1,117 @@
1
+ require 'rubygems'
2
+ require 'iup'
3
+
4
+ lbl_h = Iup.Label(:title=>"0",:alignment=>"ACENTER",:size=>"30x")
5
+ lbl_v = Iup.Label(:title=>"0",:alignment=>"ACENTER",:size=>"30x")
6
+ lbl_c = Iup.Label(:title=>"0",:alignment=>"ACENTER",:size=>"30x")
7
+
8
+
9
+ dial_v = Iup.Dial(:type=>"VERTICAL",:unit=>"DEGREES",:size=>"100x100")
10
+ dial_h = Iup.Dial(:type=>"HORIZONTAL",:density=>0.1)
11
+ dial_c = Iup.Dial(:type=>"CIRCULAR")
12
+
13
+ dlg = Iup.Dialog(
14
+ Iup.Hbox([
15
+ Iup.Fill(),
16
+ Iup.Vbox([
17
+ Iup.Frame(
18
+ Iup.Vbox([
19
+ Iup.Hbox([
20
+ Iup.Fill(),
21
+ dial_v,
22
+ Iup.Fill()
23
+ ]),
24
+ Iup.Hbox([
25
+ Iup.Fill(),
26
+ lbl_v,
27
+ Iup.Fill()
28
+ ])
29
+ ])
30
+ ),
31
+ Iup.Fill(),
32
+ Iup.Frame(
33
+ Iup.Vbox([
34
+ Iup.Hbox([
35
+ Iup.Fill(),
36
+ dial_h,
37
+ Iup.Fill()
38
+ ]),
39
+ Iup.Hbox([
40
+ Iup.Fill(),
41
+ lbl_h,
42
+ Iup.Fill()
43
+ ])
44
+ ])
45
+ ),
46
+ Iup.Fill(),
47
+ Iup.Frame(
48
+ Iup.Vbox([
49
+ Iup.Hbox([
50
+ Iup.Fill(),
51
+ dial_c,
52
+ Iup.Fill()
53
+ ]),
54
+ Iup.Hbox([
55
+ Iup.Fill(),
56
+ lbl_c,
57
+ Iup.Fill()
58
+ ])
59
+ ])
60
+ ),
61
+ Iup.Fill()
62
+ ]),
63
+ Iup.Fill()
64
+ ])
65
+ )
66
+ dlg.title = "IupDial"
67
+
68
+ printdial = lambda do |c,a,color|
69
+ case c['type']
70
+ when 'VERTICAL'
71
+ label = lbl_v
72
+ when 'HORIZONTAL'
73
+ label = lbl_h
74
+ when 'CIRCULAR'
75
+ label = lbl_c
76
+ end
77
+
78
+ if label
79
+ label.title = "%.3g" % a
80
+ label.bgcolor = color
81
+ end
82
+ end
83
+
84
+ mousemove = lambda do |c,a|
85
+ printdial.call(c, a, "0 255 0")
86
+ Iup::DEFAULT
87
+ end
88
+
89
+ button_press = lambda do |c,a|
90
+ printdial.call(c, a, "255 0 0")
91
+ Iup::DEFAULT
92
+ end
93
+
94
+ button_release = lambda do |c,a|
95
+ printdial.call(c, a,nil)
96
+ Iup::DEFAULT
97
+ end
98
+
99
+ dial_v.button_press_cb = button_press
100
+ dial_c.button_press_cb = button_press
101
+ dial_h.button_press_cb = button_press
102
+
103
+ dial_v.button_release_cb = button_release
104
+ dial_c.button_release_cb = button_release
105
+ dial_h.button_release_cb = button_release
106
+
107
+ dial_v.mousemove_cb = mousemove
108
+ dial_c.mousemove_cb = mousemove
109
+ dial_h.mousemove_cb = mousemove
110
+
111
+ # Shows dialog in the center of the screen */
112
+ dlg.ShowXY(Iup::CENTER, Iup::CENTER)
113
+
114
+ # Initializes IUP main loop */
115
+ Iup.MainLoop
116
+
117
+ dlg.Destroy
@@ -0,0 +1,242 @@
1
+ require 'rubygems'
2
+ require 'iup'
3
+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,2,2,1,1,1,2,2,2,2,1,2,2,2,2,2,
116
+ 2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,
117
+ 2,2,2,2,2,2,2,1,1,2,2,2,2,1,1,2,2,2,2,2,2,2,
118
+ 2,2,2,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,
119
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
120
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
121
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
122
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
123
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
124
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
125
+
126
+
127
+
128
+ gauge = Iup.Gauge(:expand=>"YES")
129
+ # gauge.max = 3.5
130
+ # gauge.min = 0.7
131
+
132
+ img_start = Iup.Image(22,22, pixmap_start)
133
+ img_play = Iup.Image(22,22, pixmap_play)
134
+ img_forward = Iup.Image(22,22, pixmap_forward)
135
+ img_rewind = Iup.Image(22,22, pixmap_rewind)
136
+ img_show = Iup.Image(22,22, pixmap_show)
137
+
138
+ img_start["1"]= "0 0 0"
139
+ img_start["2"]= Iup::BGCOLOR
140
+ img_play["1"]= "0 0 0"
141
+ img_play["2"]= Iup::BGCOLOR
142
+ img_forward["1"]= "0 0 0"
143
+ img_forward["2"]= Iup::BGCOLOR
144
+ img_rewind["1"]= "0 0 0"
145
+ img_rewind["2"]= Iup::BGCOLOR
146
+ img_show["1"]= "0 0 0"
147
+ img_show["2"]= Iup::BGCOLOR
148
+
149
+ btn_start = Iup.Button(:title=>"start",:image => img_start,:tip => "Start")
150
+ btn_pause = Iup.Button(:title=>"pause",:image => img_play,:tip => "Pause")
151
+ btn_accelerate = Iup.Button(:title=>"accelerate",:image => img_forward,:tip => "Accelerate")
152
+ btn_decelerate = Iup.Button(:title=>"decelerate",:image => img_rewind,:tip => "Decelerate" )
153
+ btn_show = Iup.Button(:title=>"show",:image => img_show,:tip => "Show" )
154
+
155
+
156
+ idle_cb = lambda do
157
+ value = gauge.value.to_f
158
+ value += speed
159
+ if(value > gauge.max.to_f)
160
+ value = gauge.min.to_f
161
+ end
162
+ gauge.value = "%.7f" % value
163
+
164
+ Iup::DEFAULT
165
+ end
166
+
167
+ btn_pause_cb = lambda do |h|
168
+ if(Iup.GetIdle==nil)
169
+ Iup.SetIdle(idle_cb)
170
+ else
171
+ Iup.SetIdle(nil)
172
+ end
173
+
174
+ Iup::DEFAULT
175
+ end
176
+
177
+ btn_start_cb = lambda do |h|
178
+ gauge.value = gauge.min
179
+ Iup::DEFAULT
180
+ end
181
+
182
+ btn_accelerate_cb = lambda do |h|
183
+ speed *= 2
184
+ if(speed > 1.0)
185
+ speed = 1.0
186
+ end
187
+ Iup::DEFAULT
188
+ end
189
+
190
+ btn_decelerate_cb = lambda do |h|
191
+ speed /= 2
192
+ Iup::DEFAULT
193
+ end
194
+
195
+ btn_show_cb = lambda do |h|
196
+ if(gauge.show_text=="NO")
197
+ gauge.show_text = "YES"
198
+ gauge.dashed = "NO"
199
+ else
200
+ gauge.show_text = "NO"
201
+ gauge.dashed = "YES"
202
+ end
203
+
204
+ Iup::DEFAULT
205
+ end
206
+
207
+
208
+ hbox = Iup.Hbox([
209
+ Iup.Fill(),
210
+ btn_pause,
211
+ btn_start,
212
+ btn_decelerate,
213
+ btn_accelerate,
214
+ btn_show,
215
+ Iup.Fill()
216
+ ])
217
+
218
+ vbox = Iup.Vbox([ gauge , hbox],:margin=>"10x10",:gap=>5)
219
+
220
+ dlg = Iup.Dialog(vbox,:title=>"IupGauge")
221
+ btn_pause.action = btn_pause_cb
222
+ btn_start.action = btn_start_cb
223
+ btn_accelerate.action = btn_accelerate_cb
224
+ btn_decelerate.action = btn_decelerate_cb
225
+ btn_show.action = btn_show_cb
226
+
227
+ Iup.SetIdle(idle_cb)
228
+
229
+ # Shows dialog in the center of the screen */
230
+ dlg.ShowXY(Iup::CENTER, Iup::CENTER)
231
+
232
+ # Initializes IUP main loop */
233
+ Iup.MainLoop
234
+
235
+ dlg.Destroy
236
+
237
+ img_start.Destroy
238
+ img_play.Destroy
239
+ img_forward.Destroy
240
+ img_rewind.Destroy
241
+ img_show.Destroy
242
+