PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: FrontendPixelLight.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_FRONTEND_PIXELLIGHT_H__ 00024 #define __PLCORE_FRONTEND_PIXELLIGHT_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Frontend/Frontend.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Forward declaration ] 00042 //[-------------------------------------------------------] 00043 class FrontendApplication; 00044 00045 00046 //[-------------------------------------------------------] 00047 //[ Classes ] 00048 //[-------------------------------------------------------] 00049 /** 00050 * @brief 00051 * PixelLight frontend 00052 * 00053 * @remarks 00054 * This frontend controls an embedded PixelLight frontend application, meaning application classes 00055 * derived from "FrontendApplication". Just think of this frontend class as a puppet master 00056 * (puppet = application class) controlled by another puppet master (the frontend implementation, 00057 * e.g. a simple native OS window or a browser such as MS Internet Explorer or Mozilla Firefox). 00058 */ 00059 class FrontendPixelLight : public Frontend { 00060 00061 00062 //[-------------------------------------------------------] 00063 //[ RTTI interface ] 00064 //[-------------------------------------------------------] 00065 pl_class(PLCORE_RTTI_EXPORT, FrontendPixelLight, "PLCore", PLCore::Frontend, "PixelLight frontend") 00066 // Attributes 00067 pl_attribute(ApplicationClass, String, "Application", ReadWrite, DirectValue, "Name of the frontend application RTTI class to use", "") 00068 pl_attribute(ApplicationConstructor, String, "", ReadWrite, DirectValue, "Name of the frontend application RTTI class constructor to use", "") 00069 pl_attribute(ApplicationConstructorParameters, String, "", ReadWrite, DirectValue, "Parameters for the frontend application RTTI class constructor", "") 00070 pl_attribute(ApplicationParameters, String, "", ReadWrite, DirectValue, "Parameters for the frontend application RTTI class instance", "") 00071 #ifdef PLCORE_EXPORTS // The following is only required when compiling PLCore 00072 // Constructors 00073 pl_constructor_2(ParameterConstructor, const FrontendContext&, FrontendImpl&, "Parameter constructor. Frontend context this frontend is using as first parameter, frontend implementation this frontend is using as second parameter.", "") 00074 #endif 00075 pl_class_end 00076 00077 00078 //[-------------------------------------------------------] 00079 //[ Public functions ] 00080 //[-------------------------------------------------------] 00081 public: 00082 /** 00083 * @brief 00084 * Constructor 00085 * 00086 * @param[in] cFrontendContext 00087 * Frontend context to use (just shared, the given instance must stay valid as long as this frontend lives) 00088 * @param[in] cFrontendImpl 00089 * Frontend implementation instance 00090 */ 00091 PLCORE_API FrontendPixelLight(const FrontendContext &cFrontendContext, FrontendImpl &cFrontendImpl); 00092 00093 /** 00094 * @brief 00095 * Destructor 00096 */ 00097 PLCORE_API virtual ~FrontendPixelLight(); 00098 00099 00100 //[-------------------------------------------------------] 00101 //[ Public virtual Frontend functions ] 00102 //[-------------------------------------------------------] 00103 public: 00104 PLCORE_API virtual bool IsRunning() const override; 00105 00106 00107 //[-------------------------------------------------------] 00108 //[ Protected virtual Frontend functions ] 00109 //[-------------------------------------------------------] 00110 protected: 00111 PLCORE_API virtual void OnRun(const String &sExecutableFilename, const Array<String> &lstArguments); 00112 00113 00114 //[-------------------------------------------------------] 00115 //[ Protected virtual AbstractLifecycle functions ] 00116 //[-------------------------------------------------------] 00117 protected: 00118 PLCORE_API virtual void OnCreate() override; 00119 PLCORE_API virtual void OnRestart() override; 00120 PLCORE_API virtual bool OnStart() override; 00121 PLCORE_API virtual void OnResume() override; 00122 PLCORE_API virtual void OnPause() override; 00123 PLCORE_API virtual void OnStop() override; 00124 PLCORE_API virtual void OnDestroy() override; 00125 00126 00127 //[-------------------------------------------------------] 00128 //[ Protected virtual AbstractFrontend functions ] 00129 //[-------------------------------------------------------] 00130 protected: 00131 PLCORE_API virtual void OnSize() override; 00132 PLCORE_API virtual void OnFullscreenMode() override; 00133 PLCORE_API virtual void OnDraw() override; 00134 PLCORE_API virtual void OnUpdate() override; 00135 PLCORE_API virtual void OnDrop(const Container<String> &lstFiles) override; 00136 00137 00138 //[-------------------------------------------------------] 00139 //[ Private data ] 00140 //[-------------------------------------------------------] 00141 private: 00142 FrontendApplication *m_pFrontendApplication; /**< Frontend application instance, can be a null pointer */ 00143 bool m_bFrontendApplicationInitialized; /**< Frontend application successfully initialized? */ 00144 00145 00146 }; 00147 00148 00149 //[-------------------------------------------------------] 00150 //[ Namespace ] 00151 //[-------------------------------------------------------] 00152 } // PLCore 00153 00154 00155 #endif // __PLCORE_FRONTEND_PIXELLIGHT_H__
|