]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.h
Point fix, earlier forgotten
[lyx.git] / src / ToolbarBackend.h
index 0819908ee2be04c23a0bddeedae78aa9286ba2b7..946cf0fb91c0bcddc5b204eb0250a66cb52a04fe 100644 (file)
@@ -4,9 +4,10 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author unknown
+ * \author Jean-Marc Lasgouttes
+ * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #ifndef TOOLBAR_BACKEND_H
@@ -23,13 +24,13 @@ class LyXLex;
 class ToolbarBackend {
 public:
        /// The special toolbar actions
-       enum  ItemType {
+       enum ItemType {
+               /// the command buffer
+               MINIBUFFER = -3,
                /// adds space between buttons in the toolbar
-               SEPARATOR = -3,
+               SEPARATOR = -2,
                /// a special combox insead of a button
-               LAYOUTS = -2,
-               /// begin a new line of button (not working)
-               NEWLINE = -1
+               LAYOUTS = -1,
        };
 
        /// action, tooltip
@@ -38,40 +39,64 @@ public:
        /// the toolbar items
        typedef std::vector<std::pair<int, string> > Items;
 
-       typedef Items::iterator iterator;
+       /// toolbar flags
+       enum Flags {
+               ON = 1, //< always shown
+               OFF = 2, //< never shown
+               MATH = 4, //< shown when in math
+               TABLE = 8, //< shown when in table
+               TOP = 16, //< show at top
+               BOTTOM = 32, //< show at bottom
+               LEFT = 64, //< show at left
+               RIGHT = 128 //< show at right
+       };
+
+       /// a toolbar
+       struct Toolbar {
+               /// toolbar UI name
+               string name;
+               /// toolbar contents
+               Items items;
+               /// flags
+               Flags flags;
+       };
+
+       typedef std::vector<Toolbar> Toolbars;
+
+       typedef Items::const_iterator item_iterator;
 
-       typedef Items::const_iterator const_iterator;
-       ///
        ToolbarBackend();
-       ///
-       iterator begin() {
-               return items.begin();
-       }
-       ///
-       const_iterator begin() const {
-               return items.begin();
-       }
-       ///
-       iterator end() {
-               return items.end();
+
+       /// iterator for all toolbars
+       Toolbars::const_iterator begin() const {
+               return usedtoolbars.begin();
        }
-       ///
-       const_iterator end() const {
-               return items.end();
+
+       Toolbars::const_iterator end() const {
+               return usedtoolbars.end();
        }
-       ///
+
+       /// read a toolbar from the file
        void read(LyXLex &);
 
+       /// read the used toolbars
+       void readToolbars(LyXLex &);
+
        /// return a full path of an XPM for the given action
        static string const getIcon(int action);
 
 private:
        /// add the given lfun with tooltip if relevant
-       void add(int, string const & tooltip = string());
+       void add(Toolbar & tb, int, string const & tooltip = string());
+
        /// add the given lfun with tooltip if relevant
-       void add(string const &, string const & tooltip);
-       /// all the items
-       Items items;
+       void add(Toolbar & tb, string const &, string const & tooltip);
+
+       /// all the toolbars
+       Toolbars toolbars;
+
+       /// toolbars listed
+       Toolbars usedtoolbars;
 };
 
 /// The global instance