qwebkitplatformplugin.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. #ifndef QWEBKITPLATFORMPLUGIN_H
  21. #define QWEBKITPLATFORMPLUGIN_H
  22. /*
  23. * Warning: The contents of this file is not part of the public QtWebKit API
  24. * and may be changed from version to version or even be completely removed.
  25. */
  26. #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
  27. #include <QMediaPlayer>
  28. #endif
  29. #include <QtCore/QObject>
  30. #include <QtCore/QRect>
  31. #include <QtCore/QUrl>
  32. #include <QtGui/QColor>
  33. #include <QtGui/QFont>
  34. class QWebSelectData {
  35. public:
  36. virtual ~QWebSelectData() {}
  37. enum ItemType { Option, Group, Separator };
  38. virtual ItemType itemType(int) const = 0;
  39. virtual QString itemText(int index) const = 0;
  40. virtual QString itemToolTip(int index) const = 0;
  41. virtual bool itemIsEnabled(int index) const = 0;
  42. virtual bool itemIsSelected(int index) const = 0;
  43. virtual int itemCount() const = 0;
  44. virtual bool multiple() const = 0;
  45. virtual QColor backgroundColor() const = 0;
  46. virtual QColor foregroundColor() const = 0;
  47. virtual QColor itemBackgroundColor(int index) const = 0;
  48. virtual QColor itemForegroundColor(int index) const = 0;
  49. };
  50. class QWebSelectMethod : public QObject {
  51. Q_OBJECT
  52. public:
  53. virtual ~QWebSelectMethod() {}
  54. virtual void show(const QWebSelectData&) = 0;
  55. virtual void hide() = 0;
  56. virtual void setGeometry(const QRect&) = 0;
  57. virtual void setFont(const QFont&) = 0;
  58. Q_SIGNALS:
  59. void selectItem(int index, bool allowMultiplySelections, bool shift);
  60. void didHide();
  61. };
  62. class QWebNotificationData {
  63. public:
  64. virtual ~QWebNotificationData() {}
  65. virtual const QString title() const = 0;
  66. virtual const QString message() const = 0;
  67. virtual const QUrl iconUrl() const = 0;
  68. virtual const QUrl openerPageUrl() const = 0;
  69. };
  70. class QWebNotificationPresenter : public QObject {
  71. Q_OBJECT
  72. public:
  73. QWebNotificationPresenter() {}
  74. virtual ~QWebNotificationPresenter() {}
  75. virtual void showNotification(const QWebNotificationData*) = 0;
  76. Q_SIGNALS:
  77. void notificationClosed();
  78. void notificationClicked();
  79. };
  80. class QWebHapticFeedbackPlayer: public QObject {
  81. Q_OBJECT
  82. public:
  83. QWebHapticFeedbackPlayer() {}
  84. virtual ~QWebHapticFeedbackPlayer() {}
  85. enum HapticStrength {
  86. None, Weak, Medium, Strong
  87. };
  88. enum HapticEvent {
  89. Press, Release
  90. };
  91. virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0;
  92. };
  93. class QWebTouchModifier : public QObject {
  94. Q_OBJECT
  95. public:
  96. virtual ~QWebTouchModifier() {}
  97. enum PaddingDirection {
  98. Up, Right, Down, Left
  99. };
  100. virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0;
  101. };
  102. #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
  103. class QWebFullScreenVideoHandler : public QObject {
  104. Q_OBJECT
  105. public:
  106. QWebFullScreenVideoHandler() {}
  107. virtual ~QWebFullScreenVideoHandler() {}
  108. virtual bool requiresFullScreenForVideoPlayback() const = 0;
  109. Q_SIGNALS:
  110. void fullScreenClosed();
  111. public Q_SLOTS:
  112. virtual void enterFullScreen(QMediaPlayer*) = 0;
  113. virtual void exitFullScreen() = 0;
  114. };
  115. #endif
  116. class QWebSpellChecker : public QObject {
  117. Q_OBJECT
  118. public:
  119. struct GrammarDetail {
  120. int location;
  121. int length;
  122. QStringList guesses;
  123. QString userDescription;
  124. };
  125. virtual bool isContinousSpellCheckingEnabled() const = 0;
  126. virtual void toggleContinousSpellChecking() = 0;
  127. virtual void learnWord(const QString& word) = 0;
  128. virtual void ignoreWordInSpellDocument(const QString& word) = 0;
  129. virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength) = 0;
  130. virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word) = 0;
  131. virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses) = 0;
  132. virtual bool isGrammarCheckingEnabled() = 0;
  133. virtual void toggleGrammarChecking() = 0;
  134. virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
  135. };
  136. class QWebKitPlatformPlugin {
  137. public:
  138. virtual ~QWebKitPlatformPlugin() {}
  139. enum Extension {
  140. MultipleSelections,
  141. Notifications,
  142. Haptics,
  143. TouchInteraction,
  144. FullScreenVideoPlayer,
  145. SpellChecker
  146. };
  147. virtual bool supportsExtension(Extension) const = 0;
  148. virtual QObject* createExtension(Extension) const = 0;
  149. };
  150. QT_BEGIN_NAMESPACE
  151. Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9");
  152. QT_END_NAMESPACE
  153. #endif // QWEBKITPLATFORMPLUGIN_H