• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3  * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
4  * Copyright (C) 2009-2010 ProFUSION embedded systems
5  * Copyright (C) 2009-2010 Samsung Electronics
6  * Copyright (C) 2010 Company 100, Inc.
7  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this library; see the file COPYING.LIB.  If not, write to
21  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  *
24  */
25 
26 #include "config.h"
27 #include "PopupMenuBrew.h"
28 
29 #include "Chrome.h"
30 #include "ChromeClientBrew.h"
31 #include "FrameView.h"
32 #include "NotImplemented.h"
33 
34 namespace WebCore {
35 
PopupMenuBrew(PopupMenuClient * menuList)36 PopupMenuBrew::PopupMenuBrew(PopupMenuClient* menuList)
37     : m_popupClient(menuList)
38     , m_view(0)
39 {
40 }
41 
~PopupMenuBrew()42 PopupMenuBrew::~PopupMenuBrew()
43 {
44     // Tell client to destroy data related to this popup since this object is
45     // going away.
46     hide();
47 }
48 
disconnectClient()49 void PopupMenuBrew::disconnectClient()
50 {
51     m_popupClient = 0;
52 }
53 
show(const IntRect & rect,FrameView * view,int index)54 void PopupMenuBrew::show(const IntRect& rect, FrameView* view, int index)
55 {
56     ASSERT(m_popupClient);
57     ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(view->frame()->page()->chrome()->client());
58     ASSERT(chromeClient);
59 
60     m_view = view;
61     chromeClient->createSelectPopup(m_popupClient, index, rect);
62 }
63 
hide()64 void PopupMenuBrew::hide()
65 {
66     ASSERT(m_view);
67     ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(m_view->frame()->page()->chrome()->client());
68     ASSERT(chromeClient);
69 
70     chromeClient->destroySelectPopup();
71 }
72 
updateFromElement()73 void PopupMenuBrew::updateFromElement()
74 {
75     client()->setTextFromItem(client()->selectedIndex());
76 }
77 
78 // This code must be moved to the concrete brew ChromeClient that is not in repository.
79 // I kept this code commented out here to prevent loosing the information of what
80 // must be the return value for brew.
81 
82 // bool PopupMenuBrew::itemWritingDirectionIsNatural()
83 // {
84 //     return true;
85 // }
86 
87 } // namespace WebCore
88