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

App.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_H 00020 #define BAKERY_APP_H 00021 00022 #include <bakery/App/AppInstanceManager.h> 00023 #include <gtkmm/window.h> 00024 00025 #include <vector> 00026 #include <list> 00027 #include <map> 00028 00029 namespace Bakery 00030 { 00031 00032 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00033 class HelpInfo 00034 { 00035 public: 00036 typedef std::vector<Glib::ustring> type_vecStrings; 00037 Glib::ustring m_strVersion, m_strCopyright, m_strDescription, m_strTranslatorCredits; 00038 00039 type_vecStrings m_vecAuthors, m_vecDocumenters; 00040 }; 00041 #endif //DOXYGEN_SHOULD_SKIP_THIS 00042 00060 class App : virtual public Glib::ObjectBase 00061 { 00062 public: 00063 friend class AppInstanceManager; 00064 00066 App(const Glib::ustring& appname = Glib::ustring()); 00067 virtual ~App(); 00068 00069 virtual void init(); //Sets it up and shows it. 00070 00071 //'About Box' information: 00072 typedef std::vector<Glib::ustring> type_vecStrings; 00073 static void set_about_information(const Glib::ustring& strVersion, const type_vecStrings& vecAuthors, const Glib::ustring& strCopyright, const Glib::ustring& strDescription); 00074 virtual Glib::ustring get_version() const; 00075 00076 static void set_command_line_args(int argc, char** &argv); //Needed for session management. 00077 00078 typedef SigC::Signal0<void> type_signal_hide; 00079 type_signal_hide ui_signal_hide(); 00080 00081 protected: 00082 static void init_app_name(const Glib::ustring& appname); 00083 00084 virtual void init_menus() = 0; //Override this to add more menu or different menus. 00085 virtual void init_menus_file() = 0; //Call this from init_menus() to add the standard file menu. 00086 virtual void init_menus_edit() = 0; //Call this from init_menus() to add the standard edit menu 00087 virtual void init_menus_help() = 0; //Call this from init_menus() to add the standard help menu. 00088 virtual void init_toolbars() = 0; 00089 00090 virtual App* new_instance() = 0; //Must override in order to new() the derived document class. 00091 00092 // virtual void close_window() = 0; 00093 // virtual void bring_to_front() = 0; 00094 //Signal handlers: 00095 00096 //Menus: 00097 virtual void on_menu_file_new(); 00098 virtual void on_menu_file_close(); 00099 virtual void on_menu_file_exit(); 00100 00101 //Edit menu handlers overriden in App_WithDoc: 00102 virtual void on_menu_edit_cut(); 00103 virtual void on_menu_edit_copy(); 00104 virtual void on_menu_edit_paste(); 00105 virtual void on_menu_edit_clear(); 00106 00107 virtual void on_menu_help_about() = 0; 00108 00109 00110 virtual void on_about_close(); 00111 00112 00113 //GUI abstractions: 00114 virtual void ui_hide() = 0; 00115 virtual void ui_bring_to_front() = 0; 00116 00117 //operation_cancelled: 00118 //e.g. A File|Open tries to save existing data, 00119 //but this needs to be cancelled if the save failed. 00120 static void set_operation_cancelled(bool bVal = true); 00121 static bool get_operation_cancelled(); 00122 00123 //Member data: 00124 00125 bool m_bInitialized; //Whether init() has been called. 00126 //'About Box'/WM Class information: 00127 static Glib::ustring m_strAppName; 00128 00129 //'About Box' information: 00130 static HelpInfo m_HelpInfo; 00131 00132 //Instances 00133 static AppInstanceManager m_AppInstanceManager; 00134 00135 static bool m_bOperationCancelled; //see set/get_operation_cancelled(). 00136 00137 //All instances share 1 About box: 00138 static bool m_bAboutShown; 00139 00140 //Command line args: 00141 static Glib::ustring m_strCommandLine_0; 00142 00143 type_signal_hide m_signal_hide; 00144 00145 //typedef std::vector<poptOption> type_vecPoptOptions; 00146 //type_vecPoptOptions m_vecPoptOptions; 00147 }; 00148 00149 } //namespace 00150 00151 #endif //BAKERY_APP_H

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