1 /* This file is part of -*- C++ -*-
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2000 The LyX Team.
9 * This file is Copyright 1999
10 * Jean-Marc Lasgouttes
12 *======================================================*/
22 #include "support/lstrings.h"
30 /// The type of elements that can be in a menu
38 /** This is the list of last opened file,
39 typically for the File menu. */
41 /** This is the list of opened Documents,
42 typically for the Documents menu. */
44 /** This is a list of viewable formats
45 typically for the Documents menu. */
47 /** This is a list of updatable formats
48 typically for the Documents menu. */
50 /** This is a list of exportable formats
51 typically for the Documents menu. */
54 /// Create a Command type MenuItem
56 string const & label = string(),
57 string const & command = string(),
58 bool optional = false);
59 /// The label of a given menuitem
60 string label() const { return token(label_, '|', 0); }
62 string shortcut() const { return token(label_, '|', 1); }
64 Kind kind() const { return kind_; }
65 /// the action (if relevant)
66 int action() const { return action_; }
67 /// the description of the submenu (if relevant)
68 string const & submenu() const { return submenu_; }
69 /// returns true if the entry should be ommited when disabled
70 bool optional() const { return optional_; }
89 typedef std::vector<MenuItem> ItemList;
91 typedef ItemList::const_iterator const_iterator;
93 explicit Menu(string const & name, bool mb = false)
94 : menubar_(mb), name_(name) {}
96 Menu & add(MenuItem const &);
98 Menu & read(LyXLex &);
100 bool menubar() const { return menubar_; }
102 string const & name() const { return name_; }
104 bool empty() const { return items_.empty(); }
106 const_iterator begin() const {
107 return items_.begin();
110 const_iterator end() const {
127 typedef std::vector<Menu> MenuList;
129 typedef MenuList::const_iterator const_iterator;
132 /// Set default values for menu structure.
135 void add(Menu const &);
137 bool hasMenu (string const &) const;
139 Menu & getMenu (string const &);
141 Menu const & getMenu (string const &) const;
143 bool empty() const { return menulist_.empty(); }
145 const_iterator begin() const {
146 return menulist_.begin();
149 const_iterator end() const {
150 return menulist_.end();
158 extern MenuBackend menubackend;
160 #endif /* MENUBACKEND_H */