]> git.lyx.org Git - lyx.git/blob - src/textcursor.h
Qt compilation fixes.
[lyx.git] / src / textcursor.h
1 // -*- C++ -*-
2 /**
3  * \file textcursor.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author Lars Gullik Bjønnes
9  * \author John Levon
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef TEXTCURSOR_H
16 #define TEXTCURSOR_H
17
18 #include "lyxcursor.h"
19
20 class Buffer;
21
22 // Do not even think of forward declaring LyXText/BufferView etc here!
23 // If you need Paragraph proper, go to text_func.h
24
25 /** The cursor.
26         Later this variable has to be removed. There should be no internal
27         cursor in a text (and thus not in a buffer). By keeping this it is
28         (I think) impossible to have several views with the same buffer, but
29         the cursor placed at different places.
30         [later]
31         Since the LyXText now has been moved from Buffer to BufferView
32         it should not be absolutely needed to move the cursor...
33         [even later]
34         Nevertheless, it should still be moved, in order to keep classes
35         and interdependencies small.
36         */
37
38 // The structure that keeps track of the selections set.
39 struct Selection {
40         Selection()
41                 : set_(false), mark_(false)
42                 {}
43         bool set() const {
44                 return set_;
45         }
46         void set(bool s) {
47                 set_ = s;
48         }
49         bool mark() const {
50                 return mark_;
51         }
52         void mark(bool m) {
53                 mark_ = m;
54         }
55         LyXCursor cursor; // temporary cursor to hold a cursor position
56                                 // until setSelection is called!
57         LyXCursor start;  // start of a REAL selection
58         LyXCursor end;    // end of a REAL selection
59 private:
60         bool set_; // former selection
61         bool mark_; // former mark_set
62
63 };
64
65 struct TextCursor {
66         ///
67         void setSelection();
68         ///
69         void clearSelection();
70         ///
71         std::string const selectionAsString(Buffer const & buffer, bool label) const;
72
73         // actual cursor position
74         LyXCursor cursor;
75
76         Selection selection;
77         // this is used to handle XSelection events in the right manner
78         Selection xsel_cache;
79 };
80
81 #endif