homescreenapp/examples/pannablewidgetplugin/src/pannablewidgetplugin.cpp
changeset 62 341166945d65
parent 57 2e2dc3d30ca8
child 63 52b0f64eeb51
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Example of home screen widget
       
    15 *
       
    16 */
       
    17 
       
    18 #include <qserviceinterfacedescriptor.h>
       
    19 #include <qabstractsecuritysession.h>
       
    20 #include <qservicecontext.h>
       
    21 
       
    22 #include "pannablewidgetplugin.h"
       
    23 #include "pannablewidget.h"
       
    24 
       
    25 /**
       
    26     @page page_creating_pannable_widget Creating pannable Home Screen Widget Plugin
       
    27 
       
    28     When widget need to use horizontal pan gesture itself, e.g when slider is used
       
    29     it must implement bool isPannable(QGraphicsMouseEvent *)  function. 
       
    30     
       
    31     Home Screen will call this when it recognize a pan gesture on a widget. 
       
    32     By default, horizontal pan gesture is used to switch pages, but if isPannable() 
       
    33     returns true, event is not filtered by Home Screen. 
       
    34 */
       
    35 
       
    36 /*!
       
    37     \ingroup group_pannablewidget
       
    38     \class PannableWidgetPlugin
       
    39     \brief Example implementation for home screen widget plugin.
       
    40 */    
       
    41     
       
    42 /*!
       
    43     Initialize plugin for pannable widget. Contains necessary information about 
       
    44     the pannable widget that it can be loaded through QT Service Framework.
       
    45 */
       
    46 QObject *PannableWidgetPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
       
    47                                              QServiceContext *context,
       
    48                                              QAbstractSecuritySession *session)
       
    49 {
       
    50     Q_UNUSED(context);
       
    51     Q_UNUSED(session);
       
    52 
       
    53     if (descriptor.interfaceName() == QLatin1String("com.nokia.symbian.IHomeScreenWidget")) {
       
    54         return new PannableWidget();
       
    55     } else {
       
    56         return 0;
       
    57     }
       
    58 }
       
    59 
       
    60 Q_EXPORT_PLUGIN2(pannablewidgetplugin, PannableWidgetPlugin)