Home | History | Annotate | Download | only in WebCoreSupport
      1 /*
      2  * Copyright (C) 2009 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 QtFallbackWebPopup_h
     21 #define QtFallbackWebPopup_h
     22 
     23 #include "Platform.h"
     24 #include "qwebkitplatformplugin.h"
     25 
     26 #include <QComboBox>
     27 
     28 #ifndef QT_NO_COMBOBOX
     29 
     30 QT_BEGIN_NAMESPACE
     31 class QGraphicsProxyWidget;
     32 QT_END_NAMESPACE
     33 
     34 class QWebPageClient;
     35 
     36 namespace WebCore {
     37 
     38 class ChromeClientQt;
     39 class QtFallbackWebPopupCombo;
     40 
     41 class QtFallbackWebPopup : public QWebSelectMethod {
     42     Q_OBJECT
     43 public:
     44     QtFallbackWebPopup(const ChromeClientQt*);
     45     ~QtFallbackWebPopup();
     46 
     47     virtual void show(const QWebSelectData&);
     48     virtual void hide();
     49 
     50     void destroyPopup();
     51 
     52     void setGeometry(const QRect& rect) { m_geometry = rect; }
     53     QRect geometry() const { return m_geometry; }
     54 
     55     void setFont(const QFont& font) { m_font = font; }
     56     QFont font() const { return m_font; }
     57 
     58 private slots:
     59     void activeChanged(int);
     60 
     61 private:
     62     friend class QtFallbackWebPopupCombo;
     63     bool m_popupVisible;
     64     QtFallbackWebPopupCombo* m_combo;
     65     const ChromeClientQt* m_chromeClient;
     66     QRect m_geometry;
     67     QFont m_font;
     68 
     69     QWebPageClient* pageClient() const;
     70 
     71     void populate(const QWebSelectData&);
     72 #if ENABLE(SYMBIAN_DIALOG_PROVIDERS)
     73     void showS60BrowserDialog();
     74 #endif
     75 };
     76 
     77 class QtFallbackWebPopupCombo : public QComboBox {
     78 public:
     79     QtFallbackWebPopupCombo(QtFallbackWebPopup& ownerPopup);
     80     virtual void showPopup();
     81     virtual void hidePopup();
     82     virtual bool eventFilter(QObject* watched, QEvent* event);
     83 
     84 private:
     85     QtFallbackWebPopup& m_ownerPopup;
     86 };
     87 
     88 }
     89 
     90 #endif // QT_NO_COMBOBOX
     91 
     92 #endif // QtFallbackWebPopup_h
     93