1#
2#  PathDemoController.rb
3#  PathDemo
4#
5#  Created by Laurent Sansonetti on 1/3/07.
6#  Copyright (c) 2007 Apple Computer. All rights reserved.
7#
8
9class PathDemoController < NSObject
10
11  ib_outlets :button, :popup, :window, :demoView
12
13  def awakeFromNib
14    @popup.removeAllItems
15    ['Rectangles', 'Circles', 'Bezier Paths', 'Circle Clipping'].each do |title|
16      @popup.addItemWithTitle(title)
17    end
18  end
19
20  def runAgain(sender)
21    select(self)
22  end
23  ib_action :runAgain
24  
25  def select(sender)
26    @demoView.demoNumber = @popup.indexOfSelectedItem
27    @demoView.setNeedsDisplay(true)
28  end
29  ib_action :select
30
31  def print(sender)
32    info = NSPrintInfo.sharedPrintInfo
33	printOp = NSPrintOperation.printOperationWithView_printInfo(@demoView, info)
34    printOp.setShowPanels(true)
35	printOp.runOperation
36  end
37  ib_action :print
38
39  def applicationShouldTerminateAfterLastWindowClosed(application)
40    true
41  end
42
43end
44