diff -r 4526337fb576 -r 3eca7e70b1b8 mulwidgets/mulsliderwidget/src/mulsliderwidgetfactoryplugin.cpp --- a/mulwidgets/mulsliderwidget/src/mulsliderwidgetfactoryplugin.cpp Tue Feb 02 00:28:09 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Plugin factory implementation for slider widget. -* -*/ - -// OSN Includes -#include - -// WidgetModel Includes -#include "alf/alfwidget.h" -#include -#include - -// Symbian Includes -#include - -// OpenC Includes -#include - -// Widget Includes -#include -#include -#include "imulsliderbaseelementinternal.h" -//Internal includes -#include "mulsliderwidgetfactoryplugin.h" -#include "mulsliderwidget.h" -#include "mulslidermodel.h" -#include "mulslidervertical.h" -#include "mulprogressbarslider.h" -#include "mulsliderhorizontal.h" -//#include "alfscrollbardefaultlctbaseelement.h" - -using namespace osncore; - -namespace Alf - { -const TInt KScrollBarWidgetFactoryPluginUid = {0x2000FA80}; -const int KProductCount = 5; - - -// --------------------------------------------------------------------------- -// Two-phased Symbian constructor. -// --------------------------------------------------------------------------- -// -MulSliderWidgetFactoryPlugin* MulSliderWidgetFactoryPlugin::NewL() - { - return new (EMM) MulSliderWidgetFactoryPlugin; - } - - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -// -MulSliderWidgetFactoryPlugin::~MulSliderWidgetFactoryPlugin() - { - - } - - -// --------------------------------------------------------------------------- -// Creates either a scrollbar widget or a scrollbar model. -// --------------------------------------------------------------------------- -// -IAlfInterfaceBase* MulSliderWidgetFactoryPlugin::createProduct( - const char* aProduct, - void* aInitData) - { - IAlfInterfaceBase* ret (0); - - if (!strcmp(aProduct, KSliderWidget)) - { - AlfWidgetInitData* initData = (AlfWidgetInitData*)aInitData; - auto_ptr widget(MulSliderWidget::create( - *initData->mEnv, - *initData->mContainerWidget, - initData->mWidgetId, - initData->mCustomData)); - ret = widget->makeInterface (IMulSliderWidget::type()); - widget.release(); - } - else if (!strcmp(aProduct, KSliderModel)) - { - auto_ptr model(new(EMM) MulSliderModel()); - ret = model->makeInterface (IMulSliderModel::type()); - model.release(); - } - // Vertical element support template 3, 9 - else if (!strcmp(aProduct, KSliderVerticalElement)) - { - AlfElementInitData* initData = (AlfElementInitData*) aInitData; - auto_ptr element( - new(EMM) MulSliderVertical( - (CAlfWidgetControl&)(*initData->mControl), - initData->mElementId, - initData->mCustomData)); - - ret = element->makeInterface(IMulSliderBaseElementInternal::type()); - element.release(); - } - // Progressbar element support template 7,8 - else if(!strcmp(aProduct, KSliderProgressbarElement)) - { - AlfElementInitData* initData = (AlfElementInitData*) aInitData; - auto_ptr element( - new(EMM) MulSliderProgressive( - (CAlfWidgetControl&)(*initData->mControl), - initData->mElementId, - initData->mCustomData)); - ret = element->makeInterface(IMulSliderBaseElementInternal::type()); - element.release(); - } - // Horizontal element support template 1,2,4,6 - else if(!strcmp(aProduct, KSliderHorizontalElement)) - { - AlfElementInitData* initData = (AlfElementInitData*) aInitData; - auto_ptr element( - new(EMM) MulSliderHorizontal( - (CAlfWidgetControl&)(*initData->mControl), - initData->mElementId, - initData->mCustomData)); - ret = element->makeInterface(IMulSliderBaseElementInternal::type()); - element.release(); - } - - return ret; - } - - -// --------------------------------------------------------------------------- -// From IAlfInterfaceBase. -// Creates interface based on the given type. -// --------------------------------------------------------------------------- -// -IAlfInterfaceBase* MulSliderWidgetFactoryPlugin::makeInterface( - const IfId& aType) - { - UString param (aType.mImplementationId); - if (param == UString (IAlfFactoryPlugin::type().mImplementationId)) - { - return static_cast (this); - } - else - { - // Do Nothing - } - return NULL; - } - - -// --------------------------------------------------------------------------- -// Returns the amount of products this factory can produce. -// --------------------------------------------------------------------------- -// -int MulSliderWidgetFactoryPlugin::productCount() const - { - return KProductCount; - } - - -// --------------------------------------------------------------------------- -// Returns product information. -// --------------------------------------------------------------------------- -// -const char* MulSliderWidgetFactoryPlugin::productInfo (int aIndex) const - { - switch (aIndex) - { - case ESliderWidget: - { - return KSliderWidget; - } - - case ESliderModel: - { - return KSliderModel; - } - - case ESliderHorizontalElement: - { - return KSliderHorizontalElement; - } - - case ESliderVerticalElement: - { - return KSliderVerticalElement; - } - - case ESliderProgressbarElement: - { - return KSliderProgressbarElement; - } - - default: - break; - - } - - return 0; - } - - }// NameSpace - - -// --------------------------------------------------------------------------- -// OTHER EXPORTED FUNCTIONS. -// --------------------------------------------------------------------------- -// - -using namespace Alf; -const TImplementationProxy ImplementationTable[] = - { -#ifdef __EABI__ - IMPLEMENTATION_PROXY_ENTRY ( - KScrollBarWidgetFactoryPluginUid, - MulSliderWidgetFactoryPlugin::NewL) -#else - { - {KScrollBarWidgetFactoryPluginUid}, - MulSliderWidgetFactoryPlugin::NewL} -#endif - }; - -OSN_EXPORT const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount) - { - aTableCount = sizeof (ImplementationTable) / sizeof (TImplementationProxy); - - return ImplementationTable; - } - -