ruby-iup 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. data/Rakefile +1 -1
  2. data/examples/ctrl/degrade.rb +5 -2
  3. data/examples/ctrl/iupgauge.rb +5 -5
  4. data/examples/ctrl/iupplot2.rb +2 -5
  5. data/examples/dlg/iupalarm.rb +3 -1
  6. data/examples/elem/iupbutton.rb +42 -59
  7. data/examples/elem/iupcanvas.rb +4 -2
  8. data/examples/elem/iupcanvas2.rb +9 -8
  9. data/examples/elem/iupcanvas3.rb +19 -29
  10. data/examples/elem/iupdialog.rb +3 -7
  11. data/examples/elem/progressbar.rb +104 -118
  12. data/ext/iup-linux/include/cd.h +494 -494
  13. data/ext/iup-linux/include/cd_canvas.hpp +358 -358
  14. data/ext/iup-linux/include/cd_old.h +158 -158
  15. data/ext/iup-linux/include/cd_private.h +362 -362
  16. data/ext/iup-linux/include/cdcgm.h +34 -34
  17. data/ext/iup-linux/include/cdclipbd.h +22 -22
  18. data/ext/iup-linux/include/cddbuf.h +23 -23
  19. data/ext/iup-linux/include/cddebug.h +24 -24
  20. data/ext/iup-linux/include/cddgn.h +23 -23
  21. data/ext/iup-linux/include/cddxf.h +22 -22
  22. data/ext/iup-linux/include/cdemf.h +22 -22
  23. data/ext/iup-linux/include/cdgdiplus.h +29 -29
  24. data/ext/iup-linux/include/cdimage.h +23 -23
  25. data/ext/iup-linux/include/cdirgb.h +30 -30
  26. data/ext/iup-linux/include/cdiup.h +22 -22
  27. data/ext/iup-linux/include/cdlua.h +39 -39
  28. data/ext/iup-linux/include/cdlua3_private.h +120 -120
  29. data/ext/iup-linux/include/cdlua5_private.h +141 -141
  30. data/ext/iup-linux/include/cdluaim.h +24 -24
  31. data/ext/iup-linux/include/cdluaiup.h +27 -27
  32. data/ext/iup-linux/include/cdluapdf.h +27 -27
  33. data/ext/iup-linux/include/cdmf.h +24 -24
  34. data/ext/iup-linux/include/cdmf_private.h +32 -32
  35. data/ext/iup-linux/include/cdnative.h +26 -26
  36. data/ext/iup-linux/include/cdpdf.h +38 -38
  37. data/ext/iup-linux/include/cdpicture.h +22 -22
  38. data/ext/iup-linux/include/cdprint.h +23 -23
  39. data/ext/iup-linux/include/cdps.h +37 -37
  40. data/ext/iup-linux/include/cdwmf.h +22 -22
  41. data/ext/iup-linux/include/iup.h +318 -255
  42. data/ext/iup-linux/include/iup_pplot.h +40 -40
  43. data/ext/iup-linux/include/iupcb.h +25 -25
  44. data/ext/iup-linux/include/iupcbs.h +43 -42
  45. data/ext/iup-linux/include/iupcells.h +130 -130
  46. data/ext/iup-linux/include/iupcolorbar.h +126 -126
  47. data/ext/iup-linux/include/iupcontrols.h +36 -40
  48. data/ext/iup-linux/include/iupdef.h +520 -520
  49. data/ext/iup-linux/include/iupdial.h +63 -64
  50. data/ext/iup-linux/include/iupgauge.h +57 -57
  51. data/ext/iup-linux/include/iupgetparam.h +1 -1
  52. data/ext/iup-linux/include/iupgl.h +101 -101
  53. data/ext/iup-linux/include/iupim.h +21 -21
  54. data/ext/iup-linux/include/iupkey.h +457 -290
  55. data/ext/iup-linux/include/iuplua.h +41 -41
  56. data/ext/iup-linux/include/iuplua_pplot.h +26 -26
  57. data/ext/iup-linux/include/iupluacontrols.h +27 -27
  58. data/ext/iup-linux/include/iupluagl.h +26 -26
  59. data/ext/iup-linux/include/iupluaim.h +26 -26
  60. data/ext/iup-linux/include/iupluaole.h +26 -26
  61. data/ext/iup-linux/include/iupmask.h +40 -52
  62. data/ext/iup-linux/include/iupmatrix.h +63 -69
  63. data/ext/iup-linux/include/iupole.h +24 -24
  64. data/ext/iup-linux/include/iupspin.h +21 -21
  65. data/ext/iup-linux/include/iuptabs.h +75 -79
  66. data/ext/iup-linux/include/iuptree.h +93 -93
  67. data/ext/iup-linux/include/iupval.h +46 -46
  68. data/ext/iup-linux/include/wd.h +78 -78
  69. data/ext/iup-linux/include/wd_old.h +85 -85
  70. data/ext/iup-linux/libcd.so +0 -0
  71. data/ext/iup-linux/libcdcontextplus.so +0 -0
  72. data/ext/iup-linux/libcdpdf.so +0 -0
  73. data/ext/iup-linux/libim.so +0 -0
  74. data/ext/iup-linux/libim_fftw.so +0 -0
  75. data/ext/iup-linux/libim_jp2.so +0 -0
  76. data/ext/iup-linux/libim_process.so +0 -0
  77. data/ext/iup-linux/libiup.so +0 -0
  78. data/ext/iup-linux/libiup_pplot.so +0 -0
  79. data/ext/iup-linux/libiupcontrols.so +0 -0
  80. data/ext/iup-linux/libiupgl.so +0 -0
  81. data/ext/iup-linux/libiupim.so +0 -0
  82. data/ext/iup-linux/libiupimglib.so +0 -0
  83. data/ext/iup-linux/libiupmot.so +0 -0
  84. data/ext/iup-win32/cd.dll +0 -0
  85. data/ext/iup-win32/cd.lib +0 -0
  86. data/ext/iup-win32/cdcontextplus.dll +0 -0
  87. data/ext/iup-win32/cdcontextplus.lib +0 -0
  88. data/ext/iup-win32/cdpdf.dll +0 -0
  89. data/ext/iup-win32/cdpdf.lib +0 -0
  90. data/ext/iup-win32/freetype6.dll +0 -0
  91. data/ext/iup-win32/freetype6.lib +0 -0
  92. data/ext/iup-win32/im.dll +0 -0
  93. data/ext/iup-win32/im.lib +0 -0
  94. data/ext/iup-win32/im_avi.dll +0 -0
  95. data/ext/iup-win32/im_avi.lib +0 -0
  96. data/ext/iup-win32/im_capture.dll +0 -0
  97. data/ext/iup-win32/im_capture.lib +0 -0
  98. data/ext/iup-win32/im_fftw.dll +0 -0
  99. data/ext/iup-win32/im_fftw.lib +0 -0
  100. data/ext/iup-win32/im_jp2.dll +0 -0
  101. data/ext/iup-win32/im_jp2.lib +0 -0
  102. data/ext/iup-win32/im_process.dll +0 -0
  103. data/ext/iup-win32/im_process.lib +0 -0
  104. data/ext/iup-win32/im_wmv.dll +0 -0
  105. data/ext/iup-win32/im_wmv.lib +0 -0
  106. data/ext/iup-win32/imlua_capture51.dll +0 -0
  107. data/ext/iup-win32/imlua_capture51.lib +0 -0
  108. data/ext/iup-win32/imlua_wmv51.dll +0 -0
  109. data/ext/iup-win32/imlua_wmv51.lib +0 -0
  110. data/ext/iup-win32/include/cd.h +494 -494
  111. data/ext/iup-win32/include/cd_canvas.hpp +358 -358
  112. data/ext/iup-win32/include/cd_old.h +158 -158
  113. data/ext/iup-win32/include/cd_private.h +362 -362
  114. data/ext/iup-win32/include/cdcgm.h +34 -34
  115. data/ext/iup-win32/include/cdclipbd.h +22 -22
  116. data/ext/iup-win32/include/cddbuf.h +23 -23
  117. data/ext/iup-win32/include/cddebug.h +24 -24
  118. data/ext/iup-win32/include/cddgn.h +23 -23
  119. data/ext/iup-win32/include/cddxf.h +22 -22
  120. data/ext/iup-win32/include/cdemf.h +22 -22
  121. data/ext/iup-win32/include/cdgdiplus.h +29 -29
  122. data/ext/iup-win32/include/cdimage.h +23 -23
  123. data/ext/iup-win32/include/cdirgb.h +30 -30
  124. data/ext/iup-win32/include/cdiup.h +22 -22
  125. data/ext/iup-win32/include/cdlua.h +39 -39
  126. data/ext/iup-win32/include/cdlua3_private.h +120 -120
  127. data/ext/iup-win32/include/cdlua5_private.h +141 -141
  128. data/ext/iup-win32/include/cdluaim.h +24 -24
  129. data/ext/iup-win32/include/cdluaiup.h +27 -27
  130. data/ext/iup-win32/include/cdluapdf.h +27 -27
  131. data/ext/iup-win32/include/cdmf.h +24 -24
  132. data/ext/iup-win32/include/cdmf_private.h +32 -32
  133. data/ext/iup-win32/include/cdnative.h +26 -26
  134. data/ext/iup-win32/include/cdpdf.h +38 -38
  135. data/ext/iup-win32/include/cdpicture.h +22 -22
  136. data/ext/iup-win32/include/cdprint.h +23 -23
  137. data/ext/iup-win32/include/cdps.h +37 -37
  138. data/ext/iup-win32/include/cdwmf.h +22 -22
  139. data/ext/iup-win32/include/iup.h +318 -255
  140. data/ext/iup-win32/include/iup_pplot.h +40 -40
  141. data/ext/iup-win32/include/iupcb.h +25 -25
  142. data/ext/iup-win32/include/iupcbs.h +43 -42
  143. data/ext/iup-win32/include/iupcells.h +130 -130
  144. data/ext/iup-win32/include/iupcolorbar.h +126 -126
  145. data/ext/iup-win32/include/iupcontrols.h +36 -40
  146. data/ext/iup-win32/include/iupdef.h +520 -520
  147. data/ext/iup-win32/include/iupdial.h +63 -64
  148. data/ext/iup-win32/include/iupgauge.h +57 -57
  149. data/ext/iup-win32/include/iupgetparam.h +1 -1
  150. data/ext/iup-win32/include/iupgl.h +101 -101
  151. data/ext/iup-win32/include/iupim.h +21 -21
  152. data/ext/iup-win32/include/iupkey.h +457 -290
  153. data/ext/iup-win32/include/iuplua.h +41 -41
  154. data/ext/iup-win32/include/iuplua_pplot.h +26 -26
  155. data/ext/iup-win32/include/iupluacontrols.h +27 -27
  156. data/ext/iup-win32/include/iupluagl.h +26 -26
  157. data/ext/iup-win32/include/iupluaim.h +26 -26
  158. data/ext/iup-win32/include/iupluaole.h +26 -26
  159. data/ext/iup-win32/include/iupmask.h +40 -52
  160. data/ext/iup-win32/include/iupmatrix.h +63 -69
  161. data/ext/iup-win32/include/iupole.h +24 -24
  162. data/ext/iup-win32/include/iupspin.h +21 -21
  163. data/ext/iup-win32/include/iuptabs.h +75 -79
  164. data/ext/iup-win32/include/iuptree.h +93 -93
  165. data/ext/iup-win32/include/iupval.h +46 -46
  166. data/ext/iup-win32/include/wd.h +78 -78
  167. data/ext/iup-win32/include/wd_old.h +85 -85
  168. data/ext/iup-win32/iup.dll +0 -0
  169. data/ext/iup-win32/iup.lib +0 -0
  170. data/ext/iup-win32/iup_pplot.dll +0 -0
  171. data/ext/iup-win32/iup_pplot.lib +0 -0
  172. data/ext/iup-win32/iupcd.dll +0 -0
  173. data/ext/iup-win32/iupcd.lib +0 -0
  174. data/ext/iup-win32/iupcontrols.dll +0 -0
  175. data/ext/iup-win32/iupcontrols.lib +0 -0
  176. data/ext/iup-win32/iupgl.dll +0 -0
  177. data/ext/iup-win32/iupgl.lib +0 -0
  178. data/ext/iup-win32/iupgtk.dll +0 -0
  179. data/ext/iup-win32/iupgtk.lib +0 -0
  180. data/ext/iup-win32/iupim.dll +0 -0
  181. data/ext/iup-win32/iupim.lib +0 -0
  182. data/ext/iup-win32/iupimglib.dll +0 -0
  183. data/ext/iup-win32/iupimglib.lib +0 -0
  184. data/ext/iup-win32/iupole.dll +0 -0
  185. data/ext/iup-win32/iupole.lib +0 -0
  186. data/ext/iup-win32/iupstub.lib +0 -0
  187. data/ext/iup-win32/pdflib.dll +0 -0
  188. data/ext/iup-win32/pdflib.lib +0 -0
  189. data/ext/iup.c +3 -351
  190. data/ext/rb_iup.h +48 -15
  191. data/ext/rb_iupcb.h +1 -0
  192. data/ext/rb_iupcells.h +1 -0
  193. data/ext/rb_iupcolorbar.h +1 -4
  194. data/ext/rb_iupcontrols.h +0 -5
  195. data/ext/rb_iupdial.h +1 -0
  196. data/ext/rb_iupgauge.h +1 -0
  197. data/ext/rb_iupgc.h +0 -1
  198. data/ext/rb_iupmatrix.h +1 -0
  199. data/ext/rb_iupsbox.h +0 -1
  200. data/ext/rb_iuptabs.h +1 -0
  201. data/ext/rb_iuptree.h +1 -0
  202. data/ext/rb_iupval.h +1 -0
  203. metadata +16 -29
  204. data/ext/iup-linux/include/iupcbox.h +0 -23
  205. data/ext/iup-linux/include/iupcompat.h +0 -62
  206. data/ext/iup-linux/include/iupcpi.h +0 -76
  207. data/ext/iup-linux/include/iupgc.h +0 -20
  208. data/ext/iup-linux/include/iupsbox.h +0 -20
  209. data/ext/iup-linux/include/iupspeech.h +0 -23
  210. data/ext/iup-linux/libcdluacontextplus51.so +0 -0
  211. data/ext/iup-win32/cdlua51.lib +0 -0
  212. data/ext/iup-win32/cdluacontextplus51.lib +0 -0
  213. data/ext/iup-win32/cdluaim51.lib +0 -0
  214. data/ext/iup-win32/cdluapdf51.lib +0 -0
  215. data/ext/iup-win32/include/iupcbox.h +0 -23
  216. data/ext/iup-win32/include/iupcompat.h +0 -62
  217. data/ext/iup-win32/include/iupcpi.h +0 -76
  218. data/ext/iup-win32/include/iupgc.h +0 -20
  219. data/ext/iup-win32/include/iupsbox.h +0 -20
  220. data/ext/iup-win32/include/iupspeech.h +0 -23
  221. data/ext/iup-win32/iuplua51.lib +0 -0
  222. data/ext/iup-win32/iuplua_pplot51.lib +0 -0
  223. data/ext/iup-win32/iupluacd51.lib +0 -0
  224. data/ext/iup-win32/iupluacontrols51.lib +0 -0
  225. data/ext/iup-win32/iupluagl51.lib +0 -0
  226. data/ext/iup-win32/iupluaim51.lib +0 -0
  227. data/ext/iup-win32/iupluaimglib51.lib +0 -0
  228. data/ext/iup-win32/iupluaole51.lib +0 -0
  229. data/ext/rb_iupcbox.h +0 -40
  230. data/ext/rb_iupspeech.h +0 -25
