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_GNOMEUI_H 00020 #define BAKERY_APP_GNOMEUI_H 00021 00022 #include "bakery/App/App.h" 00023 #include <libgnomeuimm.h> 00024 #include <gtkmm.h> 00025 //#include <libgnome/gnome-i18n.h> 00026 00027 00028 namespace Bakery 00029 { 00030 00044 class App_GnomeUI 00045 : virtual public Bakery::App, 00046 public Gnome::UI::App 00047 { 00048 public: 00049 friend class AppInstanceManager; 00050 00052 App_GnomeUI(const Glib::ustring& appname, const Glib::ustring& title); 00053 virtual ~App_GnomeUI(); 00054 00055 virtual void init(); //Sets it up and shows it. 00056 00057 static void set_command_line_args(int argc, char **&argv); //Needed for session management. 00058 00059 00060 typedef std::map<GnomeUIInfoConfigurableTypes, Gtk::Widget*> type_mapMenuItemWidgets; 00061 00062 protected: 00063 virtual void init_menus(); //Override this to add more menu or different menus. 00064 virtual void init_menus_file(); //Call this from init_menus() to add the standard file menu. 00065 virtual void init_menus_edit(); //Call this from init_menus() to add the standard edit menu 00066 virtual void init_menus_help(); //Call this from init_menus() to add the standard help menu. 00067 virtual void init_toolbars(); 00068 00069 00070 //Signal handlers: 00071 00072 //Menus: 00073 virtual void on_menu_help_about(); 00074 00075 00076 virtual void on_about_close(); 00077 00078 //GnomeClient Session Management: 00079 virtual void on_session_die(); 00080 virtual bool on_session_save_yourself(int phase, Gnome::UI::SaveStyle save_style, bool is_shutdown, Gnome::UI::InteractStyle interact_style, bool is_fast); 00081 00082 virtual void on_hide(); //override. 00083 00084 virtual void ui_hide(); 00085 virtual void ui_bring_to_front(); 00086 00087 virtual bool on_delete_event(GdkEventAny *event); //override 00088 00089 //virtual void destroy_and_remove_from_list(); 00090 00091 00092 //Menus, toolbars: 00093 typedef std::vector<Gnome::UI::Items::SubTree> type_vecGnome_UI_SubTree; 00094 type_vecGnome_UI_SubTree m_menu_UI_Infos; //Filled by init_menus; 00095 typedef std::vector<Gnome::UI::Items::Info> type_vecGnome_UI_Info; 00096 type_vecGnome_UI_Info m_toolbar_UI_Infos; //Filled by init_toolbars; 00097 00098 //Member widgets: 00099 Gnome::UI::AppBar m_Status; 00100 00101 //All instances share 1 About box: 00102 static Gnome::UI::About* m_pAbout; //About box. 00103 00104 //Command line args: 00105 static Glib::ustring m_strCommandLine_0; 00106 }; 00107 00108 } //namespace 00109 00110 #endif //BAKERY_APP_GNOMEUI_H