2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * Copyright (C) 2010 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #ifndef WebPopupMenu_h
23 #define WebPopupMenu_h
25 #include "WebPopupItem.h"
26 #include <WebCore/PopupMenu.h>
27 #include <wtf/Forward.h>
28 #include <wtf/OwnPtr.h>
29 #include <wtf/Vector.h>
32 class PopupMenuClient;
38 struct PlatformPopupMenuData;
41 class WebPopupMenu : public WebCore::PopupMenu {
43 static PassRefPtr<WebPopupMenu> create(WebPage*, WebCore::PopupMenuClient*);
46 WebPage* page() { return m_page; }
48 void disconnectFromPage() { m_page = 0; }
49 void didChangeSelectedIndex(int newIndex);
50 void setTextForIndex(int newIndex);
51 #if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
52 WebCore::PopupMenuClient* client() const { return m_popupClient; }
55 virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index) OVERRIDE;
56 virtual void hide() OVERRIDE;
57 virtual void updateFromElement() OVERRIDE;
58 virtual void disconnectClient() OVERRIDE;
61 WebPopupMenu(WebPage*, WebCore::PopupMenuClient*);
63 Vector<WebPopupItem> populateItems();
64 void setUpPlatformData(const WebCore::IntRect& pageCoordinates, PlatformPopupMenuData&);
66 WebCore::PopupMenuClient* m_popupClient;
72 #endif // WebPopupMenu_h