PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: ModBlend.h * 00003 * 00004 * Copyright (C) 2002-2011 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_MODBLEND_H__ 00024 #define __PLGUI_MODBLEND_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLGui/Modifiers/Modifier.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLGui { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Forward declarations ] 00042 //[-------------------------------------------------------] 00043 class Timer; 00044 00045 00046 //[-------------------------------------------------------] 00047 //[ Classes ] 00048 //[-------------------------------------------------------] 00049 /** 00050 * @brief 00051 * Modifier that blends a widget in and out according to the mouse cursor 00052 */ 00053 class ModBlend : public Modifier { 00054 00055 00056 //[-------------------------------------------------------] 00057 //[ Class definition ] 00058 //[-------------------------------------------------------] 00059 pl_class(PLGUI_RTTI_EXPORT, ModBlend, "PLGui", PLGui::Modifier, "Modifier that blends a widget in and out according to the mouse cursor") 00060 // Constructors 00061 pl_constructor_0(DefaultConstructor, "Default constructor", "") 00062 // Slots 00063 pl_slot_0(OnTimer, "Timer callback", "") 00064 pl_class_end 00065 00066 00067 //[-------------------------------------------------------] 00068 //[ Public functions ] 00069 //[-------------------------------------------------------] 00070 public: 00071 /** 00072 * @brief 00073 * Constructor 00074 */ 00075 PLGUI_API ModBlend(); 00076 00077 /** 00078 * @brief 00079 * Destructor 00080 */ 00081 PLGUI_API virtual ~ModBlend(); 00082 00083 /** 00084 * @brief 00085 * Get blend animation time 00086 * 00087 * @return 00088 * Time in milliseconds for the blend animation 00089 */ 00090 PLGUI_API PLCore::uint64 GetBlendTime() const; 00091 00092 /** 00093 * @brief 00094 * Set blend animation time 00095 * 00096 * @param[in] nBlendTime 00097 * Time in milliseconds for the blend animation 00098 */ 00099 PLGUI_API void SetBlendTime(PLCore::uint64 nBlendTime); 00100 00101 00102 //[-------------------------------------------------------] 00103 //[ Protected virtual Modifier functions ] 00104 //[-------------------------------------------------------] 00105 protected: 00106 virtual void OnAttach(Widget &cWidget) override; 00107 virtual void OnDetach(Widget &cWidget) override; 00108 00109 00110 //[-------------------------------------------------------] 00111 //[ Protected virtual WidgetFunctions functions ] 00112 //[-------------------------------------------------------] 00113 protected: 00114 virtual void OnMouseOver(bool bMouseOver) override; 00115 00116 00117 //[-------------------------------------------------------] 00118 //[ Protected functions ] 00119 //[-------------------------------------------------------] 00120 protected: 00121 /** 00122 * @brief 00123 * Called when the timer has fired 00124 */ 00125 void OnTimer(); 00126 00127 00128 //[-------------------------------------------------------] 00129 //[ Protected data ] 00130 //[-------------------------------------------------------] 00131 protected: 00132 PLCore::uint64 m_nTimeout; /**< Timeout for blend animation (in milliseconds) */ 00133 float m_fTrans; /**< Current transparency (0.0f - 1.0f) */ 00134 float m_fTransDest; /**< Destination transparency (0.0f - 1.0f) */ 00135 Timer *m_pTimer; /**< Timer used for fading */ 00136 00137 00138 }; 00139 00140 00141 //[-------------------------------------------------------] 00142 //[ Namespace ] 00143 //[-------------------------------------------------------] 00144 } // PLGui 00145 00146 00147 #endif // __PLGUI_MODBLEND_H__
|