GTK+ IOStream  Beta
<< GTK+ >> add C++ IOStream operators to GTK+. Now with extra abilities ... like network serialisation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Container.H
Go to the documentation of this file.
1 /* Copyright 2000-2013 Matt Flax <flatmax@flatmax.org>
2  This file is part of GTK+ IOStream class set
3 
4  GTK+ IOStream is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  GTK+ IOStream is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You have received a copy of the GNU General Public License
15  along with GTK+ IOStream
16  */
17 #ifndef CONTAINER_H_
18 #define CONTAINER_H_
19 #include <gtk/gtk.h>
20 #include "mffm/LinkList.H"
21 #include "Widget.H"
22 
28 class Container : public Widget {
29 protected:
30 
33  virtual void pack(GtkWidget *obj){
34  gtk_container_add(GTK_CONTAINER(widget),obj);
35  }
36 
37 public:
41  GtkWidget* getWidget(void) {
42  return widget;
43  }
44 
48  GtkWidget* show(void) {
49  gtk_widget_show(widget);
50  return widget;
51  }
55  GtkWidget* hide(void) {
56  gtk_widget_hide(widget);
57  return widget;
58  }
59 
63  void setBorder(unsigned int size){
64  gtk_container_set_border_width(GTK_CONTAINER(widget), size);
65  }
66 
70  unsigned int getBorder(void){
71  return gtk_container_get_border_width(GTK_CONTAINER(widget));
72  }
73 
79  return operator<<(b.getWidget());
80  }
81 
87  return operator<<(b->getWidget());
88  }
89 
94  virtual Container& operator <<(GtkWidget * b) {
95  pack(b);
96  return *this;
97  }
98 
103  Container& operator <<(LinkList<GtkWidget *> &ll) {
104  ll.grab(1);// load using next from the first
105  for (int i=1;i<=ll.getCount();i++,ll.next())
106  operator<<(ll.current());
107  return *this;
108  }
109 
115  Container& operator >>(GtkWidget * b) {
116  gtk_container_remove(GTK_CONTAINER(widget), b);
117  return *this;
118  }
119 
126  gtk_container_remove(GTK_CONTAINER(widget), b->getWidget());
127  return *this;
128  }
129 
136  gtk_container_remove(GTK_CONTAINER(widget), b.getWidget());
137  return *this;
138  }
139 
140 // Container& operator=(const Container b){
141 // widget=b.getWidget();
142 // }
143 };
144 #endif // CONTAINER_H_