Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

App_WithDoc.h

Go to the documentation of this file.
00001 /* 00002 * Copyright 2000 Murray Cumming 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this library; if not, write to the Free 00016 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef BAKERY_APP_WITHDOC_H 00020 #define BAKERY_APP_WITHDOC_H 00021 00022 #include <bakery/App/App.h> 00023 #include <bakery/Document/Document.h> 00024 00025 namespace Bakery 00026 { 00027 00056 class App_WithDoc : virtual public App //virtual because App_WithDoc_Gtk will inherit it via App_With_Doc and via App_Gtk. 00057 { 00058 public: 00060 App_WithDoc(const Glib::ustring& appname); 00061 virtual ~App_WithDoc(); 00062 00063 virtual void init(); //overridden to create document. 00064 00065 enum enumSaveChanges 00066 { 00067 SAVECHANGES_Save, 00068 SAVECHANGES_Cancel, 00069 SAVECHANGES_Discard 00070 }; 00071 00072 protected: 00073 virtual void init_create_document(); //override this to new() the specific document type. 00074 00076 virtual Document* get_document(); 00077 00079 virtual const Document* get_document() const ; 00080 00081 virtual void set_document_modified(bool bModified = true); 00082 00084 virtual bool open_document(const Glib::ustring& strFilepath); 00085 00086 static void document_history_add(const Glib::ustring& strFilepath); 00087 static void document_history_remove(const Glib::ustring& strFilepath); 00088 00089 static void session_load_document_history(); 00090 static void session_save_document_history(); 00091 00092 //Signal handlers: 00093 00094 //Menu items: 00095 virtual void on_menu_file_open(); 00096 virtual void on_menu_file_open_recent(guint index); //use with SigC::bind. 00097 virtual void on_menu_file_saveas(); //signal handler. 00098 virtual void offer_saveas(); //For direct use. 00099 virtual void on_menu_file_save(); //signal handler. 00100 virtual void on_menu_file_close(); 00101 00102 virtual void on_menu_edit_copy(); 00103 virtual void on_menu_edit_paste(); 00104 virtual void on_menu_edit_clear(); 00105 00106 //Document: 00108 virtual void on_document_modified(); 00109 00111 virtual void on_document_load(); 00112 00113 00114 virtual void offer_to_save_changes(); 00115 00117 virtual void cancel_close_or_exit(); 00118 00120 virtual void close_mark_or_destroy(); 00121 00122 virtual void update_window_title(); 00123 static void show_document_history_in_all_instances(); //In all instances' menus. 00124 virtual void show_document_history(); //override this. 00125 virtual void after_successful_save(); //e.g. disable File|Save. 00126 00127 virtual void ui_warning(const Glib::ustring& text) = 0; 00128 virtual Glib::ustring ui_file_select_open() = 0; 00129 virtual Glib::ustring ui_file_select_save(const Glib::ustring& old_filepath) = 0; 00130 virtual void ui_show_modification_status() = 0; 00131 00132 virtual enumSaveChanges ui_offer_to_save_changes() = 0; 00133 00134 virtual bool ui_ask_overwrite(const std::string& filepath) = 0; 00135 00136 static Glib::ustring get_conf_fullkey(const Glib::ustring& key); 00137 00138 00139 //Document: 00140 Document* m_pDocument; //An instance of a derived type. 00141 bool m_bCloseAfterSave; 00142 00143 typedef std::vector<Glib::ustring> type_vecStrings; 00144 static type_vecStrings m_vecDocHistory; //Previously-opened files. 00145 }; 00146 00147 } //namespace 00148 00149 #endif //BAKERY_APP_WITHDOC_H

Generated on Wed Jul 28 07:28:30 2004 for bakery by doxygen 1.3.7