fzeet 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/LICENSE_CEF +29 -0
  2. data/checks/Bstr.rb +14 -0
  3. data/checks/Decimal.rb +27 -0
  4. data/checks/OSVERSIONINFOEX.rb +14 -0
  5. data/checks/Point.rb +65 -0
  6. data/checks/Rect.rb +104 -0
  7. data/checks/RunAll.rb +2 -0
  8. data/checks/SafeArray.rb +27 -0
  9. data/checks/Size.rb +45 -0
  10. data/checks/SystemTime.rb +43 -0
  11. data/checks/Variant.rb +160 -0
  12. data/examples/Control/DateTimePicker.rbw +1 -1
  13. data/examples/Control/MonthCalendar.rbw +1 -1
  14. data/examples/Control/{WebBrowser.rbw → WebBrowser/WebBrowser.rbw} +2 -2
  15. data/examples/Control/{WebBrowser1.rbw → WebBrowser/WebBrowser1.rbw} +0 -0
  16. data/examples/Control/WebBrowser/WebBrowser2.rbw +24 -0
  17. data/examples/Control/{WebBrowser3.rbw → WebBrowser/WebBrowser3.rbw} +0 -0
  18. data/examples/Control/{WebBrowser4.rbw → WebBrowser/WebBrowser4.rbw} +8 -3
  19. data/examples/Control/{WebBrowser4Sinatra.rb → WebBrowser/WebBrowser4Sinatra.rb} +0 -0
  20. data/examples/Control/{WebBrowser5.rbw → WebBrowser/WebBrowser5.rbw} +4 -2
  21. data/examples/Control/WebBrowser/jQueryUI.html +53 -0
  22. data/examples/Control/WebBrowser/jQueryUI.rbw +26 -0
  23. data/examples/MDI.rbw +2 -2
  24. data/examples/Raw/UIRibbon/Command.rbw +3 -3
  25. data/examples/Raw/UIRibbon/Minimal.rbw +3 -3
  26. data/examples/Version.rbw +1 -1
  27. data/lib/fzeet.rb +22 -7
  28. data/lib/fzeet/windows.rb +82 -5
  29. data/lib/fzeet/windows/com.rb +1 -318
  30. data/lib/fzeet/windows/com/Common.rb +318 -0
  31. data/lib/fzeet/windows/comctl.rb +1 -1
  32. data/lib/fzeet/windows/comctl/ComboBoxEx.rb +32 -0
  33. data/lib/fzeet/windows/comctl/DateTimePicker.rb +35 -0
  34. data/lib/fzeet/windows/comctl/Header.rb +61 -1
  35. data/lib/fzeet/windows/comctl/ListView.rb +133 -3
  36. data/lib/fzeet/windows/comctl/MonthCalendar.rb +35 -0
  37. data/lib/fzeet/windows/comctl/ProgressBar.rb +37 -0
  38. data/lib/fzeet/windows/comctl/PropertySheet.rb +50 -2
  39. data/lib/fzeet/windows/comctl/SysLink.rb +37 -0
  40. data/lib/fzeet/windows/comctl/Tab.rb +56 -0
  41. data/lib/fzeet/windows/comctl/TreeView.rb +81 -2
  42. data/lib/fzeet/windows/comctl/UpDown.rb +33 -0
  43. data/lib/fzeet/windows/comdlg.rb +1 -0
  44. data/lib/fzeet/windows/comdlg/ColorDialog.rb +41 -0
  45. data/lib/fzeet/windows/comdlg/Common.rb +87 -0
  46. data/lib/fzeet/windows/comdlg/FileDialog.rb +133 -0
  47. data/lib/fzeet/windows/comdlg/FindReplaceDialog.rb +102 -0
  48. data/lib/fzeet/windows/comdlg/FontDialog.rb +36 -0
  49. data/lib/fzeet/windows/comdlg/PrintDialog.rb +72 -0
  50. data/lib/fzeet/{Dialog → windows/comdlg}/ShellFileDialog.rb +0 -0
  51. data/lib/fzeet/windows/core.rb +5 -0
  52. data/lib/fzeet/windows/core/Common.rb +324 -0
  53. data/lib/fzeet/windows/core/Point.rb +42 -0
  54. data/lib/fzeet/windows/core/Rect.rb +114 -0
  55. data/lib/fzeet/windows/core/Size.rb +34 -0
  56. data/lib/fzeet/windows/core/SystemTime.rb +46 -0
  57. data/lib/fzeet/windows/core/Version.rb +57 -0
  58. data/lib/fzeet/windows/gdi.rb +1 -62
  59. data/lib/fzeet/windows/gdi/Common.rb +40 -0
  60. data/lib/fzeet/windows/gdi/Font.rb +64 -0
  61. data/lib/fzeet/windows/kernel.rb +1 -92
  62. data/lib/fzeet/windows/kernel/Common.rb +92 -0
  63. data/lib/fzeet/windows/libc.rb +1 -1
  64. data/lib/fzeet/windows/libcef.rb +1 -0
  65. data/lib/fzeet/windows/mshtml.rb +1 -1135
  66. data/lib/fzeet/windows/mshtml/Common.rb +1135 -0
  67. data/lib/fzeet/windows/ole.rb +1 -561
  68. data/lib/fzeet/windows/ole/Common.rb +112 -0
  69. data/lib/fzeet/windows/ole/PropVariant.rb +141 -0
  70. data/lib/fzeet/windows/oleaut.rb +3 -0
  71. data/lib/fzeet/windows/oleaut/Bstr.rb +39 -0
  72. data/lib/fzeet/windows/oleaut/Common.rb +187 -0
  73. data/lib/fzeet/windows/oleaut/SafeArray.rb +104 -0
  74. data/lib/fzeet/windows/oleaut/Variant.rb +269 -0
  75. data/lib/fzeet/windows/scintilla.rb +115 -1
  76. data/lib/fzeet/windows/{SciLexer.dll → scintilla/SciLexer.dll} +0 -0
  77. data/lib/fzeet/windows/shdocvw.rb +150 -0
  78. data/lib/fzeet/windows/shell.rb +1 -1
  79. data/lib/fzeet/windows/shell/Common.rb +94 -2
  80. data/lib/fzeet/windows/shlwapi.rb +1 -1
  81. data/lib/fzeet/windows/uiribbon.rb +416 -0
  82. data/lib/fzeet/windows/urlmon.rb +2 -2
  83. data/lib/fzeet/windows/user.rb +20 -0
  84. data/lib/fzeet/windows/user/Accelerator.rb +45 -0
  85. data/lib/fzeet/windows/user/Common.rb +3 -2
  86. data/lib/fzeet/windows/user/Control/Button.rb +54 -0
  87. data/lib/fzeet/windows/user/Control/ComboBox.rb +44 -1
  88. data/lib/fzeet/windows/user/Control/Common.rb +88 -1
  89. data/lib/fzeet/windows/user/Control/Edit.rb +50 -0
  90. data/lib/fzeet/windows/user/Control/ListBox.rb +69 -0
  91. data/lib/fzeet/windows/user/Control/Static.rb +31 -0
  92. data/lib/fzeet/windows/user/Menu.rb +130 -0
  93. data/lib/fzeet/windows/user/Message.rb +9 -0
  94. data/lib/fzeet/windows/user/MessageBox.rb +47 -0
  95. data/lib/fzeet/windows/user/SystemParametersInfo.rb +1 -1
  96. data/lib/fzeet/windows/user/Window.rb +5 -463
  97. data/lib/fzeet/{Window → windows/user/Window}/Common.rb +460 -0
  98. data/lib/fzeet/{Window → windows/user/Window}/Container.rb +0 -0
  99. data/lib/fzeet/{Window → windows/user/Window}/Dialog.rb +0 -0
  100. data/lib/fzeet/{Window → windows/user/Window}/MDI.rb +0 -0
  101. data/lib/fzeet/{Window → windows/user/Window}/View.rb +0 -0
  102. data/lib/fzeet/{Window → windows/user/Window}/Window.rb +0 -0
  103. data/lib/fzeet/{Window → windows/user/Window}/WindowMethods.rb +1 -1
  104. metadata +55 -61
  105. data/examples/Control/WebBrowser2.rbw +0 -39
  106. data/lib/fzeet/Accelerator.rb +0 -48
  107. data/lib/fzeet/Application.rb +0 -71
  108. data/lib/fzeet/Common.rb +0 -350
  109. data/lib/fzeet/Control.rb +0 -19
  110. data/lib/fzeet/Control/Button.rb +0 -57
  111. data/lib/fzeet/Control/ComboBox.rb +0 -46
  112. data/lib/fzeet/Control/ComboBoxEx.rb +0 -35
  113. data/lib/fzeet/Control/Common.rb +0 -89
  114. data/lib/fzeet/Control/DateTimePicker.rb +0 -38
  115. data/lib/fzeet/Control/Edit.rb +0 -53
  116. data/lib/fzeet/Control/ExplorerBrowser.rb +0 -66
  117. data/lib/fzeet/Control/Header.rb +0 -63
  118. data/lib/fzeet/Control/ListBox.rb +0 -72
  119. data/lib/fzeet/Control/ListView.rb +0 -133
  120. data/lib/fzeet/Control/MonthCalendar.rb +0 -38
  121. data/lib/fzeet/Control/ProgressBar.rb +0 -40
  122. data/lib/fzeet/Control/PropertySheet.rb +0 -51
  123. data/lib/fzeet/Control/Scintilla.rb +0 -117
  124. data/lib/fzeet/Control/Static.rb +0 -34
  125. data/lib/fzeet/Control/SysLink.rb +0 -40
  126. data/lib/fzeet/Control/Tab.rb +0 -59
  127. data/lib/fzeet/Control/TreeView.rb +0 -82
  128. data/lib/fzeet/Control/UpDown.rb +0 -36
  129. data/lib/fzeet/Control/WebBrowser.rb +0 -153
  130. data/lib/fzeet/Dialog.rb +0 -6
  131. data/lib/fzeet/Dialog/ColorDialog.rb +0 -44
  132. data/lib/fzeet/Dialog/Common.rb +0 -89
  133. data/lib/fzeet/Dialog/FileDialog.rb +0 -136
  134. data/lib/fzeet/Dialog/FindReplaceDialog.rb +0 -105
  135. data/lib/fzeet/Dialog/FontDialog.rb +0 -39
  136. data/lib/fzeet/Dialog/PrintDialog.rb +0 -75
  137. data/lib/fzeet/Menu.rb +0 -133
  138. data/lib/fzeet/UIRibbon.rb +0 -417
  139. data/lib/fzeet/Window.rb +0 -5
  140. data/lib/fzeet/windows/common.rb +0 -244
