The Gnome Chemistry Utils  0.14.0
tk/dialog.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * gcugtk/dialog.h
6  *
7  * Copyright (C) 2001-2012 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 3 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCU_GTK_DIALOG_H
26 #define GCU_GTK_DIALOG_H
27 #include "ui-builder.h"
28 #include <gcu/dialog.h>
29 #include <gtk/gtk.h>
30 #include <string>
31 
34 namespace gcu {
35 class DialogOwner;
36 }
37 
38 namespace gcugtk {
39 
56 {
57  NoCheck,
58  Min,
59  Max,
60  MinMax,
61  MinEq,
62  MaxEq,
63  MinEqMax,
64  MinMaxEq,
65  MinEqMaxEq
66 };
67 
68 class Application;
69 
73 class Dialog: public UIBuilder, public gcu::Dialog
74 {
75 public:
76 friend class DialogPrivate;
97  Dialog (Application* App, char const *filename, const char* windowname, char const *domainname, gcu::DialogOwner *owner = NULL, void (*extra_destroy)(gpointer) = NULL, gpointer data = NULL) throw (std::runtime_error);
101  virtual ~Dialog ();
102 
109  virtual void Destroy ();
110 
119  virtual bool Apply ();
123  virtual void Closed ();
124 
128  GtkWindow* GetWindow () {return dialog;}
129 
133  void Present () {gtk_window_present (dialog);}
134 
140  void SetTransientFor (GtkWindow *window);
141 
142 protected:
155  bool GetNumber (GtkEntry *Entry, double *x, CheckType c = NoCheck, double min = 0, double max = 0);
156 
157 protected:
161  GtkWindow *dialog;
162 
163 private:
164  void (*m_extra_destroy) (gpointer);
165  gpointer m_data;
166  char m_buf[64];
167 };
168 
169 } // namespace gcu
170 
171 #endif // GCU_GTK_DIALOG_H