]> git.lyx.org Git - features.git/blob - src/frontends/xforms/Menubar_pimpl.h
f284f437786993ef4ecccfe0fc54e1bd2ce4159a
[features.git] / src / frontends / xforms / Menubar_pimpl.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2000 The LyX Team.
8  *
9  *           This file is Copyright 1996-2000
10  *           Lars Gullik Bjønnes
11  *
12  * ====================================================== */
13
14 #ifndef MENUBAR_PIMPL_H
15 #define MENUBAR_PIMPL_H
16
17 #include <vector>
18 #include <map>
19 #include <boost/smart_ptr.hpp>
20 #include FORMS_H_LOCATION
21
22 #ifdef __GNUG__
23 #pragma interface
24 #endif
25
26 #include "LString.h"
27 #include "frontends/Menubar.h"
28 #include "commandtags.h"
29
30 class LyXView;
31 class MenuBackend;
32 class MenuItem;
33 class Menu;
34
35 /** The LyX GUI independent menubar class
36   The GUI interface is implemented in the corresponding Menubar_pimpl class. 
37   */
38 struct Menubar::Pimpl {
39 public:
40         ///
41         Pimpl(LyXView *, MenuBackend const &);
42         ///
43         void set(string const &);
44         /// Opens a top-level submenu given its name
45         void openByName(string const &);
46
47         ///
48         static void MenuCallback(FL_OBJECT *, long);
49
50         ///
51         void add_toc(int menu, string const & extra_label,
52                      std::vector<int> & smn, Window win);
53         ///
54         void add_references(int menu, string const & extra_label,
55                             std::vector<int> & smn, Window win);
56         ///
57         int create_submenu(Window win, LyXView * view,
58                            string const & menuname,
59                            std::vector<int> & smn);
60
61         /// update the state of the menuitems
62         void update() {}
63 private:
64         //
65         void makeMenubar(Menu const &menu);
66
67         /// 
68         LyXView * owner_;
69         ///
70         MenuBackend const * menubackend_;
71         ///
72         struct ItemInfo {
73                 ///
74                 ItemInfo(Menubar::Pimpl * p, MenuItem const * i, 
75                          FL_OBJECT * o)
76                 
77                         : pimpl_(p), obj_(o) { item_.reset(i); }
78                 ///
79                 Menubar::Pimpl * pimpl_;
80                 ///
81                 boost::shared_ptr<MenuItem const> item_;
82                 ///
83                 FL_OBJECT * obj_;
84         };
85
86         ///
87         typedef std::vector<boost::shared_ptr<ItemInfo> > ButtonList;
88         ///
89         ButtonList buttonlist_;
90
91         ///
92         typedef std::map<string, FL_OBJECT *> MenubarMap;
93         ///
94         MenubarMap menubarmap_;
95         ///
96         string current_menu_name_;
97         ///
98         FL_OBJECT * current_group_;
99 };
100 #endif