This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / LyXAction.h
blob2c1bda9e2b685d402c450ecf47c69e0709913f96
1 // -*- C++ -*-
2 #ifndef _LYXACTION_H_
3 #define _LYXACTION_H_
5 #ifdef __GNUG__
6 #pragma interface
7 #endif
9 #include "commandtags.h"
11 class LString;
13 /// Command name - action
14 struct kb_func_table {
15 ///
16 char const *name;
17 ///
18 kb_action action;
22 /** This class encapsulates LyX action and user command operations.
24 class LyXAction {
25 public:
26 ///
27 LyXAction();
28 ///
29 ~LyXAction();
31 /** Returns an action tag from a string. Returns kb_action.
32 Include arguments in func_name ONLY if you
33 want to create new pseudo actions. */
34 int LookupFunc(char const *func_name);
36 /** Returns an action tag which name is the most similar to a string.
37 Don't include arguments, they would be ignored. */
38 int getApproxFunc(char const *func);
40 /** Returns an action name the most similar to a string.
41 Don't include arguments, they would be ignored. */
42 const char *getApproxFuncName(char const *func);
44 /// Returns a pseudo-action given an action and its argument.
45 int getPseudoAction(kb_action action, char const *arg);
47 /// Retrieves the real action and its argument.
48 int retrieveActionArg(int i, char const **arg);
50 /// Search for an existent pseudoaction, return -1 if it doesn't exist.
51 int searchActionArg(kb_action action, char const *arg);
53 /// Check if a value is a pseudo-action.
54 bool isPseudoAction(int);
56 /// Not sure if this function should be here
57 int bindKey(char const* seq, int action);
59 /// Return the name associated with command
60 char const *getActionName(int action) const;
62 /// Return one line help text associated with command
63 char const *helpText(kb_action action) const;
65 /// True if the command is Read Only (not allowed for RO buffers)
66 bool isFuncRO(kb_action action) const;
68 private:
70 /// Standard commands
71 static kb_func_table const * lyx_func_table;
72 /// Number of commands
73 int funcCount;
74 /// Pseudoactions
75 static kb_func_table *lyx_func_args;
76 /// Pseudoaction index
77 static int psd_idx;
78 /// Last action index found
79 int last_action_idx;
83 /* -------------------- Inlines ------------------ */
86 inline
87 bool LyXAction::isPseudoAction(int a)
89 return (a >= (int)LFUN_LASTACTION);
93 #endif