PixelLightAPI  .
BitmapToggleButton.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: BitmapToggleButton.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_BITMAPTOGGLEBUTTON_H__
00024 #define __PLGUI_BITMAPTOGGLEBUTTON_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLGui/Gui/Resources/Image.h"
00032 #include "PLGui/Widgets/Base/AbstractToggleButton.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLGui {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    A toggle button that displays images for each state
00047 */
00048 class BitmapToggleButton : public AbstractToggleButton {
00049 
00050 
00051     //[-------------------------------------------------------]
00052     //[ Class definition                                      ]
00053     //[-------------------------------------------------------]
00054     pl_class(PLGUI_RTTI_EXPORT, BitmapToggleButton, "PLGui", PLGui::AbstractToggleButton, "A toggle button that displays images for each state")
00055         // Constructors
00056         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00057         // [TODO] Images...
00058     pl_class_end
00059 
00060 
00061     //[-------------------------------------------------------]
00062     //[ Public functions                                      ]
00063     //[-------------------------------------------------------]
00064     public:
00065         /**
00066         *  @brief
00067         *    Constructor
00068         *
00069         *  @param[in] pParent
00070         *    Pointer to the parent widget
00071         */
00072         PLGUI_API BitmapToggleButton(Widget *pParent = nullptr);
00073 
00074         /**
00075         *  @brief
00076         *    Destructor
00077         */
00078         PLGUI_API virtual ~BitmapToggleButton();
00079 
00080         /**
00081         *  @brief
00082         *    Get image for disabled-state
00083         *
00084         *  @return
00085         *    Image that is displayed when the button is disabled
00086         */
00087         PLGUI_API const Image &GetImageDisabled() const;
00088 
00089         /**
00090         *  @brief
00091         *    Set image for disabled-state
00092         *
00093         *  @param[in] cImage
00094         *    Image that is displayed when the button is disabled
00095         */
00096         PLGUI_API void SetImageDisabled(const Image &cImage);
00097 
00098         /**
00099         *  @brief
00100         *    Get image for unselected state
00101         *
00102         *  @param[in] nChecked
00103         *    Check-state for which to set the image
00104         *
00105         *  @return
00106         *    Image that is displayed when the button is not selected
00107         */
00108         PLGUI_API const Image &GetImageUnselected(ECheckState nChecked) const;
00109 
00110         /**
00111         *  @brief
00112         *    Set image for unselected state
00113         *
00114         *  @param[in] nChecked
00115         *    Check-state for which to set the image
00116         *  @param[in] cImage
00117         *    Image that is displayed when the button is not selected
00118         */
00119         PLGUI_API void SetImageUnselected(ECheckState nChecked, const Image &cImage);
00120 
00121         /**
00122         *  @brief
00123         *    Get image for selected state
00124         *
00125         *  @param[in] nChecked
00126         *    Check-state for which to set the image
00127         *
00128         *  @return
00129         *    Image that is displayed when the button is selected
00130         */
00131         PLGUI_API const Image &GetImageSelected(ECheckState nChecked) const;
00132 
00133         /**
00134         *  @brief
00135         *    Set image for selected state
00136         *
00137         *  @param[in] nChecked
00138         *    Check-state for which to set the image
00139         *  @param[in] cImage
00140         *    Image that is displayed when the button is selected
00141         */
00142         PLGUI_API void SetImageSelected(ECheckState nChecked, const Image &cImage);
00143 
00144 
00145     //[-------------------------------------------------------]
00146     //[ Private virtual Widget functions                      ]
00147     //[-------------------------------------------------------]
00148     private:
00149         PLGUI_API virtual PLMath::Vector2i OnPreferredSize(const PLMath::Vector2i &vRefSize) const override;
00150         PLGUI_API virtual void OnDraw(Graphics &cGraphics) override;
00151         PLGUI_API virtual void OnMouseEnter() override;
00152         PLGUI_API virtual void OnMouseLeave() override;
00153 
00154 
00155     //[-------------------------------------------------------]
00156     //[ Private data                                          ]
00157     //[-------------------------------------------------------]
00158     private:
00159         Image m_cImageDisabled;                 /**< Image that is displayed when the button is disabled */
00160         Image m_cImageNotChecked;               /**< Image that is displayed when the button is not checked */
00161         Image m_cImageChecked;                  /**< Image that is displayed when the button is checked */
00162         Image m_cImagePartiallyChecked;         /**< Image that is displayed when the button is partially checked */
00163         Image m_cImageSelectedNotChecked;       /**< Image that is displayed when the button is selected and not checked */
00164         Image m_cImageSelectedChecked;          /**< Image that is displayed when the button is selected and checked */
00165         Image m_cImageSelectedPartiallyChecked; /**< Image that is displayed when the button is selected and partially checked */
00166 
00167 
00168 };
00169 
00170 
00171 //[-------------------------------------------------------]
00172 //[ Namespace                                             ]
00173 //[-------------------------------------------------------]
00174 } // PLGui
00175 
00176 
00177 #endif // __PLGUI_BITMAPTOGGLEBUTTON_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