File without changes
File without changes
File without changes
File without changes
@@ -144,7 +144,7 @@ module Fzeet
144
144
  def location; position.lt end
145
145
  def location=(a) Windows.DetonateLastError(0, :SetWindowPos, @handle, nil, a[0], a[1], 0, 0, Fzeet.flags([:nosize, :nozorder], :swp_)) end
146
146
 
147
- def size; r = position; Size.new(r[:right] - r[:left], r[:bottom] - r[:top]) end
147
+ def size; r = position; Size[r[:right] - r[:left], r[:bottom] - r[:top]] end
148
148
  def size=(a) Windows.DetonateLastError(0, :SetWindowPos, @handle, nil, 0, 0, a[0], a[1], Fzeet.flags([:nomove, :nozorder], :swp_)) end
149
149
 
150
150
  def reframe
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fzeet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 6
9
- - 5
10
- version: 0.6.5
8
+ - 6
9
+ version: 0.6.6
11
10
  platform: ruby
12
11
  authors:
13
12
  - Radoslav Peev
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-10-08 00:00:00 +03:00
17
+ date: 2011-01-24 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,12 +25,11 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 1
30
28
  segments:
29
+ - 1
31
30
  - 0
32
- - 6
33
- - 3
34
- version: 0.6.3
31
+ - 5
32
+ version: 1.0.5
35
33
  type: :runtime
