# dialog.h

Go to the documentation of this file.

    00001 // -*- C++ -*-
    00002
    00003 /*
    00004  * Gnome Chemistry Utils
    00005  * gcu/dialog.h
    00006  *
    00007  * Copyright (C) 2001-2008 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
    00032 namespace gcu {
    00033
    00049 enum CheckType
    00050 {
    00051         NoCheck,
    00052         Min,
    00053         Max,
    00054         MinMax,
    00055         MinEq,
    00056         MaxEq,
    00057         MinEqMax,
    00058         MinMaxEq,
    00059         MinEqMaxEq
    00060 };
    00061
    00062 class Application;
    00063 class DialogOwner;
    00064
    00068 class Dialog
    00069 {
    00070 public:
    00090         Dialog (Application* App, const char* filename, const char* windowname, DialogOwner *owner = NULL, void (*extra_destroy)(gpointer) = NULL, gpointer data = NULL);
    00091         virtual ~Dialog ();
    00092
    00099         virtual void Destroy ();
    00100
    00109         virtual bool Apply ();
    00110
    00115         void Help ();
    00116
    00120         GtkWindow* GetWindow () {return dialog;}
    00121
    00125         void Present () {gtk_window_present (dialog);}
    00126
    00127 protected:
    00140         bool GetNumber (GtkEntry *Entry, double *x, CheckType c = NoCheck, double min = 0, double max = 0);
    00141
    00142 protected:
    00147         GladeXML* xml;
    00151         GtkWindow *dialog;
    00155         Application *m_App;
    00156
    00157 private:
    00158         void (*m_extra_destroy) (gpointer);
    00159         gpointer m_data;
    00160         char m_buf[64];
    00161         std::string m_windowname;
    00162         DialogOwner *m_Owner;
    00163 };
    00164
    00165 }       // namespace gcu
    00166
    00167 #endif // GCU_DIALOG_H