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. */
48 /** This is a list of viewable formats
49 typically for the Documents menu. */
51 /** This is a list of updatable formats
52 typically for the Documents menu. */
54 /** This is a list of exportable formats
55 typically for the Documents menu. */
58 /// Create a Command type MenuItem
60 string const & label = string(),
61 string const & command = string(),
62 bool optional = false);
63 /// The label of a given menuitem
64 string label() const { return token(label_, '|', 0); }
66 string shortcut() const { return token(label_, '|', 1); }
68 Kind kind() const { return kind_; }
69 /// the action (if relevant)
70 int action() const { return action_; }
71 /// the description of the submenu (if relevant)
72 string const & submenu() const { return submenu_; }
73 /// returns true if the entry should be ommited when disabled
74 bool optional() const { return optional_; }
93 typedef std::vector<MenuItem> ItemList;
95 typedef ItemList::const_iterator const_iterator;
97 explicit Menu(string const & name, bool mb = false)
98 : menubar_(mb), name_(name) {}
100 Menu & add(MenuItem const &);
102 Menu & read(LyXLex &);
104 bool menubar() const { return menubar_; }
106 string const & name() const { return name_; }
108 bool empty() const { return items_.empty(); }
110 ItemList::size_type size() const { return items_.size(); }
112 const_iterator begin() const {
113 return items_.begin();
116 const_iterator end() const {
133 typedef std::vector<Menu> MenuList;
135 typedef MenuList::const_iterator const_iterator;
138 /// Set default values for menu structure.
141 void add(Menu const &);
143 bool hasMenu (string const &) const;
145 Menu & getMenu (string const &);
147 Menu const & getMenu (string const &) const;
149 bool empty() const { return menulist_.empty(); }
151 const_iterator begin() const {
152 return menulist_.begin();
155 const_iterator end() const {
156 return menulist_.end();
164 extern MenuBackend menubackend;
166 #endif /* MENUBACKEND_H */