]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Menubar_pimpl.h
change some __GNUG_ to __GNUG__
[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 #include <vector>
16 #include <map>
17 #include <boost/smart_ptr.hpp>
18 #include FORMS_H_LOCATION
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include "LString.h"
25 #include "frontends/Menubar.h"
26 #include "commandtags.h"
27 #include "MenuBackend.h"
28
29 class LyXView;
30
31 /** The LyX GUI independent menubar class
32   The GUI interface is implemented in the corresponding Menubar_pimpl class.
33   */
34 struct Menubar::Pimpl {
35 public:
36         ///
37         Pimpl(LyXView *, MenuBackend const &);
38         ///
39         void set(string const &);
40         /// Opens a top-level submenu given its name
41         void openByName(string const &);
42
43         ///
44         static void MenuCallback(FL_OBJECT *, long);
45
46         ///
47         void add_toc(int menu, string const & extra_label,
48                      std::vector<int> & smn, Window win);
49         ///
50         void add_references(int menu, string const & extra_label,
51                             std::vector<int> & smn, Window win);
52         ///
53         int create_submenu(Window win, LyXView * view,
54                            string const & menuname,
55                            std::vector<int> & smn);
56
57         /// update the state of the menuitems
58         void update() {}
59 private:
60         //
61         void makeMenubar(Menu const &menu);
62
63         ///
64         LyXView * owner_;
65         ///
66         MenuBackend const * menubackend_;
67         ///
68         struct ItemInfo {
69                 ///
70                 ItemInfo(Menubar::Pimpl * p, MenuItem const * i,
71                          FL_OBJECT * o)
72
73                         : pimpl_(p), obj_(o) { item_.reset(i); }
74                 ///
75                 Menubar::Pimpl * pimpl_;
76                 ///
77                 boost::shared_ptr<MenuItem const> item_;
78                 ///
79                 FL_OBJECT * obj_;
80         };
81
82         ///
83         typedef std::vector<boost::shared_ptr<ItemInfo> > ButtonList;
84         ///
85         ButtonList buttonlist_;
86
87         ///
88         typedef std::map<string, FL_OBJECT *> MenubarMap;
89         ///
90         MenubarMap menubarmap_;
91         ///
92         string current_menu_name_;
93         ///
94         FL_OBJECT * current_group_;
95 };
96 #endif