]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XFormsMenubar.h
04775b3ea0fb63ec045328ca8303e32391a46edd
[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 <boost/shared_ptr.hpp>
19
20 #include "forms_fwd.h"
21 #include <X11/X.h> // Window
22
23 #include "support/std_string.h"
24 #include <vector>
25
26
27 class LyXView;
28 class XFormsView;
29 class Menu;
30 class MenuItem;
31 class MenuBackend;
32
33 class XFormsMenubar : public Menubar {
34 public:
35         ///
36         typedef std::vector<FuncRequest> Funcs;
37         ///
38         XFormsMenubar(LyXView *, MenuBackend const &);
39         ///
40         ~XFormsMenubar();
41
42         /// update the state of the menuitems
43         void update();
44
45         /// Opens a top-level submenu given its name
46         void openByName(string const &);
47
48         ///
49         static void MenuCallback(FL_OBJECT *, long);
50
51 private:
52         ///
53         void add_toc(int menu, string const & extra_label,
54                      std::vector<int> & smn, Window win);
55         ///
56         void add_references(int menu, string const & extra_label,
57                             std::vector<int> & smn, Window win);
58         ///
59         int create_submenu(Window win, XFormsView * view,
60                            Menu const & menu,
61                            std::vector<int> & smn, Funcs & funcs);
62
63         //
64         void makeMenubar(Menu const & menu);
65
66         ///
67         XFormsView * owner_;
68         ///
69         MenuBackend const * menubackend_;
70         ///
71         struct ItemInfo {
72                 ///
73                 ItemInfo(XFormsMenubar * p, MenuItem const * i,
74                          FL_OBJECT * o);
75                 ~ItemInfo();
76                 ///
77                 XFormsMenubar * menubar_;
78                 ///
79                 boost::shared_ptr<MenuItem const> item_;
80                 ///
81                 FL_OBJECT * obj_;
82         };
83
84         ///
85         typedef std::vector<boost::shared_ptr<ItemInfo> > ButtonList;
86         ///
87         ButtonList buttonlist_;
88 };
89 #endif