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

Last change on this file since 7786 was 7786, checked in by mikel, 13 years ago

tested build-application with CurrencyConverter?; added CurrencyConverter?.nib

File size: 1.7 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: ((self converter-controller) sender)
21  (let* ((conv (converter self))
22         (dollar-field (dollar-field self))
23         (rate-field (rate-field self))
24         (amount-field (amount-field self))
25         (dollars (#/floatValue dollar-field))
26         (rate (#/floatValue rate-field))
27         (amount (#/convertCurrency:atRate: conv dollars rate)))
28    (#/setFloatValue: amount-field amount)
29    (#/selectText: rate-field self)))
30
31
32
33
34#|
35"/Users/mikel/Valise/clozure/openmcl/example-code/currency-converter/CurrencyConverter.nib"
36
37building the app:
38
39(progn
40  (setf (current-directory) "/Users/mikel/Valise/clozure/openmcl/example-code/currency-converter/")
41  (load "currency-converter")
42  (require "build-application")
43  (ccl::build-application :name "CurrencyConverter"
44                          :main-nib-name "CurrencyConverter"
45                          :directory "/Users/mikel/Desktop/"
46                          :nibfiles '(#P"/usr/local/openmcl/trunk/ccl/examples/cocoa/currency-converter/CurrencyConverter.xib")))
47
48TODO NOTES:
49
50The name of the app in the main menu title is determined by the CFBundleName field in the
51InfoPlist.strings file in the English.lproj resources folder.
52
53|#
Note: See TracBrowser for help on using the repository browser.