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



267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 267

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.



281
282
283
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 281

def struct
  @struct
end

Instance Method Details

#show(window = Application.window) ⇒ Object



283
284
285
286
287
# File 'lib/fzeet/windows/comdlg/PrintDialog.rb', line 283

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

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