]> Dogcows Code - chaz/openbox/blob - otk/label.hh
offsets in planar surfaces
[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(int screen, EventDispatcher *ed, int bevel = 3);
18 Label(Widget *parent);
19 virtual ~Label();
20
21 inline const ustring& text(void) const { return _text; }
22 void setText(const ustring &text);
23
24 virtual inline bool isHighlighted() const { return _highlight; }
25 virtual void setHighlighted(bool h);
26
27 RenderStyle::Justify horizontalJustify() const { return _justify_horz; }
28 virtual void setHorizontalJustify(RenderStyle::Justify j);
29 RenderStyle::Justify verticalJustify() const { return _justify_vert; }
30 virtual void setVerticalJustify(RenderStyle::Justify j);
31
32 const Font *font() const { return _font; }
33 virtual void setFont(const Font *f);
34
35 virtual void styleChanged(const RenderStyle &style);
36
37 virtual void renderForeground(Surface &surface);
38
39 protected:
40 virtual void calcDefaultSizes();
41
42 //! The color the label will use for rendering its text
43 RenderColor *_forecolor;
44
45 private:
46 //! Text to be displayed in the label
47 ustring _text;
48 //! Text to be displayed, parsed into its separate lines
49 std::vector<ustring> _parsedtext;
50 //! The actual text being shown, may be a subset of _text
51 ustring _drawtext;
52 //! The font the text will be rendered with
53 const Font *_font;
54 //! The horizontal justification used for drawing text
55 RenderStyle::Justify _justify_horz;
56 //! The vertical justification used for drawing text
57 RenderStyle::Justify _justify_vert;
58 //! The drawing offset for the text
59 int _drawx;
60 //! If the widget is highlighted or not
61 bool _highlight;
62 };
63
64 }
65
66 #endif
This page took 0.035944 seconds and 4 git commands to generate.