The Gnome Chemistry Utils  0.13.6
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-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 
00038 namespace gcr {
00039 
00040 class Document;
00041 class View;
00042 class Window;
00043 
00044 class Application: public gcugtk::Application {
00045 public:
00046         Application ();
00047         virtual ~Application ();
00048 
00049         virtual gcr::Document *OnFileNew () = 0;
00050         void OnFileOpen ();
00051         void OnFileSave ();
00052         void OnFileSaveAs ();
00053         bool OnFileClose ();
00054         void OnSaveAsImage ();
00055         bool OnQuit ();
00056         void SetActiveDocument (Document *doc) {m_pActiveDoc = doc;}
00057         virtual Window *CreateNewWindow (Document *doc);
00058         bool FileProcess (const gchar* filename, const gchar* mime_type, bool bSave, GtkWindow *window, gcu::Document *pDoc = NULL);
00059         char const *GetFirstSupportedMimeType (std::list<std::string>::iterator &it);
00060         char const *GetNextSupportedMimeType (std::list<std::string>::iterator &it);
00061         Document* GetDocument (const char* filename);
00062         bool IsEmpty() {return m_Views.empty();}
00063         void SetOpening() {m_bFileOpening = true;}
00064 
00065 private:
00066         void AddMimeType (std::list<std::string> &l, std::string const& mime_type);
00067 
00068 protected:
00069         Document* m_pActiveDoc;
00070 
00071 private:
00072         std::list<std::string> m_SupportedMimeTypes;
00073         std::list<std::string> m_WriteableMimeTypes;
00074         std::list <View*> m_Views;
00075         GtkUIManager* m_UIManager;
00076         unsigned m_statusId;
00077         bool m_bFileOpening;
00078         guint m_NotificationId;
00079 
00080 GCU_RO_PROP (GOConfNode *, ConfNode)
00081 };
00082 
00083 }       //      namespace gcr
00084 
00085 #endif  //      GCR_APPLICATION_H