]> Dogcows Code - chaz/openbox/blob - otk/label.hh
Brand spankin new widgets for otk (Label and Button).
[chaz/openbox] / otk / label.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __label_hh
3 #define __label_hh
4
5 #include "widget.hh"
6 #include "ustring.hh"
7 #include "renderstyle.hh"
8 #include "font.hh"
9
10 #include <vector>
11
12 namespace otk {
13
14 class Label : public Widget {
15
16 public:
17 Label(Widget *parent);
18 virtual ~Label();
19
20 inline const ustring& getText(void) const { return _text; }
21 void setText(const ustring &text);
22
23 RenderStyle::Justify horizontalJustify() const { return _justify_horz; }
24 virtual void setHorizontalJustify(RenderStyle::Justify j);
25 RenderStyle::Justify verticalJustify() const { return _justify_vert; }
26 virtual void setVerticalJustify(RenderStyle::Justify j);
27
28 const Font *font() const { return _font; }
29 virtual void setFont(const Font *f);
30
31 virtual void calcDefaultSizes();
32
33 virtual void styleChanged(const RenderStyle &style);
34
35 virtual void renderForeground(Surface &surface);
36
37 protected:
38 //! The color the label will use for rendering its text
39 RenderColor *_forecolor;
40
41 private:
42 //! Text to be displayed in the label
43 ustring _text;
44 //! Text to be displayed, parsed into its separate lines
45 std::vector<ustring> _parsedtext;
46 //! The actual text being shown, may be a subset of _text
47 ustring _drawtext;
48 //! The font the text will be rendered with
49 const Font *_font;
50 //! The horizontal justification used for drawing text
51 RenderStyle::Justify _justify_horz;
52 //! The vertical justification used for drawing text
53 RenderStyle::Justify _justify_vert;
54 //! The drawing offset for the text
55 int _drawx;
56 };
57
58 }
59
60 #endif
This page took 0.037615 seconds and 5 git commands to generate.