1 | /*
|
---|
2 | * PIApplQuartz.cpp
|
---|
3 | * PI
|
---|
4 | *
|
---|
5 | * Created by Bruno MANSOUX on Wed Jun 09 2004.
|
---|
6 | * Copyright (c) 2004 __MyCompanyName__. All rights reserved.
|
---|
7 | *
|
---|
8 | */
|
---|
9 |
|
---|
10 | #include "PIApplQuartz.h"
|
---|
11 |
|
---|
12 | static OSErr QuitAppleEventHandler(const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon);
|
---|
13 |
|
---|
14 |
|
---|
15 | PIApplicationQuartz::PIApplicationQuartz()
|
---|
16 | :PIApplicationGen()
|
---|
17 | {
|
---|
18 | OSErr err;
|
---|
19 |
|
---|
20 | err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication,
|
---|
21 | NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler),
|
---|
22 | 0, false );
|
---|
23 | if (err != noErr)
|
---|
24 | ExitToShell();
|
---|
25 |
|
---|
26 | menubar = new PIMenubar(this, "DefMenubar");
|
---|
27 | }
|
---|
28 |
|
---|
29 |
|
---|
30 | PIApplicationQuartz::PIApplicationQuartz(int width, int height,int narg, char *arg[])
|
---|
31 | :PIApplicationGen()
|
---|
32 | {
|
---|
33 | OSErr err;
|
---|
34 |
|
---|
35 | err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication,
|
---|
36 | NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler),
|
---|
37 | 0, false );
|
---|
38 | if (err != noErr)
|
---|
39 | ExitToShell();
|
---|
40 |
|
---|
41 | topcont = new PIContainer((PIContainer*)this,(const char*)"Main Window",width,height,50,50);
|
---|
42 | menubar = new PIMenubar(this, "DefMenubar");
|
---|
43 | mainWindow = new PIWindow(this,(const char*)"Main Window",PIWK_normal,width,height,50,50);
|
---|
44 | mainWindow->Refresh();
|
---|
45 | }
|
---|
46 |
|
---|
47 | PIApplicationQuartz::~PIApplicationQuartz()
|
---|
48 | {
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | void PIApplicationQuartz::Run()
|
---|
53 | {
|
---|
54 | RunApplicationEventLoop ();
|
---|
55 | return;
|
---|
56 | }
|
---|
57 |
|
---|
58 | void PIApplicationQuartz::Stop()
|
---|
59 | {
|
---|
60 | ExitToShell ();
|
---|
61 | return;
|
---|
62 | }
|
---|
63 |
|
---|
64 | void PIApplicationQuartz::SetReady()
|
---|
65 | {
|
---|
66 | mState = kReadyState;
|
---|
67 | }
|
---|
68 |
|
---|
69 | /* There's no default window in MacOSX */
|
---|
70 | void PIApplicationQuartz::PrefCompSize(int& szx, int& szy)
|
---|
71 | {
|
---|
72 | return;
|
---|
73 | }
|
---|
74 |
|
---|
75 | void PIApplicationQuartz::ScreenSize(int& szx, int& szy)
|
---|
76 | {
|
---|
77 | return;
|
---|
78 | }
|
---|
79 |
|
---|
80 | void PIApplicationQuartz::ScreenSizeMM(int& szx, int& szy)
|
---|
81 | {
|
---|
82 | return;
|
---|
83 | }
|
---|
84 |
|
---|
85 | void PIApplicationQuartz::ScreenResolution(int& resolx, int& resoly)
|
---|
86 | {
|
---|
87 | return;
|
---|
88 | }
|
---|
89 |
|
---|
90 | static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon )
|
---|
91 | {
|
---|
92 | ExitToShell ();
|
---|
93 | return noErr;
|
---|
94 | }
|
---|
95 |
|
---|
96 |
|
---|