Sha256: 49f7b9413fdd320645da0a65cd3562dea86f4cc1f0a99b5a8e26516e75423b81

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

module Motion ; module Xray

  module_function
  def ui
    unless @xray_ui
      @xray_ui ||= UI.new

      # register default plugins if this is the first time xray_ui has been
      # accessed.  AKA "startup".  Default plugins get pushed to the front,
      # so they will appear in reverse order than they are here.
      [LogPlugin, AccessibilityPlugin, UIPlugin].each do |plugin_class|
        unless Xray.plugins.any? { |plugin| plugin_class === plugin }
          Xray.plugins.unshift(plugin_class.new)
        end
      end
    end
    return @xray_ui
  end

  def controller
    @xray_controller ||= XrayViewController.new
  end

  def toggle
    Xray.ui.toggle
  end

  def fire_up
    Xray.ui.fire_up
  end

  def cool_down
    Xray.ui.cool_down
  end

  def window
    UIApplication.sharedApplication.keyWindow || UIApplication.sharedApplication.windows[0]
  end

  def app_shared
    UIApplication.sharedApplication
  end

  def app_bounds
    UIScreen.mainScreen.bounds
  end

  def plugins
    @plugins ||= []
  end

  def register(plugin)
    Xray.plugins << plugin
  end

end end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-xray-1.0.8 lib/motion-xray/xray.rb
motion-xray-1.0.7 lib/motion-xray/xray.rb
motion-xray-1.0.6 lib/motion-xray/xray.rb
motion-xray-1.0.4 lib/motion-xray/xray.rb