The Gnome Chemistry Utils  0.14.0
gcugtk/application.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * gcugtk/application.h
6  *
7  * Copyright (C) 2005-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 GCU_GTK_APPLICATION_H
26 #define GCU_GTK_APPLICATION_H
27 
28 #include <gcu/application.h>
29 
30 namespace gcu {
31 class Object;
32 }
33 
41 namespace gcugtk {
42 
43 class Object;
44 class CmdContextGtk;
45 
49 typedef struct {
53  std::string name;
58  std::string uri;
59 } Database;
60 
64 typedef enum {
81 } WindowState;
82 
87 {
88 friend class ApplicationPrivate;
89 public:
102  Application (std::string name, std::string datadir = DATADIR, char const *help_name = NULL, char const *icon_name = NULL, CmdContextGtk *cc = NULL);
106  virtual ~Application ();
107 
111  static WindowState GetDefaultWindowState () {return DefaultWindowState;}
112 
117  GtkWidget *GetImageResolutionWidget ();
118 
123  GtkWidget *GetImageSizeWidget ();
124 
133  virtual void ReceiveTargets (G_GNUC_UNUSED GtkClipboard *clipboard, G_GNUC_UNUSED GtkSelectionData *selection_data) {;}
134 
143  static void OnReceiveTargets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App)
144  {
145  App->ReceiveTargets (clipboard, selection_data);
146  }
147 
154  void ShowURI (GdkScreen *screen, std::string& uri);
155 
162  void OnBug (GdkScreen *screen, char const *uri = PACKAGE_BUGREPORT)
163  {std::string s (uri); ShowURI (screen, s);}
164 
170  void OnWeb (GdkScreen *screen, char const *uri = "http://gchemutils.nongnu.org/")
171  {std::string s (uri); ShowURI (screen, s);}
172 
180  void OnMail (GdkScreen *screen, char const *MailAddress = "mailto:gchemutils-main@nongnu.org");
181 
186  void OnLiveAssistance (GdkScreen *screen);
187 
188 protected:
189 
195  virtual void NoMoreDocsEvent () {gtk_main_quit ();}
196 
200  void CreateDefaultCmdContext ();
201 
205  bool LoopRunning () {return (gtk_main_level ());}
206 
207 private:
208  static WindowState DefaultWindowState;
209 
213 GCU_RO_PROP (GtkRecentManager*, RecentManager)
214 };
215 
216 } // namespace gcugtk
217 
218 #endif // GCU_GTK_APPLICATION_H