public
Description: fork of Martin Kahr work on an Apple Remote Wrapper
Homepage: http://www.martinkahr.com/source-code/
Clone URL: git://github.com/mattetti/apple-remote-wrapper.git
name age message
file .gitignore Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file AppleRemote-Info.plist Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file AppleRemote.bridgesupport Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file AppleRemote.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file AppleRemote.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file AppleRemote.tiff Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
directory English.lproj/ Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file GlobalKeyboardDevice.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file GlobalKeyboardDevice.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file HIDRemoteControlDevice.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file HIDRemoteControlDevice.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file Info.plist Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
directory Japanese.lproj/ Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file KeyspanFrontRowControl.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file KeyspanFrontRowControl.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file MainController.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file MainController.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file MultiClickRemoteBehavior.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file MultiClickRemoteBehavior.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteControl.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteControl.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteControlClasses.graffle Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteControlContainer.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteControlContainer.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
directory RemoteControlWrapper.xcodeproj/ Tue Jun 30 19:21:24 -0700 2009 added readme info [mattetti]
file RemoteControlWrapper_Prefix.pch Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteControls-Info.plist Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteFeedbackView.h Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file RemoteFeedbackView.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file license.txt Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file main.m Mon Jun 29 10:01:18 -0700 2009 port of martin's code to objc 2 and added a fra... [mattetti]
file readme.txt Tue Jun 30 19:21:24 -0700 2009 added readme info [mattetti]
readme.txt
Remote Control Wrapper
----------------------

You can get the original version of this code from http://martinkahr.com/source-code/

Remote Control Wrapper is an Objective-C wrapper for the Apple remote control.
It was modified to be Obj-C 2 compatible and compile as a framework to be used with MacRuby.
Note that to use this framework with MacRuby you need to use a BridgeSupport file (generated for you in the repo).
A compiled version of the framework is available in the download section.

Here is a quick implementation example using MacRuby and HotCocoa:


require 'hotcocoa'
framework File.join(File.dirname(__FILE__), 'vendor', 'AppleRemote.framework')

class Application

  include HotCocoa
  
  def start
    application :name => "AppRemote" do |app|
      app.delegate = self
      window :frame => [100, 100, 500, 500], :title => "Appremote" do |win|
        win << label(:text => "Application Remote", :layout => {:start => false})
        win.will_close { exit }
      end
      @remoteControl = AppleRemote.alloc.initWithDelegate(self)
      @remoteControl.startListening(self)
    end
  end
  
  # Callback triggered when the remote is being used.
  #
  # === Parameters
  # button<Fixnum>:: button id
  # pressed<Boolean>:: is the button pressed or released
  # remote<AppleRemote>::
  def sendRemoteButtonEvent(button, pressedDown:pressed, remoteControl:remote)
    p "button pressed #{button} #{pressed ? 'clicked' : 'released'}"
  end
end