libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
label.h
1 /* Copyright (C) 2011-2012 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WIDGET_LABEL_H
15 #define T3_WIDGET_LABEL_H
16 
17 #include <t3widget/widgets/widget.h>
18 
19 namespace t3_widget {
20 
26 class T3_WIDGET_API label_t : public widget_t {
27  public:
29  enum align_t {
43  ALIGN_CENTER
44  };
45 
46  private:
47  std::string text;
48  int text_width;
49  align_t align;
50  bool focus,
51  can_focus;
53  public:
55  label_t(const char *_text);
56 
57  virtual bool process_key(key_t key);
58  virtual bool set_size(optint height, optint width);
59  virtual void update_contents(void);
60  virtual void set_focus(focus_t _focus);
61  virtual bool accepts_focus(void);
62 
64  void set_align(align_t _align);
66  void set_text(const char *_text);
67 
69  void set_accepts_focus(bool _can_focus);
70 
72  int get_text_width(void) const;
73 };
74 
75 }; // namespace
76 #endif
77 
A widget displaying a text.
Definition: label.h:26
Align text to the right of the allocated space, with underflow indicator.
Definition: label.h:42
align_t
Constants defining alignments.
Definition: label.h:29
Align text to the right of the allocated space.
Definition: label.h:31
long key_t
Integer type holding a single key symbol.
Definition: key.h:24
Base class for widgets.
Definition: widget.h:24
Class defining values with a separate validity check.
Definition: util.h:29
Align text to the left of the allocated space, with underflow indicator.
Definition: label.h:37
Align text to the left of the allocated space.
Definition: label.h:30