data/Rakefile CHANGED
@@ -75,7 +75,7 @@ gem_files = gem_files.exclude("**/*.a","ext/*.so", "**/*.o{,bj}", "ext/*.log", "
75
75
 
76
76
  spec = Gem::Specification.new do |s|
77
77
  s.name = "ruby-iup"
78
- s.version = "0.0.1"
78
+ s.version = "0.0.2"
79
79
  s.authors = [ "Park Heesob" ]
80
80
  s.email = "phasis@gmail.com"
81
81
  s.rubyforge_project = "ruby-iup"
@@ -8,6 +8,7 @@ def create()
8
8
  puts("CLICK: #{b}: (#{i}, #{j})")
9
9
  Iup::DEFAULT
10
10
  }
11
+
11
12
  cells.draw_cb = lambda {|h,i,j,xmin,xmax,ymin,ymax,cnv|
12
13
  xm = (xmax + xmin) / 2
13
14
  ym = (ymax + ymin) / 2
@@ -34,6 +35,7 @@ def create()
34
35
 
35
36
  Iup::DEFAULT
36
37
  }
38
+
37
39
  cells.width_cb = lambda {|h,j| (50+j*1.5).to_i }
38
40
  cells.height_cb = lambda {|h,i| (30+i*1.5).to_i }
