4 * Purpose: Declaration of interaction classes for mathed
5 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
6 * Created: January 1996
7 * Description: MathCursor control all user interaction
9 * Dependencies: Xlib, XForms
11 * Copyright: 1996, Alejandro Aguilar Sierra
13 * You are free to use and modify this code under the terms of
14 * the GNU General Public Licence version 2 or later.
24 #include "math_defs.h"
28 class MathScriptInset;
29 class InsetFormulaBase;
33 /// This is the external interface of Math's subkernel
37 explicit MathCursor(InsetFormulaBase *);
39 void insert(char, MathTextCodes t = LM_TC_MIN);
41 void insert(MathInset *);
47 bool Right(bool sel = false);
49 bool Left(bool sel = false);
51 bool Up(bool sel = false);
53 bool Down(bool sel = false);
54 /// Put the cursor in the first position
56 /// Put the cursor in the last position
62 /// This is in pixels from (maybe?) the top of inset
63 void SetPos(int, int);
65 void GetPos(int & x, int & y);
67 MathInset * par() const;
68 /// return the next enclosing par of the given type and the cursor's
70 MathInset * enclosing(MathInsetTypes, int &) const;
72 InsetFormulaBase const * formula();
76 void Interpret(string const &);
78 void SetSize(MathStyles);
81 /// Set accent: if argument = 0 it's considered consumed
82 void setAccent(int ac = 0);
83 /// Returns last accent
84 int getAccent() const;
89 void MacroModeClose();
91 bool InMacroMode() const;
93 // Local selection methods
95 bool Selection() const;
105 void SelHandle(bool);
111 void SelGetArea(int * xp, int * yp, int & n);
113 void clearLastCode();
115 void setLastCode(MathTextCodes t);
117 void toggleLastCode(MathTextCodes t);
119 MathTextCodes getLastCode() const;
121 int idx() const { return idx_; }
127 bool isInside(MathInset *) const;
129 MathTextCodes nextCode() const;
131 MathTextCodes prevCode() const;
133 void selArray(MathArray &) const;
151 InsetFormulaBase * const formula_;
153 void doAccent(char c, MathTextCodes t);
155 void doAccent(MathInset * p);
161 MathTextCodes lastcode;
164 MathArray & array() const;
166 MathXArray & xarray() const;
169 MathStyles style() const;
171 void normalize() const;
174 /// Description of a position
182 std::vector<MathIter> path_;
185 void push(MathInset * par, bool first);
191 MathInset * parInset(int i) const;
193 void seldump(char const * str) const;
195 void dump(char const * str) const;
203 bool nextIsInset() const;
205 bool nextIsActive() const;
207 bool prevIsInset() const;
209 bool prevIsActive() const;
213 bool IsScript() const;
215 void merge(MathArray const & arr);
217 MathInset * nextInset() const;
219 MathInset * nextActiveInset() const;
221 MathInset * prevInset() const;
223 MathInset * prevActiveInset() const;
225 MathScriptInset * prevScriptInset() const;
232 MathFuncInset * imacro;
235 extern MathCursor * mathcursor;