PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: Cursor.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_CURSOR_H__ 00024 #define __PLGUI_CURSOR_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/String/String.h> 00032 #include "PLGui/PLGui.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Forward declarations ] 00037 //[-------------------------------------------------------] 00038 namespace PLMath { 00039 class Vector2i; 00040 } 00041 namespace PLGui { 00042 class Gui; 00043 class CursorImpl; 00044 } 00045 00046 00047 //[-------------------------------------------------------] 00048 //[ Namespace ] 00049 //[-------------------------------------------------------] 00050 namespace PLGui { 00051 00052 00053 //[-------------------------------------------------------] 00054 //[ Classes ] 00055 //[-------------------------------------------------------] 00056 /** 00057 * @brief 00058 * Cursor class 00059 * 00060 * @note 00061 * - Implementation of the bridge design pattern, this class is the abstraction 00062 */ 00063 class Cursor { 00064 00065 00066 //[-------------------------------------------------------] 00067 //[ Public functions ] 00068 //[-------------------------------------------------------] 00069 public: 00070 /** 00071 * @brief 00072 * Constructor 00073 * 00074 * @param[in] cGui 00075 * Owner GUI 00076 * 00077 * @remarks 00078 * Loads the standard mouse cursor 00079 */ 00080 PLGUI_API Cursor(Gui &cGui); 00081 00082 /** 00083 * @brief 00084 * Constructor 00085 * 00086 * @param[in] cGui 00087 * Owner GUI 00088 * @param[in] nCursor 00089 * Cursor ID 00090 * 00091 * @remarks 00092 * Loads one of the predefined mouse cursors. If you pass CursorCustom here, it will be ignored 00093 * and the standard mouse cursor will be used instead. To load a custom cursor, see the other 00094 * constructor and pass a filename. 00095 */ 00096 PLGUI_API Cursor(Gui &cGui, EMouseCursor nCursor); 00097 00098 /** 00099 * @brief 00100 * Constructor 00101 * 00102 * @param[in] cGui 00103 * Owner GUI 00104 * @param[in] sFilename 00105 * Name of image file 00106 * @param[in] vHotspot 00107 * Hotspot of cursor 00108 * 00109 * @remarks 00110 * Loads a custom cursor from an image. The mouse cursor ID will be set to CursorCustom. 00111 */ 00112 PLGUI_API Cursor(Gui &cGui, const PLCore::String &sFilename, const PLMath::Vector2i &vHotspot); 00113 00114 /** 00115 * @brief 00116 * Copy constructor 00117 * 00118 * @param[in] cCursor 00119 * Cursor that is copied 00120 */ 00121 PLGUI_API Cursor(const Cursor &cCursor); 00122 00123 /** 00124 * @brief 00125 * Destructor 00126 */ 00127 PLGUI_API ~Cursor(); 00128 00129 /** 00130 * @brief 00131 * Assignment operator 00132 * 00133 * @param[in] cCursor 00134 * Cursor that is copied 00135 */ 00136 PLGUI_API Cursor &operator =(const Cursor &cCursor); 00137 00138 /** 00139 * @brief 00140 * Get owner GUI 00141 * 00142 * @return 00143 * Pointer to GUI object (never a null pointer) 00144 */ 00145 PLGUI_API Gui *GetGui() const; 00146 00147 /** 00148 * @brief 00149 * Get implementation 00150 * 00151 * @return 00152 * Pointer to platform specific implementation 00153 */ 00154 PLGUI_API CursorImpl *GetImpl() const; 00155 00156 /** 00157 * @brief 00158 * Load cursor 00159 * 00160 * @param[in] nCursor 00161 * Cursor ID 00162 */ 00163 PLGUI_API void Load(EMouseCursor nCursor); 00164 00165 /** 00166 * @brief 00167 * Load cursor 00168 * 00169 * @param[in] sFilename 00170 * Name of image file 00171 * @param[in] vHotspot 00172 * Hotspot of cursor 00173 */ 00174 PLGUI_API void Load(const PLCore::String &sFilename, const PLMath::Vector2i &vHotspot); 00175 00176 /** 00177 * @brief 00178 * Get cursor ID 00179 * 00180 * @return 00181 * Cursor ID or CursorCustom, if no standard cursor is used 00182 */ 00183 PLGUI_API EMouseCursor GetCursorID() const; 00184 00185 /** 00186 * @brief 00187 * Get cursor filename 00188 * 00189 * @return 00190 * Cursor filename 00191 */ 00192 PLGUI_API PLCore::String GetFilename() const; 00193 00194 00195 //[-------------------------------------------------------] 00196 //[ Protected data ] 00197 //[-------------------------------------------------------] 00198 protected: 00199 Gui *m_pGui; /**< Pointer to GUI */ 00200 CursorImpl *m_pCursorImpl; /**< Cursor implementation */ 00201 EMouseCursor m_nMouseCursor; /**< Cursor ID (CustomCursor if a custom image has been loaded) */ 00202 PLCore::String m_sFilename; /**< Image filename */ 00203 00204 00205 }; 00206 00207 00208 //[-------------------------------------------------------] 00209 //[ Namespace ] 00210 //[-------------------------------------------------------] 00211 } // PLGui 00212 00213 00214 #endif // __PLGUI_CURSOR_H__
|