]> git.lyx.org Git - lyx.git/blob - src/frontends/Selection.h
Rename frontend qt4 to qt
[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 SELECTION_H
15 #define SELECTION_H
16
17 #include "support/strfwd.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         /**
31          * Tell the window system whether we set or cleared our selection.
32          * This is a noop on systems that don't have a selection.
33          * This should be called by the kernel whenever a selection is
34          * created, changed or cleared.
35          * \param own
36          * If true: Tell that we got a valid selection.
37          * If false: Tell that we cleared our selection.
38          */
39         virtual void haveSelection(bool) = 0;
40         /**
41          * Get the X selection contents.
42          * This is a noop on systems that don't have a selection.
43          * The format is plain text.
44          * This should be called when the user presses the middle mouse
45          * button.
46          */
47         virtual docstring const get() const = 0;
48         /**
49          * Fill the X selection.
50          * The format is plain text.
51          * Does nothing on systems that don't have a selection.
52          * Since the X selection protocol is asyncronous this should never be
53          * called from the kernel.
54          * If another application requests the current selection a
55          * SelectionRequest XEvent will be triggered. The response of the
56          * frontend to this event should be to retrieve the current selection
57          * from the kernel and push it to X with this method.
58          */
59         virtual void put(docstring const &) = 0;
60         /**
61          * Is the X selection empty?
62          * This does always return true on systems that don't have a real
63          * selection.
64          */
65         virtual bool empty() const = 0;
66 };
67
68 } // namespace frontend
69
70 /// Implementation is in Application.cpp
71 extern frontend::Selection & theSelection();
72
73 } // namespace lyx
74
75
76 #endif // SELECTION_H