Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLGUI_LABEL_H__
00024 #define __PLGUI_LABEL_H__
00025 #pragma once
00026
00027
00028
00029
00030
00031 #include <PLGraphics/Color/Color4.h>
00032 #include "PLGui/Gui/Resources/Font.h"
00033 #include "PLGui/Widgets/Widget.h"
00034
00035
00036
00037
00038
00039 namespace PLGui {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class Label : public Widget {
00050
00051
00052
00053
00054
00055 pl_class(PLGUI_RTTI_EXPORT, Label, "PLGui", PLGui::Widget, "Widget that displays a static text")
00056
00057 pl_attribute(Color, PLGraphics::Color4, PLGraphics::Color4::Black, ReadWrite, GetSet, "Text color", "")
00058 pl_attribute(Align, pl_enum_type(EAlign), AlignLeft, ReadWrite, GetSet, "Text alignment (horizontal)", "")
00059 pl_attribute(VAlign, pl_enum_type(EVAlign), AlignMiddle, ReadWrite, GetSet, "Text alignment (vertical)", "")
00060 pl_attribute(Wrap, pl_enum_type(ETextWrap), TextWrap, ReadWrite, GetSet, "Text wrapping", "")
00061 pl_attribute(Style, pl_flag_type(ETextStyle), 0, ReadWrite, GetSet, "Text style", "")
00062 pl_attribute(Text, PLCore::String, "", ReadWrite, GetSet, "Text label", "")
00063
00064 pl_constructor_0(DefaultConstructor, "Default constructor", "")
00065 pl_class_end
00066
00067
00068
00069
00070
00071 public:
00072
00073
00074
00075
00076
00077
00078
00079 PLGUI_API Label(Widget *pParent = nullptr);
00080
00081
00082
00083
00084
00085 PLGUI_API virtual ~Label();
00086
00087
00088
00089
00090
00091
00092
00093
00094 PLGUI_API const Font &GetFont() const;
00095
00096
00097
00098
00099
00100
00101
00102
00103 PLGUI_API void SetFont(const Font &cFont);
00104
00105
00106
00107
00108
00109
00110
00111
00112 PLGUI_API PLGraphics::Color4 GetColor() const;
00113
00114
00115
00116
00117
00118
00119
00120
00121 PLGUI_API void SetColor(const PLGraphics::Color4 &cColor);
00122
00123
00124
00125
00126
00127
00128
00129
00130 PLGUI_API EAlign GetAlign() const;
00131
00132
00133
00134
00135
00136
00137
00138
00139 PLGUI_API void SetAlign(EAlign nAlign);
00140
00141
00142
00143
00144
00145
00146
00147
00148 PLGUI_API EVAlign GetVAlign() const;
00149
00150
00151
00152
00153
00154
00155
00156
00157 PLGUI_API void SetVAlign(EVAlign nAlign);
00158
00159
00160
00161
00162
00163
00164
00165
00166 PLGUI_API ETextWrap GetWrap() const;
00167
00168
00169
00170
00171
00172
00173
00174
00175 PLGUI_API void SetWrap(ETextWrap nWrap);
00176
00177
00178
00179
00180
00181
00182
00183
00184 PLGUI_API PLCore::uint32 GetStyle() const;
00185
00186
00187
00188
00189
00190
00191
00192
00193 PLGUI_API void SetStyle(PLCore::uint32 nStyle);
00194
00195
00196
00197
00198
00199
00200
00201
00202 PLGUI_API PLCore::String GetText() const;
00203
00204
00205
00206
00207
00208
00209
00210
00211 PLGUI_API void SetText(const PLCore::String &sText);
00212
00213
00214
00215
00216
00217 private:
00218 PLGUI_API virtual PLMath::Vector2i OnPreferredSize(const PLMath::Vector2i &vRefSize) const override;
00219 PLGUI_API virtual void OnDraw(Graphics &cGraphics) override;
00220
00221
00222
00223
00224
00225 private:
00226
00227 PLGraphics::Color4 m_cColor;
00228 EAlign m_nAlign;
00229 EVAlign m_nVAlign;
00230 ETextWrap m_nWrap;
00231 PLCore::uint32 m_nStyle;
00232 PLCore::String m_sText;
00233
00234
00235 Font m_cFont;
00236
00237
00238 };
00239
00240
00241
00242
00243
00244 }
00245
00246
00247 #endif // __PLGUI_LABEL_H__