PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: BitmapButton.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_BITMAPBUTTON_H__ 00024 #define __PLGUI_BITMAPBUTTON_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLGui/Gui/Resources/Image.h" 00032 #include "PLGui/Widgets/Base/AbstractButton.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLGui { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * A button that displays images for each state 00047 */ 00048 class BitmapButton : public AbstractButton { 00049 00050 00051 //[-------------------------------------------------------] 00052 //[ Class definition ] 00053 //[-------------------------------------------------------] 00054 pl_class(PLGUI_RTTI_EXPORT, BitmapButton, "PLGui", PLGui::AbstractButton, "A 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 BitmapButton(Widget *pParent = nullptr); 00073 00074 /** 00075 * @brief 00076 * Destructor 00077 */ 00078 PLGUI_API virtual ~BitmapButton(); 00079 00080 /** 00081 * @brief 00082 * Get image for enabled-state 00083 * 00084 * @return 00085 * Image that is displayed when the button is enabled 00086 */ 00087 PLGUI_API const Image &GetImageEnabled() const; 00088 00089 /** 00090 * @brief 00091 * Set image for enabled-state 00092 * 00093 * @param[in] cImage 00094 * Image that is displayed when the button is enabled 00095 */ 00096 PLGUI_API void SetImageEnabled(const Image &cImage); 00097 00098 /** 00099 * @brief 00100 * Get image for disabled-state 00101 * 00102 * @return 00103 * Image that is displayed when the button is disabled 00104 */ 00105 PLGUI_API const Image &GetImageDisabled() const; 00106 00107 /** 00108 * @brief 00109 * Set image for disabled-state 00110 * 00111 * @param[in] cImage 00112 * Image that is displayed when the button is disabled 00113 */ 00114 PLGUI_API void SetImageDisabled(const Image &cImage); 00115 00116 /** 00117 * @brief 00118 * Get image for selected-state 00119 * 00120 * @return 00121 * Image that is displayed when the button is selected 00122 */ 00123 PLGUI_API const Image &GetImageSelected() const; 00124 00125 /** 00126 * @brief 00127 * Set image for selected-state 00128 * 00129 * @param[in] cImage 00130 * Image that is displayed when the button is selected 00131 */ 00132 PLGUI_API void SetImageSelected(const Image &cImage); 00133 00134 /** 00135 * @brief 00136 * Get image for pressed-state 00137 * 00138 * @return 00139 * Image that is displayed when the button is pressed 00140 */ 00141 PLGUI_API const Image &GetImagePressed() const; 00142 00143 /** 00144 * @brief 00145 * Set image for pressed-state 00146 * 00147 * @param[in] cImage 00148 * Image that is displayed when the button is pressed 00149 */ 00150 PLGUI_API void SetImagePressed(const Image &cImage); 00151 00152 00153 //[-------------------------------------------------------] 00154 //[ Private virtual Widget functions ] 00155 //[-------------------------------------------------------] 00156 private: 00157 PLGUI_API virtual PLMath::Vector2i OnPreferredSize(const PLMath::Vector2i &vRefSize) const override; 00158 PLGUI_API virtual void OnDraw(Graphics &cGraphics) override; 00159 PLGUI_API virtual void OnMouseEnter() override; 00160 PLGUI_API virtual void OnMouseLeave() override; 00161 00162 00163 //[-------------------------------------------------------] 00164 //[ Private data ] 00165 //[-------------------------------------------------------] 00166 private: 00167 Image m_cImageEnabled; /**< Image that is displayed when the button is enabled */ 00168 Image m_cImageDisabled; /**< Image that is displayed when the button is disabled */ 00169 Image m_cImageSelected; /**< Image that is displayed when the button is selected by the mouse */ 00170 Image m_cImagePressed; /**< Image that is displayed when the button is pressed */ 00171 00172 00173 }; 00174 00175 00176 //[-------------------------------------------------------] 00177 //[ Namespace ] 00178 //[-------------------------------------------------------] 00179 } // PLGui 00180 00181 00182 #endif // __PLGUI_BITMAPBUTTON_H__
|