Class: Fzeet::PrintDialog

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ PrintDialog

Returns a new instance of PrintDialog.



224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 224

def initialize(opts = {})
	_opts = {

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

	@struct = Windows::PRINTDLG.new

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

Instance Attribute Details

#structObject (readonly)

Returns the value of attribute struct.



238
239
240
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 238

def struct
  @struct
end

Instance Method Details

#show(window = Application.window) ⇒ Object



240
241
242
243
244
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 240

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

	DialogResult.new((Windows.PrintDlg(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
end