The Gnome Chemistry Utils 0.13.5
gcr/application.h
00001 // -*- C++ -*-
00002 
00003 /*
00004  * GCrystal library
00005  * application.h
00006  *
00007  * Copyright (C) 2010-2011 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 GCR_APPLICATION_H
00026 #define GCR_APPLICATION_H
00027 
00028 #include <gcugtk/application.h>
00029 #include <goffice/goffice.h>
00030 
00031 namespace gcr {
00032 
00033 class Document;
00034 class View;
00035 class Window;
00036 
00037 class Application: public gcugtk::Application {
00038 public:
00039         Application ();
00040         virtual ~Application ();
00041 
00042         virtual gcr::Document *OnFileNew () = 0;
00043         void OnFileOpen ();
00044         void OnFileSave ();
00045         void OnFileSaveAs ();
00046         bool OnFileClose ();
00047         void OnSaveAsImage ();
00048         bool OnQuit ();
00049         void SetActiveDocument (Document *doc) {m_pActiveDoc = doc;}
00050         virtual Window *CreateNewWindow (Document *doc);
00051         bool FileProcess (const gchar* filename, const gchar* mime_type, bool bSave, GtkWindow *window, gcu::Document *pDoc = NULL);
00052         char const *GetFirstSupportedMimeType (std::list<std::string>::iterator &it);
00053         char const *GetNextSupportedMimeType (std::list<std::string>::iterator &it);
00054         Document* GetDocument (const char* filename);
00055         bool IsEmpty() {return m_Views.empty();}
00056         void SetOpening() {m_bFileOpening = true;}
00057 
00058 private:
00059         void AddMimeType (std::list<std::string> &l, std::string const& mime_type);
00060 
00061 protected:
00062         Document* m_pActiveDoc;
00063 
00064 private:
00065         std::list<std::string> m_SupportedMimeTypes;
00066         std::list<std::string> m_WriteableMimeTypes;
00067         std::list <View*> m_Views;
00068         GtkUIManager* m_UIManager;
00069         unsigned m_statusId;
00070         bool m_bFileOpening;
00071         guint m_NotificationId;
00072 
00073 GCU_RO_PROP (GOConfNode *, ConfNode)
00074 };
00075 
00076 }       //      namespace gcr
00077 
00078 #endif  //      GCR_APPLICATION_H