tizen beta release
[framework/web/webkit-efl.git] / Source / WebKit / qt / examples / platformplugin / qwebkitplatformplugin.h
1 /*
2  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  */
20
21 #ifndef QWEBKITPLATFORMPLUGIN_H
22 #define QWEBKITPLATFORMPLUGIN_H
23
24 /*
25  *  Warning: The contents of this file is not  part of the public QtWebKit API
26  *  and may be changed from version to version or even be completely removed.
27 */
28
29 #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
30 #include <QMediaPlayer>
31 #endif
32 #include <QtCore/QObject>
33 #include <QtCore/QRect>
34 #include <QtCore/QUrl>
35 #include <QtGui/QColor>
36 #include <QtGui/QFont>
37
38 class QWebSelectData {
39 public:
40     virtual ~QWebSelectData() {}
41
42     enum ItemType { Option, Group, Separator };
43
44     virtual ItemType itemType(int) const = 0;
45     virtual QString itemText(int index) const = 0;
46     virtual QString itemToolTip(int index) const = 0;
47     virtual bool itemIsEnabled(int index) const = 0;
48     virtual bool itemIsSelected(int index) const = 0;
49     virtual int itemCount() const = 0;
50     virtual bool multiple() const = 0;
51     virtual QColor backgroundColor() const = 0;
52     virtual QColor foregroundColor() const = 0;
53     virtual QColor itemBackgroundColor(int index) const = 0;
54     virtual QColor itemForegroundColor(int index) const = 0;
55 };
56
57 class QWebSelectMethod : public QObject {
58     Q_OBJECT
59 public:
60     virtual ~QWebSelectMethod() {}
61
62     virtual void show(const QWebSelectData&) = 0;
63     virtual void hide() = 0;
64     virtual void setGeometry(const QRect&) = 0;
65     virtual void setFont(const QFont&) = 0;
66
67 Q_SIGNALS:
68     void selectItem(int index, bool allowMultiplySelections, bool shift);
69     void didHide();
70 };
71
72 class QWebNotificationData {
73 public:
74     virtual ~QWebNotificationData() {}
75
76     virtual const QString title() const = 0;
77     virtual const QString message() const = 0;
78     virtual const QByteArray iconData() const = 0;
79     virtual const QUrl openerPageUrl() const = 0;
80 };
81
82 class QWebNotificationPresenter : public QObject {
83     Q_OBJECT
84 public:
85     QWebNotificationPresenter() {}
86     virtual ~QWebNotificationPresenter() {}
87
88     virtual void showNotification(const QWebNotificationData*) = 0;
89     
90 Q_SIGNALS:
91     void notificationClosed();
92     void notificationClicked();
93 };
94
95 class QWebHapticFeedbackPlayer: public QObject {
96     Q_OBJECT
97 public:
98     QWebHapticFeedbackPlayer() {}
99     virtual ~QWebHapticFeedbackPlayer() {}
100
101     enum HapticStrength {
102         None, Weak, Medium, Strong
103     };
104
105     enum HapticEvent {
106         Press, Release
107     };
108
109     virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0;
110 };
111
112 class QWebTouchModifier : public QObject {
113     Q_OBJECT
114 public:
115     virtual ~QWebTouchModifier() {}
116
117     enum PaddingDirection {
118         Up, Right, Down, Left
119     };
120
121     virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0;
122 };
123
124 #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
125 class QWebFullScreenVideoHandler : public QObject {
126     Q_OBJECT
127 public:
128     QWebFullScreenVideoHandler() {}
129     virtual ~QWebFullScreenVideoHandler() {}
130     virtual bool requiresFullScreenForVideoPlayback() const = 0;
131
132 Q_SIGNALS:
133     void fullScreenClosed();
134
135 public Q_SLOTS:
136     virtual void enterFullScreen(QMediaPlayer*) = 0;
137     virtual void exitFullScreen() = 0;
138 };
139 #endif
140
141 class QWebSpellChecker : public QObject {
142     Q_OBJECT
143 public:
144     struct GrammarDetail {
145         int location;
146         int length;
147         QStringList guesses;
148         QString userDescription;
149     };
150
151     virtual bool isContinousSpellCheckingEnabled() const = 0;
152     virtual void toggleContinousSpellChecking() = 0;
153
154     virtual void learnWord(const QString& word) = 0;
155     virtual void ignoreWordInSpellDocument(const QString& word) = 0;
156     virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength) = 0;
157     virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word) = 0;
158     virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses) = 0;
159
160     virtual bool isGrammarCheckingEnabled() = 0;
161     virtual void toggleGrammarChecking() = 0;
162     virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
163 };
164
165 class QWebKitPlatformPlugin {
166 public:
167     virtual ~QWebKitPlatformPlugin() {}
168
169     enum Extension {
170         MultipleSelections,
171         Notifications,
172         Haptics,
173         TouchInteraction,
174         FullScreenVideoPlayer,
175         SpellChecker
176     };
177
178     virtual bool supportsExtension(Extension) const = 0;
179     virtual QObject* createExtension(Extension) const = 0;
180 };
181
182 QT_BEGIN_NAMESPACE
183 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.8");
184 QT_END_NAMESPACE
185
186 #endif // QWEBKITPLATFORMPLUGIN_H