class Fzeet::FileDialog
Constants
- DialogStruct
- HookProc
Public Class Methods
new(opts = {}) { |self| ... }
click to toggle source
Calls superclass method
Fzeet::CommonDialog::new
# File lib/fzeet/windows/comdlg/FileDialog.rb, line 132 def initialize(opts = {}) _opts = { filter: nil, customFilter: nil, filterIndex: 0, fileTitle: nil, initialDir: nil, title: nil, flags: 0, fileExtension: nil, defExt: nil, custData: 0, hook: nil, templateName: nil, xflags: 0 } badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty? _opts.merge!(opts) @struct = DialogStruct.new @struct[:lStructSize] = @struct.size @struct[:hInstance] = Windows.GetModuleHandle(nil) @struct[:lpstrFile] = @buf = FFI::MemoryPointer.new(:char, 4096) @struct[:nMaxFile] = @buf.size @struct[:Flags] = Fzeet.flags([:enablehook, :explorer, :enablesizing, :overwriteprompt] + [*_opts[:flags]], :ofn_) @struct[:lCustData] = object_id @struct[:lpfnHook] = HookProc super() begin yield self ensure dispose end if block_given? end
Public Instance Methods
dispose()
click to toggle source
# File lib/fzeet/windows/comdlg/FileDialog.rb, line 170 def dispose; @buf.free end
path()
click to toggle source
# File lib/fzeet/windows/comdlg/FileDialog.rb, line 172 def path; @buf.read_string end