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_GTK_H 00020 #define BAKERY_APP_GTK_H 00021 00022 #include <bakery/App/App.h> 00023 #include <gtkmm/menubar.h> 00024 #include <gtkmm/menu.h> 00025 #include <gtkmm/toolbar.h> 00026 #include <gtkmm/handlebox.h> 00027 #include <gtkmm/dialog.h> 00028 #include <gtkmm/uimanager.h> 00029 #include <libglademm.h> 00030 00031 namespace Bakery 00032 { 00033 00040 class App_Gtk 00041 : virtual public App, //virtual because App_WithDoc_Gtk will inherit it via App_Gtk and via App_With_Doc 00042 virtual public Gtk::Window //inherit virtually to share sigc::trackable. 00043 { 00044 public: 00045 friend class AppInstanceManager; 00046 00048 App_Gtk(const Glib::ustring& appname); 00049 00051 App_Gtk(BaseObjectType* cobject, const Glib::ustring& appname); 00052 00053 virtual ~App_Gtk(); 00054 00056 virtual void add(Gtk::Widget& child); 00057 00058 protected: 00059 00060 virtual void init(); //Override to show(). 00061 virtual void init_ui_manager(); //Override this to add more UI placeholders 00062 virtual void init_menus(); //Override this to add more or different menus. 00063 virtual void init_menus_file(); //Call this from init_menus() to add the standard file menu. 00064 virtual void init_menus_edit(); //Call this from init_menus() to add the standard edit menu 00065 virtual void init_menus_help(); //Call this from init_menus() to add the standard help menu. 00066 virtual void init_toolbars(); 00067 00068 virtual void init_layout(); //Arranges the menu, toolbar, etc. 00069 00070 virtual void add_ui_from_string(const Glib::ustring& ui_description); //Convenience function 00071 00072 virtual void on_hide(); //override. 00073 00074 //Signal handlers: 00075 00076 //Menus: 00077 virtual void on_menu_help_about(); 00078 00079 virtual void on_about_close(); 00080 00081 00082 virtual void ui_hide(); 00083 virtual void ui_bring_to_front(); 00084 00085 virtual bool on_delete_event(GdkEventAny* event); //override 00086 00087 //virtual void destroy_and_remove_from_list(); 00088 00089 //Member data: 00090 00091 //UIManager and Actions 00092 Glib::RefPtr<Gtk::UIManager> m_refUIManager; 00093 Glib::RefPtr<Gtk::ActionGroup> m_refFileActionGroup; 00094 Glib::RefPtr<Gtk::ActionGroup> m_refEditActionGroup; 00095 Glib::RefPtr<Gtk::ActionGroup> m_refHelpActionGroup; 00096 00097 //Member widgets: 00098 Gtk::VBox* m_pVBox; 00099 Gtk::VBox m_VBox_PlaceHolder; 00100 00101 //Gtk::MenuBar m_MenuBar; 00102 //Gtk::Menu m_Menu_File, m_Menu_Edit, m_Menu_Help; 00103 00104 Gtk::HandleBox m_HandleBox_Toolbar; 00105 //Gtk::Toolbar m_Toolbar; 00106 00107 //All instances share 1 About box: 00108 static Gtk::Window* m_pAbout; //About box. 00109 00110 00111 //typedef std::vector<poptOption> type_vecPoptOptions; 00112 //type_vecPoptOptions m_vecPoptOptions; 00113 }; 00114 00115 } //namespace 00116 00117 #endif //BAKERY_APP_GTK_H