36
34
  version_requirements: *id001
37
35
  description:
@@ -46,12 +44,14 @@ files:
46
44
  - lib/fzeet/windows/com.rb
47
45
  - lib/fzeet/windows/comctl.rb
48
46
  - lib/fzeet/windows/comdlg.rb
49
- - lib/fzeet/windows/common.rb
47
+ - lib/fzeet/windows/core.rb
50
48
  - lib/fzeet/windows/gdi.rb
51
49
  - lib/fzeet/windows/kernel.rb
52
50
  - lib/fzeet/windows/libc.rb
51
+ - lib/fzeet/windows/libcef.rb
53
52
  - lib/fzeet/windows/mshtml.rb
54
53
  - lib/fzeet/windows/ole.rb
54
+ - lib/fzeet/windows/oleaut.rb
55
55
  - lib/fzeet/windows/propsys.rb
56
56
  - lib/fzeet/windows/scintilla.rb
57
57
  - lib/fzeet/windows/shdocvw.rb
@@ -60,7 +60,13 @@ files:
60
60
  - lib/fzeet/windows/uiribbon.rb
61
61
  - lib/fzeet/windows/urlmon.rb
62
62
  - lib/fzeet/windows/user.rb
63
- - lib/fzeet/windows/SciLexer.dll
63
+ - lib/fzeet/windows/core/Common.rb
64
+ - lib/fzeet/windows/core/Point.rb
65
+ - lib/fzeet/windows/core/Rect.rb
66
+ - lib/fzeet/windows/core/Size.rb
67
+ - lib/fzeet/windows/core/SystemTime.rb
68
+ - lib/fzeet/windows/core/Version.rb
69
+ - lib/fzeet/windows/kernel/Common.rb
64
70
  - lib/fzeet/windows/user/Accelerator.rb
65
71
  - lib/fzeet/windows/user/Common.rb
66
72
  - lib/fzeet/windows/user/Control.rb
@@ -69,12 +75,21 @@ files:
69
75
  - lib/fzeet/windows/user/MessageBox.rb
70
76
  - lib/fzeet/windows/user/SystemParametersInfo.rb
71
77
  - lib/fzeet/windows/user/Window.rb
78
+ - lib/fzeet/windows/user/Window/Common.rb
79
+ - lib/fzeet/windows/user/Window/Container.rb
80
+ - lib/fzeet/windows/user/Window/Dialog.rb
81
+ - lib/fzeet/windows/user/Window/MDI.rb
82
+ - lib/fzeet/windows/user/Window/View.rb
83
+ - lib/fzeet/windows/user/Window/Window.rb
84
+ - lib/fzeet/windows/user/Window/WindowMethods.rb
72
85
  - lib/fzeet/windows/user/Control/Button.rb
