Main Page   Class Hierarchy   Compound List   File List   Compound Members  

MacSystem.h

00001 /*
00002     Copyright (C) 1998 by Jorrit Tyberghein and K. Robert Bate.
00003   
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008   
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013   
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 /*----------------------------------------------------------------
00020         Written by K. Robert Bate 1998.
00021 ----------------------------------------------------------------*/
00022 
00023 #ifndef MACSYSTEM_H
00024 #define MACSYSTEM_H
00025 
00026 #include <AppleEvents.h>
00027 #include <Events.h>
00028 #include <Files.h>
00029 #include "cssys/system.h"
00030 
00031 #define MAX_ARGS        25
00032 
00033 class iMacGraphics;
00034 struct iObjectRegistry;
00035 
00036 class SysSystemDriver : public csSystemDriver, public iEventPlug
00037 {
00038 public:
00039                         SysSystemDriver(iObjectRegistry* object_reg);
00040         virtual         ~SysSystemDriver();
00041 
00042         virtual void Close();
00043 
00044         virtual bool Initialize ();
00045 
00046         virtual void Alert( const char* s );
00047         virtual void Warn( const char* s );
00048 
00049         OSErr           HandleAppleEvent( const AppleEvent *theEvent );
00050 
00051         SCF_DECLARE_IBASE_EXT (csSystemDriver);
00052 
00053         //------------------------- iEventPlug interface ---------------------------//
00054 
00055         virtual unsigned GetPotentiallyConflictingEvents ()
00056         { return CSEVTYPE_Keyboard | CSEVTYPE_Mouse; }
00057         virtual unsigned QueryEventPriority (unsigned /*iType*/)
00058         { return 100; }
00059 
00060 private:
00061         void            DispatchEvent( EventRecord *theEvent, iMacGraphics* piG2D );
00062         void            HandleMouseEvent( EventRecord *theEvent, iMacGraphics* piG2D );
00063         void            HandleMenuUpdate( void );
00064         void            HandleMenuSelection( const short menuNum, const short itemNum );
00065         void            HandleKey( const unsigned char key, const char keycode, const short modifiers, bool down );
00066         void            HandleHLEvent( EventRecord *theEvent );
00067         void            HandleOSEvent( EventRecord *theEvent, iMacGraphics* piG2D );
00068         void            ScanKeyboard( );
00069         int                     GetCommandLine( char ***arg );
00070         int                     ParseCommandLine( char *s );
00071 
00072         void            DoAboutDialog( void);
00073 
00074         Str255          mAppName;
00075         FSSpec          mAppLocation;
00076 
00077         bool            mInputSprocketsAvailable;
00078         bool            mInputSprocketsRunning;
00079 
00080         bool                    mDriverNeedsEvent;
00081         iGraphics2D*    mG2D;
00082         iMacGraphics*   mIG2D;
00083 
00084         char            CommandLine[256];
00085         char            argStr[256];
00086         char            *argv[MAX_ARGS + 1];
00087 
00088         long            mKeyboardState[4];
00089 
00090         iEventOutlet    *EventOutlet;
00091 };
00092 
00093 #endif /* MACSYSTEM_H */

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000