]> git.lyx.org Git - lyx.git/blob - src/frontends/Selection.h
Prepare for external/internal clipboard merging.
[lyx.git] / src / frontends / Selection.h
1 // -*- C++ -*-
2 /**
3  * \file Selection.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 John Levon
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef BASE_SELECTION_H
15 #define BASE_SELECTION_H
16
17 #include "support/docstring.h"
18
19 namespace lyx {
20 namespace frontend {
21
22 /**
23  * A Selection class manages the selection.
24  */
25 class Selection
26 {
27 public:
28         virtual ~Selection() {}
29
30         /// Tell the window system whether we have a selection.
31         virtual void haveSelection(bool) = 0;
32         /**
33          * Get the X selection contents.
34          * This is a noop on systems that don't have a selection.
35          * The format is plain text.
36          * This should be called when the user presses the middle mouse
37          * button.
38          */
39         virtual docstring const get() const = 0;
40         /**
41          * Fill the X selection.
42          * Does nothing on systems that don't have a selection.
43          * This should be called whenever some text is highlighted.
44          */
45         virtual void put(docstring const &) = 0;
46
47         /// state of clipboard.
48         /// \retval true if the system clipboard has been set within LyX.
49         virtual bool isInternal() const = 0;
50 };
51
52 } // namespace frontend
53
54 /// Implementation is in Application.C
55 extern frontend::Selection & theSelection();
56
57 } // namespace lyx
58
59
60 #endif // BASE_SELECTION_H