The Gnome Chemistry Utils 0.12.8
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * gcu/dialog.h 00006 * 00007 * Copyright (C) 2001-2010 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 "ui-builder.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: public UIBuilder 00069 { 00070 public: 00091 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); 00092 virtual ~Dialog (); 00093 00100 virtual void Destroy (); 00101 00110 virtual bool Apply (); 00111 00116 void Help (); 00117 00121 GtkWindow* GetWindow () {return dialog;} 00122 00126 void Present () {gtk_window_present (dialog);} 00127 00133 void SetTransientFor (GtkWindow *window); 00145 void SetRealName (char const *name, DialogOwner *owner) throw (std::runtime_error); 00146 00147 protected: 00160 bool GetNumber (GtkEntry *Entry, double *x, CheckType c = NoCheck, double min = 0, double max = 0); 00161 00162 protected: 00166 GtkWindow *dialog; 00170 Application *m_App; 00171 00172 private: 00173 void (*m_extra_destroy) (gpointer); 00174 gpointer m_data; 00175 char m_buf[64]; 00176 std::string m_windowname; 00177 DialogOwner *m_Owner; 00178 }; 00179 00180 } // namespace gcu 00181 00182 #endif // GCU_DIALOG_H