PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: Border.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_BORDER_H__ 00024 #define __PLGUI_BORDER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLGraphics/Color/Color4.h> 00032 #include "PLGui/Themes/Theme.h" 00033 #include "PLGui/Widgets/Containers/ContainerWidget.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLGui { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Classes ] 00044 //[-------------------------------------------------------] 00045 /** 00046 * @brief 00047 * Container widget that displays a border around it's content 00048 */ 00049 class Border : public ContainerWidget { 00050 00051 00052 //[-------------------------------------------------------] 00053 //[ Class definition ] 00054 //[-------------------------------------------------------] 00055 pl_class(PLGUI_RTTI_EXPORT, Border, "PLGui", PLGui::ContainerWidget, "Container widget that displays a border around it's content") 00056 // Attributes 00057 pl_attribute(LineStyle, pl_enum_type(ELineStyle), SolidLine, ReadWrite, GetSet, "Line style", "") 00058 pl_attribute(BorderSize, int, 1, ReadWrite, GetSet, "Border size", "") 00059 pl_attribute(BorderColor, PLGraphics::Color4, PLGraphics::Color4::Black, ReadWrite, GetSet, "Border color", "") 00060 // Constructors 00061 pl_constructor_0(DefaultConstructor, "Default constructor", "") 00062 pl_class_end 00063 00064 00065 //[-------------------------------------------------------] 00066 //[ Public functions ] 00067 //[-------------------------------------------------------] 00068 public: 00069 /** 00070 * @brief 00071 * Constructor 00072 * 00073 * @param[in] pParent 00074 * Pointer to parent widget 00075 */ 00076 PLGUI_API Border(Widget *pParent = nullptr); 00077 00078 /** 00079 * @brief 00080 * Destructor 00081 */ 00082 PLGUI_API virtual ~Border(); 00083 00084 /** 00085 * @brief 00086 * Get line style 00087 * 00088 * @return 00089 * Line style 00090 */ 00091 PLGUI_API ELineStyle GetLineStyle() const; 00092 00093 /** 00094 * @brief 00095 * Set line style 00096 * 00097 * @param[in] nLineStyle 00098 * Line style 00099 */ 00100 PLGUI_API void SetLineStyle(ELineStyle nLineStyle); 00101 00102 /** 00103 * @brief 00104 * Get border size 00105 * 00106 * @return 00107 * Border size 00108 */ 00109 PLGUI_API int GetBorderSize() const; 00110 00111 /** 00112 * @brief 00113 * Set border size 00114 * 00115 * @param[in] nSize 00116 * Border size 00117 */ 00118 PLGUI_API void SetBorderSize(int nSize); 00119 00120 /** 00121 * @brief 00122 * Get border color 00123 * 00124 * @return 00125 * Border color 00126 */ 00127 PLGUI_API const PLGraphics::Color4 &GetBorderColor() const; 00128 00129 /** 00130 * @brief 00131 * Set border color 00132 * 00133 * @param[in] cColor 00134 * Border color 00135 */ 00136 PLGUI_API void SetBorderColor(const PLGraphics::Color4 &cColor); 00137 00138 00139 //[-------------------------------------------------------] 00140 //[ Public virtual Widget functions ] 00141 //[-------------------------------------------------------] 00142 public: 00143 PLGUI_API virtual void OnDraw(Graphics &cGraphics) override; 00144 PLGUI_API virtual PLMath::Vector2i OnPreferredSize(const PLMath::Vector2i &vRefSize) const override; 00145 PLGUI_API virtual void OnAdjustContent() override; 00146 00147 00148 //[-------------------------------------------------------] 00149 //[ Protected data ] 00150 //[-------------------------------------------------------] 00151 public: 00152 ELineStyle m_nLineStyle; /**< Line style */ 00153 int m_nBorderSize; /**< Border size */ 00154 PLGraphics::Color4 m_cBorderColor; /**< Border color */ 00155 00156 00157 }; 00158 00159 00160 //[-------------------------------------------------------] 00161 //[ Namespace ] 00162 //[-------------------------------------------------------] 00163 } // PLGui 00164 00165 00166 #endif // __PLGUI_BORDER_H__
|