00001 /// \file CATEvent.h 00002 /// \brief Evironmental event encapsulation 00003 /// \ingroup CATGUI 00004 /// 00005 /// Copyright (c) 2003-2008 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-23 01:43:25 -0600 (Wed, 23 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 00013 #ifndef _CATEvent_H_ 00014 #define _CATEvent_H_ 00015 00016 typedef CATUInt32 CATEventCode; 00017 00018 #include "CATInternal.h" 00019 00020 /// \class CATEvent 00021 /// \brief Evironmental event encapsulation 00022 /// \ingroup CATGUI 00023 /// 00024 /// Events are occurances from the external environment targetted to a specific 00025 /// window. They should be acted on immediately if possible, and are encountered 00026 /// and parsed on the primary GUI thread. 00027 /// 00028 /// Events are identified by a 32-bit enumerated code (CATEventCode). These 00029 /// codes are stored in CATEventDefs.h, along with a description of what the 00030 /// parameters mean. 00031 /// 00032 /// The main use of events is to take operating system / environmental messages 00033 /// and coax them into a single uniform type that can be dealt with by one 00034 /// set of code for all platforms. 00035 /// 00036 /// \sa CATEventDefs, CATApp, CATWindow, CATCommand 00037 class CATEvent 00038 { 00039 public: 00040 CATEvent( CATEventCode eventCode, 00041 CATInt32 iParam1 = 0, 00042 CATInt32 iParam2 = 0, 00043 CATInt32 iParam3 = 0, 00044 CATInt32 iParam4 = 0, 00045 CATFloat32 fParam1 = 0.0f, 00046 const CATString sParam1 = "", 00047 const CATString sParam2 = "", 00048 const CATString sParam3 = "", 00049 void* vParam = 0) 00050 { 00051 fEventCode = eventCode; 00052 fIntParam1 = iParam1; 00053 fIntParam2 = iParam2; 00054 fIntParam3 = iParam3; 00055 fIntParam4 = iParam4; 00056 fFloatParam1 = fParam1; 00057 fStringParam1 = sParam1; 00058 fStringParam2 = sParam2; 00059 fStringParam3 = sParam3; 00060 fVoidParam = vParam; 00061 } 00062 00063 00064 virtual ~CATEvent() 00065 { 00066 } 00067 00068 CATEvent& operator=(const CATEvent& event) 00069 { 00070 fEventCode = event.fEventCode; 00071 fIntParam1 = event.fIntParam1; 00072 fIntParam2 = event.fIntParam2; 00073 fIntParam3 = event.fIntParam3; 00074 fIntParam4 = event.fIntParam4; 00075 fFloatParam1 = event.fFloatParam1; 00076 fStringParam1 = event.fStringParam1; 00077 fStringParam2 = event.fStringParam2; 00078 fStringParam3 = event.fStringParam3; 00079 fVoidParam = event.fVoidParam; 00080 return *this; 00081 } 00082 00083 // Event data.... 00084 CATEventCode fEventCode; 00085 CATInt32 fIntParam1; 00086 CATInt32 fIntParam2; 00087 CATInt32 fIntParam3; 00088 CATInt32 fIntParam4; 00089 CATFloat32 fFloatParam1; 00090 CATString fStringParam1; 00091 CATString fStringParam2; 00092 CATString fStringParam3; 00093 void* fVoidParam; 00094 }; 00095 00096 00097 #endif // _CATEvent_H_ 00098 00099