]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Menubar_pimpl.h
Fix xforms menus display problems
[lyx.git] / src / frontends / xforms / Menubar_pimpl.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2000 The LyX Team.
8  *
9  *           This file is Copyright 1996-2000
10  *           Lars Gullik Bjønnes
11  *
12  * ====================================================== */
13
14 #ifndef MENUBAR_PIMPL_H
15 #define MENUBAR_PIMPL_H
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include <vector>
22 #include <map>
23 #include "LString.h"
24 #include "frontends/Menubar.h"
25 #include "commandtags.h"
26 #include FORMS_H_LOCATION
27 class LyXView;
28 class MenuBackend;
29 class MenuItem;
30 class Menu;
31
32 #include "debug.h"
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         ~Pimpl();
43         ///
44         void set(string const &);
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         /** Add to "menu" the list of last opened files
52             (add "extra_label" to the last entry)
53         */
54         void add_lastfiles(int menu, string const & extra_label);
55         /** Add to "menu" the list of opened documents
56             (add "extra_label" to the last entry)
57         */
58         void add_documents(int menu, string const & extra_label);
59         /// Add to "menu" the list of exportable/viewable formats
60         /// (add "extra_label" to the last entry)
61         void add_formats(int menu, string const & extra_label,
62                          kb_action action, bool viewable);
63         ///
64         void add_toc(int menu, string const & extra_label,
65                      std::vector<int> & smn, Window win);
66         ///
67         void add_references(int menu, string const & extra_label,
68                             std::vector<int> & smn, Window win);
69         ///
70         int create_submenu(Window win, LyXView * view,
71                            string const & menuname,
72                            std::vector<int> & smn);
73
74         /// update the state of the menuitems
75         void update() {}
76 private:
77         //
78         void makeMenubar(Menu const &menu);
79
80         /// 
81         LyXView * owner_;
82         ///
83         MenuBackend const * menubackend_;
84         ///
85         struct ItemInfo {
86                 ///
87                 ItemInfo(Menubar::Pimpl * p, MenuItem const * i, 
88                            FL_OBJECT * o) 
89                         : pimpl_(p), item_(i), obj_(o) {}
90                 ///
91                 Menubar::Pimpl * pimpl_;
92                 ///
93                 MenuItem const * item_;
94                 ///
95                 FL_OBJECT * obj_;
96         };
97
98         ///
99         typedef std::vector<ItemInfo *> ButtonList;
100         ///
101         ButtonList buttonlist_;
102
103         ///
104         typedef std::map<string, FL_OBJECT *> MenubarMap;
105         ///
106         MenubarMap menubarmap_;
107         ///
108         string current_menu_name_;
109         ///
110         FL_OBJECT * current_group_;
111 };
112 #endif