2003-09-17 16:44:51 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
|
|
|
|
* \file cursor.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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef CURSOR_H
|
|
|
|
|
#define CURSOR_H
|
|
|
|
|
|
|
|
|
|
#include "ParagraphList_fwd.h"
|
|
|
|
|
#include "textcursor.h"
|
|
|
|
|
|
|
|
|
|
#include "support/types.h"
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2003-09-18 11:21:53 +00:00
|
|
|
|
class BufferView;
|
|
|
|
|
class DispatchResult;
|
|
|
|
|
class FuncRequest;
|
2003-09-17 16:44:51 +00:00
|
|
|
|
class LyXText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The cursor class describes the position of a cursor within a document.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class CursorItem : public TextCursor {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
CursorItem() : text_(0) {}
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
LyXText * text_;
|
|
|
|
|
///
|
|
|
|
|
ParagraphList::iterator pit_;
|
|
|
|
|
///
|
|
|
|
|
int pos_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Cursor {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
Cursor() {}
|
|
|
|
|
///
|
2003-09-18 11:21:53 +00:00
|
|
|
|
DispatchResult dispatch(FuncRequest const & cmd);
|
2003-09-17 16:44:51 +00:00
|
|
|
|
public:
|
|
|
|
|
/// mainly used as stack, bnut wee need random access
|
|
|
|
|
std::vector<CursorItem> data_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// build cursor from current cursor in view
|
|
|
|
|
void buildCursor(Cursor & cursor, BufferView & bv);
|
|
|
|
|
|
|
|
|
|
/// build cursor from (x,y) coordinates
|
|
|
|
|
void buildCursor(Cursor & cursor, BufferView & bv, int x, int y);
|
|
|
|
|
|
|
|
|
|
#endif // LYXCURSOR_H
|