class Fzeet::ExplorerBrowser
Attributes
events[R]
handlers[R]
parent[R]
Public Class Methods
new(parent)
click to toggle source
Calls superclass method
# File lib/fzeet/windows/shell/Common.rb, line 343 def initialize(parent) @parent = parent super() @events = Windows::ExplorerBrowserEvents.new @events.instance_variable_set(:@browser, self) class << @events attr_reader :browser (self::VTBL.members - Windows::IUnknown::VTBL.members).each { |name| define_method(name) { |*args| (handlers = browser.handlers && browser.handlers[name]) && handlers.each { |handler| (handler.arity == 0) ? handler.call : handler.call(*args) } Windows::S_OK } } end @cookie = nil FFI::MemoryPointer.new(:ulong) { |p| Advise(@events, p); @cookie = p.get_ulong(0) } Initialize(@parent.handle, parent.rect, nil) @parent. on(:size) { SetRect(nil, @parent.rect) }. on(:destroy) { Unadvise(@cookie); @events.Release; Destroy(); Release() }. instance_variable_set(:@__ExplorerBrowser__, self) end
Public Instance Methods
back()
click to toggle source
# File lib/fzeet/windows/shell/Common.rb, line 400 def back; BrowseToIDList(nil, Windows::SBSP_NAVIGATEBACK); self end
forward()
click to toggle source
# File lib/fzeet/windows/shell/Common.rb, line 401 def forward; BrowseToIDList(nil, Windows::SBSP_NAVIGATEFORWARD); self end
goto(where)
click to toggle source
# File lib/fzeet/windows/shell/Common.rb, line 386 def goto(where) pidl = nil FFI::MemoryPointer.new(:pointer) { |p| Windows.SHGetKnownFolderIDList(Windows.const_get("FOLDERID_#{where}"), 0, nil, p) BrowseToIDList(pidl = p.read_pointer, 0) } self ensure Windows.CoTaskMemFree(pidl) end
on(event, &block)
click to toggle source
# File lib/fzeet/windows/shell/Common.rb, line 380 def on(event, &block) ((@handlers ||= {})["On#{event}".to_sym] ||= []) << block self end
up()
click to toggle source
# File lib/fzeet/windows/shell/Common.rb, line 402 def up; BrowseToIDList(nil, Windows::SBSP_PARENT); self end