// -*- C++ -*-
/* This file is part of
- * ======================================================
+ * ======================================================
*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
*
- *======================================================*/
+ * ====================================================== */
#ifndef LYXCURSOR_H
#define LYXCURSOR_H
struct Row;
-/** All these variavles should be explained. Matthias?
+/** All these variables should be explained. Matthias?
*/
-struct LyXCursor {
+class LyXCursor {
+public:
///
- LyXParagraph * par;
-#ifdef NEW_TEXT
+ void par(LyXParagraph * p);
///
- LyXParagraph::size_type pos;
-#else
+ LyXParagraph * par();
///
- int pos;
-#endif
+ LyXParagraph * par() const;
+ ///
+ void pos(LyXParagraph::size_type p);
+ ///
+ LyXParagraph::size_type pos() const;
+ ///
+ void boundary(bool b);
+ ///
+ bool boundary() const;
+ ///
+ void x(int i);
+ ///
+ int x() const;
+ ///
+ void x_fix(int i);
+ ///
+ int x_fix() const;
+ ///
+ void y(unsigned long i);
///
- int x;
+ unsigned long y() const;
///
- int x_fix;
+ void row(Row * r);
///
- long y;
+ Row * row();
///
- Row * row;
+ Row * row() const;
+private:
+ /// The paragraph the cursor is in.
+ LyXParagraph * par_;
+ /// The position inside the paragraph
+ LyXParagraph::size_type pos_;
+ ///
+ bool boundary_;
+ ///
+ int x_;
+ ///
+ int x_fix_;
+ ///
+ unsigned long y_;
+ ///
+ Row * row_;
};
+
+///
+inline
+bool operator==(LyXCursor const & a, LyXCursor const & b)
+{
+ return (a.par() == b.par())
+ && (a.pos() == b.pos())
+ && a.boundary() == b.boundary();
+}
+
+
+///
+inline
+bool operator!=(LyXCursor const & a, LyXCursor const & b)
+{
+ return !(a == b);
+}
+
#endif