]> git.lyx.org Git - lyx.git/blob - src/lyxcursor.h
fix typo that put too many include paths for most people
[lyx.git] / src / lyxcursor.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef LYXCURSOR_H
13 #define LYXCURSOR_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "support/types.h"
20
21 class Paragraph;
22 class Row;
23
24 /** All these variables should be explained. Matthias?
25  */
26 class LyXCursor {
27 public:
28         ///
29         LyXCursor();
30         ///
31         void par(Paragraph * p);
32         ///
33         Paragraph * par() const;
34         ///
35         void pos(lyx::pos_type p);
36         ///
37         lyx::pos_type pos() const;
38         ///
39         void boundary(bool b);
40         ///
41         bool boundary() const;
42         ///
43         void x(int i);
44         ///
45         int x() const;
46         ///
47         void x_fix(int i);
48         ///
49         int x_fix() const;
50         ///
51         void y(int i);
52         ///
53         int y() const;
54         ///
55         void row(Row * r);
56         ///
57         Row * row() const;
58 private:
59         /// The paragraph the cursor is in.
60         Paragraph * par_;
61         /// The position inside the paragraph
62         lyx::pos_type pos_;
63         ///
64         bool boundary_;
65         ///
66         int x_;
67         ///
68         int x_fix_;
69         ///
70         int y_;
71         ///
72         Row * row_;
73 };
74
75 ///
76 inline
77 bool operator==(LyXCursor const & a, LyXCursor const & b)
78 {
79         return (a.par() == b.par())
80                 && (a.pos() == b.pos())
81                 && a.boundary() == b.boundary();
82 }
83
84 ///
85 inline
86 bool operator!=(LyXCursor const & a, LyXCursor const & b)
87 {
88         return !(a == b);
89 }
90
91 ///
92 inline
93 bool operator<(LyXCursor const & a, LyXCursor const & b)
94 {
95         // Can this be done in a nother way?
96         return (a.y() < b.y() && a.pos() < b.pos());
97 }
98
99 ///
100 inline
101 bool operator>(LyXCursor const & a, LyXCursor const & b)
102 {
103         return b < a;
104 }
105
106 ///
107 inline
108 bool operator>=(LyXCursor const & a, LyXCursor const & b)
109 {
110         return !(a < b);
111 }
112
113
114 ///
115 inline
116 bool operator<=(LyXCursor const & a, LyXCursor const & b)
117 {
118         return !(a > b);
119 }
120
121 #endif