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