Home | History | Annotate | Download | only in symbian
      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 #include "config.h"
     21 #include "PluginContainerSymbian.h"
     22 
     23 #include "FocusController.h"
     24 #include "Frame.h"
     25 #include "FrameView.h"
     26 #include "Page.h"
     27 #include "PlatformKeyboardEvent.h"
     28 #include "PluginView.h"
     29 
     30 #include <QApplication>
     31 #include <QWidget>
     32 
     33 using namespace WebCore;
     34 
     35 PluginContainerSymbian::PluginContainerSymbian(PluginView* view, QWidget* parent, QGraphicsProxyWidget* proxy)
     36     : QWidget(parent)
     37     , m_pluginView(view)
     38     , m_proxy(proxy)
     39     , m_hasPendingGeometryChange(false)
     40 {
     41 }
     42 
     43 PluginContainerSymbian::~PluginContainerSymbian()
     44 {
     45 }
     46 
     47 void PluginContainerSymbian::requestGeometry(const QRect& rect, const QRegion& clip)
     48 {
     49     if (m_windowRect != rect || m_clipRegion != clip) {
     50         m_windowRect = rect;
     51         m_clipRegion = clip;
     52         m_hasPendingGeometryChange = true;
     53     }
     54 }
     55 
     56 void PluginContainerSymbian::adjustGeometry()
     57 {
     58     if (m_hasPendingGeometryChange) {
     59         setGeometry(m_windowRect);
     60         setMask(m_clipRegion);
     61         m_hasPendingGeometryChange = false;
     62     }
     63 }
     64 
     65 void PluginContainerSymbian::focusInEvent(QFocusEvent*)
     66 {
     67     if (Page* page = m_pluginView->parentFrame()->page())
     68         page->focusController()->setActive(true);
     69 
     70     m_pluginView->focusPluginElement();
     71 }
     72 
     73 void PluginContainerSymbian::focusOutEvent(QFocusEvent*)
     74 {
     75     if (Page* page = m_pluginView->parentFrame()->page())
     76         page->focusController()->setActive(false);
     77 }
     78