gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
gtkDialog.H
Go to the documentation of this file.
1 /* Copyright 2000-2018 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 "Window.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  g_signal_connect(G_OBJECT (win), "delete_event", reinterpret_cast<GCallback> (quit), NULL );
36  gtk_container_set_border_width( GTK_CONTAINER (win), 10 );
37  gtk_widget_show( win );
38  }
39 
40  ~Gtkdialog(void){
41 #ifdef DEBUG
42  cout<<"Gtkdialog::~Gtkdialog "<<endl;
43 #endif
44  gtk_widget_hide( win );
45  }
46 
47  static gint quit(GtkWidget *widget, GdkEvent *event, gpointer data){
48  gtk_main_quit();
49  return 0;
50  }
51 
53  gtk_container_add (GTK_CONTAINER (win), b.getWidget());
54  return *this;
55  }
57  gtk_container_add (GTK_CONTAINER (win), b->getWidget());
58  return *this;
59  }
60  Gtkdialog& operator <<(void * w) {
61  gtk_container_add (GTK_CONTAINER (win), GTK_WIDGET(w));
62  return *this;
63  }
64  Gtkdialog& operator >>(void * w) {
65  gtk_container_remove (GTK_CONTAINER (win), GTK_WIDGET(w));
66  return *this;
67  }
68 };
69 #endif
GtkWidget * win
Definition: gtkDialog.H:27
~Gtkdialog(void)
Definition: gtkDialog.H:40
#define GTK_WINDOW_DIALOG
Definition: gtkDialog.H:23
Gtkdialog & operator>>(void *w)
Definition: gtkDialog.H:64
static gint quit(GtkWidget *widget, GdkEvent *event, gpointer data)
Definition: gtkDialog.H:47
Definition: Box.H:153
GtkWidget * getWidget(void)
Definition: Widget.H:91
Gtkdialog & operator<<(Box &b)
Definition: gtkDialog.H:52
Gtkdialog(void)
Definition: gtkDialog.H:28
gtkIOStream: /tmp/gtkiostream/include/gtkDialog.H Source File
GTK+ IOStream  Beta