dialog.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * gcu/dialog.h 
00006  *
00007  * Copyright (C) 2001-2007 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef GCU_DIALOG_H
00026 #define GCU_DIALOG_H
00027 #include <glade/glade.h>
00028 #include <gtk/gtk.h>
00029 #include <string>
00030 
00031 namespace gcu {
00032 
00048 enum CheckType
00049 {
00050         NoCheck,
00051         Min,
00052         Max,
00053         MinMax,
00054         MinEq,
00055         MaxEq,
00056         MinEqMax,
00057         MinMaxEq,
00058         MinEqMaxEq
00059 };
00060 
00061 class Application;
00062 class DialogOwner;
00063 
00067 class Dialog
00068 {
00069 public:
00089         Dialog (Application* App, const char* filename, const char* windowname, DialogOwner *owner = NULL, void (*extra_destroy)(gpointer) = NULL, gpointer data = NULL);
00090         virtual ~Dialog ();
00091 
00098         virtual void Destroy ();
00099 
00108         virtual bool Apply ();
00109 
00114         void Help ();
00115 
00119         GtkWindow* GetWindow () {return dialog;}
00120 
00124         void Present () {gtk_window_present (dialog);}
00125 
00126 protected:
00139         bool GetNumber (GtkEntry *Entry, double *x, CheckType c = NoCheck, double min = 0, double max = 0);
00140 
00141 protected:
00146         GladeXML* xml;
00150         GtkWindow *dialog;
00154         Application *m_App;
00155         
00156 private:
00157         void (*m_extra_destroy) (gpointer);
00158         gpointer m_data;
00159         char m_buf[64];
00160         std::string m_windowname;
00161         DialogOwner *m_Owner;
00162 };
00163 
00164 }       // namespace gcu
00165 
00166 #endif // GCU_DIALOG_H

Generated on Sun Jun 22 13:26:05 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6