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