[3326] | 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 |
|
---|
[3747] | 14 | static PIApplication* cur_piapp = NULL;
|
---|
| 15 | PIApplication* PIApplicationGetApp() { return cur_piapp; }
|
---|
[3326] | 16 |
|
---|
| 17 | PIApplicationQuartz::PIApplicationQuartz()
|
---|
| 18 | :PIApplicationGen()
|
---|
| 19 | {
|
---|
| 20 | OSErr err;
|
---|
| 21 |
|
---|
| 22 | err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication,
|
---|
| 23 | NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler),
|
---|
| 24 | 0, false );
|
---|
| 25 | if (err != noErr)
|
---|
| 26 | ExitToShell();
|
---|
| 27 |
|
---|
| 28 | menubar = new PIMenubar(this, "DefMenubar");
|
---|
[3747] | 29 | cur_piapp = this;
|
---|
[3326] | 30 | }
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | PIApplicationQuartz::PIApplicationQuartz(int width, int height,int narg, char *arg[])
|
---|
| 34 | :PIApplicationGen()
|
---|
| 35 | {
|
---|
| 36 | OSErr err;
|
---|
| 37 |
|
---|
| 38 | err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication,
|
---|
| 39 | NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler),
|
---|
| 40 | 0, false );
|
---|
| 41 | if (err != noErr)
|
---|
| 42 | ExitToShell();
|
---|
| 43 |
|
---|
[3479] | 44 | topcont = new PIContainer((PIContainer*)this,(const char*)"Main Window",width,height,50,50);
|
---|
[3326] | 45 | menubar = new PIMenubar(this, "DefMenubar");
|
---|
[3479] | 46 | mainWindow = new PIWindow(this,(const char*)"Main Window",PIWK_normal,width,height,50,50);
|
---|
[3326] | 47 | mainWindow->Refresh();
|
---|
[3747] | 48 | cur_piapp = this;
|
---|
[3326] | 49 | }
|
---|
| 50 |
|
---|
| 51 | PIApplicationQuartz::~PIApplicationQuartz()
|
---|
| 52 | {
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | void PIApplicationQuartz::Run()
|
---|
| 57 | {
|
---|
| 58 | RunApplicationEventLoop ();
|
---|
| 59 | return;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | void PIApplicationQuartz::Stop()
|
---|
| 63 | {
|
---|
| 64 | ExitToShell ();
|
---|
| 65 | return;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | void PIApplicationQuartz::SetReady()
|
---|
| 69 | {
|
---|
| 70 | mState = kReadyState;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | /* There's no default window in MacOSX */
|
---|
| 74 | void PIApplicationQuartz::PrefCompSize(int& szx, int& szy)
|
---|
| 75 | {
|
---|
| 76 | return;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | void PIApplicationQuartz::ScreenSize(int& szx, int& szy)
|
---|
| 80 | {
|
---|
| 81 | return;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | void PIApplicationQuartz::ScreenSizeMM(int& szx, int& szy)
|
---|
| 85 | {
|
---|
| 86 | return;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | void PIApplicationQuartz::ScreenResolution(int& resolx, int& resoly)
|
---|
| 90 | {
|
---|
| 91 | return;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon )
|
---|
| 95 | {
|
---|
| 96 | ExitToShell ();
|
---|
| 97 | return noErr;
|
---|
| 98 | }
|
---|
| 99 |
|
---|