73
86
  - lib/fzeet/windows/user/Control/ComboBox.rb
74
87
  - lib/fzeet/windows/user/Control/Common.rb
75
88
  - lib/fzeet/windows/user/Control/Edit.rb
76
89
  - lib/fzeet/windows/user/Control/ListBox.rb
77
90
  - lib/fzeet/windows/user/Control/Static.rb
91
+ - lib/fzeet/windows/gdi/Common.rb
92
+ - lib/fzeet/windows/gdi/Font.rb
78
93
  - lib/fzeet/windows/comctl/Button.rb
79
94
  - lib/fzeet/windows/comctl/ComboBox.rb
80
95
  - lib/fzeet/windows/comctl/ComboBoxEx.rb
@@ -90,59 +105,37 @@ files:
90
105
  - lib/fzeet/windows/comctl/Tab.rb
91
106
  - lib/fzeet/windows/comctl/TreeView.rb
92
107
  - lib/fzeet/windows/comctl/UpDown.rb
108
+ - lib/fzeet/windows/scintilla/SciLexer.dll
93
109
  - lib/fzeet/windows/comdlg/ColorDialog.rb
94
110
  - lib/fzeet/windows/comdlg/Common.rb
95
111
  - lib/fzeet/windows/comdlg/FileDialog.rb
96
112
  - lib/fzeet/windows/comdlg/FindReplaceDialog.rb
97
113
  - lib/fzeet/windows/comdlg/FontDialog.rb
98
114
  - lib/fzeet/windows/comdlg/PrintDialog.rb
115
+ - lib/fzeet/windows/comdlg/ShellFileDialog.rb
116
+ - lib/fzeet/windows/com/Common.rb
117
+ - lib/fzeet/windows/ole/Common.rb
118
+ - lib/fzeet/windows/ole/PropVariant.rb
119
+ - lib/fzeet/windows/oleaut/Bstr.rb
120
+ - lib/fzeet/windows/oleaut/Common.rb
121
+ - lib/fzeet/windows/oleaut/SafeArray.rb
122
+ - lib/fzeet/windows/oleaut/Variant.rb
99
123
  - lib/fzeet/windows/shell/BrowseForFolder.rb
100
124
  - lib/fzeet/windows/shell/Common.rb
101
125
  - lib/fzeet/windows/shell/FileDialog.rb
102
- - lib/fzeet/Accelerator.rb
103
- - lib/fzeet/Application.rb
104
- - lib/fzeet/Common.rb
105
- - lib/fzeet/Control.rb
106
- - lib/fzeet/Dialog.rb
107
- - lib/fzeet/Menu.rb
108
- - lib/fzeet/UIRibbon.rb
109
- - lib/fzeet/Window.rb
126
+ - lib/fzeet/windows/mshtml/Common.rb
110
127
  - lib/fzeet/windows.rb
111
- - lib/fzeet/Window/Common.rb
112
- - lib/fzeet/Window/Container.rb
113
- - lib/fzeet/Window/Dialog.rb
114
- - lib/fzeet/Window/MDI.rb
115
- - lib/fzeet/Window/View.rb
116
- - lib/fzeet/Window/Window.rb
117
- - lib/fzeet/Window/WindowMethods.rb
118
- - lib/fzeet/Control/Button.rb
119
- - lib/fzeet/Control/ComboBox.rb
120
- - lib/fzeet/Control/ComboBoxEx.rb
121
- - lib/fzeet/Control/Common.rb
122
- - lib/fzeet/Control/DateTimePicker.rb
123
- - lib/fzeet/Control/Edit.rb
124
- - lib/fzeet/Control/ExplorerBrowser.rb
125
- - lib/fzeet/Control/Header.rb
126
- - lib/fzeet/Control/ListBox.rb
127
- - lib/fzeet/Control/ListView.rb
128
- - lib/fzeet/Control/MonthCalendar.rb
129
- - lib/fzeet/Control/ProgressBar.rb
130
- - lib/fzeet/Control/PropertySheet.rb
131
- - lib/fzeet/Control/Scintilla.rb
132
- - lib/fzeet/Control/Static.rb
133
- - lib/fzeet/Control/SysLink.rb
134
- - lib/fzeet/Control/Tab.rb
135
- - lib/fzeet/Control/TreeView.rb
136
- - lib/fzeet/Control/UpDown.rb
137
- - lib/fzeet/Control/WebBrowser.rb
138
- - lib/fzeet/Dialog/ColorDialog.rb
139
- - lib/fzeet/Dialog/Common.rb
140
- - lib/fzeet/Dialog/FileDialog.rb
141
- - lib/fzeet/Dialog/FindReplaceDialog.rb
142
- - lib/fzeet/Dialog/FontDialog.rb
143
- - lib/fzeet/Dialog/PrintDialog.rb
144
- - lib/fzeet/Dialog/ShellFileDialog.rb
145
128
  - lib/fzeet.rb
