bakery  2.6
App_Gtk.h
Go to the documentation of this file.
1 /*
2  * Copyright 2000 Murray Cumming
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef BAKERY_APP_GTK_H
20 #define BAKERY_APP_GTK_H
21 
22 #include <bakeryconfig.h> // For BAKERY_MAEMO_ENABLED
23 #include <bakery/App/App.h>
24 
25 #ifdef BAKERY_MAEMO_ENABLED
26 #include <hildonmm/window.h>
27 #endif
28 
29 #include <gtkmm/menubar.h>
30 #include <gtkmm/menu.h>
31 #include <gtkmm/toolbar.h>
32 #include <gtkmm/handlebox.h>
33 #include <gtkmm/dialog.h>
34 #include <gtkmm/uimanager.h>
35 #include <libglademm.h>
36 
37 namespace Bakery
38 {
39 
46 class App_Gtk
47  : virtual public App, //virtual because App_WithDoc_Gtk will inherit it via App_Gtk and via App_With_Doc
48 #ifdef BAKERY_MAEMO_ENABLED
49  virtual public Hildon::Window //inherit virtually to share sigc::trackable.
50 #else
51  virtual public Gtk::Window //inherit virtually to share sigc::trackable.
52 #endif
53 {
54 public:
55 #ifdef BAKERY_MAEMO_ENABLED
56  typedef Hildon::Window ParentWindow;
57 #else
58  typedef Gtk::Window ParentWindow;
59 #endif
60  friend class AppInstanceManager;
61 
63  App_Gtk(const Glib::ustring& appname);
64 
66  App_Gtk(BaseObjectType* cobject, const Glib::ustring& appname);
67 
68  virtual ~App_Gtk();
69 
71  virtual void add(Gtk::Widget& child);
72 
74  static Glib::ustring util_bold_message(const Glib::ustring& message);
75 
76 protected:
77 
78  virtual void init(); //Override to show().
79  virtual void init_ui_manager(); //Override this to add more UI placeholders
80  virtual void init_menus(); //Override this to add more or different menus.
81  virtual void init_menus_file(); //Call this from init_menus() to add the standard file menu.
82  virtual void init_menus_edit(); //Call this from init_menus() to add the standard edit menu
83  virtual void init_menus_help(); //Call this from init_menus() to add the standard help menu.
84  virtual void init_toolbars();
85 
86  virtual void init_layout(); //Arranges the menu, toolbar, etc.
87 
88  virtual void add_ui_from_string(const Glib::ustring& ui_description); //Convenience function
89 
90  virtual void on_hide(); //override.
91 
92  //Signal handlers:
93 
94  //Menus:
95  virtual void on_menu_help_about();
96 
97  virtual void on_about_close();
98 
99 
100  virtual void ui_hide();
101  virtual void ui_bring_to_front();
102 
103  virtual bool on_delete_event(GdkEventAny* event); //override
104 
105  //virtual void destroy_and_remove_from_list();
106 
107  //Member data:
108 
109  //UIManager and Actions
110  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
111  Glib::RefPtr<Gtk::ActionGroup> m_refFileActionGroup;
112  Glib::RefPtr<Gtk::ActionGroup> m_refEditActionGroup;
113  Glib::RefPtr<Gtk::ActionGroup> m_refHelpActionGroup;
114 
115  //Member widgets:
116  Gtk::VBox* m_pVBox;
118 
119  //Gtk::MenuBar m_MenuBar;
120  //Gtk::Menu m_Menu_File, m_Menu_Edit, m_Menu_Help;
121 
122  Gtk::HandleBox m_HandleBox_Toolbar;
123  //Gtk::Toolbar m_Toolbar;
124 
125  //All instances share 1 About box:
126  static Gtk::Window* m_pAbout; //About box.
127 
128 
129  //typedef std::vector<poptOption> type_vecPoptOptions;
130  //type_vecPoptOptions m_vecPoptOptions;
131 };
132 
133 } //namespace
134 
135 #endif //BAKERY_APP_GTK_H