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/LAssert.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
46 MenuItem(Kind kind_, string const & label_ = string(),
47 string const & command_ = string());
48 /// The label of a given menuitem
49 string const & label() const { return label_; }
51 Kind kind() const { return kind_; }
52 /// the action (if relevant)
53 int action() const { return action_; }
54 /// the description of the submenu (if relevant)
55 string const & submenu() const { return submenu_; }
72 typedef std::vector<MenuItem> ItemList;
74 typedef ItemList::const_iterator const_iterator;
76 explicit Menu(string const & name, bool mb = false)
77 : menubar_(mb), name_(name) {}
79 Menu & add(MenuItem const &);
83 bool menubar() const { return menubar_; }
85 string const & name() const { return name_; }
87 bool empty() const { return items_.empty(); }
89 const_iterator begin() const {
90 return items_.begin();
93 const_iterator end() const {
111 typedef std::vector<Menu> MenuList;
113 typedef MenuList::const_iterator const_iterator;
116 /// Set default values for menu structure.
119 void add(Menu const &);
121 bool hasMenu (string const &) const;
123 Menu const & getMenu (string const &) const;
125 bool empty() const { return menulist_.empty(); }
127 const_iterator begin() const {
128 return menulist_.begin();
131 const_iterator end() const {
132 return menulist_.end();
140 extern MenuBackend menubackend;
142 #endif /* MENUBACKEND_H */