PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: ButtonGroup.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_BUTTONGROUP_H__ 00024 #define __PLGUI_BUTTONGROUP_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Event/Event.h> 00032 #include "PLGui/PLGui.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLGui { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Forward declaration ] 00043 //[-------------------------------------------------------] 00044 class AbstractToggleButton; 00045 00046 00047 //[-------------------------------------------------------] 00048 //[ Classes ] 00049 //[-------------------------------------------------------] 00050 /** 00051 * @brief 00052 * Manages a button group 00053 */ 00054 class ButtonGroup { 00055 00056 00057 //[-------------------------------------------------------] 00058 //[ Public events ] 00059 //[-------------------------------------------------------] 00060 public: 00061 PLCore::Event<AbstractToggleButton*> EventActivate; 00062 00063 00064 //[-------------------------------------------------------] 00065 //[ Public functions ] 00066 //[-------------------------------------------------------] 00067 public: 00068 /** 00069 * @brief 00070 * Constructor 00071 */ 00072 PLGUI_API ButtonGroup(); 00073 00074 /** 00075 * @brief 00076 * Destructor 00077 */ 00078 PLGUI_API virtual ~ButtonGroup(); 00079 00080 /** 00081 * @brief 00082 * Check if the button activation is exclusive 00083 * 00084 * @return 00085 * 'true', if the button activation is exclusive, else 'false' 00086 * 00087 * @remarks 00088 * If the button activation is exclusive, only one button can be active at the same time 00089 */ 00090 PLGUI_API bool IsExclusive() const; 00091 00092 /** 00093 * @brief 00094 * Set if the button activation is exclusive 00095 * 00096 * @param[in] bExclusive 00097 * 'true', if the button activation is exclusive, else 'false' 00098 */ 00099 PLGUI_API void SetExclusive(bool bExclusive); 00100 00101 /** 00102 * @brief 00103 * Activates a certain button 00104 * 00105 * @param[in] cButton 00106 * Button that is being activated 00107 */ 00108 PLGUI_API void Activate(AbstractToggleButton &cButton); 00109 00110 00111 //[-------------------------------------------------------] 00112 //[ Protected data ] 00113 //[-------------------------------------------------------] 00114 protected: 00115 bool m_bExclusive; /**< If 'true', only one button can be activated at the same time */ 00116 AbstractToggleButton *m_pButton; /**< Button that is currently activated */ 00117 00118 00119 }; 00120 00121 00122 //[-------------------------------------------------------] 00123 //[ Namespace ] 00124 //[-------------------------------------------------------] 00125 } // PLGui 00126 00127 00128 #endif // __PLGUI_BUTTONGROUP_H__
|