libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
multiwidget.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_MULTIWIDGET_H
15 #define T3_WIDGET_MULTIWIDGET_H
16 
17 #include <t3widget/widgets/widget.h>
18 
19 namespace t3_widget {
20 
21 class T3_WIDGET_API multi_widget_t : public widget_t, public focus_widget_t, public container_t {
22  private:
23  struct T3_WIDGET_LOCAL item_t {
24  widget_t *widget;
25  int width;
26  int calculated_width;
27  bool takes_focus;
28  };
29  std::list<item_t> widgets;
30  int fixed_sum, proportion_sum;
31  widget_t *send_key_widget;
32 
33  public:
34  multi_widget_t(void);
35  virtual ~multi_widget_t(void);
36  virtual bool process_key(key_t key);
37  virtual bool set_size(optint height, optint width);
38  virtual void update_contents(void);
39  virtual void set_focus(focus_t focus);
40  virtual bool accepts_focus(void);
41  virtual void force_redraw(void);
42  virtual void set_enabled(bool enable);
43  virtual void set_child_focus(window_component_t *target);
44  virtual bool is_child(window_component_t *component);
45 
46  /* Width is negative for fixed width widgets, positive for proportion */
47  void push_back(widget_t *widget, int _width, bool takes_focus, bool send_keys);
48  void resize_widgets(void);
49 };
50 
51 }; // namespace
52 #endif