The Gnome Chemistry Utils  0.13.7
gcr/application.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /*
00004  * GCrystal library
00005  * application.h
00006  *
00007  * Copyright (C) 2010-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 GCR_APPLICATION_H
00026 #define GCR_APPLICATION_H
00027 
00028 #include <gcugtk/application.h>
00029 #include <goffice/goffice.h>
00030 
00038 namespace gcr {
00039 
00040 class Document;
00041 class View;
00042 class Window;
00043 
00050 class Application: public gcugtk::Application {
00051 public:
00055         Application ();
00059         virtual ~Application ();
00060 
00065         virtual gcr::Document *OnFileNew () = 0;
00066 
00070         void OnFileOpen ();
00071 
00076         void OnFileSave ();
00077 
00081         void OnFileSaveAs ();
00082 
00087         bool OnFileClose ();
00088 
00092         void OnSaveAsImage ();
00093 
00098         bool OnQuit ();
00099 
00105         void SetActiveDocument (Document *doc) {m_pActiveDoc = doc;}
00106 
00113         virtual Window *CreateNewWindow (Document *doc);
00114 
00128         bool FileProcess (const gchar* filename, const gchar* mime_type, bool bSave, GtkWindow *window, gcu::Document *pDoc = NULL);
00129 
00136         char const *GetFirstSupportedMimeType (std::list<std::string>::iterator &it);
00137 
00144         char const *GetNextSupportedMimeType (std::list<std::string>::iterator &it);
00145 
00151         Document* GetDocument (const char* filename);
00152 
00156         bool IsEmpty() {return m_Views.empty();}
00157 
00161         void SetOpening() {m_bFileOpening = true;}
00162 
00163 private:
00164         void AddMimeType (std::list<std::string> &l, std::string const& mime_type);
00165 
00166 protected:
00170         Document* m_pActiveDoc;
00171 
00172 private:
00173         std::list<std::string> m_SupportedMimeTypes;
00174         std::list<std::string> m_WriteableMimeTypes;
00175         std::list <View*> m_Views;
00176         GtkUIManager* m_UIManager;
00177         unsigned m_statusId;
00178         bool m_bFileOpening;
00179         guint m_NotificationId;
00180 
00184 GCU_RO_PROP (GOConfNode *, ConfNode)
00185 };
00186 
00187 }       //      namespace gcr
00188 
00189 #endif  //      GCR_APPLICATION_H