00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCU_APPLICATION_H
00026 #define GCU_APPLICATION_H
00027
00028 #include <set>
00029 #include <string>
00030 #include <gtk/gtkmain.h>
00031 #include <gtk/gtkwindow.h>
00032
00033 using namespace std;
00034
00035 namespace gcu {
00036
00037 class Document;
00038
00042 class Application
00043 {
00044 public:
00056 Application (string name, string datadir = DATADIR, char const *help_name = NULL, char const *icon_name = NULL);
00057 virtual ~Application ();
00058
00067 void OnHelp (string s = "");
00071 bool HasHelp ();
00075 string &GetName () {return Name;}
00076
00080 virtual GtkWindow * GetWindow () {return NULL;}
00081
00095 virtual bool FileProcess (const gchar* filename, const gchar* mime_type, bool bSave, GtkWindow *window, Document *pDoc = NULL)
00096 {return false;}
00097
00101 char const* GetCurDir () {return CurDir;}
00102
00106 void SetCurDir (char const* dir);
00107 void ShowURI (string& uri);
00108 void OnBug (char *uri = PACKAGE_BUGREPORT)
00109 {string s (uri); ShowURI (s);}
00110 void OnWeb (char *uri = "http://gchemutils.nongnu.org/")
00111 {string s (uri); ShowURI (s);}
00112 void OnMail (char *MailAddress = "mailto:gchemutils-main@nongnu.org");
00113 bool HasMailAgent () {return MailAgent.length () > 0;}
00114 bool HasWebBrowser () {return WebBrowser.length () > 0;}
00115 void AddDocument (Document *Doc) {m_Docs.insert (Doc);}
00116 void RemoveDocument (Document *Doc) {m_Docs.erase (Doc); if (m_Docs.size () == 0) NoMoreDocsEvent ();}
00117 virtual void NoMoreDocsEvent () {gtk_main_quit ();}
00118
00119 private:
00120 string Name;
00121 string HelpBrowser;
00122 string HelpFilename;
00123 char *CurDir;
00124
00125 protected:
00126 string WebBrowser;
00127 string MailAgent;
00128 set <Document*> m_Docs;
00129 };
00130
00131 }
00132
00133 #endif // GCU_APPLICATION_H