• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 QtAbstractWebPopup_h
21 #define QtAbstractWebPopup_h
22 
23 #include "PopupMenuClient.h"
24 
25 #include <QFont>
26 #include <QList>
27 #include <QRect>
28 #include <QWidget>
29 
30 class QWebPageClient;
31 
32 namespace WebCore {
33 
34 class QtAbstractWebPopup {
35 public:
36     enum ItemType { Option, Group, Separator };
37 
38     ItemType itemType(int) const;
itemText(int idx)39     QString itemText(int idx) const { return m_popupClient->itemText(idx); }
itemToolTip(int idx)40     QString itemToolTip(int idx) const { return m_popupClient->itemToolTip(idx); }
itemIsEnabled(int idx)41     bool itemIsEnabled(int idx) const { return m_popupClient->itemIsEnabled(idx); }
itemCount()42     int itemCount() const { return m_popupClient->listSize(); }
43 
pageClient()44     QWebPageClient* pageClient() const { return m_pageClient; }
geometry()45     QRect geometry() const { return m_geometry; }
currentIndex()46     int currentIndex() const { return m_currentIndex; }
47 
48     QtAbstractWebPopup();
49     virtual ~QtAbstractWebPopup();
50 
51     virtual void show() = 0;
52     virtual void hide() = 0;
53 
54     void popupDidHide();
55     void valueChanged(int index);
56 
font()57     QFont font() { return m_popupClient->menuStyle().font().font(); }
58 
59 private:
60     friend class PopupMenu;
61     PopupMenuClient* m_popupClient;
62     QWebPageClient* m_pageClient;
63     int m_currentIndex;
64     QRect m_geometry;
65 };
66 
67 }
68 
69 #endif // QtAbstractWebPopup_h
70