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