libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules
widget.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_WIDGETS_H
15 #define T3_WIDGET_WIDGETS_H
16 
17 #include <deque>
18 
19 #include <t3widget/interfaces.h>
20 
21 namespace t3_widget {
22 
24 class T3_WIDGET_API widget_t : public virtual window_component_t, public mouse_target_t {
25  private:
26  friend class container_t;
27 
29  static cleanup_t3_window_ptr default_parent;
30 
31  protected:
32  bool redraw,
33  enabled,
34  shown;
37  widget_t(int height, int width, bool register_as_mouse_target = true);
42  widget_t(void);
43 
45  void init_window(int height, int width, bool register_as_mouse_target = true);
47  void init_unbacked_window(int height, int width, bool register_as_mouse_target = false);
48 
49  public:
51  virtual bool is_hotkey(key_t key);
53  virtual bool accepts_focus(void);
54  virtual void set_position(optint top, optint left);
55  virtual void show(void);
56  virtual void hide(void);
61  virtual void set_anchor(window_component_t *anchor, int relation);
62  virtual void force_redraw(void);
66  virtual void set_enabled(bool enable);
68  virtual bool is_enabled(void);
70  virtual bool is_shown(void);
71  virtual void set_focus(focus_t focus);
72  virtual bool process_mouse_event(mouse_event_t event);
73 };
74 
76 class T3_WIDGET_API focus_widget_t {
80  T3_WIDGET_SIGNAL(move_focus_left, void);
84  T3_WIDGET_SIGNAL(move_focus_right, void);
88  T3_WIDGET_SIGNAL(move_focus_up, void);
92  T3_WIDGET_SIGNAL(move_focus_down, void);
93 };
94 
95 class T3_WIDGET_API widget_container_t : public container_t {
96  public:
97  virtual widget_t *is_child_hotkey(key_t key) = 0;
98 };
99 
100 typedef std::deque<widget_t *> widgets_t;
101 
102 }; // namespace
103 #endif
The t3_widget namespace is contains all classes, functions and global variables in the libt3widget li...
Definition: autocompleter.cc:18
Abstract base class for all items displayed on screen.
Definition: interfaces.h:28
long key_t
Integer type holding a single key symbol.
Definition: key.h:24
void redraw(void)
Force a complete redraw of the terminal contents.
Definition: main.cc:395
Base class for widgets.
Definition: widget.h:24
bool shown
Widget is shown.
Definition: widget.h:32
Base class for widgets that take focus.
Definition: widget.h:76
Base class for window_component_t's that are the parents of other window_component_t's.
Definition: interfaces.h:86
Class defining values with a separate validity check.
Definition: util.h:29
Definition: widget.h:95
Structure holding the relevant elements of a mouse event.
Definition: mouse.h:23
Definition: interfaces.h:122