libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
smartlabel.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_SMARTLABEL_H
15 #define T3_WIDGET_SMARTLABEL_H
16 
17 #include <t3widget/widgets/widget.h>
18 #include <t3widget/key.h>
19 
20 namespace t3_widget {
21 
22 class T3_WIDGET_API smart_label_text_t {
23  protected:
24  bool add_colon;
25  cleanup_free_ptr<char>::t text;
26  size_t underline_start, underline_length, text_length;
27  bool underlined;
28  key_t hotkey;
29 
30  public:
31  smart_label_text_t(const char *spec, bool _addColon = false);
32  virtual ~smart_label_text_t(void);
33  void draw(t3_window_t *win, int attr, bool selected = false);
34  int get_width(void);
35  bool is_hotkey(key_t key);
36 };
37 
38 class T3_WIDGET_API smart_label_t : public smart_label_text_t, public widget_t {
39  public:
40  smart_label_t(const char *spec, bool _addColon = false);
41  virtual bool process_key(key_t key);
42  virtual bool set_size(optint height, optint width);
43  virtual void update_contents(void);
44  virtual void set_focus(focus_t focus);
45 
46  virtual bool is_hotkey(key_t key);
47  virtual bool accepts_focus(void);
48 };
49 
50 }; // namespace
51 #endif
Definition: smartlabel.h:38
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
Definition: smartlabel.h:22