Add an optional retained selection mode to the compositor.
[profile/ivi/qtwayland.git] / src / qt-compositor / compositor_api / waylandcompositor.h
1 /****************************************************************************
2 **
3 ** This file is part of QtCompositor**
4 **
5 ** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
6 ** All rights reserved.
7 **
8 ** Contact:  Nokia Corporation qt-info@nokia.com
9 **
10 ** You may use this file under the terms of the BSD license as follows:
11 **
12 ** Redistribution and use in source and binary forms, with or without
13 ** modification, are permitted provided that the following conditions are
14 ** met:
15 **
16 ** Redistributions of source code must retain the above copyright
17 ** notice, this list of conditions and the following disclaimer.
18 **
19 ** Redistributions in binary form must reproduce the above copyright
20 ** notice, this list of conditions and the following disclaimer in the
21 ** documentation and/or other materials provided with the distribution.
22 **
23 ** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
24 ** names of its contributors may be used to endorse or promote products
25 ** derived from this software without specific prior written permission.
26 **
27 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 **
39 ****************************************************************************/
40
41 #ifndef QTCOMP_H
42 #define QTCOMP_H
43
44 #include <QObject>
45 #include <QImage>
46 #include <QRect>
47
48 #ifdef QT_COMPOSITOR_WAYLAND_GL
49 #include <QtOpenGL/QGLContext>
50 #endif
51
52 class QWidget;
53 class QMimeData;
54 class WaylandSurface;
55
56 namespace Wayland
57 {
58     class Compositor;
59 }
60
61 class WaylandCompositor
62 {
63 public:
64     WaylandCompositor(QWidget *topLevelWidget = 0);
65     virtual ~WaylandCompositor();
66
67     void frameFinished();
68
69     void setInputFocus(WaylandSurface *surface);
70     void destroyClientForSurface(WaylandSurface *surface);
71
72     void setDirectRenderSurface(WaylandSurface *surface);
73     WaylandSurface *directRenderSurface() const;
74
75     QWidget *topLevelWidget()const;
76
77     virtual void surfaceCreated(WaylandSurface *surface) = 0;
78
79     Wayland::Compositor *handle() const;
80
81     void setRetainedSelectionEnabled(bool enable);
82     virtual void retainedSelectionReceived(QMimeData *mimeData);
83
84 private:
85     static void retainedSelectionChanged(QMimeData *mimeData, void *param);
86
87     Wayland::Compositor *m_compositor;
88     QWidget  *m_toplevel_widget;
89
90 };
91
92 #endif // QTCOMP_H