4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
27 * This class is a container for LyX actions. It associates a name to
28 * most of them and describes some of their properties.
32 /// category of an action, used in the Shortcuts dialog
34 Hidden
, //< Not listed for configuration
35 Edit
, //< Cursor and mouse movement, copy/paste etc
37 Buffer
, //< Buffer and window related
38 Layout
, //< Font, Layout and textclass related
39 System
, //< Lyx preference, server etc
43 /// information for an action
47 /// the func_attrib values set
49 /// the category of this func
55 LyXAction(LyXAction
const &);
56 void operator=(LyXAction
const &);
58 /// type for map between a function name and its action
59 typedef std::map
<std::string
, FuncCode
> func_map
;
60 /// type for map between an action and its info
61 typedef std::map
<FuncCode
, FuncInfo
> info_map
;
63 /// possible "permissions" for an action
65 Noop
= 0, //< nothing special about this func
66 ReadOnly
= 1, //< can be used in RO mode (perhaps this should change); no automatic markDirty
67 NoBuffer
= 2, //< Can be used when there is no document open
68 Argument
= 4, //< Requires argument
69 NoUpdate
= 8, //< Does not (usually) require update
70 SingleParUpdate
= 16 //< Usually only requires this par updated
76 * Returns an pseudoaction from a string
77 * If you include arguments in func_name, a new pseudoaction
78 * will be created if needed.
80 FuncRequest
lookupFunc(std::string
const & func_name
) const;
82 /// Return the name (and argument) associated with the given (pseudo) action
83 std::string
const getActionName(FuncCode action
) const;
85 func_type
const getActionType(FuncCode action
) const;
87 /// True if the command has `flag' set
88 bool funcHasFlag(FuncCode action
, func_attrib flag
) const;
90 /// iterator across all real actions
91 typedef func_map::const_iterator const_func_iterator
;
93 /// return an iterator to the start of all real actions
94 const_func_iterator
func_begin() const;
96 /// return an iterator to the end of all real actions
97 const_func_iterator
func_end() const;
100 /// populate the action container with our actions
102 /// add the given action
103 void newFunc(FuncCode
, std::string
const & name
, unsigned int attrib
, func_type type
);
106 * This is a list of all the LyXFunc names with the
107 * coresponding action number. It is usually only used by the
108 * minibuffer or when assigning commands to keys during init.
110 func_map lyx_func_map
;
113 * This is a mapping from action number to an object holding
114 * info about this action. f.ex. command name (string),
115 * command attributes (ro)
117 info_map lyx_info_map
;
120 /// singleton instance
121 extern LyXAction lyxaction
;
126 #endif // LYXACTION_H