]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/mainapp.C
major GUII cleanup + Baruchs patch + Angus's patch + removed a couple of generated...
[lyx.git] / src / frontends / gnome / mainapp.C
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 2000 The LyX Team.
8  *
9  * ====================================================== */
10
11 #include <config.h>
12 #include <gnome--/main.h>
13 #include <gtk--/accelgroup.h>
14 #include <vector>
15 #include <algorithm>
16
17 #include "mainapp.h"
18
19 using SigC::bind;
20 using SigC::slot;
21
22 GLyxAppWin::GLyxAppWin() :
23   Gnome::App("GnomeLyX","LyX Gnomified"),
24          status_(false, true, GNOME_PREFERENCES_NEVER)
25 {
26   init();
27   show_all();
28 }
29
30 GLyxAppWin::~GLyxAppWin()
31 {
32 }
33
34 void GLyxAppWin::init()
35 {
36   // set defaults
37   set_policy(false, true, false);
38   set_default_size(250, 350);
39   set_wmclass("lyx", "GnomeLyX");
40
41   frame_.set_shadow_type(GTK_SHADOW_IN);
42
43   set_contents(frame_);
44
45   set_statusbar(status_);
46
47   // initial (dummy) menu
48   vector<Gnome::UI::Info> menus, fm;
49   fm.push_back(Gnome::MenuItems::Open());
50   menus.push_back(Gnome::Menus::File(fm));
51
52   Gnome::UI::Array menu = menus;
53   gnome_app_create_menus(this->gtkobj(),
54                          menu.gtkobj());
55
56   menusize_ = menu.size();
57 }
58
59
60 void GLyxAppWin::set_menu(Gnome::UI::Array &menu)
61 {
62   // clean up and install new menus
63   gnome_app_remove_menus(this->gtkobj(),"/",menusize_);
64   gnome_app_insert_menus(this->gtkobj(), "", menu.gtkobj());
65   gnome_app_install_menu_hints(this->gtkobj(), menu.gtkobj());
66   menusize_ = menu.size();
67 }
68
69