class Plugin::GUI::Command

Public Class Methods

get_active_widget() click to toggle source

フォーカスされているウィジェットを返す。

Return

現在アクティブなウィジェット

# File core/plugin/gui/command.rb, line 35
def get_active_widget
  chain = Plugin::GUI::Window.active.active_chain
  chain.last if chain
end
get_menu_items(widget = get_active_widget) click to toggle source
# File core/plugin/gui/command.rb, line 6
def get_menu_items(widget = get_active_widget)
  type_strict widget => Plugin::GUI::Widget
  labels = []
  contextmenu = []
  timeline = widget.is_a?(Plugin::GUI::Timeline) ? widget : widget.active_class_of(Plugin::GUI::Timeline)
  event = Plugin::GUI::Event.new(:contextmenu, widget, timeline ? timeline.selected_messages : [])
  Plugin.filtering(:command, Hash.new).first.values.each{ |record|
    if(record[:visible] and widget.class.find_role_ancestor(record[:role]))
      index = where_should_insert_it(record[:slug].to_s, labels, UserConfig[:mumble_contextmenu_order] || [])
      labels.insert(index, record[:slug].to_s)
      face = record[:show_face] || record[:name] || record[:slug].to_s
      name = if defined? face.call then lambda{ |x| face.call(event) } else face end
      contextmenu.insert(index, [name,
                                 lambda{ |x| record[:condition] === event },
                                 lambda{ |x| record[:exec].call(event) },
                                 record[:icon]]) end }

  [event,contextmenu]
end
menu_pop(widget = get_active_widget) click to toggle source