Class: Fzeet::FileOpenDialog

Inherits:
FileDialog show all
Defined in:
lib/fzeet/windows/comdlg/FileDialog.rb

Constant Summary

Constants inherited from FileDialog

Fzeet::FileDialog::DialogStruct, Fzeet::FileDialog::HookProc

Constants inherited from CommonDialog

CommonDialog::HookProc

Constants included from WindowMethods

WindowMethods::EnumChildProc

Instance Attribute Summary

Attributes inherited from CommonDialog

#struct

Instance Method Summary collapse

Methods inherited from FileDialog

#dispose, #initialize, #path

Methods inherited from CommonDialog

crackMessage, #hookProc, #initialize, #on

Methods included from WindowMethods

#[], #capture=, #capture?, #dialog=, #dialog?, #dlgmsg?, #drawMenuBar, #eachChild, #enabled=, #enabled?, #focus=, #focus?, #invalidate, #location, #location=, #long, #menu, #menu=, #message, #paint, #position, #position=, #postmsg, #question, #rect, #reframe, #sendmsg, #size, #size=, #style, #style?, #text, #text=, #textlen, #topmost=, #topmost?, #update, #visible=, #visible?, #xstyle, #xstyle?

Methods included from Toggle

#toggle

Constructor Details

This class inherits a constructor from Fzeet::FileDialog

Instance Method Details

#multiselect=(multiselect) ⇒ Object



178
179
180
181
182
# File 'lib/fzeet/windows/comdlg/FileDialog.rb', line 178

def multiselect=(multiselect)
	(multiselect) ?
		@struct[:Flags] |= Windows::OFN_ALLOWMULTISELECT :
		@struct[:Flags] &= ~Windows::OFN_ALLOWMULTISELECT
end

#pathsObject



163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/fzeet/windows/comdlg/FileDialog.rb', line 163

def paths
	return [path] if
		(path = @buf.read_string).length + 1 != @struct[:nFileOffset]

	result, tip = [], path.length + 1

	until @buf.get_bytes(tip, 2) == "\0\0"
		result << (name = @buf.get_string(tip))

		tip += name.length + 1
	end

	result.map! { |name| "#{path}\\#{name}" }
end

#show(window = Application.window) ⇒ Object



157
158
159
160
161
# File 'lib/fzeet/windows/comdlg/FileDialog.rb', line 157

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

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