2011-05-22 Hui Huang <hui.2.huang@nokia.com>, Yi Shen <yi.4.shen@nokia.com>
[webkit:qtwebkit.git] / Source / WebKit / qt / symbian / platformplugin / WebPlugin.h
1 /*
2  * Copyright (C) 2011 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 WebPlugin_h
22 #define WebPlugin_h
23
24 #include "qwebkitplatformplugin.h"
25 #include <QDialog>
26
27 class QListWidgetItem;
28 class QListWidget;
29 class QScrollArea;
30
31 class PopupScrollingHandler;
32
33 class Popup : public QDialog {
34     Q_OBJECT
35 public:
36     Popup(const QWebSelectData&);
37     void updateSelectionsBeforeDialogClosing();
38     QList<int> preSelectedIndices() const { return m_preSelectedIndices; }
39     QListWidget* listWidget() { return m_list; }
40
41 signals:
42     void itemClicked(int idx);
43
44 protected slots:
45     void onItemSelected(QListWidgetItem*);
46     void updateAndClose();
47
48 protected:
49     void populateList();
50     void resizeEvent(QResizeEvent*);
51     const QWebSelectData& m_data;
52     QListWidget* m_list;
53     QList<int> m_preSelectedIndices;
54     PopupScrollingHandler* m_scrollingHandler;
55 };
56
57
58 class SingleSelectionPopup : public Popup {
59     Q_OBJECT
60 public:
61     SingleSelectionPopup(const QWebSelectData&);
62 };
63
64
65 class MultipleSelectionPopup : public Popup {
66     Q_OBJECT
67 public:
68     MultipleSelectionPopup(const QWebSelectData&);
69 };
70
71
72 class WebPopup : public QWebSelectMethod {
73     Q_OBJECT
74 public:
75     WebPopup();
76     ~WebPopup();
77
78     virtual void show(const QWebSelectData&);
79     virtual void hide();
80
81 private slots:
82     void popupClosed();
83     void itemClicked(int idx);
84
85 private:
86     Popup* m_popup;
87
88     Popup* createPopup(const QWebSelectData&);
89     Popup* createSingleSelectionPopup(const QWebSelectData&);
90     Popup* createMultipleSelectionPopup(const QWebSelectData&);
91 };
92
93 class WebNotificationPresenter : public QWebNotificationPresenter {
94     Q_OBJECT
95 public:
96     WebNotificationPresenter() { }
97     ~WebNotificationPresenter() { }
98     void showNotification(const QWebNotificationData*);
99 };
100
101 class WebPlugin : public QObject, public QWebKitPlatformPlugin {
102     Q_OBJECT
103     Q_INTERFACES(QWebKitPlatformPlugin)
104 public:
105     virtual bool supportsExtension(Extension) const;
106     virtual QObject* createExtension(Extension) const;
107 };
108
109 #endif // WebPlugin_h