PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: Dialog.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 __PLGUI_DIALOG_H__ 00024 #define __PLGUI_DIALOG_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Event/Event.h> 00032 #include "PLGui/Widgets/Windows/Window.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLGui { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Base class for dialog windows 00047 */ 00048 class Dialog : public Window { 00049 00050 00051 //[-------------------------------------------------------] 00052 //[ Class definition ] 00053 //[-------------------------------------------------------] 00054 pl_class(PLGUI_RTTI_EXPORT, Dialog, "PLGui", PLGui::Widget, "Base class for dialog windows") 00055 pl_constructor_0(DefaultConstructor, "Default constructor", "") 00056 pl_class_end 00057 00058 00059 //[-------------------------------------------------------] 00060 //[ Public events ] 00061 //[-------------------------------------------------------] 00062 public: 00063 PLCore::Event<> EventShowDialog; /**< Dialog is shown */ 00064 PLCore::Event<int> EventCloseDialog; /**< Dialog is closed */ 00065 00066 00067 //[-------------------------------------------------------] 00068 //[ Public functions ] 00069 //[-------------------------------------------------------] 00070 public: 00071 /** 00072 * @brief 00073 * Constructor 00074 * 00075 * @param[in] pParent 00076 * Pointer to parent widget 00077 */ 00078 PLGUI_API Dialog(Widget *pParent = nullptr); 00079 00080 /** 00081 * @brief 00082 * Destructor 00083 */ 00084 PLGUI_API virtual ~Dialog(); 00085 00086 /** 00087 * @brief 00088 * Show dialog 00089 */ 00090 PLGUI_API void ShowDialog(); 00091 00092 /** 00093 * @brief 00094 * Close dialog 00095 * 00096 * @param[in] nResult 00097 * Result value 00098 */ 00099 PLGUI_API void CloseDialog(int nResult = 0); 00100 00101 /** 00102 * @brief 00103 * Get result value 00104 * 00105 * @return 00106 * Result value 00107 */ 00108 PLGUI_API int GetResult() const; 00109 00110 00111 //[-------------------------------------------------------] 00112 //[ Protected virtual Widget functions ] 00113 //[-------------------------------------------------------] 00114 protected: 00115 PLGUI_API virtual void OnClose(); 00116 00117 00118 //[-------------------------------------------------------] 00119 //[ Public virtual Dialog functions ] 00120 //[-------------------------------------------------------] 00121 public: 00122 /** 00123 * @brief 00124 * Called when dialog has been closed 00125 * 00126 * @param[in] nResult 00127 * Result value 00128 */ 00129 PLGUI_API virtual void OnCloseDialog(int nResult); 00130 00131 00132 //[-------------------------------------------------------] 00133 //[ Private data ] 00134 //[-------------------------------------------------------] 00135 private: 00136 int m_nResult; /**< Result value */ 00137 00138 00139 }; 00140 00141 00142 //[-------------------------------------------------------] 00143 //[ Namespace ] 00144 //[-------------------------------------------------------] 00145 } // PLGui 00146 00147 00148 #endif // __PLGUI_DIALOG_H__
|