The Gnome Chemistry Utils  0.12.13
dialog.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * gcu/dialog.h
6  *
7  * Copyright (C) 2001-2010 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 2 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_DIALOG_H
26 #define GCU_DIALOG_H
27 #include "ui-builder.h"
28 #include <gtk/gtk.h>
29 #include <string>
30 
32 namespace gcu {
33 
50 {
51  NoCheck,
52  Min,
53  Max,
54  MinMax,
55  MinEq,
56  MaxEq,
57  MinEqMax,
58  MinMaxEq,
59  MinEqMaxEq
60 };
61 
62 class Application;
63 class DialogOwner;
64 
68 class Dialog: public UIBuilder
69 {
70 public:
91  Dialog (Application* App, char const *filename, const char* windowname, char const *domainname, DialogOwner *owner = NULL, void (*extra_destroy)(gpointer) = NULL, gpointer data = NULL) throw (std::runtime_error);
92  virtual ~Dialog ();
93 
100  virtual void Destroy ();
101 
110  virtual bool Apply ();
111 
116  void Help ();
117 
121  GtkWindow* GetWindow () {return dialog;}
122 
126  void Present () {gtk_window_present (dialog);}
127 
133  void SetTransientFor (GtkWindow *window);
145  void SetRealName (char const *name, DialogOwner *owner) throw (std::runtime_error);
146 
147 protected:
160  bool GetNumber (GtkEntry *Entry, double *x, CheckType c = NoCheck, double min = 0, double max = 0);
161 
162 protected:
166  GtkWindow *dialog;
171 
172 private:
173  void (*m_extra_destroy) (gpointer);
174  gpointer m_data;
175  char m_buf[64];
176  std::string m_windowname;
177  DialogOwner *m_Owner;
178 };
179 
180 } // namespace gcu
181 
182 #endif // GCU_DIALOG_H