PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: DynEventHandler.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_DYNEVENTHANDLER_H__ 00024 #define __PLCORE_DYNEVENTHANDLER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Container/SimpleList.h" 00032 #include "PLCore/Base/Func/DynSignature.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLCore { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Forward declarations ] 00043 //[-------------------------------------------------------] 00044 class DynEvent; 00045 class DynParams; 00046 class EventHandlerDesc; 00047 00048 00049 //[-------------------------------------------------------] 00050 //[ Classes ] 00051 //[-------------------------------------------------------] 00052 /** 00053 * @brief 00054 * Virtual base class for event handlers 00055 * 00056 * @remarks 00057 * This is the virtual base class to access event handlers dynamically. 00058 * 00059 * @note 00060 * - Implementation of the observer design pattern (this class is the observer, the destination) 00061 */ 00062 class DynEventHandler : public DynSignature { 00063 00064 00065 //[-------------------------------------------------------] 00066 //[ Friends ] 00067 //[-------------------------------------------------------] 00068 friend class DynEvent; 00069 00070 00071 //[-------------------------------------------------------] 00072 //[ Public functions ] 00073 //[-------------------------------------------------------] 00074 public: 00075 /** 00076 * @brief 00077 * Constructor 00078 */ 00079 PLCORE_API DynEventHandler(); 00080 00081 /** 00082 * @brief 00083 * Destructor 00084 */ 00085 PLCORE_API virtual ~DynEventHandler(); 00086 00087 00088 //[-------------------------------------------------------] 00089 //[ Public virtual DynEventHandler functions ] 00090 //[-------------------------------------------------------] 00091 public: 00092 /** 00093 * @brief 00094 * Get event handler descriptor 00095 * 00096 * @return 00097 * Descriptor (can be a null pointer) 00098 */ 00099 PLCORE_API virtual const EventHandlerDesc *GetDesc() const; 00100 00101 00102 //[-------------------------------------------------------] 00103 //[ Protected data ] 00104 //[-------------------------------------------------------] 00105 protected: 00106 SimpleList<DynEvent*> m_lstEvents; /**< List of events */ 00107 00108 00109 }; 00110 00111 00112 //[-------------------------------------------------------] 00113 //[ Namespace ] 00114 //[-------------------------------------------------------] 00115 } // PLCore 00116 00117 00118 #endif // __PLCORE_DYNEVENTHANDLER_H__
|