module ActionHandler

Public Instance Methods

action_collection() click to toggle source
# File lib/rui/toolkits/qt/qt.rb, line 132
def action_collection
  @action_collection ||= { }
end
action_list_entries() click to toggle source
# File lib/rui/toolkits/qt/qt.rb, line 136
def action_list_entries
  @action_list_entries ||= Hash.new {|h, x| h[x] = [] }
end
action_parent() click to toggle source
# File lib/rui/toolkits/kde/kde.rb, line 139
def action_parent
  self
end
add_action(name, a) click to toggle source
# File lib/rui/toolkits/qt/qt.rb, line 154
def add_action(name, a)
  action_parent.action_collection[name] = a
end
get_slot(s = nil, &blk) click to toggle source
# File lib/rui/toolkits/kde/kde.rb, line 121
def get_slot(s = nil, &blk)
  target, slot = if block_given?
    [Qt::SignalBlockInvocation.new(action_parent, blk, 'invoke()'), SLOT('invoke()')]
  else
    [action_parent, SLOT(s)]
  end
end
plug_action_list(name, actions) click to toggle source
# File lib/rui/toolkits/kde/kde.rb, line 143
def plug_action_list(name, actions)
  plugActionList(name.to_s, actions)
end
regular_action(name, opts, &blk) click to toggle source
# File lib/rui/toolkits/kde/kde.rb, line 129
def regular_action(name, opts, &blk)
  a = KDE::Action.new(KDE::Icon.from_theme(opts[:icon]), 
                  opts[:text], action_parent)
  action_collection.add_action(name.to_s, a)  
  a.connect(SIGNAL('triggered(bool)'), &blk)
  a.tool_tip = opts[:tooltip] if opts[:tooltip]
  a.shortcut = opts[:shortcut] if opts[:shortcut]
  a
end
std_action(action, opts = {}, &blk) click to toggle source
# File lib/rui/toolkits/kde/kde.rb, line 116
def std_action(action, opts = {}, &blk)
  target, slot = get_slot(opts[:slot], &blk)
  KDE::StandardAction.method_missing(action, target, slot, action_collection)
end
unplug_action_list(name) click to toggle source
# File lib/rui/toolkits/kde/kde.rb, line 147
def unplug_action_list(name)
  unplugActionList(name.to_s)
end