The Gnome Chemistry Utils  0.13.7
tk/dialog.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /*
00004  * Gnome Chemistry Utils
00005  * gcugtk/dialog.h
00006  *
00007  * Copyright (C) 2001-2012 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 3 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_GTK_DIALOG_H
00026 #define GCU_GTK_DIALOG_H
00027 #include "ui-builder.h"
00028 #include <gcu/dialog.h>
00029 #include <gtk/gtk.h>
00030 #include <string>
00031 
00034 namespace gcu {
00035 class DialogOwner;
00036 }
00037 
00038 namespace gcugtk {
00039 
00055 enum CheckType
00056 {
00057         NoCheck,
00058         Min,
00059         Max,
00060         MinMax,
00061         MinEq,
00062         MaxEq,
00063         MinEqMax,
00064         MinMaxEq,
00065         MinEqMaxEq
00066 };
00067 
00068 class Application;
00069 
00073 class Dialog: public UIBuilder, public gcu::Dialog
00074 {
00075 public:
00076 friend class DialogPrivate;
00097         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);
00101         virtual ~Dialog ();
00102 
00109         virtual void Destroy ();
00110 
00119         virtual bool Apply ();
00123         virtual void Closed ();
00124 
00128         GtkWindow* GetWindow () {return dialog;}
00129 
00133         void Present () {gtk_window_present (dialog);}
00134 
00140         void SetTransientFor (GtkWindow *window);
00141 
00142 protected:
00155         bool GetNumber (GtkEntry *Entry, double *x, CheckType c = NoCheck, double min = 0, double max = 0);
00156 
00157 protected:
00161         GtkWindow *dialog;
00162 
00163 private:
00164         void (*m_extra_destroy) (gpointer);
00165         gpointer m_data;
00166         char m_buf[64];
00167 };
00168 
00169 }       // namespace gcu
00170 
00171 #endif // GCU_GTK_DIALOG_H