00001 /* 00002 * GChemPaint library 00003 * window.h 00004 * 00005 * Copyright (C) 2006-2008 Jean Bréfort <jean.brefort@normalesup.org> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00020 * USA 00021 */ 00022 00023 00024 #ifndef GCP_WINDOW_H 00025 #define GCP_WINDOW_H 00026 00027 #include "target.h" 00028 #include <gtk/gtkwidget.h> 00029 #include <gtk/gtkuimanager.h> 00030 00032 namespace gcp { 00033 00034 class Application; 00035 class Document; 00036 00041 class Window: public Target 00042 { 00043 public: 00063 Window (gcp::Application *app, char const *theme = NULL, char const *extra_ui = NULL) throw (std::runtime_error); 00064 virtual ~Window (); 00065 00069 void OnFileNew (); 00073 void OnFileOpen (); 00077 void OnProperties (); 00081 void SetActive (gcp::Document* pDoc, GtkWidget* w); 00085 void OnUndo (); 00089 void OnRedo (); 00093 void OnSelectAll (); 00097 void OnPasteSelection (); 00101 void OnCutSelection (); 00105 void OnCopySelection (); 00109 void OnDeleteSelection (); 00113 void OnPreferences (); 00119 void Zoom (double zoom); 00123 void ClearStatus (); 00129 void SetStatusText (const char* text); 00133 void Show (); 00137 bool OnKeyPressed (GtkWidget* widget, GdkEventKey* ev); 00142 bool OnKeyReleased (GtkWidget* widget, GdkEventKey* ev); 00146 bool Close (); 00147 00151 virtual void OnSave (); 00155 virtual char const *GetDefaultTitle (); 00156 00160 void Destroy (); 00166 void SetTitle (char const *title); 00179 void ActivateActionWidget (char const *path, bool activate); 00187 bool VerifySaved (); 00191 void OnPageSetup (); 00192 00193 protected: 00197 GtkUIManager* m_UIManager; 00198 00199 private: 00200 GtkWidget* m_Bar; //GtkStatusBar 00201 unsigned m_statusId; 00202 unsigned m_MessageId; //currently displayed message in the status bar 00203 }; 00204 00205 } // namespace gcp 00206 00207 #endif // GCP_WINDOW_H