wrb 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +7 -0
  2. data/README +28 -0
  3. data/Rakefile +66 -0
  4. data/bin/wrb +41 -0
  5. data/bin/wrb.bat +6 -0
  6. data/ext/rwin/aatree.c +192 -0
  7. data/ext/rwin/aatree.h +55 -0
  8. data/ext/rwin/extconf.rb +47 -0
  9. data/ext/rwin/rw_api.c +2058 -0
  10. data/ext/rwin/rw_devices.c +215 -0
  11. data/ext/rwin/rw_gdiplus.h +278 -0
  12. data/ext/rwin/rw_graphics.c +1583 -0
  13. data/ext/rwin/rw_resources.c +1988 -0
  14. data/ext/rwin/rw_ubfuncs.c +281 -0
  15. data/ext/rwin/rw_windows.c +1936 -0
  16. data/ext/rwin/rwin.c +451 -0
  17. data/ext/rwin/rwin.h +442 -0
  18. data/lib/rwin.rb +820 -0
  19. data/lib/wrb.rb +20 -0
  20. data/lib/wrb/applications/frmdesigner/angle.cur +0 -0
  21. data/lib/wrb/applications/frmdesigner/angle2.cur +0 -0
  22. data/lib/wrb/applications/frmdesigner/controls/Button.bmp +0 -0
  23. data/lib/wrb/applications/frmdesigner/controls/Button.rb +34 -0
  24. data/lib/wrb/applications/frmdesigner/controls/Checkbox.bmp +0 -0
  25. data/lib/wrb/applications/frmdesigner/controls/Checkbox.rb +10 -0
  26. data/lib/wrb/applications/frmdesigner/controls/Combobox.bmp +0 -0
  27. data/lib/wrb/applications/frmdesigner/controls/Combobox.rb +88 -0
  28. data/lib/wrb/applications/frmdesigner/controls/ComboboxEx.rb +97 -0
  29. data/lib/wrb/applications/frmdesigner/controls/Comboboxex.bmp +0 -0
  30. data/lib/wrb/applications/frmdesigner/controls/DateTimePicker.bmp +0 -0
  31. data/lib/wrb/applications/frmdesigner/controls/DateTimePicker.rb +11 -0
  32. data/lib/wrb/applications/frmdesigner/controls/Edit.bmp +0 -0
  33. data/lib/wrb/applications/frmdesigner/controls/Edit.rb +8 -0
  34. data/lib/wrb/applications/frmdesigner/controls/Groupbox.bmp +0 -0
  35. data/lib/wrb/applications/frmdesigner/controls/Groupbox.rb +9 -0
  36. data/lib/wrb/applications/frmdesigner/controls/Hotkeyctrl.bmp +0 -0
  37. data/lib/wrb/applications/frmdesigner/controls/Hotkeyctrl.rb +9 -0
  38. data/lib/wrb/applications/frmdesigner/controls/Imagelist.bmp +0 -0
  39. data/lib/wrb/applications/frmdesigner/controls/Imagelist.rb +115 -0
  40. data/lib/wrb/applications/frmdesigner/controls/Listbox.bmp +0 -0
  41. data/lib/wrb/applications/frmdesigner/controls/Listbox.rb +77 -0
  42. data/lib/wrb/applications/frmdesigner/controls/Listview.bmp +0 -0
  43. data/lib/wrb/applications/frmdesigner/controls/Listview.rb +157 -0
  44. data/lib/wrb/applications/frmdesigner/controls/Menu.bmp +0 -0
  45. data/lib/wrb/applications/frmdesigner/controls/Menu.rb +198 -0
  46. data/lib/wrb/applications/frmdesigner/controls/Menubar.bmp +0 -0
  47. data/lib/wrb/applications/frmdesigner/controls/Menubar.rb +9 -0
  48. data/lib/wrb/applications/frmdesigner/controls/MonthCalender.bmp +0 -0
  49. data/lib/wrb/applications/frmdesigner/controls/Monthcalender.rb +9 -0
  50. data/lib/wrb/applications/frmdesigner/controls/Panel.bmp +0 -0
  51. data/lib/wrb/applications/frmdesigner/controls/Panel.rb +30 -0
  52. data/lib/wrb/applications/frmdesigner/controls/Progressbar.rb +10 -0
  53. data/lib/wrb/applications/frmdesigner/controls/Radiobutton.bmp +0 -0
  54. data/lib/wrb/applications/frmdesigner/controls/Radiobutton.rb +13 -0
  55. data/lib/wrb/applications/frmdesigner/controls/Rebar.bmp +0 -0
  56. data/lib/wrb/applications/frmdesigner/controls/Rebar.rb +162 -0
  57. data/lib/wrb/applications/frmdesigner/controls/Splitter.bmp +0 -0
  58. data/lib/wrb/applications/frmdesigner/controls/Splitter.rb +66 -0
  59. data/lib/wrb/applications/frmdesigner/controls/Static.bmp +0 -0
  60. data/lib/wrb/applications/frmdesigner/controls/Static.rb +9 -0
  61. data/lib/wrb/applications/frmdesigner/controls/Statusbar.bmp +0 -0
  62. data/lib/wrb/applications/frmdesigner/controls/Statusbar.rb +103 -0
  63. data/lib/wrb/applications/frmdesigner/controls/Tabctrl.bmp +0 -0
  64. data/lib/wrb/applications/frmdesigner/controls/Tabctrl.rb +136 -0
  65. data/lib/wrb/applications/frmdesigner/controls/Timer.bmp +0 -0
  66. data/lib/wrb/applications/frmdesigner/controls/Timer.rb +36 -0
  67. data/lib/wrb/applications/frmdesigner/controls/Toolbar.bmp +0 -0
  68. data/lib/wrb/applications/frmdesigner/controls/Toolbar.rb +165 -0
  69. data/lib/wrb/applications/frmdesigner/controls/Trackbar.bmp +0 -0
  70. data/lib/wrb/applications/frmdesigner/controls/Trackbar.rb +34 -0
  71. data/lib/wrb/applications/frmdesigner/controls/Treeview.bmp +0 -0
  72. data/lib/wrb/applications/frmdesigner/controls/Treeview.rb +107 -0
  73. data/lib/wrb/applications/frmdesigner/controls/Updown.bmp +0 -0
  74. data/lib/wrb/applications/frmdesigner/controls/Updown.rb +31 -0
  75. data/lib/wrb/applications/frmdesigner/controls/default.bmp +0 -0
  76. data/lib/wrb/applications/frmdesigner/controls/progressbar.bmp +0 -0
  77. data/lib/wrb/applications/frmdesigner/controls/unselect.bmp +0 -0
  78. data/lib/wrb/applications/frmdesigner/fddialogs.rb +87 -0
  79. data/lib/wrb/applications/frmdesigner/fdesign.rb +1315 -0
  80. data/lib/wrb/applications/frmdesigner/fdmodules.rb +1394 -0
  81. data/lib/wrb/applications/frmdesigner/fdparseform.rb +197 -0
  82. data/lib/wrb/applications/frmdesigner/img13.bmp +0 -0
  83. data/lib/wrb/base.rb +1294 -0
  84. data/lib/wrb/combocommon.rb +77 -0
  85. data/lib/wrb/commctrlconst.rb +139 -0
  86. data/lib/wrb/commdlg.rb +77 -0
  87. data/lib/wrb/components/animate.rb +114 -0
  88. data/lib/wrb/components/bitmap.rb +116 -0
  89. data/lib/wrb/components/button.rb +134 -0
  90. data/lib/wrb/components/canvas.rb +266 -0
  91. data/lib/wrb/components/checkbox.rb +118 -0
  92. data/lib/wrb/components/choosecolordlg.rb +87 -0
  93. data/lib/wrb/components/choosefontdlg.rb +142 -0
  94. data/lib/wrb/components/clipboard.rb +174 -0
  95. data/lib/wrb/components/combobox.rb +282 -0
  96. data/lib/wrb/components/comboboxex.rb +574 -0
  97. data/lib/wrb/components/cursor.rb +91 -0
  98. data/lib/wrb/components/datetimepicker.rb +197 -0
  99. data/lib/wrb/components/ddeclient.rb +180 -0
  100. data/lib/wrb/components/ddeserver.rb +131 -0
  101. data/lib/wrb/components/dialog.rb +228 -0
  102. data/lib/wrb/components/edit.rb +412 -0
  103. data/lib/wrb/components/font.rb +35 -0
  104. data/lib/wrb/components/form.rb +65 -0
  105. data/lib/wrb/components/groupbox.rb +122 -0
  106. data/lib/wrb/components/header.rb +479 -0
  107. data/lib/wrb/components/hotkeyctrl.rb +72 -0
  108. data/lib/wrb/components/icon.rb +109 -0
  109. data/lib/wrb/components/imagelist.rb +396 -0
  110. data/lib/wrb/components/inifile.rb +97 -0
  111. data/lib/wrb/components/listbox.rb +149 -0
  112. data/lib/wrb/components/listview.rb +1467 -0
  113. data/lib/wrb/components/menu.rb +592 -0
  114. data/lib/wrb/components/menubar.rb +84 -0
  115. data/lib/wrb/components/monthcalender.rb +164 -0
  116. data/lib/wrb/components/openfilenamedlg.rb +147 -0
  117. data/lib/wrb/components/pager.rb +199 -0
  118. data/lib/wrb/components/panel.rb +103 -0
  119. data/lib/wrb/components/picture.rb +55 -0
  120. data/lib/wrb/components/printdlg.rb +148 -0
  121. data/lib/wrb/components/printdlgex.rb +117 -0
  122. data/lib/wrb/components/printer.rb +97 -0
  123. data/lib/wrb/components/progressbar.rb +140 -0
  124. data/lib/wrb/components/radiobutton.rb +49 -0
  125. data/lib/wrb/components/rebar.rb +830 -0
  126. data/lib/wrb/components/registry.rb +408 -0
  127. data/lib/wrb/components/richedit.rb +1181 -0
  128. data/lib/wrb/components/savefilenamedlg.rb +27 -0
  129. data/lib/wrb/components/scintilla.rb +1298 -0
  130. data/lib/wrb/components/scrollbar.rb +239 -0
  131. data/lib/wrb/components/splitter.rb +494 -0
  132. data/lib/wrb/components/static.rb +198 -0
  133. data/lib/wrb/components/statusbar.rb +490 -0
  134. data/lib/wrb/components/tabctrl.rb +686 -0
  135. data/lib/wrb/components/timer.rb +117 -0
  136. data/lib/wrb/components/toolbar.rb +1107 -0
  137. data/lib/wrb/components/tooltip.rb +651 -0
  138. data/lib/wrb/components/trackbar.rb +298 -0
  139. data/lib/wrb/components/treeview.rb +845 -0
  140. data/lib/wrb/components/updown.rb +198 -0
  141. data/lib/wrb/ddeml.rb +241 -0
  142. data/lib/wrb/documents/animate.html +46 -0
  143. data/lib/wrb/documents/bitmap.html +69 -0
  144. data/lib/wrb/documents/button.html +78 -0
  145. data/lib/wrb/documents/canvas.html +137 -0
  146. data/lib/wrb/documents/checkbox.html +77 -0
  147. data/lib/wrb/documents/choosecolordlg.html +29 -0
  148. data/lib/wrb/documents/choosefontdlg.html +31 -0
  149. data/lib/wrb/documents/clipboard.html +31 -0
  150. data/lib/wrb/documents/combobox.html +117 -0
  151. data/lib/wrb/documents/comboboxex.html +139 -0
  152. data/lib/wrb/documents/control.html +53 -0
  153. data/lib/wrb/documents/cursor.html +45 -0
  154. data/lib/wrb/documents/datetimepicker.html +70 -0
  155. data/lib/wrb/documents/ddeclient.html +33 -0
  156. data/lib/wrb/documents/ddeserver.html +26 -0
  157. data/lib/wrb/documents/dialog.html +78 -0
  158. data/lib/wrb/documents/edit.html +169 -0
  159. data/lib/wrb/documents/empty.html +11 -0
  160. data/lib/wrb/documents/favicon.png +0 -0
  161. data/lib/wrb/documents/font.html +38 -0
  162. data/lib/wrb/documents/form.html +63 -0
  163. data/lib/wrb/documents/groupbox.html +57 -0
  164. data/lib/wrb/documents/header.html +85 -0
  165. data/lib/wrb/documents/hotkeyctrl.html +42 -0
  166. data/lib/wrb/documents/icon.html +45 -0
  167. data/lib/wrb/documents/imagelist.html +101 -0
  168. data/lib/wrb/documents/images/button.png +0 -0
  169. data/lib/wrb/documents/images/checkbox.png +0 -0
  170. data/lib/wrb/documents/images/combobox.png +0 -0
  171. data/lib/wrb/documents/images/comboboxex.png +0 -0
  172. data/lib/wrb/documents/images/datetimepicker.png +0 -0
  173. data/lib/wrb/documents/images/edit.png +0 -0
  174. data/lib/wrb/documents/images/groupbox.png +0 -0
  175. data/lib/wrb/documents/images/hotkeyctrl.png +0 -0
  176. data/lib/wrb/documents/images/listbox.png +0 -0
  177. data/lib/wrb/documents/images/listview.png +0 -0
  178. data/lib/wrb/documents/images/menu.png +0 -0
  179. data/lib/wrb/documents/images/menubar.png +0 -0
  180. data/lib/wrb/documents/images/monthcalender.png +0 -0
  181. data/lib/wrb/documents/images/progressbar.png +0 -0
  182. data/lib/wrb/documents/images/radiobutton.png +0 -0
  183. data/lib/wrb/documents/images/rebar.png +0 -0
  184. data/lib/wrb/documents/images/richedit.png +0 -0
  185. data/lib/wrb/documents/images/splitter.png +0 -0
  186. data/lib/wrb/documents/images/static.png +0 -0
  187. data/lib/wrb/documents/images/statusbar.png +0 -0
  188. data/lib/wrb/documents/images/tabctrl.png +0 -0
  189. data/lib/wrb/documents/images/toolbar.png +0 -0
  190. data/lib/wrb/documents/images/tooltip.png +0 -0
  191. data/lib/wrb/documents/images/trackbar.png +0 -0
  192. data/lib/wrb/documents/images/treeview.png +0 -0
  193. data/lib/wrb/documents/images/updown.png +0 -0
  194. data/lib/wrb/documents/index.html +155 -0
  195. data/lib/wrb/documents/inifile.html +36 -0
  196. data/lib/wrb/documents/license.txt +22 -0
  197. data/lib/wrb/documents/listbox.html +96 -0
  198. data/lib/wrb/documents/listview.html +277 -0
  199. data/lib/wrb/documents/make_doc.rb +596 -0
  200. data/lib/wrb/documents/menu.html +144 -0
  201. data/lib/wrb/documents/menubar.html +54 -0
  202. data/lib/wrb/documents/monthcalender.html +48 -0
  203. data/lib/wrb/documents/openfilenamedlg.html +36 -0
  204. data/lib/wrb/documents/pager.html +63 -0
  205. data/lib/wrb/documents/panel.html +32 -0
  206. data/lib/wrb/documents/picture.html +48 -0
  207. data/lib/wrb/documents/printdlg.html +35 -0
  208. data/lib/wrb/documents/printdlgex.html +35 -0
  209. data/lib/wrb/documents/printer.html +40 -0
  210. data/lib/wrb/documents/progressbar.html +69 -0
  211. data/lib/wrb/documents/radiobutton.html +51 -0
  212. data/lib/wrb/documents/rebar.html +143 -0
  213. data/lib/wrb/documents/registry.html +36 -0
  214. data/lib/wrb/documents/richedit.html +232 -0
  215. data/lib/wrb/documents/samples/editimg.bmp +0 -0
  216. data/lib/wrb/documents/samples/editimg.iml +0 -0
  217. data/lib/wrb/documents/samples/fileimg.bmp +0 -0
  218. data/lib/wrb/documents/samples/fileimg.iml +0 -0
  219. data/lib/wrb/documents/samples/sample_button.rb +21 -0
  220. data/lib/wrb/documents/samples/sample_checkbox.rb +18 -0
  221. data/lib/wrb/documents/samples/sample_combobox.rb +18 -0
  222. data/lib/wrb/documents/samples/sample_comboboxex.rb +23 -0
  223. data/lib/wrb/documents/samples/sample_datetimepicker.rb +11 -0
  224. data/lib/wrb/documents/samples/sample_edit.rb +25 -0
  225. data/lib/wrb/documents/samples/sample_groupbox.rb +19 -0
  226. data/lib/wrb/documents/samples/sample_hotkeyctrl.rb +12 -0
  227. data/lib/wrb/documents/samples/sample_listbox.rb +12 -0
  228. data/lib/wrb/documents/samples/sample_listview.rb +32 -0
  229. data/lib/wrb/documents/samples/sample_menu.rb +21 -0
  230. data/lib/wrb/documents/samples/sample_menubar.rb +23 -0
  231. data/lib/wrb/documents/samples/sample_monthcalender.rb +11 -0
  232. data/lib/wrb/documents/samples/sample_progressbar.rb +14 -0
  233. data/lib/wrb/documents/samples/sample_radiobutton.rb +14 -0
  234. data/lib/wrb/documents/samples/sample_rebar.rb +25 -0
  235. data/lib/wrb/documents/samples/sample_richedit.rb +60 -0
  236. data/lib/wrb/documents/samples/sample_splitter.rb +33 -0
  237. data/lib/wrb/documents/samples/sample_static.rb +15 -0
  238. data/lib/wrb/documents/samples/sample_statusbar.rb +17 -0
  239. data/lib/wrb/documents/samples/sample_tabctrl.rb +19 -0
  240. data/lib/wrb/documents/samples/sample_toolbar.rb +29 -0
  241. data/lib/wrb/documents/samples/sample_tooltip.rb +50 -0
  242. data/lib/wrb/documents/samples/sample_trackbar.rb +30 -0
  243. data/lib/wrb/documents/samples/sample_treeview.rb +19 -0
  244. data/lib/wrb/documents/samples/sample_updown.rb +18 -0
  245. data/lib/wrb/documents/samples/sampleimg16.iml +0 -0
  246. data/lib/wrb/documents/samples/sampleimg32.iml +0 -0
  247. data/lib/wrb/documents/samples/samplemg16.png +0 -0
  248. data/lib/wrb/documents/samples/samplemg32.png +0 -0
  249. data/lib/wrb/documents/samples/wrb.ico +0 -0
  250. data/lib/wrb/documents/savefilenamedlg.html +19 -0
  251. data/lib/wrb/documents/scrollbar.html +60 -0
  252. data/lib/wrb/documents/splitter.html +96 -0
  253. data/lib/wrb/documents/static.html +84 -0
  254. data/lib/wrb/documents/statusbar.html +110 -0
  255. data/lib/wrb/documents/tabctrl.html +151 -0
  256. data/lib/wrb/documents/timer.html +43 -0
  257. data/lib/wrb/documents/toolbar.html +181 -0
  258. data/lib/wrb/documents/tooltip.html +131 -0
  259. data/lib/wrb/documents/trackbar.html +107 -0
  260. data/lib/wrb/documents/treeview.html +210 -0
  261. data/lib/wrb/documents/updown.html +85 -0
  262. data/lib/wrb/documents/wincontrol.html +258 -0
  263. data/lib/wrb/documents/window.html +499 -0
  264. data/lib/wrb/documents/wrb.css +228 -0
  265. data/lib/wrb/gmem.rb +26 -0
  266. data/lib/wrb/imecommon.rb +59 -0
  267. data/lib/wrb/listcommon.rb +185 -0
  268. data/lib/wrb/lzss.rb +126 -0
  269. data/lib/wrb/scrollinfo.rb +142 -0
  270. data/lib/wrb/toplevelcommon.rb +634 -0
  271. metadata +315 -0
