libt3widget
expander.h
1 /* Copyright (C) 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_EXPANDER_H
15 #define T3_WIDGET_EXPANDER_H
16 
17 #include <t3widget/widgets/widget.h>
18 #include <t3widget/widgets/smartlabel.h>
19 
20 namespace t3_widget {
21 
23 class T3_WIDGET_API expander_t : public widget_t, public widget_container_t, public focus_widget_t {
24  private:
25  enum expander_focus_t {
26  FOCUS_NONE,
27  FOCUS_SELF,
28  FOCUS_CHILD,
29  };
30 
31  struct implementation_t {
32  expander_focus_t focus, last_focus;
33  bool is_expanded;
34  smart_label_text_t label;
35  cleanup_t3_window_ptr symbol_window;
36  cleanup_ptr<widget_t>::t child;
37  int full_height;
38  signals::connection move_up_connection, move_down_connection, move_right_connection, move_left_connection;
39  implementation_t(const char *text) : focus(FOCUS_NONE), last_focus(FOCUS_NONE), is_expanded(false), label(text),
40  child(NULL), full_height(2) {}
41  };
42  pimpl_ptr<implementation_t>::t impl;
43 
44  void focus_up_from_child(void);
45 
46  public:
50  expander_t(const char *text);
56  void set_child(widget_t *_child);
57  void set_expanded(bool expand);
58 
59  virtual bool process_key(key_t key);
60  virtual void update_contents(void);
61  virtual void set_focus(focus_t _focus);
62  virtual bool set_size(optint height, optint width);
63  virtual bool is_hotkey(key_t key);
64  virtual void set_enabled(bool enable);
65  virtual void force_redraw(void);
66  virtual void set_child_focus(window_component_t *target);
67  virtual bool is_child(window_component_t *component);
68  virtual widget_t *is_child_hotkey(key_t key);
69  virtual bool process_mouse_event(mouse_event_t event);
70 
71  T3_WIDGET_SIGNAL(expanded, void, bool);
72 };
73 
74 }; // namespace
75 #endif
The t3_widget namespace is contains all classes, functions and global variables in the libt3widget li...
Definition: autocompleter.cc:18
A widget showing an expander, which allows hiding another widget.
Definition: expander.h:23
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
Base class for widgets.
Definition: widget.h:24
Base class for widgets that take focus.
Definition: widget.h:76
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: smartlabel.h:22