fzeet 0.6.5 → 0.6.6

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 (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
@@ -1,89 +0,0 @@
1
- require_relative '../Window/Dialog'
2
-
3
- module Fzeet
4
- class CommonDialog < Handle
5
- include WindowMethods
6
-
7
- HookProc = -> klass, hwnd, uMsg, wParam, lParam {
8
- begin
9
- if klass == Windows::BROWSEINFO
10
- if uMsg == Windows::BFFM_IUNKNOWN
11
- instance = ObjectSpace._id2ref(lParam)
12
-
13
- if @@instances.include?(hwnd.to_i)
14
- @@instances.delete(hwnd.to_i)
15
- else
16
- @@instances[hwnd.to_i] = instance
17
-
18
- @@instances[hwnd.to_i].instance_variable_set(:@handle, hwnd)
19
- end
20
- end
21
- else
22
- if uMsg == Windows::WM_INITDIALOG
23
- @@instances[hwnd.to_i] = ObjectSpace._id2ref(
24
- klass.new(FFI::Pointer.new(lParam))[:lCustData].to_i
25
- )
26
-
27
- @@instances[hwnd.to_i].instance_variable_set(:@handle, hwnd)
28
- end
29
- end
30
-
31
- result = @@instances[hwnd.to_i].hookProc(hwnd, uMsg, wParam, lParam) if @@instances[hwnd.to_i]
32
- rescue
33
- answer = Fzeet.message %Q{#{$!}\n\n#{$!.backtrace.join("\n")}}, buttons: [:abort, :retry, :ignore], icon: :error
34
-
35
- Application.quit if answer.abort?
36
- ensure
37
- if uMsg == Windows::WM_NCDESTROY
38
- @@instances.delete(hwnd.to_i)
39
- end
40
- end
41
-
42
- result || 0
43
- }
44
-
45
- def self.crackMessage(hwnd, uMsg, wParam, lParam)
46
- window = @@instances[hwnd.to_i]
47
-
48
- args = {
49
- hwnd: hwnd,
50
- uMsg: uMsg,
51
- wParam: wParam,
52
- lParam: lParam,
53
- result: 0,
54
- window: window,
55
- sender: window
56
- }
57
-
58
- args
59
- end
60
-
61
- def initialize
62
- @messages = {}
63
- end
64
-
65
- attr_reader :struct
66
-
67
- def hookProc(hwnd, uMsg, wParam, lParam)
68
- args, result = nil, nil
69
-
70
- if (handlers = @messages[uMsg])
71
- args ||= self.class.crackMessage(hwnd, uMsg, wParam, lParam)
72
-
73
- handlers.each { |handler|
74
- (handler.arity == 0) ? handler.call : handler.call(args)
75
-
76
- result = args[:result]
77
- }
78
- end
79
-
80
- result
81
- end
82
-
83
- def on(msg, &block)
84
- (@messages[Fzeet.constant(msg, :wm_)] ||= []) << block
85
-
86
- self
87
- end
88
- end
89
- end
@@ -1,136 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- class FileDialog < CommonDialog
5
- DialogStruct = Windows::OPENFILENAME
6
-
7
- HookProc = -> *args { CommonDialog::HookProc.(*args.unshift(DialogStruct)) }
8
-
9
- def initialize(opts = {})
10
- _opts = {
11
- filter: nil,
12
- customFilter: nil,
13
- filterIndex: 0,
14
- fileTitle: nil,
15
- initialDir: nil,
16
- title: nil,
17
- flags: 0,
18
- fileExtension: nil,
19
- defExt: nil,
20
- custData: 0,
21
- hook: nil,
22
- templateName: nil,
23
- xflags: 0
24
- }
25
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
26
- _opts.merge!(opts)
27
-
28
- @struct = DialogStruct.new
29
-
30
- @struct[:lStructSize] = @struct.size
31
- @struct[:hInstance] = Windows.GetModuleHandle(nil)
32
- @struct[:lpstrFile] = @buf = FFI::MemoryPointer.new(:char, 4096)
33
- @struct[:nMaxFile] = @buf.size
34
- @struct[:Flags] = Fzeet.flags([:enablehook, :explorer, :enablesizing, :overwriteprompt] + [*_opts[:flags]], :ofn_)
35
- @struct[:lCustData] = object_id
36
- @struct[:lpfnHook] = HookProc
37
-
38
- super()
39
-
40
- begin
41
- yield self
42
- ensure
43
- dispose
44
- end if block_given?
45
- end
46
-
47
- def dispose; @buf.free end
48
-
49
- def path; @buf.read_string end
50
- end
51
-
52
- class FileOpenDialog < FileDialog
53
- def show(window = Application.window)
54
- @struct[:hwndOwner] = window.handle
55
-
56
- DialogResult.new((Windows.GetOpenFileName(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
57
- end
58
-
59
- def paths
60
- return [path] if
61
- (path = @buf.read_string).length + 1 != @struct[:nFileOffset]
62
-
63
- result, tip = [], path.length + 1
64
-
65
- until @buf.get_bytes(tip, 2) == "\0\0"
66
- result << (name = @buf.get_string(tip))
67
-
68
- tip += name.length + 1
69
- end
70
-
71
- result.map! { |name| "#{path}\\#{name}" }
72
- end
73
-
74
- def multiselect=(multiselect)
75
- (multiselect) ?
76
- @struct[:Flags] |= Windows::OFN_ALLOWMULTISELECT :
77
- @struct[:Flags] &= ~Windows::OFN_ALLOWMULTISELECT
78
- end
79
- end
80
-
81
- class FileSaveDialog < FileDialog
82
- def show(window = Application.window)
83
- @struct[:hwndOwner] = window.handle
84
-
85
- DialogResult.new((Windows.GetSaveFileName(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
86
- end
87
- end
88
-
89
- class FolderDialog < CommonDialog
90
- DialogStruct = Windows::BROWSEINFO
91
-
92
- HookProc = -> *args { CommonDialog::HookProc.(*args.unshift(DialogStruct)) }
93
-
94
- def initialize(opts = {})
95
- _opts = {
96
- root: nil,
97
- displayName: nil,
98
- title: nil,
99
- flags: 0,
100
- hook: nil,
101
- param: 0,
102
- image: 0
103
- }
104
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
105
- _opts.merge!(opts)
106
-
107
- @struct = DialogStruct.new
108
-
109
- @struct[:ulFlags] = Fzeet.flags([:returnonlyfsdirs, :usenewui], :bif_)
110
- @struct[:lpfn] = HookProc
111
- @struct[:lParam] = object_id
112
-
113
- super()
114
- end
115
-
116
- def path; @path && @path.dup end
117
-
118
- def show(window = Application.window)
119
- @struct[:hwndOwner] = window.handle
120
-
121
- @path = nil
122
-
123
- DialogResult.new(((pidl = Windows.SHBrowseForFolder(@struct)).null?) ? Windows::IDCANCEL : Windows::IDOK).tap { |result|
124
- next unless result.ok?
125
-
126
- FFI::MemoryPointer.new(:char, 4096) { |p|
127
- Windows.SHGetPathFromIDList(pidl, p)
128
-
129
- @path = p.read_string
130
- }
131
- }
132
- ensure
133
- Windows.CoTaskMemFree(pidl)
134
- end
135
- end
136
- end
@@ -1,105 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- class FindReplaceDialog < CommonDialog
5
- DialogStruct = Windows::FINDREPLACE
6
-
7
- HookProc = -> *args { CommonDialog::HookProc.(*args.unshift(DialogStruct)) }
8
-
9
- Message = Windows.DetonateLastError(0, :RegisterWindowMessage, Windows::FINDMSGSTRING)
10
-
11
- def initialize(opts = {})
12
- _opts = {
13
-
14
- }
15
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
16
- _opts.merge!(opts)
17
-
18
- @frNotifies = {}
19
-
20
- @struct = DialogStruct.new
21
-
22
- @struct[:lStructSize] = @struct.size
23
- @struct[:hInstance] = Windows.GetModuleHandle(nil)
24
- @struct[:Flags] = Fzeet.flags(:enablehook, :fr_)
25
- @struct[:lpstrFindWhat] = @findbuf = FFI::MemoryPointer.new(:char, 4096)
26
- @struct[:lpstrReplaceWith] = @replacebuf = FFI::MemoryPointer.new(:char, 4096)
27
- @struct[:wFindWhatLen] = @findbuf.size
28
- @struct[:wReplaceWithLen] = @replacebuf.size
29
- @struct[:lCustData] = object_id
30
- @struct[:lpfnHook] = HookProc
31
-
32
- super()
33
- end
34
-
35
- def dispose; [@findbuf, @replacebuf].each(&:free) end
36
-
37
- def findWhat; @findbuf.read_string end
38
- def replaceWith; @replacebuf.read_string end
39
-
40
- def frProc(args)
41
- return unless args[:lParam] == @struct.pointer.address
42
-
43
- (handlers = @frNotifies[:all]) and handlers.each { |handler|
44
- (handler.arity == 0) ? handler.call : handler.call(args)
45
- }
46
-
47
- if @struct[:Flags] & Windows::FR_DIALOGTERM != 0
48
- (handlers = @frNotifies[Windows::FR_DIALOGTERM]) and handlers.each { |handler|
49
- (handler.arity == 0) ? handler.call : handler.call(args)
50
- }
51
-
52
- self.dialog = false
53
-
54
- dispose
55
- elsif @struct[:Flags] & Windows::FR_FINDNEXT != 0
56
- (handlers = @frNotifies[Windows::FR_FINDNEXT]) and handlers.each { |handler|
57
- (handler.arity == 0) ? handler.call : handler.call(args)
58
- }
59
- elsif @struct[:Flags] & Windows::FR_REPLACE != 0
60
- (handlers = @frNotifies[Windows::FR_REPLACE]) and handlers.each { |handler|
61
- (handler.arity == 0) ? handler.call : handler.call(args)
62
- }
63
- elsif @struct[:Flags] & Windows::FR_REPLACEALL != 0
64
- (handlers = @frNotifies[Windows::FR_REPLACEALL]) and handlers.each { |handler|
65
- (handler.arity == 0) ? handler.call : handler.call(args)
66
- }
67
- end
68
- end
69
-
70
- def onNotify(notification, &block)
71
- notification = Fzeet.constant(notification, :fr_) unless
72
- notification.kind_of?(Integer) || notification == :all
73
-
74
- (@frNotifies[notification] ||= []) << block
75
-
76
- self
77
- end
78
- end
79
-
80
- class FindDialog < FindReplaceDialog
81
- def show(window = Application.window)
82
- @struct[:hwndOwner] = window.handle
83
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :FindText, @struct)
84
-
85
- self.dialog = true
86
-
87
- window.on(FindReplaceDialog::Message, &method(:frProc))
88
-
89
- self
90
- end
91
- end
92
-
93
- class ReplaceDialog < FindReplaceDialog
94
- def show(window = Application.window)
95
- @struct[:hwndOwner] = window.handle
96
- @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :ReplaceText, @struct)
97
-
98
- self.dialog = true
99
-
100
- window.on(FindReplaceDialog::Message, &method(:frProc))
101
-
102
- self
103
- end
104
- end
105
- end
@@ -1,39 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- class FontDialog < CommonDialog
5
- DialogStruct = Windows::CHOOSEFONT
6
-
7
- HookProc = -> *args { CommonDialog::HookProc.(*args.unshift(DialogStruct)) }
8
-
9
- def initialize(opts = {})
10
- _opts = {
11
- font: Control::Font,
12
- color: 0
13
- }
14
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
15
- _opts.merge!(opts)
16
-
17
- @struct = DialogStruct.new
18
-
19
- @struct[:lStructSize] = @struct.size
20
- @struct[:hInstance] = Windows.GetModuleHandle(nil)
21
- @struct[:lpLogFont] = _opts[:font].logfont.pointer
22
- @struct[:Flags] = Fzeet.flags([:enablehook, :both, :inittologfontstruct, :effects], :cf_)
23
- @struct[:rgbColors] = _opts[:color]
24
- @struct[:lCustData] = object_id
25
- @struct[:lpfnHook] = HookProc
26
-
27
- super()
28
- end
29
-
30
- def show(window = Application.window)
31
- @struct[:hwndOwner] = window.handle
32
-
33
- DialogResult.new((Windows.ChooseFont(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
34
- end
35
-
36
- def font; IndirectFont.new(Windows::LOGFONT.new(@struct[:lpLogFont])) end
37
- def color; @struct[:rgbColors] end
38
- end
39
- end
@@ -1,75 +0,0 @@
1
- require_relative 'Common'
2
-
3
- module Fzeet
4
- class PageSetupDialog
5
- def initialize(opts = {})
6
- _opts = {
7
-
8
- }
9
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
10
- _opts.merge!(opts)
11
-
12
- @struct = Windows::PAGESETUPDLG.new
13
-
14
- @struct[:lStructSize] = @struct.size
15
- @struct[:hInstance] = Windows.GetModuleHandle(nil)
16
- @struct[:Flags] = Fzeet.flags(0, :psd_)
17
- end
18
-
19
- attr_reader :struct
20
-
21
- def show(window = Application.window)
22
- @struct[:hwndOwner] = window.handle
23
-
24
- DialogResult.new((Windows.PageSetupDlg(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
25
- end
26
- end
27
-
28
- class PrintDialog
29
- def initialize(opts = {})
30
- _opts = {
31
-
32
- }
33
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
34
- _opts.merge!(opts)
35
-
36
- @struct = Windows::PRINTDLG.new
37
-
38
- @struct[:lStructSize] = 66
39
- @struct[:hInstance] = Windows.GetModuleHandle(nil)
40
- @struct[:Flags] = Fzeet.flags([:returndc, :usedevmodecopiesandcollate], :pd_)
41
- end
42
-
43
- attr_reader :struct
44
-
45
- def show(window = Application.window)
46
- @struct[:hwndOwner] = window.handle
47
-
48
- DialogResult.new((Windows.PrintDlg(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
49
- end
50
- end
51
-
52
- class PrintDialogEx
53
- def initialize(opts = {})
54
- _opts = {
55
-
56
- }
57
- badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
58
- _opts.merge!(opts)
59
-
60
- @struct = Windows::PRINTDLGEX.new
61
-
62
- @struct[:lStructSize] = @struct.size
63
- @struct[:hInstance] = Windows.GetModuleHandle(nil)
64
- @struct[:Flags] = Fzeet.flags([:returndc, :usedevmodecopiesandcollate], :pd_)
65
- end
66
-
67
- attr_reader :struct
68
-
69
- def show(window = Application.window)
70
- @struct[:hwndOwner] = window.handle
71
-
72
- DialogResult.new((Windows.PrintDlgEx(@struct) != Windows::S_OK) ? Windows::IDCANCEL : Windows::IDOK)
73
- end
74
- end
75
- end