4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * \author Abdelrazak Younes
11 * Full author contact details are available in file CREDITS.
17 #include "support/strfwd.h"
23 * A Selection class manages the selection.
28 virtual ~Selection() {}
31 * Returns true if the underlying system supports mouse selection
32 * (basically X11 and Wayland).
34 virtual bool supported() const = 0;
36 * Tell the window system whether we set or cleared our selection.
37 * This is a noop on systems that don't have a selection.
38 * This should be called by the kernel whenever a selection is
39 * created, changed or cleared.
41 * If true: Tell that we got a valid selection.
42 * If false: Tell that we cleared our selection.
44 virtual void haveSelection(bool) = 0;
46 * Get the X selection contents.
47 * This is a noop on systems that don't have a selection.
48 * The format is plain text.
49 * This should be called when the user presses the middle mouse
52 virtual docstring const get() const = 0;
54 * Fill the X selection.
55 * The format is plain text.
56 * Does nothing on systems that don't have a selection.
57 * Since the X selection protocol is asynchronous this should never be
58 * called from the kernel.
59 * If another application requests the current selection a
60 * SelectionRequest XEvent will be triggered. The response of the
61 * frontend to this event should be to retrieve the current selection
62 * from the kernel and push it to X with this method.
64 virtual void put(docstring const &) = 0;
66 * Is the X selection empty?
67 * This does always return true on systems that don't have a real
70 virtual bool empty() const = 0;
73 } // namespace frontend
75 /// Implementation is in Application.cpp
76 extern frontend::Selection & theSelection();