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