Class: Fzeet::PrintDialogEx

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 = {}) ⇒ PrintDialogEx

Returns a new instance of PrintDialogEx.



248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 248

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.



262
263
264
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 262

def struct
  @struct
end

Instance Method Details

#show(window = Application.window) ⇒ Object



264
265
266
267
268
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 264

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

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