]> git.lyx.org Git - lyx.git/blob - src/frontends/Selection.h
Fix documentation of Selection::get(): The X selection protocol is asyncronous.
[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          * The format is plain text.
43          * Does nothing on systems that don't have a selection.
44          * Since the X selection protocol is asyncronous this should never be
45          * called from the kernel.
46          * If another application requests the current selection a
47          * SelectionRequest XEvent will be triggered. The response of the
48          * frontend to this event should be to retrieve the current selection
49          * from the kernel and push it to X with this method.
50          */
51         virtual void put(docstring const &) = 0;
52
53         /// state of clipboard.
54         /// \retval true if the system clipboard has been set within LyX.
55         virtual bool isInternal() const = 0;
56 };
57
58 } // namespace frontend
59
60 /// Implementation is in Application.C
61 extern frontend::Selection & theSelection();
62
63 } // namespace lyx
64
65
66 #endif // BASE_SELECTION_H