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
gtkDialog.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 GTKDIALOG_H_
18 #define GTKDIALOG_H_
19 
20 #include "gtkInterface.H"
21 
22 //for gtk 2.0 transition
23 #define GTK_WINDOW_DIALOG GTK_WINDOW_TOPLEVEL
24 
25 class Gtkdialog {
26 public:
27  GtkWidget *win;
28  Gtkdialog(void){
29 #ifdef DEBUG
30  cout<<"Gtkdialog: init "<<this<<endl;
31 #endif
32  //int argc=0;
33  win = gtk_window_new( GTK_WINDOW_DIALOG );
34  //gtk_widget_ref( win );
35  gtk_signal_connect( GTK_OBJECT (win), "delete_event",
36  GTK_SIGNAL_FUNC (quit), NULL );
37  gtk_container_set_border_width( GTK_CONTAINER (win), 10 );
38  gtk_widget_show( win );
39  }
40 
41  ~Gtkdialog(void){
42 #ifdef DEBUG
43  cout<<"Gtkdialog::~Gtkdialog "<<endl;
44 #endif
45  gtk_widget_hide( win );
46  }
47 
48  static gint quit(GtkWidget *widget, GdkEvent *event, gpointer data){
49  gtk_main_quit();
50  return 0;
51  }
52 
54  gtk_container_add (GTK_CONTAINER (win), b.getWidget());
55  return *this;
56  }
58  gtk_container_add (GTK_CONTAINER (win), b->getWidget());
59  return *this;
60  }
61  Gtkdialog& operator <<(void * w) {
62  gtk_container_add (GTK_CONTAINER (win), GTK_WIDGET(w));
63  return *this;
64  }
65  Gtkdialog& operator >>(void * w) {
66  gtk_container_remove (GTK_CONTAINER (win), GTK_WIDGET(w));
67  return *this;
68  }
69 };
70 #endif