PixelLightAPI  .
Bitmap.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Bitmap.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_BITMAP_H__
00024 #define __PLGUI_BITMAP_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLGui/Gui/Resources/Image.h"
00032 #include "PLGui/Widgets/Widget.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLGui {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Widget that displays a static image
00047 */
00048 class Bitmap : public Widget {
00049 
00050 
00051     //[-------------------------------------------------------]
00052     //[ Class definition                                      ]
00053     //[-------------------------------------------------------]
00054     pl_class(PLGUI_RTTI_EXPORT, Bitmap, "PLGui", PLGui::Widget, "Widget that displays a static image")
00055         // Attributes
00056         pl_attribute(ImageName, PLCore::String, "", ReadWrite,  GetSet, "Image filename",   "")
00057         // Constructors
00058         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00059     pl_class_end
00060 
00061 
00062     //[-------------------------------------------------------]
00063     //[ Public functions                                      ]
00064     //[-------------------------------------------------------]
00065     public:
00066         /**
00067         *  @brief
00068         *    Constructor
00069         *
00070         *  @param[in] pParent
00071         *    Pointer to parent widget
00072         */
00073         PLGUI_API Bitmap(Widget *pParent = nullptr);
00074 
00075         /**
00076         *  @brief
00077         *    Destructor
00078         */
00079         PLGUI_API virtual ~Bitmap();
00080 
00081         /**
00082         *  @brief
00083         *    Get image
00084         *
00085         *  @return
00086         *    Image
00087         */
00088         PLGUI_API const Image &GetImage() const;
00089 
00090         /**
00091         *  @brief
00092         *    Set image
00093         *
00094         *  @param[in] cImage
00095         *    Image
00096         */
00097         PLGUI_API void SetImage(const Image &cImage);
00098 
00099         /**
00100         *  @brief
00101         *    Get image filename
00102         *
00103         *  @return
00104         *    Image that is displayed on the button
00105         */
00106         PLGUI_API PLCore::String GetImageName() const;
00107 
00108         /**
00109         *  @brief
00110         *    Set image filename
00111         *
00112         *  @param[in] sImage
00113         *    Image that is displayed on the button
00114         */
00115         PLGUI_API void SetImageName(const PLCore::String &sImage);
00116 
00117 
00118     //[-------------------------------------------------------]
00119     //[ Private virtual Widget functions                      ]
00120     //[-------------------------------------------------------]
00121     private:
00122         PLGUI_API virtual PLMath::Vector2i OnPreferredSize(const PLMath::Vector2i &vRefSize) const override;
00123         PLGUI_API virtual void OnDraw(Graphics &cGraphics) override;
00124 
00125 
00126     //[-------------------------------------------------------]
00127     //[ Private data                                          ]
00128     //[-------------------------------------------------------]
00129     private:
00130         // Private data
00131         Image m_cImage;     /**< Displayed image */
00132 
00133 
00134 };
00135 
00136 
00137 //[-------------------------------------------------------]
00138 //[ Namespace                                             ]
00139 //[-------------------------------------------------------]
00140 } // PLGui
00141 
00142 
00143 #endif // __PLGUI_BITMAP_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