2003-08-19 13:00:56 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
|
|
|
|
* \file math_pos.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-10 10:09:00 +00:00
|
|
|
|
#ifndef MATH_POS_H
|
|
|
|
|
#define MATH_POS_H
|
|
|
|
|
|
2002-09-11 09:14:57 +00:00
|
|
|
|
|
2001-12-10 10:09:00 +00:00
|
|
|
|
#include <iosfwd>
|
2002-08-02 14:29:42 +00:00
|
|
|
|
#include "math_data.h"
|
2001-12-10 10:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
2002-03-21 17:42:56 +00:00
|
|
|
|
/// Description of a position
|
2003-06-16 11:49:38 +00:00
|
|
|
|
class CursorPos {
|
2001-12-10 10:09:00 +00:00
|
|
|
|
public:
|
2002-03-21 17:42:56 +00:00
|
|
|
|
///
|
2003-06-16 11:49:38 +00:00
|
|
|
|
CursorPos();
|
2002-03-21 17:42:56 +00:00
|
|
|
|
///
|
2003-06-16 11:49:38 +00:00
|
|
|
|
explicit CursorPos(MathInset *);
|
2001-12-10 10:09:00 +00:00
|
|
|
|
|
|
|
|
|
/// returns cell corresponding to this position
|
|
|
|
|
MathArray & cell() const;
|
|
|
|
|
/// returns cell corresponding to this position
|
|
|
|
|
MathArray & cell(MathArray::idx_type idx) const;
|
2002-07-26 13:13:20 +00:00
|
|
|
|
/// gets screen position of the thing
|
|
|
|
|
void getPos(int & x, int & y) const;
|
2002-10-15 16:17:40 +00:00
|
|
|
|
/// set position
|
|
|
|
|
void setPos(MathArray::pos_type pos);
|
2001-12-10 10:09:00 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/// pointer to an inset
|
2003-06-16 11:49:38 +00:00
|
|
|
|
MathInset * inset_;
|
2001-12-10 10:09:00 +00:00
|
|
|
|
/// cell index of a position in this inset
|
|
|
|
|
MathArray::idx_type idx_;
|
|
|
|
|
/// position in this cell
|
|
|
|
|
MathArray::pos_type pos_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// test for equality
|
2003-06-16 11:49:38 +00:00
|
|
|
|
bool operator==(CursorPos const &, CursorPos const &);
|
2001-12-10 10:09:00 +00:00
|
|
|
|
/// test for inequality
|
2003-06-16 11:49:38 +00:00
|
|
|
|
bool operator!=(CursorPos const &, CursorPos const &);
|
2001-12-10 10:09:00 +00:00
|
|
|
|
/// test for order
|
2003-06-16 11:49:38 +00:00
|
|
|
|
bool operator<(CursorPos const &, CursorPos const &);
|
2001-12-10 10:09:00 +00:00
|
|
|
|
/// output
|
2003-06-16 11:49:38 +00:00
|
|
|
|
std::ostream & operator<<(std::ostream &, CursorPos const &);
|
2001-12-10 10:09:00 +00:00
|
|
|
|
|
|
|
|
|
#endif
|