30 #ifndef Pt_Forms_Label_H
31 #define Pt_Forms_Label_H
33 #include <Pt/Forms/Control.h>
34 #include <Pt/Forms/Alignment.h>
35 #include <Pt/Forms/Adjustment.h>
36 #include <Pt/Forms/TextBlock.h>
37 #include <Pt/Forms/PixmapSurface.h>
38 #include <Pt/Forms/Icon.h>
39 #include <Pt/SmartPtr.h>
40 #include <Pt/String.h>
46 class PT_FORMS_API Label :
public Control
56 Alignment alignment()
const;
58 void setAlignment(Alignment a);
64 void setIcon(
const Icon& icon,
const Gfx::SizeF& iconSize);
67 const Gfx::Brush* background()
const;
69 void setBackground(
const Gfx::Brush& b);
71 const Gfx::Pen* contour()
const;
73 void setContour(
const Gfx::Pen& p);
75 const Gfx::Color& textColor()
const;
77 void setTextColor(
const Gfx::Color& color);
79 const Gfx::Font& font()
const;
81 void setFont(
const Gfx::Font& font);
83 void setFontSize(std::size_t size);
85 void setFontWeight(Gfx::Font::Weight weight);
87 void setFontSlant(Gfx::Font::Slant slant);
89 void setRenderer(LabelRenderer* renderer);
92 virtual Gfx::SizeF onMeasure(
const SizePolicy& policy);
94 virtual void onLayout(
const Gfx::RectF& rect);
96 virtual void onRescaleEvent(
const RescaleEvent& ev);
98 virtual void onResizeEvent(
const ResizeEvent& ev);
101 virtual void onConnect(Screen& screen);
103 virtual void onInvalidate();
105 virtual void onPaint(PaintSurface& surface,
106 const Gfx::RectF& rect);
109 Pixmap& getIconPixmap();
111 Adjustment adjustment()
const;
117 Gfx::Font getFont()
const;
120 enum FontOverride :
unsigned
123 OverrideWeight = 0x02,
124 OverrideSlant = 0x04,
129 Alignment _alignment;
132 Adjustment _adjustment;
133 TextBlock _textBlock;
136 Gfx::PointF _iconPos;
137 Gfx::SizeF _iconSize;
140 FacetPtr<LabelRenderer> _renderer;
143 AutoPtr<Gfx::Brush> _background;
144 AutoPtr<Gfx::Pen> _contour;
145 AutoPtr<Gfx::Color> _textColor;
146 Gfx::Font _customFont;
147 unsigned _fontOverride;
148 std::size_t _styleGeneration;
Unicode capable basic_string.
Definition: String.h:42