129
+ - checks/Bstr.rb
130
+ - checks/Decimal.rb
131
+ - checks/OSVERSIONINFOEX.rb
132
+ - checks/Point.rb
133
+ - checks/Rect.rb
134
+ - checks/RunAll.rb
135
+ - checks/SafeArray.rb
136
+ - checks/Size.rb
137
+ - checks/SystemTime.rb
138
+ - checks/Variant.rb
146
139
  - examples/res/applications-graphics-big.bmp
147
140
  - examples/res/applications-graphics-small.bmp
148
141
  - examples/res/applications-graphics.bmp
@@ -233,13 +226,15 @@ files:
233
226
  - examples/Control/Tab.rbw
234
227
  - examples/Control/TreeView.rbw
235
228
  - examples/Control/UpDown.rbw
236
- - examples/Control/WebBrowser.rbw
237
- - examples/Control/WebBrowser1.rbw
238
- - examples/Control/WebBrowser2.rbw
239
- - examples/Control/WebBrowser3.rbw
240
- - examples/Control/WebBrowser4.rbw
241
- - examples/Control/WebBrowser5.rbw
242
- - examples/Control/WebBrowser4Sinatra.rb
229
+ - examples/Control/WebBrowser/jQueryUI.rbw
230
+ - examples/Control/WebBrowser/WebBrowser.rbw
231
+ - examples/Control/WebBrowser/WebBrowser1.rbw
232
+ - examples/Control/WebBrowser/WebBrowser2.rbw
233
+ - examples/Control/WebBrowser/WebBrowser3.rbw
234
+ - examples/Control/WebBrowser/WebBrowser4.rbw
235
+ - examples/Control/WebBrowser/WebBrowser5.rbw
236
+ - examples/Control/WebBrowser/WebBrowser4Sinatra.rb
237
+ - examples/Control/WebBrowser/jQueryUI.html
243
238
  - examples/Dialog/ColorDialog.rbw
244
239
  - examples/Dialog/Dialog.rbw
245
240
  - examples/Dialog/DialogApplication.rbw
@@ -297,6 +292,7 @@ files:
297
292
  - examples/UIRibbon/Control/Spinner.dll
298
293
  - LICENSE
299
294
  - LICENSE_Scintilla
295
+ - LICENSE_CEF
300
296
  has_rdoc: true
301
297
  homepage: http://github.com/rpeev/Fzeet
302
298
  licenses: []
@@ -311,7 +307,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
311
307
  requirements:
312
308
  - - ">="
313
309
  - !ruby/object:Gem::Version
314
- hash: 3
315
310
  segments:
316
311
  - 0
317
312
  version: "0"
@@ -320,7 +315,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
315
  requirements:
321
316
  - - ">="
322
317
  - !ruby/object:Gem::Version
323
- hash: 3
324
318
  segments:
325
319
  - 0
326
320
  version: "0"
