cwidget  0.5.17
container.h
1 // container.h -*-c++-*-
2 //
3 //
4 // Copyright (C) 2000, 2005 Daniel Burrows
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License as
8 // published by the Free Software Foundation; either version 2 of
9 // the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; see the file COPYING. If not, write to
18 // the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 // Boston, MA 02111-1307, USA.
20 //
21 // A generic interface for a widget that can hold other widgets.
22 
23 #ifndef CONTAINER_H
24 #define CONTAINER_H
25 
26 #include "widget.h"
27 
28 namespace cwidget
29 {
30  namespace widgets
31  {
32  class container : public widget
33  {
34  public:
35  container() : widget() {}
36  ~container();
37 
38  virtual void add_widget(const widget_ref &)=0;
39  void add_visible_widget(const widget_ref &, bool visible);
40  virtual void rem_widget(const widget_ref &)=0;
41 
42  // Variants of the above that take a bare reference; used for weak
43  // slot connections.
44  void add_widget_bare(widget &w)
45  {
46  add_widget(widget_ref(&w));
47  }
48 
49  void add_visible_widget_bare(widget &w, bool visible)
50  {
51  add_visible_widget(widget_ref(&w), visible);
52  }
53 
54  void rem_widget_bare(widget &w)
55  {
56  rem_widget(widget_ref(&w));
57  }
58 
60  virtual widget_ref get_active_widget() = 0;
61 
63  virtual void show_all()=0;
64  };
65  }
66 }
67 
68 #endif
virtual widget_ref get_active_widget()=0
Return the currently "active" child of this container, or NULL.
The namespace containing everything defined by cwidget.
Definition: columnify.cc:26
Definition: container.h:32
The basic widget interface.
Definition: widget.h:107
virtual void show_all()=0
Display this widget and all its subwidgets.