@@ -0,0 +1,131 @@
1
+ #ddemlserver
2
+ require 'wrb/ddeml'
3
+
4
+ module WR
5
+
6
+ # Provides Dynamic Data Exchange server.
7
+ class DdeServer < DDEML
8
+ def self.[](*args) self.new(*args); end
9
+
10
+ def initialize(*args)
11
+ @_owner = args.shift if args[0].is_a?(Window)
12
+ appname, topic, codepage, timeout = args
13
+ @_appname = appname || raise(ArgumentError, "appname needed")
14
+ @_topic = topic || raise(ArgumentError, "topic needed")
15
+ @_codepage = codepage || CP_WINUNICODE
16
+ @__adv_value__ = {}
17
+ end
18
+
19
+ def name
20
+ @_appname
21
+ end
22
+
23
+ def parent()
24
+ @_owner
25
+ end
26
+ def parent=(win)
27
+ @_owner = win
28
+ create if @_owner.alive?
29
+ end
30
+
31
+ def create() # will be called from owner window.
32
+ @sescallback = lambda{|uType, uFmt, hconv, htopic, hservice, hdata, dwData1, dwData2|
33
+ dispatchXTYP(uType, uFmt, hconv, htopic, hservice, hdata, dwData1, dwData2)
34
+ }
35
+ idinst = IDINST.new
36
+ API.DdeInitialize(idinst, @sescallback, APPCLASS_STANDARD | CBF_SKIP_ALLNOTIFICATIONS, 0)
37
+ @_idinst = idinst.value
38
+ @_hservice = str2h(@_appname.to_s)
39
+ @_htopic = str2h(@_topic)
40
+ API.DdeNameService(@_idinst, @_hservice, 0, DNS_REGISTER)
41
+ ObjectSpace.define_finalizer(self,
42
+ self.class.callback_finalizer(@_idinst, @_hservice, @_htopic))
43
+ end
44
+
45
+ def post_advise(topic, item)
46
+ API.DdePostAdvise(@_idinst, str2h(topic), str2h(item));
47
+ end
48
+
49
+ private
50
+ def dispatchXTYP(uType, uFmt, hconv, htopic, hitem, hdata, dwData1, dwData2)
51
+ case uType
52
+ when XTYP_CONNECT
53
+ return hitem==@_hservice && htopic==@_htopic ? 1 : 0
54
+ when XTYP_REQUEST
55
+ if @_owner.respond_to?("#{@_appname}_request")
56
+ s = @_owner.__send__("#{@_appname}_request", h2str(htopic), h2str(hitem))
57
+ return data2h(hitem, s)
58
+ end
59
+ when XTYP_POKE
60
+ if @_owner.respond_to?("#{@_appname}_poke")
61
+ @_owner.__send__("#{@_appname}_poke", h2str(htopic), h2str(hitem), h2data(hdata))
62
+ return DDE_FACK
63
+ end
64
+ when XTYP_EXECUTE
65
+ if @_owner.respond_to?("#{@_appname}_execute")
66
+ @_owner.__send__("#{@_appname}_execute", h2str(htopic), h2str(hitem), h2data(hdata))
67
+ return DDE_FACK
68
+ end
69
+ when XTYP_ADVSTART
70
+ if @_owner.respond_to?("#{@_appname}_advstart")
71
+ @_owner.__send__("#{@_appname}_advstart", h2str(htopic), h2str(hitem))
72
+ return DDE_FACK
73
+ end
74
+ when XTYP_ADVREQ
75
+ if @_owner.respond_to?("#{@_appname}_advreq")
76
+ data = @_owner.__send__("#{@_appname}_advreq", h2str(htopic), h2str(hitem))
77
+ return data2h(hitem, data) # Data will be automatically free when returned.
78
+ end
79
+ when XTYP_ADVSTOP
80
+ if @_owner.respond_to?("#{@_appname}_advstop")
81
+ @_owner.__send__("#{@_appname}_advstop", h2str(htopic), h2str(hitem))
82
+ return DDE_FACK
83
+ end
84
+ else
85
+ # dp "@%#x", uType
86
+ end
87
+ return 0
88
+ end
89
+ end
90
+
91
+ end
92
+
93
+ module WR
94
+ class MyForm < Form
95
+ def initialize()
96
+ resize 280, 210
97
+ self.caption = "DDEServer"
98
+ _<< Button[:bt1, "Advise", 0, 0, 100, 24]
99
+ _<< DdeServer[:mytest, "Mytopic"]
100
+ _<< DdeServer[:mytest, "Mytopic1"]
101
+ end
102
+
103
+ def mytest_advstart(topic, item)
104
+ _.bt1.caption = "Advise start"
105
+ end
106
+
107
+ def mytest_advstop(topic, item)
108
+ _.bt1.caption = "Advise stop"
109
+ end
110
+
111
+ def bt1_clicked(*)
112
+ _.mytest[1].post_advise('Mytopic1', 'R1C1')
113
+ end
114
+
115
+ def mytest_advreq(topic, item)#; dpp topic, item
116
+ 'ABC123'
117
+ end
118
+
119
+ def mytest_request(topic, item) #; dpp topic, item
120
+ "request: #{topic}, #{item}"
121
+ end
122
+
123
+ def mytest_poke(topic, item, data)
124
+ dpp topic, item, data
125
+ end
126
+
127
+ self.start
128
+ end
129
+
130
+ end if $0 == __FILE__
131
+
@@ -0,0 +1,228 @@
1
+ require 'wrb/toplevelcommon'
2
+
3
+ module WR
4
+ module RC
5
+ # DS_ABSALIGN = 0x01
6
+ DS_SYSMODAL = 0x02
7
+ # DS_LOCALEDIT = 0x20
8
+ # DS_SETFONT = 0x40
9
+ # DS_MODALFRAME = 0x80
10
+ DS_NOIDLEMSG = 0x100
11
+ DS_SETFOREGROUND = 0x200
12
+
13
+ # DS_3DLOOK = 0x0004
14
+ # DS_FIXEDSYS = 0x0008
15
+ # DS_NOFAILCREATE = 0x0010
16
+ DS_CONTROL = 0x0400
17
+ DS_CENTER = 0x0800
18
+ DS_CENTERMOUSE = 0x1000
19
+ DS_CONTEXTHELP = 0x2000
20
+ # DS_SHELLFONT = (DS_SETFONT | DS_FIXEDSYS)
21
+ DS_USEPIXELS = 0x8000
22
+
23
+ WM_INITDIALOG = 0x0110 unless defined? WM_INITDIALOG
24
+
25
+ IDOK = 1
26
+ IDCANCEL = 2
27
+ IDABORT = 3
28
+ IDRETRY = 4
29
+ IDIGNORE = 5
30
+ IDYES = 6
31
+ IDNO = 7
32
+ IDCLOSE = 8
33
+ IDHELP = DLGMAX_ID = 9
34
+ end
35
+
36
+ # The dialog box that is also a container of controls.
37
+ # <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/api/
38
+ # _dlgbox/index"> Dialog Boxes section of Microsoft Docs.</a>
39
+ class Dialog < RWin::Dialog
40
+ include RC
41
+
42
+ WinStyles = {
43
+ :sysmodal => DS_SYSMODAL,
44
+ :contexthelp => DS_CONTEXTHELP
45
+ }.update ModToplevelWin::WinStyles
46
+
47
+ module ModDlgButton
48
+ include RC
49
+ def self.extended(obj)
50
+ obj.set_as_button
51
+ end
52
+
53
+ def set_as_button()
54
+ @__unplocessed.each{|i|
55
+ id = nil
56
+ case i
57
+ when :idok
58
+ id = IDOK
59
+ when :idcancel
60
+ id = IDCANCEL
61
+ end
62
+ if id
63
+ parent.unregister_event(id, WM_COMMAND, BN_CLICKED)
64
+ self.idcmd = id
65
+ parent.register_event(id, WM_COMMAND, BN_CLICKED, "#{name}_clicked")
66
+ end
67
+ }
68
+ end
69
+ end
70
+
71
+ alias __create__ create
72
+
73
+ include ModToplevelWin, ModBaseWin, ModAutoloading
74
+
75
+ DefaultDlgSize = [400, 300]
76
+ DefaultWindowStyle = WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION
77
+
78
+ API.defun "GetWindowRect(hWnd, pRect)"
79
+ API.defun "GetDesktopWindow()"
80
+
81
+ # Creates and show as modal dialog box.<br>
82
+ # If given nil as <i>parent</i>, creates as top level dialog box.
83
+ def self.open_modal(parent, arg=nil)
84
+ self.new.create(parent, true, arg)
85
+ end
86
+
87
+ # Creates and show as modeless dialog box.<br>
88
+ # If given nil as <i>parent</i>, creates as top level dialog box.
89
+ def self.open_modeless(parent, arg=nil)
90
+ self.new.create(parent, false, arg)
91
+ end
92
+
93
+ #
94
+ def create(owner=nil, modal=nil, arg=nil)
95
+ register_event(WM_INITDIALOG, "__initdialog__")
96
+ register_event(WM_GETFONT, "__getfont__")
97
+ register_event(WM_SIZE, "__resize__", "xh")
98
+ class << self.controls
99
+ def <<(args)
100
+ obj = super
101
+ obj.extend ModDlgButton if obj.is_a? Button
102
+ obj
103
+ end
104
+ end
105
+ self.controls.each{|i|
106
+ i.extend ModDlgButton if i.is_a? Button
107
+ }
108
+ @owner = owner
109
+ __create__(owner, modal, @_style, @_exstyle, arg)
110
+ end
111
+
112
+ # move_center([target=nil[, x, y])
113
+ # Moves this dialog to center of specified arguments.
114
+ def move_center(*args)
115
+ case args.size
116
+ when 0
117
+ target = @owner
118
+ w0, h0 = self.windowsize
119
+ when 1
120
+ target = args[0]
121
+ w0, h0 = self.windowsize
122
+ when 2
123
+ target = @owner
124
+ w0, h0 = args
125
+ when 3
126
+ target, w0, h0 = args
127
+ else
128
+ raise ArgumentError, "num of arguments must be 0..3", caller(1)
129
+ end
130
+ target = RWin::Application.getDesktop unless target
131
+ x1, y1, w1, h1 = target.windowrect
132
+ x = x1 + w1 / 2 - w0 / 2
133
+ y = y1 + h1 / 2 - h0 / 2
134
+ self.move(x, y, w0, h0)
135
+ end
136
+
137
+ #
138
+ def inspect()
139
+ "#<#{self.class}:#{self.__id__}>"
140
+ end
141
+
142
+ #
143
+ def style=(st)
144
+ st&DS_CONTEXTHELP > 0 ? self.exstyle|=WS_EX_CONTEXTHELP : self.exstyle&=~WS_EX_CONTEXTHELP
145
+ super
146
+ end
147
+
148
+ private
149
+ def __initdialog__()
150
+ self.icon = @_icon if @_icon
151
+ self.transparency = @_transparency if @_transparency
152
+ self.transparentcolor = @_transparentcolor if @_transparentcolor
153
+ self.caption = @_caption.to_s
154
+ w, h = @_w && @_h ? [@_w, @_h] : DefaultDlgSize
155
+ if @_x && @_y
156
+ x, y = @_x, @_y
157
+ elsif @owner
158
+ ox, oy = @owner.screenpos
159
+ ow, oh = @owner.windowsize
160
+ x, y = ox + (ow - w)/2, oy + (oh - h)/2
161
+ else
162
+ rc = RECT.new
163
+ API.GetWindowRect(API.GetDesktopWindow(), rc)
164
+ x1, y1, w1, h1 = rc.to_a
165
+ x = x1 + w1 / 2 - w / 2
166
+ y = y1 + h1 / 2 - h / 2
167
+ end
168
+ self.move(x, y, w, h)
169
+ controls._create
170
+ self.inheritfont = @_inheritfont if @_inheritfont
171
+ __send__(:opened, self.param) if respond_to?(:opened)
172
+ end
173
+ end
174
+ end
175
+
176
+ module WR
177
+ class MyDialog < Dialog
178
+ def initialize()
179
+ self.style |= WS_THICKFRAME | DS_SYSMODAL
180
+ self.inheritfont = 'Meiryo', -12, 'i'
181
+ resize 240, 180
182
+ controls << Button[:dlgbtn1, "OK", 10,0,100,24, :tabstop, :idcmd=>IDOK, :margin=>[nil,nil,0,10]]
183
+ controls << Button[:dlgbtn2, "Cancel", 110,0,100, 24, :tabstop, :idcancel]
184
+ end
185
+
186
+ def opened(arg)
187
+ self.style |= DS_CONTEXTHELP
188
+ self.caption = arg
189
+ end
190
+
191
+ def dlgbtn1_clicked(*)
192
+ close 100
193
+ end
194
+ def dlgbtn2_clicked(*)
195
+ close nil
196
+ end
197
+ end
198
+
199
+ class MyForm < Dialog
200
+ # class MyForm < Form
201
+ def initialize()
202
+ self.inheritfont = 'Meiryo', -12, 'b', :force
203
+ self.style |= WS_THICKFRAME
204
+ _<< Button[:bt1, "Modal", 0, 0, 100, 30, :idok]
205
+ _<< Button[:bt2, "Modeless", 100, 0, 100, 30, :idcmd=>IDCANCEL]
206
+ #_<< Button[:bt3, "Exit", 0, 50, 100, 30]
207
+ end
208
+
209
+ def opened(arg) # for dialog
210
+ _<< Button[:bt3, "Exit", 0, 50, 100, 30]
211
+ end
212
+ def created() # for form
213
+ _<< Button[:bt3, "Exit", 0, 50, 100, 30]
214
+ end
215
+
216
+ def bt1_clicked(*)
217
+ dpp MyDialog.open_modal(self, 'Modal dialog')
218
+ end
219
+ def bt2_clicked(*)
220
+ MyDialog.open_modeless(self, 'Modeless dialog')
221
+ end
222
+ def bt3_clicked(*)
223
+ APP.quit!
224
+ end
225
+
226
+ self.start # Wrapper of RW::Windows.automsgloop
227
+ end
228
+ end if __FILE__ == $0
@@ -0,0 +1,412 @@
1
+ require 'wrb'
2
+ require 'wrb/imecommon'
3
+
4
+ module WR
5
+ module RC
6
+ ES_LEFT = 0x0000
7
+ ES_CENTER = 0x0001
8
+ ES_RIGHT = 0x0002
9
+ ES_MULTILINE = 0x0004
10
+ ES_UPPERCASE = 0x0008
11
+ ES_LOWERCASE = 0x0010
12
+ ES_PASSWORD = 0x0020
13
+ ES_AUTOVSCROLL = 0x0040
14
+ ES_AUTOHSCROLL = 0x0080
15
+ ES_NOHIDESEL = 0x0100
16
+ ES_OEMCONVERT = 0x0400
17
+ ES_READONLY = 0x0800
18
+ ES_WANTRETURN = 0x1000
19
+ ES_NUMBER = 0x2000
20
+
21
+ EM_GETSEL = 0x00B0
22
+ EM_SETSEL = 0x00B1
23
+ EM_GETRECT = 0x00B2
24
+ EM_SETRECT = 0x00B3
25
+ EM_SETRECTNP = 0x00B4
26
+ EM_SCROLL = 0x00B5
27
+ EM_LINESCROLL = 0x00B6
28
+ EM_SCROLLCARET = 0x00B7
29
+ EM_GETMODIFY = 0x00B8
30
+ EM_SETMODIFY = 0x00B9
31
+ EM_GETLINECOUNT = 0x00BA
32
+ EM_LINEINDEX = 0x00BB
33
+ EM_SETHANDLE = 0x00BC
34
+ EM_GETHANDLE = 0x00BD
35
+ EM_GETTHUMB = 0x00BE
36
+ EM_LINELENGTH = 0x00C1
37
+ EM_REPLACESEL = 0x00C2
38
+ EM_GETLINE = 0x00C4
39
+ EM_LIMITTEXT = 0x00C5
40
+ EM_CANUNDO = 0x00C6
41
+ EM_UNDO = 0x00C7
42
+ EM_FMTLINES = 0x00C8
43
+ EM_LINEFROMCHAR = 0x00C9
44
+ EM_SETTABSTOPS = 0x00CB
45
+ EM_SETPASSWORDCHAR = 0x00CC
46
+ EM_EMPTYUNDOBUFFER = 0x00CD
47
+ EM_GETFIRSTVISIBLELINE = 0x00CE
48
+ EM_SETREADONLY = 0x00CF
49
+ EM_SETWORDBREAKPROC = 0x00D0
50
+ EM_GETWORDBREAKPROC = 0x00D1
51
+ EM_GETPASSWORDCHAR = 0x00D2
52
+ EM_SETMARGINS = 0x00D3
53
+ EM_GETMARGINS = 0x00D4
54
+ EM_SETLIMITTEXT = EM_LIMITTEXT
55
+ EM_GETLIMITTEXT = 0x00D5
56
+ EM_POSFROMCHAR = 0x00D6
57
+ EM_CHARFROMPOS = 0x00D7
58
+ EM_SETIMESTATUS = 0x00D8
59
+ EM_GETIMESTATUS = 0x00D9
60
+
61
+ EN_SETFOCUS = 0x0100
62
+ EN_KILLFOCUS = 0x0200
63
+ EN_CHANGE = 0x0300
64
+ EN_UPDATE = 0x0400
65
+ EN_ERRSPACE = 0x0500
66
+ EN_MAXTEXT = 0x0501
67
+ EN_HSCROLL = 0x0601
68
+ EN_VSCROLL = 0x0602
69
+ EN_ALIGN_LTR_EC = 0x0700
70
+ EN_ALIGN_RTL_EC = 0x0701
71
+
72
+ WM_CTLCOLOREDIT = 0x0133
73
+ end
74
+ # A rectangular control which enable the user to enter and edit text.
75
+ # <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
76
+ #window-controls"> Windows Control section of Microsoft Docs.</a>
77
+ class Edit < WinControl #< StandardControl
78
+ include ModStdCtrl
79
+
80
+ class Selection
81
+ include RC
82
+ def initialize(owner, selstart, selend)
83
+ @owner = owner
84
+ @selstart = selstart
85
+ @selend = selend
86
+ end
87
+
88
+ def text()
89
+ @owner.text[@selstart, @selend-@selstart]
90
+ end
91
+ def text=(txt)
92
+ @owner.SendMessage(EM_SETSEL, @selstart, @selend)
93
+ @owner.SendMessage(EM_REPLACESEL, 1, API.adjust_internal_lf_code(txt))
94
+ end
95
+ end
96
+
97
+ include ModIME
98
+
99
+ PreDefinedEvents = {
100
+ :setfocus => [WM_COMMAND, EN_SETFOCUS, 'hi'], # ???_setfocus(idcmd, code, hwnd)
101
+ :killfocus => [WM_COMMAND, EN_KILLFOCUS, 'hi'], # ???_killfocus(idcmd, code, hwnd)
102
+ :change => [WM_COMMAND, EN_CHANGE, 'hi'], # ???_change(idcmd, code, hwnd)
103
+ :update => [WM_COMMAND, EN_UPDATE, 'hi'], # ???_update(idcmd, code, hwnd)
104
+ :errspace => [WM_COMMAND, EN_ERRSPACE, 'hi'], # ???_errspace(idcmd, code, hwnd)
105
+ :maxtext => [WM_COMMAND, EN_MAXTEXT, 'hi'], # ???_maxtext(idcmd, code, hwnd)
106
+ :hscroll => [WM_COMMAND, EN_HSCROLL, 'hi'], # ???_hscroll(idcmd, code, hwnd)
107
+ :vscroll => [WM_COMMAND, EN_VSCROLL, 'hi'], # ???_vscroll(idcmd, code, hwnd)
108
+ :align_ltr_ec => [WM_COMMAND, EN_ALIGN_LTR_EC, 'hi'], # ???_align_ltr_ec(idcmd, code, hwnd)
109
+ :align_rtl_ec => [WM_COMMAND, EN_ALIGN_RTL_EC, 'hi'], # ???_align_rtl_ec(idcmd, code, hwnd)
110
+ }
111
+
112
+ DefaultEvents = [
113
+ :change, # ???_change(idcmd, code, hwnd)
114
+ :update # ???_update(idcmd, code, hwnd)
115
+ ]
116
+
117
+ def initialize(*args)
118
+ super
119
+ @_classname = "EDIT"
120
+ # self.style |= WS_BORDER
121
+ @_exstyle = WS_EX_CLIENTEDGE
122
+ @_acceptable_events = PreDefinedEvents.dup
123
+ end
124
+
125
+ #
126
+ def idcmd=(id) # for IME
127
+ parent.set_msgtranslator(WM_COMMAND) unless parent.get_msgtranslator(WM_COMMAND)
128
+ parent.register_event(id, WM_COMMAND, EN_SETFOCUS, "__gotfocus", 'hi', self)
129
+ parent.register_event(id, WM_COMMAND, EN_KILLFOCUS, "__lostfocus", 'hi', self)
130
+ super
131
+ end
132
+
133
+ #
134
+ def create()
135
+ super
136
+ self.limittext = @_limittext if @_limittext
137
+ self.passwordchar = @_passwordchar if @_passwordchar
138
+ end
139
+
140
+ #### write only attributes ####
141
+
142
+ # Sets edit style of this to ES_AUTOVSCROLL or not.
143
+ def autovscroll=(state)
144
+ set_style(state ? ES_AUTOVSCROLL : ~ES_AUTOVSCROLL)
145
+ end
146
+
147
+ # Sets edit style of this to ES_AUTOHSCROLL or not.
148
+ def autohscroll=(state)
149
+ set_style(state ? ES_AUTOHSCROLL : ~ES_AUTOHSCROLL)
150
+ end
151
+
152
+ # Sets edit style of this to ES_MULTILINE or not.
153
+ def muitiline=(state)
154
+ set_style(state ? ES_MULTILINE : ~ES_MULTILINE)
155
+ end
156
+
157
+ # Sets edit style of this to ES_PASSWORD or not.
158
+ def password=(state)
159
+ set_style(state ? ES_PASSWORD : ~ES_PASSWORD)
160
+ end
161
+
162
+ # Sets edit style of this to EM_SETREADONLY or not.
163
+ def readonly=(state)
164
+ if state != true && state !=false && state != nil
165
+ raise ArgumentError, "argument must be ture, false or nil", caller(2)
166
+ end
167
+ SendMessage(EM_SETREADONLY, state ? 1 : 0, 0)
168
+ end
169
+
170
+ # Sets edit style of this to ES_WANTRETRURN or not.
171
+ def wantreturn=(state)
172
+ set_style(sate ? ES_WANTRETRURN : ~ES_WANTRETRURN, true)
173
+ end
174
+
175
+ # Sets th back ground color of this. Give a RGB integer as <i>clr</i>.
176
+ def bkcolor=(clr)
177
+ parent.register_event WM_CTLCOLOREDIT, "__ctlcoloredit__", 'ii', self
178
+ @_bkcolor = clr
179
+ end
180
+
181
+ #### read-write attributes ####
182
+
183
+ # Gets the current text limit for this edit control.
184
+ def limittext()
185
+ alive? ? SendMessage(EM_GETLIMITTEXT, 0, 0) : @_limittext
186
+ end
187
+ # Sets the text limit of this edit control.
188
+ def limittext=(lim)
189
+ alive? ? SendMessage(EM_LIMITTEXT, lim.to_i, 0) : @_limittext = lim
190
+ end
191
+
192
+ # Gets the password character that this edit control displays when the user enters text.<br>
193
+ # Returns a single charactor of String or nil. If nil was given, this edit control is used system default password charactor.
194
+ def passwordchar()
195
+ alive? ? SendMessage(EM_GETPASSWORDCHAR , 0, 0).chr : @_passwordchar
196
+ end
197
+ # Sets or removes the password character for this edit control. <br>
198
+ # Give a single charactor of String, or nil.
199
+ def passwordchar=(ch)
200
+ alive? ? SendMessage(EM_SETPASSWORDCHAR , ch.ord, 0) : @_passwordchar = ch
201
+ end
202
+
203
+ #### only for after created ####
204
+
205
+ # Retreives wheter this edit control was modified.
206
+ def modified()
207
+ SendMessage(EM_GETMODIFY, 0, 0) == 0 ? false : true
208
+ end
209
+ # Sets modified flag to true or false.
210
+ def modified=(f)
211
+ SendMessage(EM_SETMODIFY, f ? 1 : 0, 0)
212
+ end
213
+
214
+ # Gets the starting and ending character positions of the current selection.
215
+ def selection() # returns [start_pos, end_pos]
216
+ Selection.new(self, *SPLITPARAM(SendMessage(EM_GETSEL, 0, 0)))
217
+ end
218
+
219
+ # selection=(starting[, ending])
220
+ # Selects a range of characters in an edit control.
221
+ def selection=(arg)
222
+ if arg.is_a?(Integer) || arg.is_a?(Array)
223
+ start_pos, end_pos = arg
224
+ end_pos ||= start_pos
225
+ else
226
+ raise ArgumentError, "#{arg.class} is not allowed", caller(1)
227
+ end
228
+ SendMessage(EM_SETSEL, start_pos.to_i, end_pos.to_i)
229
+ end
230
+
231
+ # Sets a text into this edit contlol. Same as caption().
232
+ def text()
233
+ self.caption
234
+ end
235
+
236
+ # Gets a text of this edit contlol. Same as caption=(str).
237
+ def text=(txt)
238
+ self.caption = API.adjust_internal_lf_code(txt)
239
+ end
240
+
241
+ # Gets a text length of this edit control.
242
+ def length()
243
+ self.text.size
244
+ end
245
+
246
+ # []=(position, length=1, text)
247
+ # Inserts and replaces at the specified <i>position</i> and <i>length</i> by the <i>text</i> in this edit control.
248
+ def []=(*args)
249
+ case args.size
250
+ when 2
251
+ start_pos, txt = args
252
+ len = 0
253
+ when 3
254
+ start_pos, len, txt = args
255
+ end
256
+ SendMessage(EM_SETSEL, start_pos, start_pos + len)
257
+ SendMessage(EM_REPLACESEL, 0, API.adjust_internal_lf_code(txt))
258
+ end
259
+
260
+ #### clip board operations etc.. ####
261
+
262
+ # Performs cut operation.
263
+ def cut() SendMessage(WM_CUT, 0, 0); end
264
+ # Performs copy operation.
265
+ def copy() SendMessage(WM_COPY, 0, 0); end
266
+ # Performs paste operation.
267
+ def paste() SendMessage(WM_PASTE, 0, 0); end
268
+ # Performs undo operation.
269
+ def undo() SendMessage(WM_UNDO, 0, 0); end
270
+
271
+ # Clears all text in this edit control.
272
+ def clear() SendMessage(WM_CLEAR, 0, 0); end
273
+
274
+
275
+ #### methods for multi line ####
276
+
277
+ # Gets a text of specified line index.
278
+ def [](idx) # line manipulation
279
+ n = SendMessage(EM_LINELENGTH, idx.to_i, 0)
280
+ n = RWin::UNICODE ? n : n*2
281
+ buff = TCHAR[n]
282
+ buff.subst(0, 2, n)
283
+ SendMessage(EM_GETLINE, idx.to_i, buff)
284
+ class << str = buff.to_s
285
+ def owner=(owner)
286
+ @owner = owner
287
+ self
288
+ end
289
+ def []=(*args)
290
+ txt = args.pop
291
+ @owner[*args] = txt
292
+ end
293
+ end
294
+ str.owner = self
295
+ str
296
+ end
297
+
298
+ # Counts num of lines in this edit control.
299
+ def countlines()
300
+ SendMessage(EM_GETLINECOUNT, 0, 0)
301
+ end
302
+
303
+ # Retreives an array of lines separated by CRLF code.
304
+ def lines()
305
+ Collection.new(self.caption.split())
306
+ end
307
+
308
+ # Gets first visible line of this edit control.<br> Retruns an Integer.
309
+ def firstvisibleline()
310
+ SendMessage(EM_GETFIRSTVISIBLELINE, 0, 0)
311
+ end
312
+
313
+ # Scrolls the text to specified line and column.
314
+ def scrollto(line, col)
315
+ SendMessage(EM_LINESCROLL, 0, MAKELPARAM(line, col))
316
+ end
317
+
318
+ def _scroll(op)
319
+ SendMessage(EM_SCROLL, op.to_i, 0)
320
+ end
321
+ private :_scroll
322
+
323
+ # Scrolls up to one line.
324
+ def scrollup() _scroll(0); end
325
+
326
+ # Scrolls down to one line.
327
+ def scrolldown() _scroll(1); end
328
+
329
+ # Scrolls up to one page.
330
+ def scrolluppage() _scroll(2); end
331
+
332
+ # Scrolls down to one page.
333
+ def scrolldnpage() _scroll(3); end
334
+
335
+ # Scrolls the caret into view in this edit control.
336
+ def scrollcaret()
337
+ SendMessage(EM_SCROLLCARET, 0, 0)
338
+ end
339
+
340
+ # Retreives a line number of specified position in this edit control.
341
+ def pos2line(pos) SendMessage(EM_LINEFROMCHAR, pos.to_i, 0); end
342
+
343
+ # Retreives a first position of specified line number in this edit control.
344
+ def line2pos(line) SendMessage(EM_LINEINDEX, line.to_i, 0); end
345
+
346
+ # Retreives a current line number of this edit control.
347
+ def currentline() SendMessage(EM_LINEFROMCHAR, -1, 0); end
348
+
349
+ # Retreives a position of specified coordinate(x, y) in this edit control.
350
+ def point2pos(x, y) LOWORD(SendMessage(EM_CHARFROMPOS, 0, MAKELPARAM(x, y))); end
351
+
352
+ # Retreives a line number of specified coordinate(x, y) in this edit control.
353
+ def point2line(x, y) HIWORD(SendMessage(EM_CHARFROMPOS, 0, MAKELPARAM(x, y))); end
354
+
355
+ WinStyles = {
356
+ :center => ES_CENTER,
357
+ :right => ES_RIGHT,
358
+ :multiline => ES_MULTILINE,
359
+ :uppercase => ES_UPPERCASE,
360
+ :lowercase => ES_LOWERCASE,
361
+ :password => ES_PASSWORD,
362
+ :autovscroll => ES_AUTOVSCROLL,
363
+ :autohscroll => ES_AUTOHSCROLL,
364
+ :nohidesell => ES_NOHIDESEL,
365
+ :oemconvert => ES_OEMCONVERT,
366
+ :readonly => ES_READONLY,
367
+ :wantreturn => ES_WANTRETURN,
368
+ :number => ES_NUMBER
369
+ }
370
+
371
+ protected
372
+ def _apply_options(arg)
373
+ if st=WinStyles[arg]
374
+ self.style |= st
375
+ return nil
376
+ end
377
+ super
378
+ end
379
+
380
+ def __ctlcoloredit__(hdc, hwnd)
381
+ return nil unless self._hwnd == hwnd
382
+ Canvas.new(hdc).Transparent
383
+ APP::CancelDefWindowProc(RWin::Brush.new(@_bkcolor)._hbrush)
384
+ end
385
+ end
386
+ end
387
+
388
+ module WR
389
+ class MyForm < Form
390
+ def initialize()
391
+ _<< Edit[:ed1, "Edit me", 0, 0, 100, 30, :disabled]
392
+ _<< Edit[:ed2, "Edit me", 0, 30, 100, 30]
393
+ # _ed1.each{|i| i.bkcolor=0xe0e0e0}
394
+ # @ed1.events = :change
395
+ # @ed1.accept_events :update , :change
396
+ # @ed1.set_subclass.register_event WM_KEYDOWN, 'key_down', 'ih'
397
+ # def @ed1.key_down(*args)
398
+ # dpp args
399
+ # end
400
+ end
401
+
402
+ def ed2_change(*args)
403
+ dpp args
404
+ end
405
+ def ed2_update(*args)
406
+ dpp args
407
+ end
408
+
409
+ self.start
410
+ end
411
+ end if $0 == __FILE__
412
+