]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Menubar_pimpl.h
John's KDE FormRef patch
[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 "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
30 #include "debug.h"
31
32 /** The LyX GUI independent menubar class
33   The GUI interface is implemented in the corresponding Menubar_pimpl class. 
34   */
35 struct Menubar::Pimpl {
36 public:
37         ///
38         Pimpl(LyXView *, MenuBackend const &);
39         ///
40         ~Pimpl();
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         /** Add to "menu" the list of last opened files
50             (add "extra_label" to the last entry)
51         */
52         void add_lastfiles(int menu, string const & extra_label);
53         /** Add to "menu" the list of opened documents
54             (add "extra_label" to the last entry)
55         */
56         void add_documents(int menu, string const & extra_label);
57         /// Add to "menu" the list of exportable/viewable formats
58         /// (add "extra_label" to the last entry)
59         void add_formats(int menu, string const & extra_label,
60                          kb_action action, bool viewable);
61         ///
62         void add_toc(int menu, string const & extra_label,
63                      std::vector<int> & smn, Window win);
64         ///
65         void add_references(int menu, string const & extra_label,
66                             std::vector<int> & smn, Window win);
67         ///
68         int create_submenu(Window win, LyXView * view,
69                            string const & menuname,
70                            std::vector<int> & smn);
71
72         /// update the state of the menuitems
73         void update() {}
74 private:
75         ///
76         FL_OBJECT * frame_;
77         /// 
78         LyXView * owner_;
79         ///
80         MenuBackend const * menubackend_;
81         ///
82         string current_menu;
83         ///
84         struct ItemInfo {
85                 ///
86                 ItemInfo(Menubar::Pimpl * p, MenuItem const * i, 
87                            FL_OBJECT * o) 
88                         : pimpl_(p), item_(i), obj_(o) {}
89                 ///
90                 Menubar::Pimpl * pimpl_;
91                 ///
92                 MenuItem const * item_;
93                 ///
94                 FL_OBJECT * obj_;
95         };
96
97         ///
98         typedef std::vector<ItemInfo *> ButtonList;
99         ///
100         ButtonList buttonlist_;
101 };
102 #endif