bakery 2.6

App_WithDoc_Gtk.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_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 #include <gtkmm/recentmanager.h>
00027 
00028 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00029 extern "C" {
00030 typedef struct _EggRecentItem EggRecentItem;
00031 }
00032 
00033 // We do not include gtkmm/recentchooser.h so that this still compiles
00034 // with gtkmm-2.6
00035 namespace Gtk {
00036   class RecentChooser;
00037 }
00038 #endif // DOXYGEN_SHOULD_SKIP_THIS
00039 
00040 namespace Bakery
00041 {
00042 
00050 class App_WithDoc_Gtk
00051     //These are virtual base classes, with shared shared App and sigc::trackable base classes:
00052   : public App_WithDoc, 
00053     public App_Gtk
00054 {
00055 public:
00057   App_WithDoc_Gtk(const Glib::ustring& appname);
00058 
00060   App_WithDoc_Gtk(BaseObjectType* cobject, const Glib::ustring& appname);
00061 
00062   virtual ~App_WithDoc_Gtk();
00063 
00064   virtual void init(); //Unique final overrider.
00065 
00066 protected:
00067   virtual void init_menus_file(); //overridden to add open/save/save as.
00068   virtual void init_menus_file_recentfiles(const Glib::ustring& path); // call this in init_menus_file()
00069   virtual void init_toolbars(); //overridden to add open/save
00070 
00071   virtual void document_history_add(const Glib::ustring& file_uri); //overridden.
00072   virtual void document_history_remove(const Glib::ustring& file_uri); //overridden.
00073 
00074   virtual void update_window_title();
00075 
00076   virtual void ui_warning(const Glib::ustring& text, const Glib::ustring& secondary_text);
00077   virtual Glib::ustring ui_file_select_open(const Glib::ustring& starting_folder_uri = Glib::ustring());
00078   virtual Glib::ustring ui_file_select_save(const Glib::ustring& old_file_uri);
00079   virtual void ui_show_modification_status();
00080   virtual enumSaveChanges ui_offer_to_save_changes();
00081 
00082   void on_recent_files_activate(Gtk::RecentChooser& recent_chooser);
00083 
00084   //Menu stuff:
00085   Glib::RefPtr<Gtk::Action> m_action_save, m_action_saveas;
00086 };
00087 
00088 } //namespace
00089 
00090 #endif //BAKERY_APP_WITHDOC_GTK_H