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 00029 00030 namespace Bakery 00031 { 00032 00039 class App_Gtk 00040 : virtual public App, //virtual because App_WithDoc_Gtk will inherit it via App_Gtk and via App_With_Doc 00041 virtual public Gtk::Window //inherit virtually to share SigC::Object. 00042 { 00043 public: 00044 friend class AppInstanceManager; 00045 00047 App_Gtk(const Glib::ustring& appname); 00048 virtual ~App_Gtk(); 00049 00051 virtual void add(Gtk::Widget& child); 00052 00053 protected: 00054 00055 virtual void init(); //Override to show(). 00056 virtual void init_menus(); //Override this to add more menu or different menus. 00057 virtual void init_menus_file(); //Call this from init_menus() to add the standard file menu. 00058 virtual void init_menus_edit(); //Call this from init_menus() to add the standard edit menu 00059 virtual void init_menus_help(); //Call this from init_menus() to add the standard help menu. 00060 virtual void init_toolbars(); 00061 00062 virtual void init_layout(); //Arranges the menu, toolbar, etc. 00063 00064 virtual void on_hide(); //override. 00065 00066 //Signal handlers: 00067 00068 //Menus: 00069 00070 virtual void on_menu_help_about(); 00071 00072 00073 virtual void on_about_close(); 00074 00075 00076 00077 00078 00079 virtual void ui_hide(); 00080 virtual void ui_bring_to_front(); 00081 00082 virtual bool on_delete_event(GdkEventAny *event); //override 00083 00084 //virtual void destroy_and_remove_from_list(); 00085 00086 //Member data: 00087 00088 //Menus, toolbars: 00089 00090 typedef Gtk::Toolbar_Helpers::Element type_toolbar_items; 00091 typedef std::vector<type_toolbar_items> type_vecToolbarItems; 00092 type_vecToolbarItems m_toolbar_UI_Infos; //Filled by init_toolbars; 00093 00094 //Member widgets: 00095 Gtk::VBox m_VBox; 00096 Gtk::VBox m_VBox_PlaceHolder; 00097 00098 Gtk::MenuBar m_MenuBar; 00099 Gtk::Menu m_Menu_File, m_Menu_Edit, m_Menu_Help; 00100 00101 Gtk::HandleBox m_HandleBox_Toolbar; 00102 Gtk::Toolbar m_Toolbar; 00103 00104 //All instances share 1 About box: 00105 static Gtk::Window* m_pAbout; //About box. 00106 00107 00108 //typedef std::vector<poptOption> type_vecPoptOptions; 00109 //type_vecPoptOptions m_vecPoptOptions; 00110 }; 00111 00112 } //namespace 00113 00114 #endif //BAKERY_APP_GTK_H