]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.h
Fix breakage caused by bad commits.
[lyx.git] / src / ToolbarBackend.h
index 952d2649cf5942410bab910910620451734a623f..8169ea910a9f60d4541cf84c06f1f8a14a025791 100644 (file)
@@ -4,56 +4,64 @@
  * 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
 #define TOOLBAR_BACKEND_H
 
+#include "funcrequest.h"
+
 #include <vector>
-#include <algorithm>
 
-#include "LString.h"
 
 class LyXLex;
 
+
 ///
 class ToolbarBackend {
 public:
        /// The special toolbar actions
        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
-       typedef std::pair<int, string> Item;
+       typedef std::pair<FuncRequest, std::string> Item;
 
        /// the toolbar items
-       typedef std::vector<std::pair<int, string> > Items;
-
-       /// possibly display types
-       enum DisplayType {
-               OFF, //< never shown
-               ON, //< always shown
-               MATH, //< shown when in math
-               TABLE //< shown when in table
+       typedef std::vector<Item> Items;
+
+       /// 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 name
+               std::string name;
+               /// toolbar GUI name
+               std::string gui_name;
                /// toolbar contents
                Items items;
-               /// display type
-               DisplayType display_type;
+               /// flags
+               Flags flags;
        };
 
        typedef std::vector<Toolbar> Toolbars;
@@ -64,28 +72,32 @@ public:
 
        /// iterator for all toolbars
        Toolbars::const_iterator begin() const {
-               return toolbars.begin();
+               return usedtoolbars.begin();
        }
 
        Toolbars::const_iterator end() const {
-               return toolbars.end();
+               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);
+       static std::string const getIcon(FuncRequest const &);
 
 private:
        /// add the given lfun with tooltip if relevant
-       void add(Toolbar & tb, int, string const & tooltip = string());
-
-       /// add the given lfun with tooltip if relevant
-       void add(Toolbar & tb, string const &, string const & tooltip);
+       void add(Toolbar & tb, FuncRequest const &,
+                std::string const & tooltip = std::string());
 
        /// all the toolbars
        Toolbars toolbars;
+
+       /// toolbars listed
+       Toolbars usedtoolbars;
 };
 
 /// The global instance