/[cl-carbon]/CL-Carbon/application.lisp
ViewVC logotype

Contents of /CL-Carbon/application.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Fri May 6 04:41:47 2005 UTC (8 years, 11 months ago) by dsteuber
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -3 lines
Added code to hopefully delete the event handler so that the associated
object can be freed.  Also removed a slot from the cl-carbon:window class.
Objects should generally not know about their containers.
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: CL-CARBON -*-
2 ;;;; ***********************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name: application.lisp
6 ;;;; Project: CL-Carbon
7 ;;;; Purpose: Define the carbon::application class
8 ;;;; Programmer: David Steuber
9 ;;;; Date Started: 1/26/2005
10 ;;;;
11 ;;;; $Id: application.lisp,v 1.3 2005/05/06 04:41:47 dsteuber Exp $
12 ;;;; ***********************************************************************
13 ;;;;
14 ;;;; Copyright (c) 2005 by David Steuber
15 ;;;;
16 ;;;; Permission is hereby granted, free of charge, to any person obtaining
17 ;;;; a copy of this software and associated documentation files (the
18 ;;;; "Software"), to deal in the Software without restriction, including
19 ;;;; without limitation the rights to use, copy, modify, merge, publish,
20 ;;;; distribute, sublicense, and/or sell copies of the Software, and to
21 ;;;; permit persons to whom the Software is furnished to do so, subject to
22 ;;;; the following conditions:
23 ;;;;
24 ;;;; The above copyright notice and this permission notice shall be
25 ;;;; included in all copies or substantial portions of the Software.
26 ;;;;
27 ;;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 ;;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 ;;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 ;;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 ;;;; LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 ;;;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 ;;;; WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 ;;;;
35 ;;;; ***********************************************************************
36
37 (in-package :cl-carbon)
38
39 (defclass application (event-target)
40 ((windows :reader application-windows :initarg :windows :initform nil
41 :documentation "The window objects belonging to this application"))
42 (:documentation "The Carbon application"))
43
44 (defgeneric run-application (application)
45 (:documentation
46 "Runs the Carbon event loop."))
47
48 (defgeneric cleanup-application (application)
49 (:documentation
50 "Performs required cleanup actions after exiting event loop."))
51
52 (defmethod initialize-instance :after ((app application) &rest initargs)
53 (declare (ignore initargs))
54 (enable-debug-log (make-pathname :directory (ccl::getenv "HOME") :name "CL-Carbon application debug" :type "log"))
55 (debug-log "Initializing Carbon application -- CARBON:APPLICATION.INITIALIZE-APPLICATION called~%")
56 (require-noerror
57 (install-event-handler app
58 (#_GetApplicationEventTarget)
59 (get-event-type-specs app))))
60
61 (defmethod get-event-type-specs ((app application))
62 `(,(carbon:make-event-type-spec #$kEventClassCommand #$kEventCommandProcess)))
63
64 (defmethod run-application ((app application))
65 (#_RunApplicationEventLoop))
66
67 (defmethod run-application :after ((app application))
68 (cleanup-application app)
69 (quit))
70
71 (defmethod cleanup-application ((app application))
72 (disable-debug-log))

  ViewVC Help
Powered by ViewVC 1.1.5