@@ -1,39 +0,0 @@
1
- require 'fzeet'
2
-
3
- include Fzeet
4
-
5
- Application.run { |window|
6
- (browser = WebBrowser.new(window)).
7
- on(:NavigateComplete) {
8
- html = <<-HTML
9
- <!doctype html>
10
- <html>
11
- <head>
12
- <title>Hello</title>
13
- </head>
14
- <body>
15
- <h1>Hello, world!</h1>
16
- </body>
17
- </html>
18
- HTML
19
-
20
- psa = Windows.SafeArrayCreateVector(Windows::VT_VARIANT, 0, 1)
21
-
22
- FFI::MemoryPointer.new(:pointer) { |pdata|
23
- Windows.DetonateHresult(:SafeArrayAccessData, psa, pdata)
24
-
25
- data = Windows::VARIANT.new(pdata.read_pointer)
26
-
27
- data[:vt] = Windows::VT_BSTR
28
- data[:bstrVal] = Windows.SysAllocString("#{html}\0".encode('utf-16le'))
29
-
30
- Windows.DetonateHresult(:SafeArrayUnaccessData, psa)
31
-
32
- browser.document.write(psa)
33
- }
34
-
35
- Windows.DetonateHresult(:SafeArrayDestroy, psa)
36
- }.
37
-
38
- goto('about:blank')
39
- }
@@ -1,48 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- module AcceleratorTableMethods
5
- def translate?(msg, window) Windows.TranslateAccelerator(window.handle, @handle, msg) != 0 end
6
- end
7
-
8
- class AcceleratorTable < Handle
9
- include AcceleratorTableMethods
10
-
11
- def initialize(*args)
12
- FFI::MemoryPointer.new(Windows::ACCEL, args.size) { |paccels|
13
- args.each_with_index { |data, i|
14
- accel = Windows::ACCEL.new(paccels + i * Windows::ACCEL.size)
15
-
16
- data.unshift(0) if data.size == 2
17
-
18
- accel[:fVirt] = Fzeet.flags(data[0], :f)
19
-
20
- accel[:key] = case key = data[1]
21
- when Integer
22
- accel[:fVirt] |= Windows::FVIRTKEY
23
-
24
- key
25
- when Symbol
26
- accel[:fVirt] |= Windows::FVIRTKEY
27
-
28
- ((key = key.to_s).length == 1) ? key.upcase.ord : Fzeet.constant(key, :vk_)
29
- when String
30
- if key.length == 1
31
- key.ord
32
- else
33
- accel[:fVirt] |= Windows::FVIRTKEY
34
-
35
- Fzeet.constant(key, :vk_)
36
- end
37
- end
38
-
39
- accel[:cmd] = Command[data[2]]
40
- }
41
-
42
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreateAcceleratorTable, paccels, args.size); attach
43
- }
44
- end
45
-
46
- def dispose; Windows.DestroyAcceleratorTable(@handle); detach end
47
- end
48
- end
@@ -1,71 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- class Application
5
- @name = File.basename($0, '.rbw')
6
- @version = '0.1.0'
7
- @authors = []
8
-
9
- @quitWhenMainWindowCloses = true
10
-
11
- @window = nil
12
- @accelerators = []
13
- @dialogs = []
14
- @images = {}
15
- Fzeet.using(ScreenDC.new) { |dc|
16
- @devcaps = {
17
- logpixelsy: Windows.GetDeviceCaps(dc.handle, Windows::LOGPIXELSY)
18
- }
19
- }
20
-
21
- class << self
22
- attr_accessor :name, :version, :authors, :quitWhenMainWindowCloses
23
- attr_reader :window, :accelerators, :dialogs, :images, :devcaps
24
- end
25
-
26
- def self.window=(window)
27
- raise 'Application.window already set.' if @window
28
-
29
- @window = window
30
- end
31
-
32
- def self.run(windowOrOpts = {}, &block)
33
- @window = case windowOrOpts
34
- when BasicWindow; windowOrOpts.tap { |window| block.call(window) if block }
35
- when Hash
36
- if windowOrOpts[:deferCreateWindow].tap { windowOrOpts.delete_if { |k, v| k == :deferCreateWindow } }
37
- Window.new(windowOrOpts, &block)
38
- else
39
- Window.new(windowOrOpts).tap { |window| block.call(window) if block }
40
- end
41
- else raise ArgumentError
42
- end
43
-
44
- return 0 if window.handle.null?
45
-
46
- @window.on(:destroy) { quit } if @quitWhenMainWindowCloses
47
-
48
- @window.show.update
49
-
50
- msg = Message.new
51
-
52
- while msg.get!
53
- msg.translate.dispatch unless
54
- (window.client && Windows.TranslateMDISysAccel(window.client.handle, msg) != 0) ||
55
- accelerators.any? { |table| table.translate?(msg, @window) } ||
56
- dialogs.any? { |dialog| dialog.dlgmsg?(msg) }
57
- end
58
-
59
- msg[:wParam]
60
- rescue
61
- Fzeet.message %Q{#{$!}\n\n#{$!.backtrace.join("\n")}}, icon: :error
62
- end
63
-
64
- def self.quit(code = 0)
65
- accelerators.each(&:dispose)
66
- images.values.each(&:dispose)
67
-
68
- Windows.PostQuitMessage(code)
69
- end
70
- end
71
- end
data/lib/fzeet/Common.rb DELETED
@@ -1,350 +0,0 @@
1
- require_relative 'windows'
2
-
3
- module Fzeet
4
- Windows.DetonateLastError(0, :InitCommonControlsEx,
5
- Windows::INITCOMMONCONTROLSEX.new.tap { |icc|
6
- icc[:dwSize] = icc.size
7
- icc[:dwICC] = \
8
- Windows::ICC_WIN95_CLASSES |
9
- Windows::ICC_DATE_CLASSES |
10
- Windows::ICC_USEREX_CLASSES |
11
- Windows::ICC_COOL_CLASSES |
12
- Windows::ICC_INTERNET_CLASSES |
13
- Windows::ICC_PAGESCROLLER_CLASS
14
- }
15
- )
16
-
17
- Windows.EnableVisualStyles
18
-
19
- Windows.DetonateLastError(0, :SetProcessDPIAware) if Windows::WINVER.AtLeastWindowsVista?
20
-
21
- Windows.InitializeOle
22
-
23
- def constant(c, *prefixes)
24
- return c if c.kind_of?(Integer) || c.kind_of?(FFI::Pointer)
25
-
26
- c = c.upcase
27
-
28
- prefixes.map! { |prefix|
29
- prefix = prefix.upcase
30
-
31
- "#{prefix}#{c}".tap { |name|
32
- return Windows.const_get(name) if Windows.const_defined?(name)
33
- }
34
- }
35
-
36
- raise "Constant not found: #{c} (tried: #{prefixes.join(', ')})."
37
- end
38
-
39
- def flags(flags, *prefixes)
40
- return flags if flags.kind_of?(Integer)
41
-
42
- [*flags].inject(0) { |flags, flag| flags |= constant(flag, *prefixes) }
43
- end
44
-
45
- module_function :constant, :flags
46
-
47
- module Toggle
48
- def toggle(what)
49
- send("#{what}=", !send("#{what}?"))
50
-
51
- begin
52
- yield self
53
- ensure
54
- toggle(what)
55
- end if block_given?
56
-
57
- self
58
- end
59
- end
60
-
61
- class Command
62
- @ids = {
63
- OK: Windows::IDOK,
64
- CANCEL: Windows::IDCANCEL,
65
- }
66
- @nextId = Windows::WM_APP + 1
67
-
68
- def self.[](id)
69
- return id if id.kind_of?(Integer)
70
-
71
- id = id.upcase
72
-
73
- @ids[id], @nextId = @nextId, @nextId + 1 unless @ids.include?(id)
74
-
75
- @ids[id]
76
- end
77
- end
78
-
79
- class DialogResult
80
- def initialize(id)
81
- @id = id
82
- end
83
-
84
- attr_reader :id
85
-
86
- Windows.constants.grep(/^ID[A-Z]{2,}$/).each { |c|
87
- define_method("#{c[2..-1].downcase}?") {
88
- @id == Windows.const_get(c)
89
- }
90
- }
91
- end
92
-
93
- def message(message, opts = {})
94
- _opts = {
95
- window: Application.window,
96
- caption: Application.name,
97
- buttons: [:ok],
98
- icon: :information
99
- }
100
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
101
- _opts.merge!(opts)
102
-
103
- defbutton = nil
104
- defbutton = if [*_opts[:buttons]].find.with_index { |button, i| defbutton = i + 1; button =~ /^[A-Z]/ }
105
- constant(defbutton.to_s, :mb_defbutton)
106
- else
107
- 0
108
- end
109
-
110
- flags = constant([*_opts[:buttons]].join(''), :mb_) | defbutton | constant(_opts[:icon], :mb_icon)
111
-
112
- DialogResult.new(
113
- Windows.DetonateLastError(0, :MessageBox, _opts[:window] && _opts[:window].handle, message.to_s, _opts[:caption].to_s, flags)
114
- )
115
- end
116
-
117
- def question(message, opts = {})
118
- opts[:buttons] ||= [:yes, :no]
119
- opts[:icon] ||= :question
120
-
121
- message(message, opts)
122
- end
123
-
124
- def shell(name, args = nil, dir = nil, verb = 'open')
125
- raise 'ShellExecute failed.' unless Windows.ShellExecute(nil, verb, name, args, dir, Windows::SW_NORMAL).to_i > 32
126
- end
127
-
128
- module_function :message, :question, :shell
129
-
130
- class Point < Windows::POINT
131
- def initialize(x = 0, y = 0) self[:x], self[:y] = x, y end
132
-
133
- def to_a; [self[:x], self[:y]] end
134
-
135
- def client!(window) Windows.DetonateLastError(0, :ScreenToClient, window.handle, self); self end
136
- def screen!(window) Windows.DetonateLastError(0, :ClientToScreen, window.handle, self); self end
137
- end
138
-
139
- class Size < Windows::SIZE
140
- def initialize(cx = 0, cy = 0) self[:cx], self[:cy] = cx, cy end
141
-
142
- def to_a; [self[:cx], self[:cy]] end
143
- end
144
-
145
- class Rect < Windows::RECT
146
- def initialize(l = 0, t = 0, r = 0, b = 0) self[:left], self[:top], self[:right], self[:bottom] = l, t, r, b end
147
-
148
- def to_a; [self[:left], self[:top], self[:right], self[:bottom]] end
149
-
150
- def lt; Point.new(self[:left], self[:top]) end
151
- def lb; Point.new(self[:left], self[:bottom]) end
152
- def rt; Point.new(self[:right], self[:top]) end
153
- def rb; Point.new(self[:right], self[:bottom]) end
154
- end
155
-
156
- class LOGFONT
157
- include Toggle
158
- end
159
-
160
- class Message < Windows::MSG
161
- def get!(window = nil, msgFilterMin = 0, msgFilterMax = 0)
162
- Windows.DetonateLastError(-1, :GetMessage, self, window && window.handle, msgFilterMin, msgFilterMax) != 0
163
- end
164
-
165
- def translate; Windows.TranslateMessage(self); self end
166
- def dispatch; Windows.DispatchMessage(self); self end
167
- end
168
-
169
- class Handle
170
- @@instances = {}
171
-
172
- def self.instance?(handle) @@instances.include?(handle.to_i) end
173
- def self.instance(handle) raise "#{self}.#{__method__} failed." unless (instance = @@instances[handle.to_i]); instance end
174
-
175
- def self.wrap(handle, *ifaces)
176
- Object.new.tap { |o|
177
- o.instance_variable_set(:@handle, handle)
178
- o.class.send(:attr_reader, :handle)
179
- ifaces.each { |iface| o.class.send(:include, iface) }
180
- }
181
- end
182
-
183
- attr_reader :handle
184
-
185
- def attach; @@instances[@handle.to_i] = self end
186
- def detach; @@instances.delete(@handle.to_i) end
187
-
188
- def dup; raise "#{self}.#{__method__} is not implemented." end
189
- end
190
-
191
- def using(o, cleanup = :dispose)
192
- yield o
193
- ensure
194
- o.send(cleanup)
195
- end
196
-
197
- module_function :using
198
-
199
- module IconMethods
200
-
201
- end
202
-
203
- class SystemIcon < Handle
204
- include IconMethods
205
-
206
- def initialize(id)
207
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :LoadIcon, nil, @id = Fzeet.constant(id, :idi_)); attach
208
- end
209
-
210
- attr_reader :id
211
-
212
- def dispose; detach end
213
- end
214
-
215
- module CursorMethods
216
-
217
- end
218
-
219
- class SystemCursor < Handle
220
- include CursorMethods
221
-
222
- def initialize(id)
223
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :LoadCursor, nil, @id = Fzeet.constant(id, :idc_)); attach
224
- end
225
-
226
- attr_reader :id
227
-
228
- def dispose; detach end
229
- end
230
-
231
- module BrushMethods
232
-
233
- end
234
-
235
- class SystemBrush < Handle
236
- include BrushMethods
237
-
238
- def initialize(id)
239
- @handle = FFI::Pointer.new((@id = Fzeet.constant(id, :color_, :ctlcolor_)) + 1); attach
240
- end
241
-
242
- attr_reader :id
243
-
244
- def dispose; detach end
245
- end
246
-
247
- module FontMethods
248
-
249
- end
250
-
251
- class IndirectFont < Handle
252
- include FontMethods
253
-
254
- def initialize(logfont)
255
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreateFontIndirect, @logfont = logfont); attach
256
- end
257
-
258
- attr_reader :logfont
259
-
260
- def dispose; Windows.DeleteObject(@handle); detach end
261
- end
262
-
263
- module BitmapMethods
264
-
265
- end
266
-
267
- class PARGB32 < Handle
268
- include BitmapMethods
269
-
270
- def initialize(path, width = 0, height = 0)
271
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :LoadImage,
272
- nil,
273
- @path = path,
274
- Windows::IMAGE_BITMAP,
275
- width,
276
- height,
277
- Windows::LR_LOADFROMFILE | Windows::LR_CREATEDIBSECTION
278
- )
279
-
280
- attach
281
- end
282
-
283
- attr_reader :path
284
-
285
- def dispose; Windows.DeleteObject(@handle); detach end
286
- end
287
-
288
- module DCMethods
289
- def select(*objects)
290
- holds = []
291
-
292
- objects.each { |object|
293
- holds << Windows.DetonateLastError(FFI::Pointer::NULL, :SelectObject, @handle, object.handle)
294
- }
295
-
296
- yield self
297
-
298
- self
299
- ensure
300
- holds.each { |hold| Windows.SelectObject(@handle, hold) }
301
- end
302
-
303
- def textExtent(text) Windows.DetonateLastError(0, :GetTextExtentPoint, @handle, text, text.length, s = Size.new); s end
304
-
305
- def color; Windows.GetTextColor(@handle) end
306
- def color=(color) Windows.SetTextColor(@handle, color) end
307
-
308
- def background; Windows.GetBkColor(@handle) end
309
- def background=(background) Windows.SetBkColor(@handle, background) end
310
-
311
- def fillRect(rect, brush) Windows.DetonateLastError(0, :FillRect, @handle, rect, (brush.kind_of?(FFI::Pointer)) ? brush : brush.handle); self end
312
-
313
- def text(text, rect, flags = 0) Windows.DetonateLastError(0, :DrawText, @handle, text, -1, rect, Fzeet.flags(flags, :dt_)); self end
314
-
315
- def sms(message)
316
- r = window.rect
317
-
318
- r[:top] += window.ribbon.height if window.ribbon
319
-
320
- text(message, r, [:singleline, :center, :vcenter])
321
-
322
- self
323
- end
324
-
325
- def move(x, y) Windows.DetonateLastError(0, :MoveToEx, @handle, x, y, nil); self end
326
- def line(x, y) Windows.DetonateLastError(0, :LineTo, @handle, x, y); self end
327
- end
328
-
329
- class ClientDC < Handle
330
- include DCMethods
331
-
332
- def initialize(window)
333
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :GetDC, (@window = window).handle); attach
334
- end
335
-
336
- attr_reader :window
337
-
338
- def dispose; Windows.ReleaseDC(@window.handle, @handle); detach end
339
- end
340
-
341
- class ScreenDC < Handle
342
- include DCMethods
343
-
344
- def initialize
345
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :GetDC, nil); attach
346
- end
347
-
348
- def dispose; Windows.ReleaseDC(nil, @handle); detach end
349
- end
350
- end