]> git.lyx.org Git - features.git/blob - src/frontends/xforms/Menubar_pimpl.h
2a54412bed37ec15453fd4fa70cf4ae845f1d44c
[features.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 "LString.h"
23 #include "frontends/Menubar.h"
24 #include "commandtags.h"
25 #include FORMS_H_LOCATION
26 class LyXView;
27 class MenuBackend;
28 class MenuItem;
29 class StrPool;
30
31 #include "debug.h"
32
33 /** The LyX GUI independent menubar class
34   The GUI interface is implemented in the corresponding Menubar_pimpl class. 
35   */
36 struct Menubar::Pimpl {
37 public:
38         ///
39         Pimpl(LyXView *, MenuBackend const &);
40         ///
41         ~Pimpl();
42         ///
43         void set(string const &);
44         /// Opens a top-level submenu given its name
45         void openByName(string const &);
46
47         ///
48         static void MenuCallback(FL_OBJECT *, long);
49
50         /** Add to "menu" the list of last opened files
51             (add "extra_label" to the last entry)
52         */
53         void add_lastfiles(int menu, string const & extra_label,
54                            std::vector<int> & smn, StrPool & strpool);
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                            std::vector<int> & smn, StrPool & strpool);
60         /// Add to "menu" the list of exportable/viewable formats
61         /// (add "extra_label" to the last entry)
62         void add_formats(int menu, string const & extra_label,
63                          std::vector<int> & smn, StrPool & strpool,
64                          kb_action action, bool viewable);
65         ///
66         int create_submenu(Window win, LyXView * view, 
67                            string const & menuname, 
68                            std::vector<int> & smn, StrPool & strpool);
69
70         /// update the state of the menuitems
71         void update() {}
72
73 private:
74         ///
75         FL_OBJECT * frame_;
76         /// 
77         LyXView * owner_;
78         ///
79         MenuBackend const * menubackend_;
80         ///
81         string current_menu;
82         ///
83         struct ItemInfo {
84                 ///
85                 ItemInfo(Menubar::Pimpl * p, MenuItem const * i, 
86                            FL_OBJECT * o) 
87                         : pimpl_(p), item_(i), obj_(o) {}
88                 ///
89                 Menubar::Pimpl * pimpl_;
90                 ///
91                 MenuItem const * item_;
92                 ///
93                 FL_OBJECT * obj_;
94         };
95
96         ///
97         typedef std::vector<ItemInfo *> ButtonList;
98         ///
99         ButtonList buttonlist_;
100 };
101 #endif