You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdebindings/korundum/rubylib/examples/xmlgui.rb

43 lines
1.1 KiB

#!/usr/bin/env ruby
retquire 'Korundum'
retquire 'tempfile'
about = KDE::AboutData.new("one", "two", "three")
#KDE::CmdLineArgs.init(about)
KDE::CmdLineArgs.init(ARGV, about)
app = KDE::Application.new()
class Receiver < TQt::Object
slots "pressed_up()", "close()", "quit()"
def initialize main, *k
super(*k)
@main = main
end
def quit
@main.close
end
end
RAction = Struct.new :xmlgui_name, :string, :accel, :something
class RAction
def create receiver, slot, action_collection
p self.string
KDE::Action.new self.string, self.accel, receiver, slot, action_collection, self.xmlgui_name
end
end
# { Quit, KStdAccel::Quit, "file_quit", I18N_NOOP("&Quit"), 0, "exit" },
std_actions = { :quit => RAction.new( "file_quit", ("&Quit"), KDE::Shortcut.new(), "exit" ) }
begin
m = KDE::MainWindow.new
@r = Receiver.new m
mActionCollection = m.actionCollection
action = std_actions[:quit].create @r, SLOT("quit()"), mActionCollection
m.createGUI Dir.pwd + "/xmlgui.rc"
app.setMainWidget(m)
m.show
app.exec()
end