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. */
45 /// Create a Command type MenuItem
47 string const & label = string(),
48 string const & command = string(),
49 bool optional = false);
50 /// The label of a given menuitem
51 string label() const { return token(label_, '|', 0); }
53 string shortcut() const { return token(label_, '|', 1); }
55 Kind kind() const { return kind_; }
56 /// the action (if relevant)
57 int action() const { return action_; }
58 /// the description of the submenu (if relevant)
59 string const & submenu() const { return submenu_; }
60 /// returns true if the entry should be ommited when disabled
61 bool optional() const { return optional_; }
80 typedef std::vector<MenuItem> ItemList;
82 typedef ItemList::const_iterator const_iterator;
84 explicit Menu(string const & name, bool mb = false)
85 : menubar_(mb), name_(name) {}
87 Menu & add(MenuItem const &);
89 Menu & read(LyXLex &);
91 bool menubar() const { return menubar_; }
93 string const & name() const { return name_; }
95 bool empty() const { return items_.empty(); }
97 const_iterator begin() const {
98 return items_.begin();
101 const_iterator end() const {
119 typedef std::vector<Menu> MenuList;
121 typedef MenuList::const_iterator const_iterator;
124 /// Set default values for menu structure.
127 void add(Menu const &);
129 bool hasMenu (string const &) const;
131 Menu & getMenu (string const &);
133 Menu const & getMenu (string const &) const;
135 bool empty() const { return menulist_.empty(); }
137 const_iterator begin() const {
138 return menulist_.begin();
141 const_iterator end() const {
142 return menulist_.end();
150 extern MenuBackend menubackend;
152 #endif /* MENUBACKEND_H */