PixelLightAPI  .
Control.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Control.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 __PLINPUT_CONTROL_H__
00024 #define __PLINPUT_CONTROL_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Object.h>
00032 #include "PLInput/PLInput.h"
00033 #include "PLInput/PLInputDefinitions.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLInput {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Forward declarations                                  ]
00044 //[-------------------------------------------------------]
00045 class Controller;
00046 
00047 
00048 //[-------------------------------------------------------]
00049 //[ Classes                                               ]
00050 //[-------------------------------------------------------]
00051 /**
00052 *  @brief
00053 *    Input control base class
00054 *
00055 *  @remarks
00056 *    A control is part of an input controller, e.g. a button or an axis.
00057 */
00058 class Control : public PLCore::Object {
00059 
00060 
00061     //[-------------------------------------------------------]
00062     //[ Class definition                                      ]
00063     //[-------------------------------------------------------]
00064     pl_class(PLINPUT_RTTI_EXPORT, Control, "PLInput", PLCore::Object, "Input control base class")
00065         #ifdef PLINPUT_EXPORTS  // The following is only required when compiling PLInput
00066             // Methods
00067             pl_method_0(GetController,  pl_ret_type(Controller*),                   "Returns the controller that owns the control, can be a null pointer.",                                         "")
00068             pl_method_0(GetType,        pl_ret_type(pl_enum_type(EControlType)),    "Returns the type of control.",                                                                                 "")
00069             pl_method_0(IsInputControl, pl_ret_type(bool),                          "Check if control is input or output control. Returns 'true' if control is input control, 'false' if output.",  "")
00070             pl_method_0(GetName,        pl_ret_type(PLCore::String),                "Returns the control name.",                                                                                    "")
00071             pl_method_0(GetDescription, pl_ret_type(PLCore::String),                "Returns the control description.",                                                                             "")
00072         #endif
00073     pl_class_end
00074 
00075 
00076     //[-------------------------------------------------------]
00077     //[ Public functions                                      ]
00078     //[-------------------------------------------------------]
00079     public:
00080         /**
00081         *  @brief
00082         *    Constructor
00083         *
00084         *  @param[in] pController
00085         *    Owning controller, can, but shouldn't be a null pointer
00086         *  @param[in] nType
00087         *    Control type
00088         *  @param[in] sName
00089         *    Control name
00090         *  @param[in] sDescription
00091         *    Control description
00092         */
00093         PLINPUT_API Control(Controller *pController, EControlType nType, const PLCore::String &sName, const PLCore::String &sDescription);
00094 
00095         /**
00096         *  @brief
00097         *    Destructor
00098         */
00099         PLINPUT_API virtual ~Control();
00100 
00101         /**
00102         *  @brief
00103         *    Get controller
00104         *
00105         *  @return
00106         *    Pointer to controller that owns the control, can be a null pointer
00107         */
00108         PLINPUT_API Controller *GetController() const;
00109 
00110         /**
00111         *  @brief
00112         *    Get control type
00113         *
00114         *  @return
00115         *    Type of control
00116         */
00117         PLINPUT_API EControlType GetType() const;
00118 
00119         /**
00120         *  @brief
00121         *    Check if control is input or output control
00122         *
00123         *  @return
00124         *    'true' if control is input control, 'false' if output
00125         */
00126         PLINPUT_API bool IsInputControl() const;
00127 
00128         /**
00129         *  @brief
00130         *    Get control name
00131         *
00132         *  @return
00133         *    Name
00134         */
00135         PLINPUT_API PLCore::String GetName() const;
00136 
00137         /**
00138         *  @brief
00139         *    Get control description
00140         *
00141         *  @return
00142         *    Description
00143         */
00144         PLINPUT_API PLCore::String GetDescription() const;
00145 
00146 
00147     //[-------------------------------------------------------]
00148     //[ Protected functions                                   ]
00149     //[-------------------------------------------------------]
00150     protected:
00151         /**
00152         *  @brief
00153         *    Inform input manager that control has been changed
00154         */
00155         PLINPUT_API void InformUpdate();
00156 
00157 
00158     //[-------------------------------------------------------]
00159     //[ Protected data                                        ]
00160     //[-------------------------------------------------------]
00161     protected:
00162         // Control data
00163         Controller      *m_pController;     /**< Owning controller, can be a null pointer */
00164         EControlType     m_nType;           /**< Control type */
00165         PLCore::String   m_sName;           /**< Control name */
00166         PLCore::String   m_sDescription;    /**< Control description */
00167 
00168 
00169 };
00170 
00171 
00172 //[-------------------------------------------------------]
00173 //[ Namespace                                             ]
00174 //[-------------------------------------------------------]
00175 } // PLInput
00176 
00177 
00178 #endif // __PLINPUT_CONTROL_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported