Module: Fzeet::ShellFileDialogMethods

Included in:
ShellFileOpenDialog, ShellFileSaveDialog, ShellFolderDialog
Defined in:
lib/fzeet/windows/comdlg/ShellFileDialog.rb

Instance Method Summary collapse

Instance Method Details

#itemObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fzeet/windows/comdlg/ShellFileDialog.rb', line 13

def item
	FFI::MemoryPointer.new(:pointer) { |psi|
		next unless GetResult(psi) == Windows::S_OK

		si = Windows::ShellItem.new(psi.read_pointer)

		begin
			yield si
		ensure
			si.Release
		end
	}
end

#itemsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fzeet/windows/comdlg/ShellFileDialog.rb', line 27

def items
	FFI::MemoryPointer.new(:pointer) { |psia|
		next unless GetResults(psia) == Windows::S_OK

		sia = Windows::ShellItemArray.new(psia.read_pointer)

		begin
			yield sia
		ensure
			sia.Release
		end
	}
end

#pathObject



41
# File 'lib/fzeet/windows/comdlg/ShellFileDialog.rb', line 41

def path; item { |si| return si.path } end

#pathsObject



43
# File 'lib/fzeet/windows/comdlg/ShellFileDialog.rb', line 43

def paths; items { |sia| return sia.map(&:path) } end

#Show(*args) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fzeet/windows/comdlg/ShellFileDialog.rb', line 5

def Show(*args)
	raise "#{self}.#{__method__} failed." if
		Windows.FAILED(result = vtbl[:Show].call(self, *args)) &&
		result != Windows.HRESULT_FROM_WIN32(Windows::ERROR_CANCELLED) - 0x1_0000_0000

	result
end

#show(window = Application.window) ⇒ Object



45
46
47
# File 'lib/fzeet/windows/comdlg/ShellFileDialog.rb', line 45

def show(window = Application.window)
	DialogResult.new((Show(window.handle) == Windows::S_OK) ? Windows::IDOK : Windows::IDCANCEL)
end