Class: Fzeet::PrintDialogEx

Inherits:
Object
  • Object
show all
Defined in:
lib/fzeet/Dialog/PrintDialog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ PrintDialogEx

Returns a new instance of PrintDialogEx.



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fzeet/Dialog/PrintDialog.rb', line 53

def initialize(opts = {})
	_opts = {

	}
	badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
	_opts.merge!(opts)

	@struct = Windows::PRINTDLGEX.new

	@struct[:lStructSize] = @struct.size
	@struct[:hInstance] = Windows.GetModuleHandle(nil)
	@struct[:Flags] = Fzeet.flags([:returndc, :usedevmodecopiesandcollate], :pd_)
end

Instance Attribute Details

#structObject (readonly)

Returns the value of attribute struct.



67
68
69
# File 'lib/fzeet/Dialog/PrintDialog.rb', line 67

def struct
  @struct
end

Instance Method Details

#show(window = Application.window) ⇒ Object



69
70
71
72
73
# File 'lib/fzeet/Dialog/PrintDialog.rb', line 69

def show(window = Application.window)
	@struct[:hwndOwner] = window.handle

	DialogResult.new((Windows.PrintDlgEx(@struct) != Windows::S_OK) ? Windows::IDCANCEL : Windows::IDOK)
end