wrb 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,134 @@
1
+ require 'wrb'
2
+
3
+ module WR
4
+ module RC
5
+ BS_PUSHBUTTON = 0x0000
6
+ BS_DEFPUSHBUTTON = 0x0001
7
+ BS_CHECKBOX = 0x0002
8
+ BS_AUTOCHECKBOX = 0x0003
9
+ BS_RADIOBUTTON = 0x0004
10
+ BS_3STATE = 0x0005
11
+ BS_AUTO3STATE = 0x0006
12
+ BS_GROUPBOX = 0x0007
13
+ #BS_USERBUTTON = 0x0008 # obsolete
14
+ BS_AUTORADIOBUTTON= 0x0009
15
+ BS_PUSHBOX = 0x000a
16
+ BS_OWNERDRAW = 0x000b
17
+ BS_TYPEMASK = 0x000f
18
+ BS_LEFTTEXT = 0x0020
19
+ BS_TEXT = 0x0000
20
+ BS_ICON = 0x0040
21
+ BS_BITMAP = 0x0080
22
+ BS_LEFT = 0x0100
23
+ BS_RIGHT = 0x0200
24
+ BS_CENTER = 0x0300
25
+ BS_TOP = 0x0400
26
+ BS_BOTTOM = 0x0800
27
+ BS_VCENTER = 0x0c00
28
+ BS_PUSHLIKE = 0x1000
29
+ BS_MULTILINE = 0x2000
30
+ BS_NOTIFY = 0x4000
31
+ BS_FLAT = 0x8000
32
+ BS_RIGHTBUTTON = BS_LEFTTEXT
33
+
34
+ BN_CLICKED = 0 unless defined? BN_CLICKED # uses Toolbar
35
+ BN_PAINT = 1
36
+ BN_HILITE = 2
37
+ BN_UNHILITE = 3
38
+ BN_DISABLE = 4
39
+ BN_DOUBLECLICKED = 5
40
+ BN_PUSHED = BN_HILITE
41
+ BN_UNPUSHED = BN_UNHILITE
42
+ BN_DBLCLK = BN_DOUBLECLICKED
43
+ BN_SETFOCUS = 6
44
+ BN_KILLFOCUS = 7
45
+
46
+ BM_GETCHECK = 0x00f0
47
+ BM_SETCHECK = 0x00f1
48
+ BM_SETSTATE = 0x00f3
49
+ BM_SETSTYLE = 0x00f4
50
+ BM_CLICK = 0x00f5
51
+ BM_GETIMAGE = 0x00f6
52
+ BM_SETIMAGE = 0x00f7
53
+
54
+ BST_UNCHECKED = 0x0000
55
+ BST_CHECKED = 0x0001
56
+ BST_INDETERMINATED = 0x0002
57
+ BST_PUSHED = 0x0004
58
+ BST_FOCUS = 0x0008
59
+ end
60
+
61
+ # This is a control the user can click to provide input to an application.
62
+ # <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
63
+ # window-controls"> Windows Control section of Microsoft Docs.</a>
64
+ class Button < WinControl
65
+ include ModStdCtrl
66
+
67
+ WinStyles = {
68
+ :pushbox => BS_PUSHBOX,
69
+ :ownerdraw => BS_OWNERDRAW,
70
+ :typemask => BS_TYPEMASK,
71
+ :lefttext => BS_LEFTTEXT,
72
+ :text => BS_TEXT,
73
+ :icon => BS_ICON,
74
+ :bitmap => BS_BITMAP,
75
+ :left => BS_LEFT,
76
+ :right => BS_RIGHT,
77
+ :center => BS_CENTER,
78
+ :top => BS_TOP,
79
+ :bottom => BS_BOTTOM,
80
+ :vcenter => BS_VCENTER,
81
+ :pushlike => BS_PUSHLIKE,
82
+ :multiline => BS_MULTILINE,
83
+ :notify => BS_NOTIFY,
84
+ :flat => BS_FLAT,
85
+ }
86
+
87
+ PreDefinedEvents = {
88
+ :clicked => [WM_COMMAND, BN_CLICKED, 'hi'],
89
+ :paint => [WM_COMMAND, BN_PAINT, 'hi'],
90
+ :hilight => [WM_COMMAND, BN_HILITE, 'hi'],
91
+ :unhilight => [WM_COMMAND, BN_UNHILITE, 'hi'],
92
+ :disable => [WM_COMMAND, BN_DISABLE, 'hi'],
93
+ :doubleclicked => [WM_COMMAND, BN_DOUBLECLICKED, 'hi'],
94
+ :pushed => [WM_COMMAND, BN_PUSHED, 'hi'],
95
+ :unpushed => [WM_COMMAND, BN_UNPUSHED, 'hi'],
96
+ :dblclk => [WM_COMMAND, BN_DBLCLK, 'hi'],
97
+ :setfocus => [WM_COMMAND, BN_SETFOCUS,'hi'],
98
+ :killfocus => [WM_COMMAND, BN_KILLFOCUS, 'hi']
99
+ }
100
+
101
+ DefaultEvents = [
102
+ :clicked, # ???_clicked(idcmd, code, hwnd)
103
+ :killfocus # ???_killfocus(idcmd, code, hwnd)
104
+ ]
105
+
106
+ # def self.sym2style(*args) _sym2style(WinStyles, args); end
107
+
108
+ def initialize(*args)
109
+ super
110
+ @_classname = "BUTTON"
111
+ @_acceptable_events = PreDefinedEvents.dup
112
+ end
113
+
114
+ protected
115
+ def _apply_options(arg)
116
+ if st=WinStyles[arg]
117
+ @_style |= st
118
+ return nil
119
+ end
120
+ super
121
+ end
122
+ end
123
+ end
124
+
125
+ module WR
126
+ class Fprm1 < Form
127
+ def initialize()
128
+ _<< Button[:button1, "Click me", 0, 0, 80, 24, :flat]
129
+ end
130
+
131
+ self.start
132
+ end
133
+ end if __FILE__ ==$0
134
+
@@ -0,0 +1,266 @@
1
+ require 'wrb'
2
+
3
+ module WR
4
+ module RC
5
+ ## DrawText constants ##
6
+ DT_TOP = 0x00000000
7
+ DT_LEFT = 0x00000000
8
+ DT_CENTER = 0x00000001
9
+ DT_RIGHT = 0x00000002
10
+ DT_VCENTER = 0x00000004
11
+ DT_BOTTOM = 0x00000008
12
+ DT_WORDBREAK = 0x00000010
13
+ DT_SINGLELINE = 0x00000020
14
+ DT_EXPANDTABS = 0x00000040
15
+ DT_TABSTOP = 0x00000080
16
+ DT_NOCLIP = 0x00000100
17
+ DT_EXTERNALLEADING = 0x00000200
18
+ DT_CALCRECT = 0x00000400
19
+ DT_NOPREFIX = 0x00000800
20
+ DT_INTERNAL = 0x00001000
21
+ DT_EDITCONTROL = 0x00002000
22
+ DT_PATH_ELLIPSIS = 0x00004000
23
+ DT_END_ELLIPSIS = 0x00008000
24
+ DT_MODIFYSTRING = 0x00010000
25
+ DT_RTLREADING = 0x00020000
26
+ DT_WORD_ELLIPSIS = 0x00040000
27
+ DT_NOFULLWIDTHCHARBREAK = 0x00080000
28
+ DT_HIDEPREFIX = 0x00100000
29
+ DT_PREFIXONLY = 0x00200000
30
+
31
+ ## raster operation constants ##
32
+ R2_BLACK = 1
33
+ R2_NOTMERGEPEN = 2
34
+ R2_MASKNOTPEN = 3
35
+ R2_NOTCOPYPEN = 4
36
+ R2_MASKPENNOT = 5
37
+ R2_NOT = 6
38
+ R2_XORPEN = 7
39
+ R2_NOTMASKPEN = 8
40
+ R2_MASKPEN = 9
41
+ R2_NOTXORPEN = 10 # uses splitter.rb
42
+ R2_NOP = 11
43
+ R2_MERGENOTPEN = 12
44
+ R2_COPYPEN = 13
45
+ R2_MERGEPENNOT = 14
46
+ R2_MERGEPEN = 15
47
+ R2_WHITE = 16
48
+ R2_LAST = 16
49
+
50
+ # BitBlt raster operatrion
51
+ SRCCOPY = 0x00CC0020
52
+ SRCPAINT = 0x00EE0086
53
+ SRCAND = 0x008800C6
54
+ SRCINVERT = 0x00660046
55
+ SRCERASE = 0x00440328
56
+ NOTSRCCOPY = 0x00330008
57
+ NOTSRCERASE = 0x001100A6
58
+ MERGECOPY = 0x00C000CA
59
+ MERGEPAINT = 0x00BB0226
60
+ PATCOPY = 0x00F00021
61
+ PATPAINT = 0x00FB0A09
62
+ PATINVERT = 0x005A0049
63
+ DSTINVERT = 0x00550009
64
+ BLACKNESS = 0x00000042
65
+ WHITENESS = 0x00FF0062
66
+ NOMIRRORBITMAP = 0x80000000
67
+ CAPTUREBLT = 0x40000000
68
+
69
+ # Following is original. See https://msdn.microsoft.com/en-us/library/dd145130(v=vs.85).aspx
70
+ DSTTRANSPARENT = 0xAA0029 # for transparent background (DST only)
71
+
72
+ def MAKEROP4(fore, back) ((back << 8) & 0xFF000000) | fore; end
73
+ module_function :MAKEROP4
74
+
75
+ # pre-defined API functions
76
+ API.loadlib "user32.dll"
77
+ API.defun "GetSysColor(int)"
78
+
79
+ ## system colors ##
80
+ COLOR_SCROLLBAR = 0
81
+ COLOR_BACKGROUND = 1
82
+ COLOR_ACTIVECAPTION = 2
83
+ COLOR_INACTIVECAPTION = 3
84
+ COLOR_MENU = 4
85
+ COLOR_WINDOW = 5
86
+ COLOR_WINDOWFRAME = 6
87
+ COLOR_MENUTEXT = 7
88
+ COLOR_WINDOWTEXT = 8
89
+ COLOR_CAPTIONTEXT = 9
90
+ COLOR_ACTIVEBORDER = 10
91
+ COLOR_INACTIVEBORDER = 11
92
+ COLOR_APPWORKSPACE = 12
93
+ COLOR_HIGHLIGHT = 13
94
+ COLOR_HIGHLIGHTTEXT = 14
95
+ COLOR_BTNFACE = 15 # uses splitter
96
+ COLOR_BTNSHADOW = 16 # uses splitter
97
+ COLOR_GRAYTEXT = 17
98
+ COLOR_BTNTEXT = 18
99
+ COLOR_INACTIVECAPTIONTEXT = 19
100
+ COLOR_BTNHIGHLIGHT = 20
101
+ COLOR_3DDKSHADOW = 21
102
+ COLOR_3DLIGHT = 22
103
+ COLOR_INFOTEXT = 23
104
+ COLOR_INFOBK = 24
105
+ COLOR_HOTLIGHT = 26
106
+ COLOR_GRADIENTACTIVECAPTION = 27
107
+ COLOR_GRADIENTINACTIVECAPTION = 28
108
+ COLOR_MENUHILIGHT = 29
109
+ COLOR_MENUBAR = 30
110
+
111
+ COLOR_DESKTOP = COLOR_BACKGROUND
112
+ COLOR_3DFACE = COLOR_BTNFACE
113
+ COLOR_3DSHADOW = COLOR_BTNSHADOW
114
+ COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT
115
+ COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT
116
+ COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT
117
+
118
+ AD_COUNTERCLOCKWISE = 1
119
+ AD_CLOCKWISE = 2
120
+ end
121
+
122
+ # This is wrapper of <i>hDC</i> operation of the window.<br>
123
+ # See <a href="https://docs.microsoft.com/en-us/windows/desktop/api/_gdi/">
124
+ # GDI section of Microsoft Docs </a> for more information.
125
+ class Canvas < RWin::Canvas # This is a document holder.
126
+
127
+ =begin
128
+ self.new(arg)
129
+ Creates a new canvas from a window or a hdc (device context handle).<br>
130
+ Not recommended to use directly, recommended to use in the <i>paint</i> message handler or in the `self.draw' method.
131
+
132
+ following methods are defined in the super class.
133
+ :singleton method
134
+ self.draw(window | hdc){|cv| ... }
135
+ Creates a new canvas from a window or a hdc (device context handle).<br>
136
+ This method needs a block. A canvas object will be given as block parameter.
137
+ You can use all following methods in this block.<br>
138
+ Note: This drawing is only at once. If you want to continue, draw in the <i>paint</i> message handler.
139
+
140
+ :instance methods
141
+ AngleArc(x, y, r, startAngle, sweepAngle)
142
+ Draws a line segment and an arc.
143
+ Arc(x1, y1, x2, y2, x3, y3)
144
+ Draws an elliptical arc.
145
+ ArcTo(left, top, right, bottom, xr1, yr1, xr2, yr2)
146
+ Draws an elliptical arc
147
+ BitBlt(xdest, ydest[, w, h], source[, xsrc, ysrc][, rop])
148
+ Performs a bit-block transfer of the data corresponding to a rectangle of pixels from the source object to this canvas.<br>
149
+ Chord(x1, y1, x2, y2, x3, y3, x4, y4)
150
+ Draws a chord.
151
+ DrawIcon(icon, x, y)
152
+ Draws an image of specified icon.
153
+ DrawImagelist(imagelist, index, x, y, style=0)
154
+ Draws an image of specified index of the image list.
155
+ DrawText(text, [left, top[, right, bottm]] | rect, format=0)
156
+ Draws formatted text in the specified rectangle.
157
+ Ellipse(left, top, right, bottom)
158
+ Draws an ellipse.
159
+ FillRect(left, top, right, bottom, burush)
160
+ Fills a rectangle by using the specified brush. Give a RWin::Brush as <i>brush</i>.
161
+ FloodFill(x, y, color, filltype=FLOODFILLBORDER)
162
+ Fills an area of the display surface with the current brush.
163
+ FrameRect(left, top, right, bottom, brush)
164
+ Draws a border around the specified rectangle by using the specified brush.
165
+ GetArcDirection()
166
+ Retrieves the current arc direction for this canvas. <br>
167
+ Arc and rectangle functions use the arc direction.
168
+ GetBkColor()
169
+ Retreives the current background color of this canvas.
170
+ GetDeviceCaps(index)
171
+ Retrieves the device-specific information for this canvas by given index.
172
+ GetLogPixels()
173
+ Gets number of pixels per logical inch along the screen width.(Not GDI function)
174
+ GetROP2()
175
+ Retrieves the foreground mix mode of this canvas.
176
+ GetStretchBltMode()
177
+ Retrieves the current stretching mode.
178
+ GetSysColor(index)
179
+ Retrieves the current color of specified index of display element.
180
+ GetTextColor()
181
+ Retrieves the current text color for this canvas.
182
+ GetTextExtent()
183
+ Computes the width and height of the specified string of text.<br>
184
+ Returns array of [width, height].
185
+ InvertRect(left, top, right, bottom)
186
+ Inverts a rectangle in a window by performing a logical NOT operation on the color values for each pixel in the given rectangle's interior.
187
+ LineTo(x, y)
188
+ Draws a line from the current position up to, but not including, the specified point.
189
+ MaskBlt(xdest, ydest[, w, h], source[, xsrc, ysrc], mask[, rop])
190
+ Performs a bit-block transfer with mask image. Give a monochrome bitmap as <i>mask</i>.
191
+ MoveTo(x, y)
192
+ Updates the current position to the specified point.Retruns previous point as an array.
193
+ Opaque()
194
+ Sets back mode of this canvas to opaque.
195
+ PatBlt(x, y, w, h[, rop])
196
+ Paints the specified rectangle using the currently selected brush and the specified raster operation.
197
+ Pie(left, top, right, bottom, xr1, yr1, xr2, yr2)
198
+ Draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials.
199
+ PlgBlt(point1, point2, point3, src[, xsrc, ysrc[, wsrc, hsrc]], xdst, ydst)
200
+ Performs a bit-block transfer from the specified rectangle in the source to the specified parallelogram in this canvas.
201
+ Give an array of two integers such as [x1, y1] as <i>points</i>.
202
+ PolyBezier(point1, point1, ... )
203
+ Draws one or more Bezier curves.
204
+ Give an array of two integers such as [x, y] as each <i>points</i>.
205
+ PolyBezierTo(point1, point2, ... )
206
+ Draws a PolyBezier from the current position and update the current position.
207
+ PolyDraw(arpoint, arjoint)
208
+ Draws a set of line segments and Bezier curves.<br>
209
+ Give an array of point such as [[x1, y1], [x2, y2], [x3, y3] ... ] as <i>arpoint</i>.<br>
210
+ And give an array of integer as <i>arjoint</i>.
211
+ PolyPolygon(polygon1, polygon2, ... )
212
+ Draws the polygons by given array of polygons. (Not tested, so can anyone test it?)
213
+ Give an array of points such as [[x1, y1], [x2, y2] ... ] as each <i>polygons</i>.
214
+ PolyPolyline(polyline1, polyline2, ... )
215
+ Draws the polylines by given array of polylines. (Not tested, so can anyone test it?)
216
+ Give an array of points such as [[x1, y1], [x2, y2] ... ] as each <i>polylines</i>.
217
+ Polygon(point1, point2, ... )
218
+ Draws a polygon.<br>
219
+ Give an array of two integers such as [x, y] as each <i>points</i>.
220
+ Polyline(point1, point2, ... )
221
+ Draws a series of line segments by connecting the points in the specified array.<br>
222
+ Give an array of two integers such as [x, y] as each <i>points</i>.
223
+ PolylineTo(point1, point1, ... )
224
+ Draws a Polyline from the current position and update the current position.
225
+ Rectangle(left, top, right, bottom)
226
+ Draws a rectangle.
227
+ RoundRect(left, top, right, bottom, width, height)
228
+ Draws a rectangle with rounded corners.
229
+ SetArcDirection(dir)
230
+ Sets the drawing direction to be used for arc and rectangle functions.<br>
231
+ Give AD_CLOCKWISE/AD_COUNTERCLOCKWISE as <i>dir</i>.
232
+ SetBkColor(color)
233
+ Sets the text back color for this canvas to the specified color.
234
+ SetBrush(brush)
235
+ Sets the current brush style by giving RWin::Brush or RGB color.
236
+ SetFont(font)
237
+ Sets the current font by giving the RWin::Font.
238
+ SetHBrush(hbrush)
239
+ Sets the current burush style by giving a handle of the burush.
240
+ SetHFont(hfont)
241
+ Sets the current font by giving a handle of the font.
242
+ SetHPen(hpen)
243
+ Sets the current pen style by giving a handle of the pen.
244
+ SetPen(pen)
245
+ Sets the current pen style by giving a RWin::Pen or a RGB color.
246
+ SetROP2(rop2)
247
+ Sets the current foreground mix mode.
248
+ SetStretchBltMode(mode)
249
+ Sets the bitmap stretching mode in this canvas.
250
+ SetTextColor(color)
251
+ Sets the text color for this canvas to the specified color.
252
+ StretchBlt(xdst, ydst, wdst, hdst, source[, xsrc, ysrc, wsrc, hsrc][, rop])
253
+ Performs a bit-block transfer with streching or complessing to fit the dimensions of the specfyed rectangle, if necessary.
254
+ TextOut(x, y, text)
255
+ Writes a string at the specified location, using the currently selected font, background color, and text color.
256
+ Transparent()
257
+ Sets back mode of this canvas to transparent.
258
+ _hdc()
259
+ Retreives device context handle of this canvas.
260
+ release()
261
+ Releases this canvas. This must be used at out of block.
262
+
263
+ =end
264
+
265
+ end
266
+ end
@@ -0,0 +1,118 @@
1
+ # Checkbox is Button
2
+ # See <https://msdn.microsoft.com/en-us/library/windows/desktop/bb775943%28v=vs.85%29.aspx>
3
+
4
+
5
+ module WR
6
+ require_relative './button' unless defined? Button
7
+
8
+ #This control consists of a square box that indicates a choice the user can make by selecting the button.
9
+ #<br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
10
+ #window-controls">Windows Control section of Microsoft Docs.</a>
11
+ class Checkbox < Button
12
+
13
+ DefaultWindowStyle = BS_AUTOCHECKBOX
14
+
15
+ PreDefinedEvents = {
16
+ :clicked => [WM_COMMAND, BN_CLICKED, 'hi'], # ???_clicked(idcmd, code, hwnd)
17
+ :paint => [WM_COMMAND, BN_PAINT, 'hi'], # ???_paint(idcmd, code, hwnd)
18
+ :hilight => [WM_COMMAND, BN_HILITE, 'hi'], # ???_hilight(idcmd, code, hwnd)
19
+ :unhilight => [WM_COMMAND, BN_UNHILITE, 'hi'], # ???_unhilight(idcmd, code, hwnd)
20
+ :disable => [WM_COMMAND, BN_DISABLE, 'hi'], # ???_disable(idcmd, code, hwnd)
21
+ :doubleclicked => [WM_COMMAND, BN_DOUBLECLICKED, 'hi'],# ???_doubleclicked(idcmd, code, hwnd)
22
+ :pushed => [WM_COMMAND, BN_PUSHED, 'hi'], # ???_pushed(idcmd, code, hwnd)
23
+ :unpushed => [WM_COMMAND, BN_UNPUSHED, 'hi'], # ???_unpushed(idcmd, code, hwnd)
24
+ :dblclk => [WM_COMMAND, BN_DBLCLK, 'hi'], # ???_dblclk(idcmd, code, hwnd)
25
+ :setfocus => [WM_COMMAND, BN_SETFOCUS,'hi'], # ???_setfocus(idcmd, code, hwnd)
26
+ :killfocus => [WM_COMMAND, BN_KILLFOCUS, 'hi'] # ???_killfocus(idcmd, code, hwnd)
27
+ }
28
+
29
+ DefaultEvents = [
30
+ :clicked, # ???_clicked(idcmd, code, hwnd)
31
+ ]
32
+
33
+ # def self.sym2style(*args)
34
+ # _sym2style(Button::WinStyles, args)
35
+ # end
36
+
37
+ def initialize(*args)
38
+ super
39
+ @_style |= DefaultWindowStyle unless (@_style & BS_AUTO3STATE) > 0
40
+ end
41
+
42
+ # Following Checkbox styles are available.
43
+ def style=(st)
44
+ st |= DefaultWindowStyle if st & BS_TYPEMASK == 0
45
+ super st
46
+ end
47
+
48
+ # Any other Button's style changes this style to other. So, do not set except following.
49
+ WinStyles = {
50
+ :lefttext => BS_LEFTTEXT,
51
+ :rightbutton => BS_RIGHTBUTTON,
52
+ :threestate => BS_3STATE,
53
+ :auto3state => BS_AUTO3STATE
54
+ }
55
+
56
+ #
57
+ def create()
58
+ super
59
+ self.checked = @_checked if @_checked
60
+ end
61
+
62
+ # Retreives check state of the control. Retuens true/false.
63
+ def checked()
64
+ if alive?
65
+ case SendMessage(BM_GETCHECK, 0, 0)
66
+ when BST_UNCHECKED
67
+ false
68
+ when BST_CHECKED
69
+ true
70
+ when BST_INDETERMINATED
71
+ nil
72
+ end
73
+ else
74
+ @_checked
75
+ end
76
+ end
77
+ alias checked? checked
78
+
79
+ # Sets a check-state of the control. Give true/false as state.
80
+ def checked=(state)
81
+ if alive?
82
+ st =
83
+ case state
84
+ when false
85
+ BST_UNCHECKED
86
+ when true
87
+ BST_CHECKED
88
+ when nil
89
+ case self.style & 0xf
90
+ when BS_3STATE, BS_AUTO3STATE
91
+ BST_INDETERMINATED
92
+ else
93
+ BST_UNCHECKED
94
+ end
95
+ else
96
+ state
97
+ end
98
+ SendMessage(BM_SETCHECK, st, 0)
99
+ else
100
+ @_checked = state
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ module WR
107
+ class MyForm < Form
108
+ def initialize()
109
+ resize 320, 240
110
+ _<< Checkbox[:cb1, "Check Me", 0, 0, 100, 24, :checked=>nil]
111
+ end
112
+
113
+ def created()
114
+ #dp "%x", _.cb1.style & BS_OWNERDRAW
115
+ end
116
+ self.start
117
+ end
118
+ end if $0==__FILE__