source: trunk/source/examples/cocoa/currency-converter/currency-converter.lisp @ 10252

Last change on this file since 10252 was 10252, checked in by gb, 12 years ago

Propagate r10236 to trunk.

File size: 1.8 KB
Line 
1(in-package "CCL")
2
3;;; define the classes referenced in the nibfile
4
5(defclass converter (ns:ns-object)
6  ()
7  (:metaclass ns:+ns-object))
8
9(objc:defmethod (#/convertCurrency:atRate: :float) 
10    ((self converter) (currency :float) (rate :float))
11  (* currency rate))
12
13(defclass converter-controller (ns:ns-object)
14  ((amount-field :foreign-type :id :accessor amount-field)
15   (converter :foreign-type :id :accessor converter)
16   (dollar-field :foreign-type :id :accessor dollar-field)
17   (rate-field :foreign-type :id :accessor rate-field))
18  (:metaclass ns:+ns-object))
19
20(objc:defmethod (#/convert: :void) ((self converter-controller) sender)
21  (declare (ignore sender))
22  (let* ((conv (converter self))
23         (dollar-field (dollar-field self))
24         (rate-field (rate-field self))
25         (amount-field (amount-field self))
26         (dollars (#/floatValue dollar-field))
27         (rate (#/floatValue rate-field))
28         (amount (#/convertCurrency:atRate: conv dollars rate)))
29    (#/setFloatValue: amount-field amount)
30    (#/selectText: rate-field self)))
31
32
33
34
35#|
36"/Users/mikel/Valise/clozure/openmcl/example-code/currency-converter/CurrencyConverter.nib"
37
38building the app:
39
40(progn
41  (setf (current-directory) "/Users/mikel/Valise/clozure/openmcl/example-code/currency-converter/")
42  (load "currency-converter")
43  (require "build-application")
44  (ccl::build-application :name "CurrencyConverter"
45                          :main-nib-name "CurrencyConverter"
46                          :directory "/Users/mikel/Desktop/"
47                          :nibfiles '(#P"/usr/local/openmcl/trunk/ccl/examples/cocoa/currency-converter/CurrencyConverter.xib")))
48
49TODO NOTES:
50
51The name of the app in the main menu title is determined by the CFBundleName field in the
52InfoPlist.strings file in the English.lproj resources folder.
53
54|#
Note: See TracBrowser for help on using the repository browser.