diff options
author | Steve Block <steveblock@google.com> | 2010-08-04 11:41:34 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-08-09 12:04:44 +0100 |
commit | db14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch) | |
tree | 9f793c5b0f5e1f2aca8247158920e2c4bf962bbf /WebCore/platform/wx | |
parent | bf916837aa84f1e4b00e6ed6268516c2acd27545 (diff) | |
download | external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2 |
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
Diffstat (limited to 'WebCore/platform/wx')
-rw-r--r-- | WebCore/platform/wx/PopupMenuWx.cpp | 29 | ||||
-rw-r--r-- | WebCore/platform/wx/PopupMenuWx.h | 62 | ||||
-rw-r--r-- | WebCore/platform/wx/SearchPopupMenuWx.cpp | 18 | ||||
-rw-r--r-- | WebCore/platform/wx/SearchPopupMenuWx.h | 44 |
4 files changed, 133 insertions, 20 deletions
diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp index 9b0deba..e88d1e5 100644 --- a/WebCore/platform/wx/PopupMenuWx.cpp +++ b/WebCore/platform/wx/PopupMenuWx.cpp @@ -2,6 +2,7 @@ * This file is part of the popup menu implementation for <select> elements in WebCore. * * Copyright (C) 2008 Apple Computer, Inc. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,7 +22,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuWx.h" #include "Frame.h" #include "FrameView.h" @@ -41,18 +42,23 @@ static int s_menuStartId = wxNewId(); namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuWx::PopupMenuWx(PopupMenuClient* client) : m_popupClient(client) , m_menu(NULL) { } -PopupMenu::~PopupMenu() +PopupMenuWx::~PopupMenuWx() { delete m_menu; } -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuWx::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuWx::show(const IntRect& r, FrameView* v, int index) { // just delete and recreate delete m_menu; @@ -78,13 +84,13 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) m_menu->Append(s_menuStartId + i, client()->itemText(i)); } } - nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); + nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY()); - nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); + nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); } } -void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) +void PopupMenuWx::OnMenuItemSelected(wxCommandEvent& event) { if (client()) { client()->valueChanged(event.GetId() - s_menuStartId); @@ -93,20 +99,15 @@ void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still? } -void PopupMenu::hide() +void PopupMenuWx::hide() { // we don't need to do anything here, the native control only exists during the time // show is called } -void PopupMenu::updateFromElement() +void PopupMenuWx::updateFromElement() { client()->setTextFromItem(m_popupClient->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - } diff --git a/WebCore/platform/wx/PopupMenuWx.h b/WebCore/platform/wx/PopupMenuWx.h new file mode 100644 index 0000000..c2573fc --- /dev/null +++ b/WebCore/platform/wx/PopupMenuWx.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PopupMenuWx_h +#define PopupMenuWx_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +#ifdef __WXMSW__ +#include <wx/msw/winundef.h> +#endif +class wxMenu; +#include <wx/defs.h> +#include <wx/event.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuWx : public PopupMenu, public wxEvtHandler { +public: + PopupMenuWx(PopupMenuClient*); + ~PopupMenuWx(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + void OnMenuItemSelected(wxCommandEvent&); + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + wxMenu* m_menu; +}; + +} + +#endif // PopupMenuWx_h diff --git a/WebCore/platform/wx/SearchPopupMenuWx.cpp b/WebCore/platform/wx/SearchPopupMenuWx.cpp index dbbe339..b724cf1 100644 --- a/WebCore/platform/wx/SearchPopupMenuWx.cpp +++ b/WebCore/platform/wx/SearchPopupMenuWx.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,32 +25,37 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuWx.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuWx::SearchPopupMenuWx(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuWx(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuWx::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuWx::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuWx::enabled() { return true; } +PopupMenu* SearchPopupMenuWx::popupMenu() +{ + return m_popup.get(); +} + } diff --git a/WebCore/platform/wx/SearchPopupMenuWx.h b/WebCore/platform/wx/SearchPopupMenuWx.h new file mode 100644 index 0000000..552a8fe --- /dev/null +++ b/WebCore/platform/wx/SearchPopupMenuWx.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuWx_h +#define SearchPopupMenuWx_h + +#include "PopupMenuWx.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuWx : public SearchPopupMenu { +public: + SearchPopupMenuWx(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuWx> m_popup; +}; + +} + +#endif // SearchPopupMenuWx_h |