39
41
  cells.nlines_cb = lambda {|h| 7 }
@@ -47,8 +49,8 @@ def create()
47
49
  return 2 if (i == 1 && j == 1)
48
50
  return 2 if (i == 5 && j == 5)
49
51
  1
50
- }
51
- cells.scroll_cb = lambda {|h,i,j|
52
+ }
53
+ cells.scrolling_cb = lambda {|h,i,j|
52
54
  puts("SCROLL: (#{i}, #{j})");
53
55
  Iup::DEFAULT
54
56
  }
@@ -64,6 +66,7 @@ end
64
66
 
65
67
  dlg = Iup.Dialog(box)
66
68
  dlg.title = "IupCells"
69
+ dlg.rastersize = "350x250"
67
70
  dlg.ShowXY(Iup::CENTER,Iup::CENTER)
68
71
  Iup.MainLoop
69
72
  dlg.Destroy
@@ -136,15 +136,15 @@ pixmap_show = [
136
136
  img_show = Iup.Image(22,22, pixmap_show)
137
137
 
138
138
  img_start["1"]= "0 0 0"
139
- img_start["2"]= Iup::BGCOLOR
139
+ img_start["2"]= "BGCOLOR"
140
140
  img_play["1"]= "0 0 0"
141
- img_play["2"]= Iup::BGCOLOR
141
+ img_play["2"]= "BGCOLOR"
142
142
  img_forward["1"]= "0 0 0"
143
- img_forward["2"]= Iup::BGCOLOR
143
+ img_forward["2"]= "BGCOLOR"
144
144
  img_rewind["1"]= "0 0 0"
145
- img_rewind["2"]= Iup::BGCOLOR
145
+ img_rewind["2"]= "BGCOLOR"
146
146
  img_show["1"]= "0 0 0"
147
- img_show["2"]= Iup::BGCOLOR
147
+ img_show["2"]= "BGCOLOR"
148
148
 
149
149
  btn_start = Iup.Button(:title=>"start",:image => img_start,:tip => "Start")
150
150
  btn_pause = Iup.Button(:title=>"pause",:image => img_play,:tip => "Pause")
@@ -235,10 +235,7 @@ class IupPlotTest
235
235
  end
236
236
 
237
237
  def tabs_get_index()
238
- curr_tab = @tabs.value
239
- ss = curr_tab.tabtitle
240
- ss = ss[5..-1] # Skip "Plot "
241
- ss.to_i
238
+ @tabs.valuepos.to_i
242
239
  end
243
240
 
244
241
  def initialize
@@ -246,7 +243,7 @@ class IupPlotTest
246
243
  # will be updated according to current @plot props
247
244
  tabs_tabchange_cb = lambda do |ih, new_tab, old_tab|
248
245
  ii=0
249
-
246
+
250
247
  ss = new_tab.tabtitle
251
248
  ss = ss[5..-1] # Skip "Plot "
252
249
  ii = ss.to_i
@@ -1,3 +1,5 @@
1
+ # Shows a dialog similar to the one shown when you exit a program without saving.
2
+
1
3
  require 'rubygems'
2
4
  require 'iup'
3
5
 
@@ -10,5 +12,5 @@ case(Iup.Alarm("IupAlarm Example","File not saved! Save it now?", "Yes", "No", "
10
12
  Iup.Message("Save file", "Operation canceled")
11
13
  end
12
14
 
13
- Iup.MainLoop()
15
+
14
16
 
@@ -1,14 +1,14 @@
1
+ #
2
+ # IupButton example
3
+ # Description : Creates four buttons. The first uses images, the second
4
+ # turns the first on and off, the third exits the
5
+ # application and the last does nothing
6
+ #
7
+
1
8
  require 'rubygems'
2
- #*****************************************************************************
3
- #* Iup.Button example *
4
- #* Author : Claudio Coutinho de Biasi *
5
- #* Description : Creates four buttons. The first uses images, the second *
6
- #* turns the first on and off, the third exits the *
7
- #* application and the last does nothing *
8
- #*****************************************************************************/
9
9
  require 'iup'
10
10
 
11
- #* Defines released button's image */
11
+ #* Defines released button's image
12
12
 
13
13
  pixmap_release = [
14
14
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -30,7 +30,7 @@ pixmap_release = [
30
30
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
31
31
  ]
32
32
 
33
- #* Defines pressed button's image */
33
+ #* Defines pressed button's image
34
34
  pixmap_press = [
35
35
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
36
36
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
@@ -51,7 +51,7 @@ pixmap_press = [
51
51
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
52
52
  ]
53
53
 
54
- #* Defines inactive button's image */
54
+ #* Defines inactive button's image
55
55
  pixmap_inactive = [
56
56
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
57
57
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
@@ -72,126 +72,109 @@ pixmap_inactive = [
72
72
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
73
73
  ]
74
74
 
75
- # Creates a text */
75
+ # Creates a text
76
76
  text = Iup.Text(:readonly=>"YES")
77
77
 
78
- # Defines released button's image size */
78
+ # Defines released button's image size
79
79
  img_release = Iup.Image(16, 16, pixmap_release)
80
80
 
81
- # Defines released button's image colors */
81
+ # Defines released button's image colors
82
82
  img_release["1"] = "215 215 215"
83
83
  img_release["2"] = "40 40 40"
84
84
  img_release["3"] = "30 50 210"
85
85
  img_release["4"] = "240 0 0"
86
86
 
87
- # Associates img_release with handle "img_release" */
88
- Iup.SetHandle( "img_release", img_release )
89
-
90
- # Defines pressed button's image size */
87
+ # Defines pressed button's image size
91
88
  img_press = Iup.Image( 16, 16, pixmap_press )
92
89
 
93
- # Defines pressed button's image colors */
90
+ # Defines pressed button's image colors
94
91
  img_press["1"] = "40 40 40"
95
92
  img_press["2"] = "215 215 215"
96
93
  img_press["3"] = "0 20 180"
97
94
  img_press["4"] = "210 0 0"
98
95
 
99
- # Associates img_press with handle "img_press" */
100
- Iup.SetHandle( "img_press", img_press )
101
-
102
- # Defines inactive button's image size */
96
+ # Defines inactive button's image size
103
97
  img_inactive = Iup.Image( 16, 16, pixmap_inactive )
104
98
 
105
- # Defines inactive button's image colors */
99
+ # Defines inactive button's image colors
106
100
  img_inactive["1"] = "215 215 215"
107
101
  img_inactive["2"] = "40 40 40"
108
102
  img_inactive["3"] = "100 100 100"
109
103
  img_inactive["4"] = "200 200 200"
110
104
 
111
- # Associates img_inactive with handle "img_inactive" */
112
- Iup.SetHandle("img_inactive", img_inactive )
105
+ # Creates a button
106
+ btn_image = Iup.Button(:title=>"Button with image",:image=>img_release,:impress=>img_press,:iminactive=>img_inactive)
113
107
 
114
- # Creates a button */
115
- btn_image = Iup.Button(:title=>"Button with image",:image=>"img_release",:impress=>"img_press",:iminactive=>"img_inactive")
116
-
117
- # Creates a button */
108
+ # Creates a button
118
109
  btn_big = Iup.Button(:title=>"Big useless button",:size=>"EIGHTHxEIGHTH")
119
110
 
120
- # Creates a button entitled Exit associated with action exit_act */
111
+ # Creates a button entitled Exit associated with action exit_act
121
112
  btn_exit = Iup.Button("Exit")
122
113
 
123
- # Creates a button entitled on/off associated with action onoff_act */
114
+ # Creates a button entitled on/off associated with action onoff_act
124
115
  btn_on_off = Iup.Button("on/off")
125
116
 
126
- # Creates dialog with the four buttons and the text*/
117
+ # Creates dialog with the four buttons and the text
127
118
  dlg = Iup.Dialog(
128
119
  Iup.Vbox([
129
120
  Iup.Hbox([
130
- Iup.Fill(),
131
121
  btn_image,
132
122
  btn_on_off,
133
- btn_exit,
134
- Iup.Fill()]
135
- ),
123
+ btn_exit]),
136
124
  text,
137
- btn_big]
138
- ),
125
+ btn_big]),
139
126
  :expand=>"YES",:title=>"IupButton",:resize=>"NO",
140
127
  :menubox=>"NO",:maxbox=>"NO",:minbox=>"NO")
141
128
 
142
129
 
143
130
  btn_on_off_cb = lambda do |ih|
144
- # If the button with with image is active...*/
131
+ # If the button with with image is active...
145
132
  if(btn_image.active=="YES")
146
- # Deactivates the button with image */
133
+ # Deactivates the button with image
147
134
  btn_image.active = "NO"
148
- # else it is inactive */
135
+ # else it is inactive
149
136
  else
150
- # Activates the button with image */
137
+ # Activates the button with image
151
138
  btn_image.active = "YES"
152
139
  end
153
140
 
154
- # Executed function sucessfully */
141
+ # Executed function sucessfully
155
142
  Iup::DEFAULT
156
143
  end
157
144
 
158
145
  btn_image_button_cb = lambda do |ih,b,e,x,y,status|
159
- # If the left button changed its state... */
160
- if( b == Iup::BUTTON1 )
161
- # If the button was pressed... */
162
- if(e == 1)
163
- # Sets text's value */
146
+ # If the left button changed its state...
147
+ if b == Iup::BUTTON1
148
+ # If the button was pressed...
149
+ if e == 1
150
+ # Sets text's value
164
151
  text.value = "Red button pressed"
165
- # else the button was released */
152
+ # else the button was released
166
153
  else
167
- # Sets text's value */
154
+ # Sets text's value
168
155
  text.value = "Red button released"
169
156
  end
170
157
  end
171
158
 
172
- # Executed function sucessfully */
159
+ # Executed function sucessfully
173
160
  Iup::DEFAULT
174
161
  end
175
162
 
176
163
  btn_exit_cb = lambda do |ih|
177
- # Exits the program */
164
+ # Exits the program
178
165
  Iup::CLOSE
179
166
  end
180
167
 
181
168
 
182
- # Registers callbacks */
169
+ # Registers callbacks
183
170
  btn_exit.action = btn_exit_cb
184
171
  btn_on_off.action = btn_on_off_cb
185
172
  btn_image.button_cb = btn_image_button_cb
186
173
 
187
- # Shows dialog on the center of the screen */
174
+ # Shows dialog on the center of the screen
188
175
  dlg.ShowXY(Iup::CENTER, Iup::CENTER )
189
176
 
190
- # Initializes IUP main loop */
177
+ # Initializes IUP main loop
191
178
  Iup.MainLoop()
192
179
 
193
180
  dlg.Destroy()
194
- img_release.Destroy()
195
- img_inactive.Destroy()
196
- img_press.Destroy()
197
-
@@ -1,3 +1,7 @@
1
+ # IupCanvas example
2
+ # Description : Creates a IUP canvas and uses CD to draw on it
3
+ # Remark : IUP must be linked to the CD library
4
+
1
5
  require 'rubygems'
2
6
  require 'iup'
3
7
 
@@ -19,9 +23,7 @@ end
19
23
 
20
24
  cdcanvas = Cd.CreateCanvas( Cd.CD_IUP, cnvs )
21
25
 
22
- # Shows dialog on the center of the screen */
23
26
  dlg.ShowXY(Iup::CENTER, Iup::CENTER )
24
27
 
25
- # Initializes IUP main loop */
26
28
  Iup.MainLoop()
27
29
  dlg.Destroy()
@@ -1,3 +1,7 @@
1
+ # Advanced IupCanvas example
2
+ # Description : This example shows how several canvas callbacks are used and how the scrollbar works.
3
+ # Remark : IUP must be linked to the CD library
4
+
1
5
  require 'rubygems'
2
6
  require 'iup'
3
7
 
@@ -93,21 +97,18 @@ end
93
97
  dlg.ShowXY(Iup::CENTER,Iup::CENTER)
94
98
 
95
99
  cdcanvas = Cd.CreateCanvas(Cd.CD_IUP, iupcanvas)
96
-
97
100
  if(cdcanvas==nil)
98
101
  Iup.Message("IupCanvas","Error creating canvas")
99
- dlg.Destroy()
102
+ dlg.Destroy
100
103
  exit
101
104
  end
102
105
 
103
106
  if(cdcanvas.Activate() == Cd::ERROR)
104
107
  Iup.Message("IupCanvas","Error creating canvas")
105
- dlg.Destroy()
108
+ dlg.Destroy
106
109
  exit
107
110
  end
108
111
 
109
- cdcanvas.CanvasClear()
110
-
111
- # Initializes IUP main loop */
112
- Iup.MainLoop()
113
- dlg.Destroy()
112
+ cdcanvas.CanvasClear
113
+ Iup.MainLoop
114
+ dlg.Destroy
@@ -1,49 +1,38 @@
1
+ # IupCanvas Redraw example
2
+
1
3
  require 'rubygems'
2
4
  require 'iup'
3
5
 
4
- need_redraw = nil
6
+ need_redraw = 0
7
+ redraw_count = 0
5
8
  cdcanvas = nil
6
9
 
7
10
 
8
- gauge = Iup.Gauge()
11
+ gauge = Iup.ProgressBar()
9
12
  cv = Iup.Canvas()
10
- bt = Iup.Button("Restart")
13
+ bt = Iup.Button("Start/Stop")
11
14
  bt.size = "50x50"
12
- bt.fgcolor = "255 255 255"
13
15
  gauge.size = "200x15"
14
16
  cv.size = "200x200"
15
17
  dlg = Iup.Dialog(Iup.Vbox([cv, Iup.Hbox([gauge, bt])]),:title=>"Redraw test")
16
18
 
17
19
  toggle_redraw = lambda do |ih|
20
+ cdcanvas.CanvasActivate() if cdcanvas
18
21
  need_redraw = 1 - need_redraw
19
22
  Iup::DEFAULT
20
23
  end
21
24
 
22
- fake_redraw = lambda do |ih,posx,posy|
23
- need_redraw = 1
24
- Iup::DEFAULT
25
- end
26
-
27
25
  redraw = lambda do
28
26
  if(need_redraw == 1)
29
- need_redraw = 0
30
- bt.fgcolor = "255 0 0"
31
- Iup.Flush()
32
-
33
- cdcanvas.CanvasActivate()
34
- cdcanvas.CanvasForeground(Cd::BLUE)
35
- cdcanvas.CanvasClear()
36
-
37
- for i in 0 ... 300000
38
- cdcanvas.CanvasBox(0, 300, 0, i/1000)
39
- gauge.value = "%f" % (i/300000.0)
40
-
41
- Iup.LoopStep()
42
- end
43
-
44
- bt.fgcolor = "255 255 255"
45
- Iup.Flush()
46
- end
27
+ cdcanvas.CanvasBox(0, 300, 0, redraw_count/100)
28
+ gauge.value = redraw_count/30000.0
29
+ redraw_count += 1
30
+ if(redraw_count==30000)
31
+ cdcanvas.CanvasClear()
32
+ redraw_count = 0
33
+ need_redraw = 0
34
+ end
35
+ end
47
36
  Iup::DEFAULT
48
37
  end
49
38
 
@@ -53,8 +42,9 @@ end
53
42
  dlg.Map()
54
43
 
55
44
  cdcanvas = Cd.CreateCanvas(Cd.CD_IUP, cv)
56
-
57
- cv.action = fake_redraw
45
+ cdcanvas.CanvasForeground(Cd::BLUE)
46
+ cdcanvas.CanvasClear()
47
+
58
48
  bt.action = toggle_redraw
59
49
 
60
50
  dlg.ShowXY(Iup::CENTER, Iup::CENTER)
@@ -50,22 +50,18 @@ end
50
50
  icon["4"] = "128 128 128"
51
51
  icon["5"] = "192 192 192"
52
52
  icon["6"] = "000 000 255"
53
- Iup.SetHandle("icon", icon)
54
53
 
55
54
  # Creating dialog's content */
56
55
  quit_bt = Iup.Button(:title=>"Quit",:action=>quit_cb)
57
- Iup.SetHandle("quit", quit_bt)
58
56
 
59
57
  # Creating dialog's menu */
60
58
  options = Iup.Menu([Iup.Item(:title=>"Exit",:action=>quit_cb)])
61
59
  submenu = Iup.Submenu("File", options)
62
60
  menu = Iup.Menu([submenu])
63
- Iup.SetHandle("menu", menu)
64
61
 
65
62
  # Creating main dialog */
66
- dialog = Iup.Dialog(Iup.Vbox([quit_bt]),:title=>"IupDialog",:menu=>"menu",:cursor=>"CROSS",:icon=>"icon",:defaultesc=>"quit")
63
+ dialog = Iup.Dialog(Iup.Vbox([quit_bt]),:title=>"IupDialog",:menu=>menu,:cursor=>"CROSS",:icon=>icon,:defaultesc=>quit_bt)
67
64
 
68
65
  dialog.ShowXY(Iup::CENTER, Iup::CENTER)
69
- Iup.MainLoop()
70
- dialog.Destroy()
71
- icon.Destroy()
66
+ Iup.MainLoop
67
+ dialog.Destroy