class Metasm::Gui::OpenFile

Public Class Methods

new(owner, title, opts={}) { |file| ... } click to toggle source

shows an asynchronous FileChooser window, yields the chosen filename TODO save last path

Calls superclass method
# File metasm/gui/gtk.rb, line 660
def initialize(owner, title, opts={})
        owner ||= Gtk::Window.toplevels.first
        super(title, owner, Gtk::FileChooser::ACTION_OPEN, nil,
        [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
        f = opts[:path] || @@currentfolder
        self.current_folder = f if f
        signal_connect('response') { |win, id|
                if id == Gtk::Dialog::RESPONSE_ACCEPT
                        file = filename
                        @@currentfolder = File.dirname(file)
                end
                destroy
                yield file if file
                true
        }

        show_all
        present
end

Public Instance Methods

w32api(arg) click to toggle source
# File metasm/gui/win32.rb, line 2439
def w32api(arg)
        Win32Gui.getopenfilenamea(arg)
end
w32flags() click to toggle source
# File metasm/gui/win32.rb, line 2442
def w32flags
        Win32Gui::OFN_PATHMUSTEXIST
end