]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XFormsMenubar.h
merge booktabs branch
[lyx.git] / src / frontends / xforms / XFormsMenubar.h
1 // -*- C++ -*-
2 /**
3  * \file XFormsMenubar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef XFORMSMENUBAR_H
13 #define XFORMSMENUBAR_H
14
15 #include "funcrequest.h"
16 #include "frontends/Menubar.h"
17
18 #include "LayoutEngine.h"
19
20 #include <boost/shared_ptr.hpp>
21
22 #include "forms_fwd.h"
23 #include <X11/X.h> // Window
24
25 #include <vector>
26
27 class LyXView;
28 class Menu;
29 class MenuItem;
30 class MenuBackend;
31
32 namespace lyx {
33 namespace frontend {
34
35 class XFormsView;
36
37 class XFormsMenubar : public Menubar {
38 public:
39         ///
40         typedef std::vector<FuncRequest> Funcs;
41         ///
42         XFormsMenubar(LyXView *, MenuBackend const &);
43         ///
44         ~XFormsMenubar();
45
46         /// update the state of the menuitems
47         void update();
48
49         /// Opens a top-level submenu given its name
50         void openByName(std::string const &);
51
52         ///
53         static void MenuCallback(FL_OBJECT *, long);
54
55 private:
56         ///
57         void add_toc(int menu, std::string const & extra_label,
58                      std::vector<int> & smn, Window win);
59         ///
60         void add_references(int menu, std::string const & extra_label,
61                             std::vector<int> & smn, Window win);
62         ///
63         int create_submenu(Window win, XFormsView * view,
64                            Menu const & menu,
65                            std::vector<int> & smn, Funcs & funcs);
66
67         //
68         void makeMenubar(Menu const & menu);
69
70         ///
71         XFormsView * owner_;
72         ///
73         MenuBackend const * menubackend_;
74         ///
75         boost::shared_ptr<Box> menubar_;
76         ///
77         WidgetMap widgets_;
78         ///
79         struct ItemInfo {
80                 ///
81                 ItemInfo(XFormsMenubar * p, MenuItem const * i,
82                          FL_OBJECT * o);
83                 ~ItemInfo();
84                 ///
85                 XFormsMenubar * menubar_;
86                 ///
87                 boost::shared_ptr<MenuItem const> item_;
88                 ///
89                 FL_OBJECT * obj_;
90         };
91
92         ///
93         typedef std::vector<boost::shared_ptr<ItemInfo> > ButtonList;
94         ///
95         ButtonList buttonlist_;
96 };
97
98 } // namespace frontend
99 } // namespace lyx
100
101 #endif