The Gnome Chemistry Utils  0.14.0
gcr/application.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * GCrystal library
5  * application.h
6  *
7  * Copyright (C) 2010-2012 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 3 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCR_APPLICATION_H
26 #define GCR_APPLICATION_H
27 
28 #include <gcugtk/application.h>
29 #include <goffice/goffice.h>
30 
38 namespace gcr {
39 
40 class Document;
41 class View;
42 class Window;
43 
51 public:
55  Application ();
59  virtual ~Application ();
60 
65  virtual gcr::Document *OnFileNew () = 0;
66 
70  void OnFileOpen ();
71 
76  void OnFileSave ();
77 
81  void OnFileSaveAs ();
82 
87  bool OnFileClose ();
88 
92  void OnSaveAsImage ();
93 
98  bool OnQuit ();
99 
106 
113  virtual Window *CreateNewWindow (Document *doc);
114 
128  bool FileProcess (const gchar* filename, const gchar* mime_type, bool bSave, GtkWindow *window, gcu::Document *pDoc = NULL);
129 
136  char const *GetFirstSupportedMimeType (std::list<std::string>::iterator &it);
137 
144  char const *GetNextSupportedMimeType (std::list<std::string>::iterator &it);
145 
151  Document* GetDocument (const char* filename);
152 
156  bool IsEmpty() {return m_Views.empty();}
157 
161  void SetOpening() {m_bFileOpening = true;}
162 
163 private:
164  void AddMimeType (std::list<std::string> &l, std::string const& mime_type);
165 
166 protected:
171 
172 private:
173  std::list<std::string> m_SupportedMimeTypes;
174  std::list<std::string> m_WriteableMimeTypes;
175  std::list <View*> m_Views;
176  GtkUIManager* m_UIManager;
177  unsigned m_statusId;
178  bool m_bFileOpening;
179  guint m_NotificationId;
180 
184 GCU_RO_PROP (GOConfNode *, ConfNode)
185 };
186 
187 } // namespace gcr
188 
189 #endif // GCR_APPLICATION_H