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