]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Toolbars.h
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / Toolbars.h
index b4a9182e6465ce686812dd53df391324e90106f6..a4acb419cb2d3f4990826c6f8cfa0e54f18b99fa 100644 (file)
@@ -16,6 +16,8 @@
 #include "FuncRequest.h"
 
 #include <vector>
+#include <map>
+#include <memory>
 
 
 namespace lyx {
@@ -37,10 +39,14 @@ public:
                LAYOUTS,
                /// a special widget to insert tabulars
                TABLEINSERT,
-               ///
+               /// a button that expands a menu
                POPUPMENU,
+               /// a button that expands a menu but remembers the last choice
+               STICKYPOPUPMENU,
+               ///
+               ICONPALETTE,
                ///
-               ICONPALETTE
+               DYNAMICMENU
        };
 
        ToolbarItem(Type type,
@@ -51,12 +57,10 @@ public:
                 std::string const & name = std::string(),
                 docstring const & label = docstring());
 
-       ~ToolbarItem();
-
        /// item type
        Type type_;
        /// action
-       FuncRequest func_;
+       std::shared_ptr<FuncRequest> func_; // non-null
        /// label/tooltip
        docstring label_;
        /// name
@@ -67,20 +71,6 @@ public:
 ///
 class ToolbarInfo {
 public:
-       /// toolbar flags
-       enum Flags {
-               ON = 1, //< show
-               OFF = 2, //< do not show
-               MATH = 4, //< show when in math
-               TABLE = 8, //< show when in table
-               TOP = 16, //< show at top
-               BOTTOM = 32, //< show at bottom
-               LEFT = 64, //< show at left
-               RIGHT = 128, //< show at right
-               REVIEW = 256, //< show when change tracking is enabled
-               AUTO = 512,  //< only if AUTO is set, when MATH, TABLE and REVIEW is used
-               MATHMACROTEMPLATE = 1024 //< show in math macro template
-       };
        /// the toolbar items
        typedef std::vector<ToolbarItem> Items;
 
@@ -92,13 +82,9 @@ public:
        /// toolbar name
        std::string name;
        /// toolbar GUI name
-       std::string gui_name;
+       docstring gui_name;
        /// toolbar contents
        Items items;
-       /// flags
-       Flags flags;
-       /// store flags when coming to fullscreen mode
-       Flags before_fullscreen;
 
        /// read a toolbar from the file
        ToolbarInfo & read(Lexer &);
@@ -112,18 +98,41 @@ private:
 ///
 class Toolbars {
 public:
+       /// toolbar visibility flags
+       enum Visibility {
+               ON = 1, //< show
+               OFF = 2, //< do not show
+               TOP = 4, //< show at top
+               BOTTOM = 8, //< show at bottom
+               LEFT = 16, //< show at left
+               RIGHT = 32, //< show at right
+               AUTO = 64,  //< only if AUTO is set, when MATH, TABLE and REVIEW is used
+               MATH = 128, //< show when in math
+               TABLE = 256, //< show when in table
+               REVIEW = 512, //< show when change tracking is enabled
+               MATHMACROTEMPLATE = 1024, //< show in math macro template
+               SAMEROW = 2048, //< place to the current row, no new line
+               IPA = 4096, //< show when in IPA inset
+               MINIBUFFER = 8192, //< show when command-execute has been invoked
+               MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
+               ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
+       };
+
        typedef std::vector<ToolbarInfo> Infos;
 
-       Toolbars();
+       Toolbars() {}
+
+       ///
+       void reset();
 
        /// iterator for all toolbars
-       Infos::const_iterator begin() const { return usedtoolbars.begin(); }
+       Infos::const_iterator begin() const { return toolbar_info_.begin(); }
 
-       Infos::const_iterator end() const { return usedtoolbars.end(); }
+       Infos::const_iterator end() const { return toolbar_info_.end(); }
 
-       Infos::iterator begin() { return usedtoolbars.begin(); }
+       Infos::iterator begin() { return toolbar_info_.begin(); }
 
-       Infos::iterator end() { return usedtoolbars.end(); }
+       Infos::iterator end() { return toolbar_info_.end(); }
 
        /// read toolbars from the file
        void readToolbars(Lexer &);
@@ -132,20 +141,17 @@ public:
        void readToolbarSettings(Lexer &);
 
        ///
-       ToolbarInfo const * getDefinedToolbarInfo(std::string const & name) const;
+       ToolbarInfo const * info(std::string const & name) const;
        ///
-       ToolbarInfo * getUsedToolbarInfo(std::string const & name);
-
-       // FIXME should be deleted when every window has its own toolbar config.
-       /// number of toggleFullScreen calls, i.e. number of FullScreen windows.
-       int fullScreenWindows;
+       int defaultVisibility(std::string const & name) const;
+       ///
+       bool isMainToolbar(std::string const & name) const;
 
 private:
        /// all the defined toolbars
-       Infos toolbars;
-
-       /// toolbars listed
-       Infos usedtoolbars;
+       Infos toolbar_info_;
+       ///
+       std::map<std::string, int> toolbar_visibility_;
 };
 
 } // namespace frontend