1 /* This file is part of -*- C++ -*-
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright (C) 1995 Matthias Ettrich
7 * Copyright (C) 1995-1999 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
35 Lastfiles, // This is the list of last opened file,
36 // typically for the File menu.
37 Documents // This is the list of opened Documents,
38 // typically for the Documents menu.
40 // Create a copy of a given MenuItem
41 MenuItem(MenuItem const &);
42 // Create a Command type MenuItem
43 MenuItem(Kind kind_, string const & label_ = string(),
44 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_; }
69 typedef std::vector<MenuItem> ItemList;
71 typedef ItemList::const_iterator const_iterator;
73 explicit Menu(string const & name, bool mb = false)
74 : menubar_(mb), name_(name) {}
76 void add(MenuItem const &);
80 bool menubar() const { return menubar_; }
82 string const & name() const { return name_; }
84 bool empty() const { return items_.empty(); }
86 const_iterator begin() const {
87 return items_.begin();
90 const_iterator end() const {
108 typedef std::vector<Menu> MenuList;
110 typedef MenuList::const_iterator const_iterator;
113 /// Set default values for menu structure.
116 void add(Menu const &);
118 bool hasMenu (string const &) const;
120 Menu const & getMenu (string const &) const;
122 bool empty() const { return menulist_.empty(); }
124 const_iterator begin() const {
125 return menulist_.begin();
128 const_iterator end() const {
129 return menulist_.end();
136 extern MenuBackend menubackend;
138 #endif /* MENUBACKEND_H */