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_GTK_H 00020 #define BAKERY_APP_WITHDOC_GTK_H 00021 00022 #include <bakery/App/App_WithDoc.h> 00023 #include <bakery/App/App_Gtk.h> 00024 #include <bakery/Document/Document.h> 00025 #include <gtkmm/toolbutton.h> 00026 00027 extern "C" { 00028 typedef struct _EggRecentItem EggRecentItem; 00029 typedef struct _EggRecentModel EggRecentModel; 00030 } 00031 00032 namespace Bakery 00033 { 00034 00042 class App_WithDoc_Gtk 00043 //These are virtual base classes, with shared shared App and sigc::trackable base classes: 00044 : public App_WithDoc, 00045 public App_Gtk 00046 { 00047 public: 00049 App_WithDoc_Gtk(const Glib::ustring& appname); 00050 00052 App_WithDoc_Gtk(BaseObjectType* cobject, const Glib::ustring& appname); 00053 00054 virtual ~App_WithDoc_Gtk(); 00055 00056 virtual void init(); //Unique final overrider. 00057 00058 typedef sigc::slot<void, EggRecentItem*> RecentFileSlot; 00059 00060 protected: 00061 virtual void init_menus_file(); //overridden to add open/save/save as. 00062 virtual void init_menus_file_recentfiles(const Glib::ustring& path); // call this in init_menus_file() 00063 virtual void init_toolbars(); //overridden to add open/save 00064 00065 virtual void document_history_add(const Glib::ustring& file_uri); //overridden. 00066 virtual void document_history_remove(const Glib::ustring& file_uri); //overridden. 00067 00068 virtual void update_window_title(); 00069 00070 virtual void ui_warning(const Glib::ustring& text); 00071 virtual Glib::ustring ui_file_select_open(); 00072 virtual Glib::ustring ui_file_select_save(const Glib::ustring& old_file_uri); 00073 virtual void ui_show_modification_status(); 00074 virtual enumSaveChanges ui_offer_to_save_changes(); 00075 virtual bool ui_ask_overwrite(const std::string& file_uri); 00076 00077 00078 void on_recent_files_activate(EggRecentItem* item); 00079 00080 //Menu stuff: 00081 Glib::RefPtr<Gtk::Action> m_action_save, m_action_saveas; 00082 EggRecentModel* m_recent_files_model; 00083 RecentFileSlot m_slot_recent_files_activate; 00084 }; 00085 00086 } //namespace 00087 00088 #endif //BAKERY_APP_WITHDOC_GTK_H