4 * Copyright 1995-2001 the LyX Team
5 * Read the file COPYING
7 * \author Matthias Ettrich
13 #include "ParagraphList.h"
14 #include "support/types.h"
17 * The cursor class describes the position of a cursor within a document.
18 * Several cursors exist within LyX; for example, when locking an inset,
19 * the position of the cursor in the containing inset is stored.
26 /// set the paragraph that contains this cursor
27 void par(ParagraphList::iterator pit);
28 /// return the paragraph this cursor is in
29 ParagraphList::iterator par() const;
30 /// set the position within the paragraph
31 void pos(lyx::pos_type p);
32 /// return the position within the paragraph
33 lyx::pos_type pos() const;
35 void boundary(bool b);
37 bool boundary() const;
38 /// set the x position in pixels
40 /// return the x position in pixels
42 /// set the stored next-line position when at the end of a row
45 * Return the x position of the start of the next row, when this
46 * cursor is at the end of the previous row, for insets that take
49 * FIXME: explain why we need this ?
52 /// set the cached x position
55 * Return the cached x position of the cursor. This is used for when
58 * blah blah blah blah| blah blah blah
60 * blah blah blah blah blah blah
62 * When we move onto row 3, we would like to be vertically aligned
63 * with where we were in row 1, despite the fact that row 2 is
67 /// set the y position in pixels
69 /// return the y position in pixels
71 /// set the stored next-line y position when at the end of a row
74 * Return the y position of the start of the next row, when this
75 * cursor is at the end of the previous row, for insets that take
78 * FIXME: explain why we need this ? especially for y...
82 /// The paragraph the cursor is in.
83 ParagraphList::iterator par_;
84 /// The position inside the paragraph
87 * When the cursor position is i, is the cursor is after the i-th char
88 * or before the i+1-th char ? Normally, these two interpretations are
89 * equivalent, except when the fonts of the i-th and i+1-th char
91 * We use boundary_ to distinguish between the two options:
92 * If boundary_=true, then the cursor is after the i-th char
93 * and if boundary_=false, then the cursor is before the i+1-th char.
95 * We currently use the boundary only when the language direction of
96 * the i-th char is different than the one of the i+1-th char.
97 * In this case it is important to distinguish between the two
98 * cursor interpretations, in order to give a reasonable behavior to
102 /// the pixel x position
104 /// the stored next-row x position
106 /// the cached x position
108 /// the pixel y position
110 /// the stored next-row y position
115 bool operator==(LyXCursor const & a, LyXCursor const & b);
117 bool operator!=(LyXCursor const & a, LyXCursor const & b);
119 #endif // LYXCURSOR_H