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 00059 static Glib::ustring util_bold_message(const Glib::ustring& message); 00060 00061 protected: 00062 00063 virtual void init(); //Override to show(). 00064 virtual void init_ui_manager(); //Override this to add more UI placeholders 00065 virtual void init_menus(); //Override this to add more or different menus. 00066 virtual void init_menus_file(); //Call this from init_menus() to add the standard file menu. 00067 virtual void init_menus_edit(); //Call this from init_menus() to add the standard edit menu 00068 virtual void init_menus_help(); //Call this from init_menus() to add the standard help menu. 00069 virtual void init_toolbars(); 00070 00071 virtual void init_layout(); //Arranges the menu, toolbar, etc. 00072 00073 virtual void add_ui_from_string(const Glib::ustring& ui_description); //Convenience function 00074 00075 virtual void on_hide(); //override. 00076 00077 //Signal handlers: 00078 00079 //Menus: 00080 virtual void on_menu_help_about(); 00081 00082 virtual void on_about_close(); 00083 00084 00085 virtual void ui_hide(); 00086 virtual void ui_bring_to_front(); 00087 00088 virtual bool on_delete_event(GdkEventAny* event); //override 00089 00090 //virtual void destroy_and_remove_from_list(); 00091 00092 //Member data: 00093 00094 //UIManager and Actions 00095 Glib::RefPtr<Gtk::UIManager> m_refUIManager; 00096 Glib::RefPtr<Gtk::ActionGroup> m_refFileActionGroup; 00097 Glib::RefPtr<Gtk::ActionGroup> m_refEditActionGroup; 00098 Glib::RefPtr<Gtk::ActionGroup> m_refHelpActionGroup; 00099 00100 //Member widgets: 00101 Gtk::VBox* m_pVBox; 00102 Gtk::VBox m_VBox_PlaceHolder; 00103 00104 //Gtk::MenuBar m_MenuBar; 00105 //Gtk::Menu m_Menu_File, m_Menu_Edit, m_Menu_Help; 00106 00107 Gtk::HandleBox m_HandleBox_Toolbar; 00108 //Gtk::Toolbar m_Toolbar; 00109 00110 //All instances share 1 About box: 00111 static Gtk::Window* m_pAbout; //About box. 00112 00113 00114 //typedef std::vector<poptOption> type_vecPoptOptions; 00115 //type_vecPoptOptions m_vecPoptOptions; 00116 }; 00117 00118 } //namespace 00119 00120 #endif //BAKERY_APP_GTK_H