initial import
[vuplus_webkit] / Source / WebKit2 / WebProcess / WebCoreSupport / WebPopupMenu.h
1 /*
2  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3  * Copyright (C) 2010 Apple Inc. All rights reserved.
4  *
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.
9  *
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.
14  *
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.
19  *
20  */
21
22 #ifndef WebPopupMenu_h
23 #define WebPopupMenu_h
24
25 #include "WebPopupItem.h"
26 #include <WebCore/PopupMenu.h>
27 #include <wtf/Forward.h>
28 #include <wtf/OwnPtr.h>
29 #include <wtf/Vector.h>
30
31 namespace WebCore {
32 class PopupMenuClient;
33 }
34
35 namespace WebKit {
36
37 class WebPage;
38 struct PlatformPopupMenuData;
39 struct WebPopupItem;
40
41 class WebPopupMenu : public WebCore::PopupMenu {
42 public:
43     static PassRefPtr<WebPopupMenu> create(WebPage*, WebCore::PopupMenuClient*);
44     ~WebPopupMenu();
45
46     WebPage* page() { return m_page; }
47
48     void disconnectFromPage() { m_page = 0; }
49     void didChangeSelectedIndex(int newIndex);
50     void setTextForIndex(int newIndex);
51
52     virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index);
53     virtual void hide();
54     virtual void updateFromElement();
55     virtual void disconnectClient();
56
57 private:
58     WebPopupMenu(WebPage*, WebCore::PopupMenuClient*);
59
60     Vector<WebPopupItem> populateItems();
61     void setUpPlatformData(const WebCore::IntRect& pageCoordinates, PlatformPopupMenuData&);
62
63     WebCore::PopupMenuClient* m_popupClient;
64     WebPage* m_page;
65 };
66
67 } // namespace WebKit
68
69 #endif // WebPopupMenu_h