cwidget  0.5.17
bin.h
1 // bin.h -*-c++-*-
2 //
3 // Generic stuff for a container that can only handle one child.
4 
5 #ifndef BIN_H
6 #define BIN_H
7 
8 #include "passthrough.h"
9 
10 #include <sigc++/connection.h>
11 
12 namespace cwidget
13 {
14  namespace widgets
15  {
16  class bin : public passthrough
17  {
18  widget_ref subwidget;
19 
20  // These are unfortunate necessities; when a widget is /removed/
21  // (but not destroyed), it is necessary to delete the connections to
22  // it. :-(
23  sigc::connection show_conn, hide_conn;
24 
25  // right now these just show or hide the bin itself
26  void show_widget(const widget_ref &w);
27  void hide_widget(const widget_ref &w);
28 
29  void show_widget_bare(widget &w);
30  void hide_widget_bare(widget &w);
31 
32  protected:
33  bin();
34 
35  public:
36  virtual ~bin();
37 
38  void set_subwidget(const util::ref_ptr<widget> &w);
39  void set_subwidget(widget &w)
40  {
41  set_subwidget(util::ref_ptr<widget>(&w));
42  }
43 
44  widget_ref get_subwidget() {return subwidget;}
45 
46  void destroy();
47 
48  virtual void show_all();
49 
50  virtual void add_widget(const widget_ref &w);
51  virtual void rem_widget(const widget_ref &w);
52 
53  widget_ref get_focus();
54 
55  void paint(const style &st);
56  };
57  }
58 }
59 
60 #endif
A "style" is a setting to be applied to a display element (widget, text, etc).
Definition: style.h:51
virtual void show_all()
Display this widget and all its subwidgets.
Definition: bin.cc:106
The namespace containing everything defined by cwidget.
Definition: columnify.cc:26
Definition: bin.h:16
The basic widget interface.
Definition: widget.h:107
Definition: passthrough.h:15
void destroy()
Destroys the visible representation of this widget and disconnects it from any children that it may h...
Definition: bin.cc:64
void paint(const style &st)
Display this widget.
Definition: bin.cc:147